   // Script Source: CodeLifter.com
   // Copyright 2003
   // Do not remove this header
	if(typeof tohideforlayer == "undefined"){
		var tohideforlayer = new Array();
	}	
	
   isIE=document.all;
   isNN=!document.all&&document.getElementById;
   isN4=document.layers;
   isHot=false;
   
   function ddInit(e){
     topDog=isIE ? "BODY" : "HTML";
     whichDog=isIE ? document.all.s2fDiv : document.getElementById("s2fDiv");  
     hotDog=isIE ? event.srcElement : e.target;  
     while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){
       hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
     }  
     if (hotDog.id=="titleBar"){
       offsetx=isIE ? event.clientX : e.clientX;
       offsety=isIE ? event.clientY : e.clientY;
       nowX=parseInt(whichDog.style.left);
       nowY=parseInt(whichDog.style.top);
       ddEnabled=true;
       document.onmousemove=dd;
     }
   }
   
   function dd(e){
     if (!ddEnabled) return;
     whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; 
     whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
     return false;  
   }
   
   function ddN4(whatDog){
     if (!isN4) return;
     N4=eval(whatDog);
     N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
     N4.onmousedown=function(e){
       N4.captureEvents(Event.MOUSEMOVE);
       N4x=e.x;
       N4y=e.y;
     }
     N4.onmousemove=function(e){
       if (isHot){
         N4.moveBy(e.x-N4x,e.y-N4y);
         return false;
       }
     }
     N4.onmouseup=function(){
       N4.releaseEvents(Event.MOUSEMOVE);
     }
   }
     
   document.getElementById("s2fDiv").onmousedown=ddInit; 
   //document.onmousedown=ddInit;
   document.onmouseup=Function("ddEnabled=false");
   
   //my stuff

   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;      
      }      
   }
      
   function InitPositionS2F(){
   
      var xpos = Math.round(getWinSize(1)/2) + getScrollXY(1);      
      var xoffset = Math.round(winwidth/2)*-1;
      var xadjust = 20;
      var xdragoffset = 0;

      var ypos = getScrollXY(2);      
      var yoffset = 0;
      var ydragoffset = 0;         
                 
      xpos = xpos + xoffset + xdragoffset;
      ypos = ypos + yoffset + ydragoffset;
      
      var t1 = ypos;
      var t2 = getWinSize(2);         
      
      var diff = ypos + S2FYoffset;
      
      if((diff<0)||winheight>getWinSize(2)){
      
         document.getElementById('s2fDiv').style.top = 5 + getScrollXY(2) + "px";     
         //document.getElementById('tester').value = t1 + " : " + t2 + " : -1";           
         
      }
      else{
      
         var fitdif = winheight + 5 + S2FYoffset - getWinSize(2);
         
         if(fitdif>0){
         
            var newpos = ypos + S2FYoffset - fitdif;
         
            if(newpos < 0){
               document.getElementById('s2fDiv').style.top = 5 + "px";     
               //document.getElementById('tester').value = t1 + " : " + t2 + " : -2";                       
            }
            else{
               document.getElementById('s2fDiv').style.top = newpos + "px"; 
               //document.getElementById('tester').value = t2 + " : " + fitdif + " : " + diff +" : -3";                          
            }
         
         }
         else{
            document.getElementById('s2fDiv').style.top = ypos + S2FYoffset + "px"; 
            //document.getElementById('tester').value = t2 + " : " + fitdif + " : " + diff +" : -4";                      
         }          
         
      }
      
      document.getElementById('s2fDiv').style.left = 400 + "px";  
      
      var t1 = xpos;
      var t2 = getWinSize(1);    
      
      if(xpos<0){
         document.getElementById('s2fDiv').style.left = 5 + "px";     
         //document.getElementById('tester2').value = t1 + " : " + t2 + " : -1";           
      }
      else{
         var diff = xpos+S2FXoffset+winwidth+xadjust;
               
         if(diff>getWinSize(1)){
         
            var adjustback = getWinSize(1) - (xpos+S2FXoffset+winwidth+xadjust);
            
            var makepos = xpos + S2FXoffset + adjustback + getScrollXY(1);
            
            if(makepos<5){
               document.getElementById('s2fDiv').style.left = 5 + "px";     
               //document.getElementById('tester2').value = diff + " : " + getWinSize(1) + " : " + adjustback +" : -2";            
            }
            else{
               document.getElementById('s2fDiv').style.left = xpos + S2FXoffset + adjustback + getScrollXY(1) + "px";     
               //document.getElementById('tester2').value = diff + " : " + getWinSize(1) + " : " + adjustback +" : -3";            
            }
            
         }
         else{
            document.getElementById('s2fDiv').style.left = xpos + S2FXoffset + "px";               
            //document.getElementById('tester2').value = diff + " : " + getWinSize(1) +  " :" + S2FXoffset + " : -4";          
         }            
      }
         
   }
   
   function PositionS2F(){
   
      var thescrolly = getScrollXY(0);   
      var thescrollx = getScrollXY(1);
      var thewinheight = getWinSize(0);
      var thewinwidth = getWinSize(1);
      var thexposinit = document.getElementById('s2fDiv').style.left;
      var theyposinit = document.getElementById('s2fDiv').style.top;  
      
      //strip the 'px' from thexpos and theypos
      var thexpos = Math.ceil(thexposinit.replace(/px/g,''));
      var theypos = Math.ceil(theyposinit.replace(/px/g,''));   
      
      var xloffset = -3;   
      var xroffset = -5;   
      var ytoffset = -4;      
      var yboffset = 3;          
      
      var thexspaceremainingleft = thexpos - thescrollx + xloffset;
      var thexspaceremainingright = thewinwidth + thescrollx - thexpos - 500 + xroffset;
      var theyspaceremainingtop = theypos - thescrolly + ytoffset;   
      var theyspaceremainingbelow = thewinheight + thescrolly - theypos - 500 + yboffset;   
      
      /*document.getElementById('thescrolly').value = thescrolly;                                
      document.getElementById('thescrollx').value = thescrollx;
      document.getElementById('thewinheight').value = thewinheight;
      document.getElementById('thewinwidth').value = thewinwidth;
      document.getElementById('thexpos').value = thexpos;
      document.getElementById('theypos').value = theypos;
      document.getElementById('thexspaceremainingleft').value = thexspaceremainingleft;
      document.getElementById('thexspaceremainingright').value = thexspaceremainingright;                                          
      document.getElementById('theyspaceremainingtop').value = theyspaceremainingtop;
      document.getElementById('theyspaceremainingbelow').value = theyspaceremainingbelow;  */   
      
      if(document.getElementById('activefixpos').value==1){
         
         //check the top pos
            if((theyspaceremainingtop<0)&&(thewinheight>550)){
               document.getElementById('s2fDiv').style.top = theypos - theyspaceremainingtop + "px";
            }
         
         //check the bot pos
            if((theyspaceremainingbelow<0)&&(thewinheight>550)){
               document.getElementById('s2fDiv').style.top = theypos + theyspaceremainingbelow + "px";
            }   
            
            if(thewinheight<550){
               document.getElementById('s2fDiv').style.top = thescrolly + 30 + "px";            
            }         
         
         //check the left pos
            if((thexspaceremainingleft<0)&&(thewinwidth>550)){
               document.getElementById('s2fDiv').style.left = thexpos - thexspaceremainingleft + "px";
            }          
         
         //check the right pos
            if((thexspaceremainingright<0)&&(thewinwidth>550)){
               document.getElementById('s2fDiv').style.left = thexpos + thexspaceremainingright + "px";
            }        
         
            if(thewinwidth<550){
               document.getElementById('s2fDiv').style.left = thescrollx + 30 + "px";            
            }         
         
         //         
         
      }
      
      /*var testX = thewinwidth - thexpos - 550 - thescrollx;
      document.getElementById('thetestx').value = testX;
      if(testX<0){
         outSide();
         document.getElementById('activefixpos').value = 1;
      }*/
                                                 
   }


   function hideS2F(doclear){
      for(var i=0;i<tohideforlayer.length;i++){
         document.getElementById(tohideforlayer[i]).style.display = 'block';  
      }   
   
      if(doclear==1){
         clearInterval(detectscrolint); 
      }
      document.getElementById('s2fDiv').style.top = -1000 + "px";
		document.getElementById('showings2f').value=0;
   }     
   
   hideS2F(0); 
	
	winwidth = 500;
	winheight = 395;      
	yadjust = 0;     
	S2FYoffset = 140; 
	S2FXoffset = 55; 
	
	function showS2F(ovmess,ovurl){
	
		if(document.getElementById('showings2f').value==1){
			hideS2F(1);
		}
		
		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 thepassedmessage = document.getElementById('themessage').value;
		var thepassedmessage = document.title;      
		var passedurl = location.href;      
//		var passedurl = document.getElementById('theurl').value;      
		var Passedcsuseragent = screen.width + 'x' +screen.height + ':' +navigator.userAgent;    
		var PassedInternalRef = location.href;
	
		var so = new SWFObject("http://autosite.quanticsolutions.co.uk/sinclude/swf/fc/sendtoafriend_ext_2_2_fc.swf?21", "s2fheader", "500", "395", "7", "#ffffff");
		so.addParam("quality", "high");
		so.addParam("wmode", "transparent");
		so.addParam("allowScriptAccess", "always");
		so.addVariable("theme", "457CC0");
		so.addVariable("PassedItem", thepassedmessage);                     
		so.addVariable("PassedFromSite", "Telematics Munich 2009");                     
		so.addVariable("PassedURL", passedurl);                                                               
		so.addVariable("PassedInternalRef", PassedInternalRef);                                 
		so.addVariable("ClientID", "2");            
		so.addVariable("SiteID", "4");  
		so.addVariable("Passedcsuseragent", Passedcsuseragent);  		
		so.addParam("menu", "false");                                    
		so.write("s2fheaderdiv");         
	
		InitPositionS2F();     
		detectscrolint = setInterval("PositionS2F()", 100);        
		killAutoPos();
		startAutoPos();     
		document.getElementById('s2fDiv').style.display = 'block';
		
		document.getElementById('showings2f').value=1;
	}   
	
	function killAutoPos(){
		clearInterval(detectscrolint); 
		document.getElementById('activefixpos').value = 0;     
	}
	function startAutoPos(){
		document.getElementById('activefixpos').value = 1;    
		Function("ddEnabled=false");  
		detectscrolint = setInterval("PositionS2F()", 100);
	}      
	
	function fromFlashS2F(){
		hideS2F(1);
	}	