checking for "/" in document URL's before replacing?

checking for "/" in document URL's before replacing?

I am trying to target all PDF document links on a website and add to the href URL.  The problem is, some of the links are relative and some are absolute...  Because all PDF's don't exist in the same DIR (or even in the root), how can I check for the "/" and then append?

Currently I have:
  1. $(document).ready(function(){
       var linkValue = $ ( "a[href$='.pdf']" ) . attr ( "href" ) ;
       $("a[href$='.pdf']").attr({
        href:"/myDir/file.htm?ref=http://www.mysite.com/" linkValue
       });
    });




...which works fine if the existing URL is an absolute path (i.e. "/document.pdf") but how do I also account for those URL's that have a relative path (i.e. "document.pdf") ??

In any case the end result should be:
  1. <a href="/myDir/Redir.htm?ref=http://www.mysite.com/document.pdf">