/* MOVIE SWITCH */
function movie_switch(current,direction)
	{

		var movie_div = document.getElementById("movie_div"); 
		// var movie_link = document.getElementById("movie_link"); 
		if(direction=="out")
			{
				//$('movie_div').appear({duration: 0.8, to: 1.0 });
				movie_div.style.display = "block";
				movie_div.innerHTML="<div id=\"movie_div_close\"><a href=\"javascript:movie_switch('uk','in');\" class=\"movie_link\">CLOSE</a></div><object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"815\" height=\"645\" id=\"player_screencast\" align=\"middle\"><param name=\"movie\" id=\"param_file\" value=\"http://blog.sitestat.com/streaming/segmentation_uk.swf?id=1\" ><param name=\"quality\" value=\"high\" /><param name=\"scale\" value=\"noscale\" /><param name=\"bgcolor\" value=\"#ffffff\" /><param name=\"autoStart\" value=\"false\" /><embed src=\"http://blog.sitestat.com/streaming/segmentation_uk.swf?id=1\" autostart=\"false\"  swliveconnect=\"true\" quality=\"high\"  scale=\"noscale\"  bgcolor=\"#ffffff\"  width=\"815\"  height=\"645\"  name=\"player_screencast\"  align=\"middle\"  type=\"application/x-shockwave-flash\"  pluginspage=\"http://www.macromedia.com/go/getflashplayer\"/></object>";
			}
			
		if(direction=="in")
			{
				// stop playing screencast
				movie_div.style.display = "none";
				movie_div.innerHTML = "";
				//$('movie_div').fade({duration: 0.8});
			}			
	}
/* END MOVIE SWITCH */	

//USED FOR POPUPS FOR IMAGE ENLARGEMENTS
var ie=document.all
var ns6=document.getElementById&&!document.all
	function ietruebody()
	{
		return (document.compatMode && document.compatMode!="BackCompat" && !window.opera)? document.documentElement : document.body
	}

	function enlarge(which, country, counter_name, e, position, imgwidth, imgheight)
	{
		if(country=="uk")
			{
				var message_close="close";
				var message_image="Click to close the screenshot";
			}
		else if(country=="nl")
			{
				var message_close="sluiten";
				var message_image="Klik op het screenshot om het te sluiten";
			}
		else if(country=="de")
			{
				var message_close="schlie&szlig;en";
				var message_image="Klicken Sie um der Screenshot zu schlie&szlig;en";
			}			
		else if(country=="es")
			{
				var message_close="cerrar";
				var message_image="Click to close the screenshot";
			}
		else if(country=="fr")
			{
				var message_close="fermer";
				var message_image="Cliquez pour fermer la capture d'&eacute;cran";
			}			
			
		else
			{
				var message_close="close";
				var message_image="Click to close the screenshot";
			}			
		
		
		
		if (ie||ns6)
			{
					crossobj=document.getElementById("showimage");
					//crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
	
					// CREATE THE BACKGROUND OVERLAY DIV, STYLE DEFINED IN CSS
					var newdiv = document.createElement('div');
					newdiv.id = "background_overlay";
					document.body.appendChild(newdiv);
	
					// stretch semi transparent overlay to fill page
					var arrayPageSize = this.getPageSize();
					
					document.getElementById("background_overlay").style.display="block";				
					document.getElementById("background_overlay").style.width=arrayPageSize[0] + "px";
					document.getElementById("background_overlay").style.height=arrayPageSize[1] + "px";
				
					//SET SIZE OF NEW DIV
					var divwidth= imgwidth + 30;
					var divheight= imgheight + 20;
	
					crossobj.style.height=divheight+"px";
					crossobj.style.width=imgwidth+"px";

					
					// SET POSITION OF IMAGE LAYOVER
					if (position=="center")
						{
						pgyoffset=ns6? parseInt(pageYOffset) : parseInt(ietruebody().scrollTop)
						horzpos=ns6? pageXOffset+window.innerWidth/6 : ietruebody().scrollLeft+ietruebody().clientWidth/6
						vertpos=ns6? pgyoffset+window.innerHeight/6 : pgyoffset+ietruebody().clientHeight/6
					
					if (window.opera && window.innerHeight) //compensate for Opera toolbar
						vertpos=pgyoffset+window.innerHeight/6
						vertpos=Math.max(pgyoffset, vertpos)
						}
					else
						{
						var horzpos=ns6? pageXOffset+e.clientX : ietruebody().scrollLeft+event.clientX
						var vertpos=ns6? pageYOffset+e.clientY : ietruebody().scrollTop+event.clientY
						}
						
						crossobj.style.left=horzpos+"px"
						crossobj.style.top=vertpos+"px"


					if(which=="image")
						{
							crossobj.innerHTML='<div id="dragbar" style="width:'+imgwidth+'px;"><a href="javascript:closepreview()"><img src="/images/icons/close.png" class="screenshot_close" border=0></a></div>';
							crossobj.innerHTML+='<div id="screenshot"><a href="javascript:closepreview();" title="'+message_image+'"><img border=0 src="'+which+'" width="'+imgwidth+'" height="'+imgheight+'" alt="'+message_image+'"></a></div>';
						}
	
					else
						{
							crossobj.innerHTML='<div id="dragbar" style="width:'+imgwidth+'px;"><a href="javascript:closepreview()"><img src="/images/icons/close.png" class="screenshot_close" border=0 alt="'+message_close+'"></a></div>';
							crossobj.innerHTML+='<div id="screenshot"><a href="javascript:closepreview();" title="'+message_image+'"><img border=0 src="'+which+'" width="'+imgwidth+'" height="'+imgheight+'" alt="'+message_image+'"></a></div>';
						}					
				
					// AND DISPLAY
					crossobj.style.display="block";
					
					sitestat("http://nl.sitestat.com/nedstat/"+country+"/s?"+country+"."+counter_name+"");	
					
					//<img src="http://nl.sitestat.com/nedstat/'+country+'nl/s?'+country+'.products.sitestat.'+counter_name+'&amp;type=view&amp;category=information&amp;prod=sitestat&amp;class=general&amp;cntry='+country+'&amp;lng=nl" width="0" height="0" alt="Sitestat pixel">
					return false
			}
			
			else {}//if NOT IE 4+ or NS 6+, simply display image in full browser window
			return true
	}

 function closepreview(e)
	 {
		crossobj.style.display="none";
		document.getElementById("background_overlay").style.display="none";
	 }
	
	
	function drag_drop(e){
		if (ie&&dragapproved){
		crossobj.style.left=tempx+event.clientX-offsetx+"px"
		crossobj.style.top=tempy+event.clientY-offsety+"px"
		}
		else if (ns6&&dragapproved){
		crossobj.style.left=tempx+e.clientX-offsetx+"px"
		crossobj.style.top=tempy+e.clientY-offsety+"px"
		}
		return false
	}
	
	
	function initializedrag(e){
		if (ie&&event.srcElement.id=="dragbar"||ns6&&e.target.id=="dragbar"){
		offsetx=ie? event.clientX : e.clientX
		offsety=ie? event.clientY : e.clientY
		tempx=parseInt(crossobj.style.left)
		tempy=parseInt(crossobj.style.top)
		dragapproved=true
		document.onmousemove=drag_drop
		}
	}
	
