Browser complete URL

Hi

I am trying to insert in the following code the browser window URL after &link= .

I don’t know why I can’t do it. Can anyone give me a hint?

my code is

$isFlashVar = '<script type="text/javascript">
    function isFlash()
    {
       var L = navigator.plugins.length;
       var D = document.location.href;
       for(var i=0; i<L; i++) {
         if(navigator.plugins*.name == "Shockwave Flash"){
                //reload with flash = 1 in the querystring
                location.href = "' . $_SERVER['PHP_SELF'] . '?flash=1&link=".D;
            	break;
         } else {
             if(i==L-1){
                //reload with flash = 0 in the querystring
                location.href = "' . $_SERVER['PHP_SELF'] . '?flash=0";
             }
         }
       }
     }
     isFlash();
    </script>';

D should be the document complete URL.

Thanks for any help.