function getWinSize(thetype) {
      var myWidth = 0, myHeight = 0;
      if( typeof( window.innerWidth ) == 'number' ) {
         myWidth = window.innerWidth;
         myHeight = window.innerHeight;
      } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
         myWidth = document.documentElement.clientWidth;
         myHeight = document.documentElement.clientHeight;
      } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
         myWidth = document.body.clientWidth;
         myHeight = document.body.clientHeight;
      }
      if(thetype==1){
         return myWidth;
      }
      else{
         return myHeight;      
      }
   }
   
   function getScrollXY(thetype) {
      var scrOfX = 0, scrOfY = 0;
      if( typeof( window.pageYOffset ) == 'number' ) {
      //Netscape compliant
         scrOfY = window.pageYOffset;
         scrOfX = window.pageXOffset;
      } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
      //DOM compliant
         scrOfY = document.body.scrollTop;
         scrOfX = document.body.scrollLeft;
      } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
      //IE6 standards compliant mode
         scrOfY = document.documentElement.scrollTop;
         scrOfX = document.documentElement.scrollLeft;
      }
      if(thetype==1){
         return scrOfX;
      }
      else{
         return scrOfY;      
      }      
   }   
   
   var use_height = parseInt(75 + getScrollXY(1));
   var use_width = parseInt(getWinSize(2)/2);   
   //alert('use_height='+use_height+' and use_width='+use_width);
	var qu_s2f_window = new quantic_window('RECOMMEND THIS PAGE TO A FRIEND',500,413,use_width,use_height);
   
      qu_s2f_window.create('s2fDiv');   
            

        function pree_showS2F(){
            qu_s2f_window.create('s2fDiv');     
            qu_s2f_window.show_the_window();    
        }
        
      
        

         function doshowS2F(ovmess,ovurl){

            for(var i=0;i<tohideforlayer.length;i++){
               document.getElementById(tohideforlayer[i]).style.display = 'none';
            }

            if(typeof ovmess == "undefined"){
               //alert("ovmess undefined");
            }
            else{
               //alert("ovmess defined");
               document.getElementById('themessage').value=ovmess;
            }

            if(typeof ovurl == "undefined"){
               //alert("ovurl undefined");
            }
            else{
               //alert("ovurl defined");
               document.getElementById('theurl').value=ovurl;
            }
           
      		var Passedcsuseragent = screen.width + 'x' +screen.height + ':' +navigator.userAgent;
      		var PassedInternalRef = location.href;

         	var ps_fn = "";
         	var ps_ln = "";
         	var ps_email = "";

         	//var thepassedmessage = document.getElementById('themessage').value;
            //var passedurl = document.getElementById('theurl').value;
          	var thepassedmessage = "#Request.Global.CurrentPageInfo.Title#";
            var passedurl = "http://#cgi.SERVER_NAME##Request.FakePathInfo#";            

            var so = new SWFObject("http://autosite.quanticsolutions.co.uk/sinclude/swf/sendtoafriend_v2.swf?ps_email="+ps_email+"&ps_ln="+ps_ln+"&ps_fn="+ps_fn+"Passedcsuseragent="+Passedcsuseragent+"&SiteID=31&PassedExternalRef=#Session.User.Referrer#&PassedInternalRef=#Session.User.InternalReferrer#&PassedURL="+passedurl+"&theme=#Variables.S2F.theme#&PassedItem="+thepassedmessage+"&PassedFromSite=#Request.Global.SiteName#&PassedID=#session.contact.id#", "s2fheader", "500", "395", "7", "##ffffff");
      		so.addParam("quality", "high");
      		so.addParam("wmode", "transparent");
      		so.addParam("allowScriptAccess", "always");
      		//so.addVariable("theme", "#Variables.S2F.theme#");
      		//so.addVariable("ps_fn", ps_fn);
      		//so.addVariable("ps_ln", ps_ln);
      		//so.addVariable("ps_email", ps_email);
      		//so.addVariable("PassedItem", thepassedmessage);
      		//so.addVariable("PassedFromSite", "#Request.Global.SiteName#");
      		//so.addVariable("PassedURL", passedurl);
            //so.addVariable("PassedInternalRef", "#Session.User.InternalReferrer#");
            //so.addVariable("PassedExternalRef", "#Session.User.Referrer#");
      		//so.addVariable("SiteID", "31");
      		//so.addVariable("Passedcsuseragent", Passedcsuseragent);
      		so.addParam("menu", "false");           
            so.write("s2fheaderdiv");
            
            pree_showS2F();
         }
         
        function showS2F(ovmess,ovurl){
            if(typeof ajaxloaded != 'undefined'){

               if(typeof ovmess == "undefined"){
                  //alert("ovmess undefined");
               }
               else{
                  //alert("ovmess defined");
                  document.getElementById('themessage').value=ovmess;
               }
   
               if(typeof ovurl == "undefined"){
                  //alert("ovurl undefined");
               }
               else{
                  //alert("ovurl defined");
                  document.getElementById('theurl').value=ovurl;
               }            

               doshowS2F(ovmess,ovurl);
            }
            else{
               alert('The page is still loading, please try again in a second');
            }
         }           


         function hideS2F(){
            qu_s2f_window.hide_the_window();
         }

         function fromFlashS2F(){
            hideS2F();
         }
         
         setloadedflag();