document.onmousedown=initializedrag
document.onmouseup=new Function("dragapproved=false")
document.ondblclick=closepreview;


// COPIED FROM LIGHTBOX
function getPageSize() 
 	{

	 	var xScroll, yScroll;

		 if (window.innerHeight && window.scrollMaxY) 
			{
				 xScroll = window.innerWidth + window.scrollMaxX;
				 yScroll = window.innerHeight + window.scrollMaxY;
			} 

		else if (document.body.scrollHeight > document.body.offsetHeight)
			{ // all but Explorer Mac
				 xScroll = document.body.scrollWidth;
				 yScroll = document.body.scrollHeight;
			} 

		else 
			{ // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
				xScroll = document.body.offsetWidth;
				yScroll = document.body.offsetHeight;
			}

 		var windowWidth, windowHeight;

		if (self.innerHeight) 
			{ // all except Explorer
				if(document.documentElement.clientWidth)
					{
						 windowWidth = document.documentElement.clientWidth;
					 } 
				else 
					{
						 windowWidth = self.innerWidth;
					 }
		 
				windowHeight = self.innerHeight;
			} 
		else if (document.documentElement && document.documentElement.clientHeight) 
			{ // Explorer 6 Strict Mode
				 windowWidth = document.documentElement.clientWidth;
				 windowHeight = document.documentElement.clientHeight;
			 } 
		else if (document.body) 
			{ // other Explorers
				windowWidth = document.body.clientWidth;
				windowHeight = document.body.clientHeight;
			}

		 // for small pages with total height less then height of the viewport
		 if(yScroll < windowHeight)
			{
				pageHeight = windowHeight;
			} 
		else 
			{
				pageHeight = yScroll;
			}

		 // for small pages with total width less then width of the viewport
		 if(xScroll < windowWidth)
			{
				pageWidth = xScroll;
			} 
		else 
			{
				pageWidth = windowWidth;
			}

 	return [pageWidth,pageHeight];
 }
//SCRIPT FOR LAYOVERS WITH IMAGES AND VIDEOS, INCLUDES MEASUREMENT
