function getWindowSize()
{  
	var h = 0, w = 0;
	if( typeof( window.innerHeight ) == 'number' ) 
	{
		h = window.innerHeight;
		w = window.innerWidth;
  }
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
	{
		h = document.documentElement.clientHeight;
		w = document.documentElement.clientWidth;
  }
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
	{
		h = document.body.clientHeight;
		w = document.body.clientWidth;
  }
	return [ w, h ];
} 

function getScrollSize() {
	var sy = 0;
	if( typeof( window.pageYOffset ) == 'number' ) 
		sy = window.pageYOffset;
	else if( document.body && ( document.body.scrollTop ) )
		sy = document.body.scrollTop;
	else if( document.documentElement && ( document.documentElement.scrollTop ) )
		sy = document.documentElement.scrollTop;
	return sy;
}

function showWindow(theImage,type) 
{   
  var isMac = MacBrower();
  var setWidth = "";
  if(type == 'video')  
    setWidth = 640; 
  else if(type == 'media')  
    setWidth = 800; 
  else if(type=='map')
    setWidth = 640;
  else
    setWidth = 640;
  var iframewin = setWidth/2; 
  var setBG = getWindowSize();
  var setScroll = getScrollSize();
  
  var win = document.getElementById('win'); 
  var winBg = document.getElementById('winBg');  
  var winContent = document.getElementById('winContent');  
  var winClose = document.getElementById('winClose'); 
  
	if(setScroll > setBG[1])
	{ 
	  win.style.height = setScroll;
	  winBg.style.height = setScroll; 
	}  
	else
	{
	  win.style.height = '100%';  
	  winBg.style.height = '100%';  
	} 
	
	if(setScroll < setBG[0])
	{ 
	  	winClose.style.width = setWidth+'px';
		winClose.style.height = '22px';
		winClose.style.left = ((setBG[0]/2) - iframewin)  +'px';
		winClose.style.top = (setBG[1]/8) +'px';
		winContent.style.width = setWidth+'px'; 
		winContent.style.left = ((setBG[0]/2) - iframewin) +'px';
		winContent.style.top = ((setBG[1]/8)+22) +'px';
	}  
	else
	{
	  	winClose.style.width = setWidth+'px';
	  	winClose.style.height = '22px';
    	winClose.style.left = ((setBG[0]/2) - iframewin) +'px';
    	winClose.style.top = (setBG[1]/8) +'px'; 
	  	winContent.style.width = setWidth+'px'; 
    	winContent.style.left = ((setBG[0]/2) - iframewin) +'px';
    	winContent.style.top = ((setBG[1]/8)+22) +'px';
	}  
	  
  winBg.style.opacity = '0.90';
	winBg.style.MozOpacity = '0.90';
	winBg.style.KHTMLOpacity = '0.90';
  winBg.style.filter = "alpha(opacity=90)";   
   
	winClose.style.opacity = '0.85';
	winClose.style.MozOpacity = '0.85'; 
	winClose.style.KHTMLOpacity = '0.85';
	winClose.style.filter = "alpha(opacity=85)";
	winClose.style.display = 'block';   
	if(type == 'video')  
	  winContent.innerHTML = "<iframe src=\"./load_video.php?objectset=" + escape(theImage) + "\" id=\"media_window\" name=\"media_window\" style=\"border:none; background:transparent;width: 640px;height: 360px;\" scrolling=\"no\" frameborder=\"0\" allowtransparency=\"true\" marginheight=\"0\" marginwidth=\"0\"></iframe>";
	else if(type == 'media')  
	  winContent.innerHTML = "<iframe src=\"./load_type.php?objectset=" + escape(theImage) + "\" id=\"media_image\" name=\"media_window\" style=\"border:none; background:transparent;width: 800px;height: 497px;\" scrolling=\"no\" frameborder=\"0\" allowtransparency=\"true\" marginheight=\"0\" marginwidth=\"0\"></iframe>";
	else if(type == 'music')
	  winContent.innerHTML = "<iframe src=\"./load_music.php?objectset=" + escape(theImage) + "\" id=\"media_window\" name=\"media_window\" style=\"border:none; background:transparent; width: 640px;height: 500px;\" scrolling=\"no\" frameborder=\"0\" allowtransparency=\"true\" marginheight=\"0\" marginwidth=\"0\"></iframe>";
	else if(type == 'map')
	  winContent.innerHTML = "<img src=\"" + theImage + "\" >";  
	else
	  winContent.innerHTML = "<img src=\"" + theImage + "\" width='640' height='360' border='0'>";  
  winContent.style.display = 'block';  
   
  win.style.display = 'block'; 
  if(isMac) { 
    document.getElementById('navbar').style.display = 'none';  
    document.getElementById('footerbar').style.display = 'none';
  } 
}
  
function hideWindow() {  
  var isMac = MacBrower();   
	document.getElementById('win').style.display = 'none';
	document.getElementById('winContent').innerHTML=''; 
	if(isMac) 
	{
	  document.getElementById('navbar').style.display = 'block'; 
	  document.getElementById('footerbar').style.display = 'block'; 
	}
}

function showPop() 
{     
  var wini = document.getElementById('winInstruction'); 
	wini.style.opacity = '0.90';
	wini.style.MozOpacity = '0.90'; 
	wini.style.KHTMLOpacity = '0.90';
	wini.style.filter = "alpha(opacity=90)";
	wini.style.display = 'block';    
}
  
function hidePop() {     
	document.getElementById('winInstruction').style.display = 'none'; 
}
 
function Void()
{
  
}

function MacBrower() {
  var userAgent = navigator.userAgent.toLowerCase();   
  if (userAgent.indexOf('mac')!=-1 && userAgent.indexOf('firefox')!=-1)  { 
    return true;  
  }
}

function showAgeGate() 
{    
  var setWidth = 923; 
  var iframewin = setWidth/2; 
  var setBG = getWindowSize();
  var setScroll = getScrollSize();
  
  var win = document.getElementById('win'); 
  var winBg = document.getElementById('winBg');  
  var winContent = document.getElementById('winContent');   
  
	if(setScroll > setBG[1])
	{ 
	  win.style.height = setScroll;
	  winBg.style.height = setScroll; 
	}  
	else
	{
	  win.style.height = '100%';  
	  winBg.style.height = '100%';  
	} 
	
	if(setScroll < setBG[0])
	{  
		winContent.style.width = setWidth+'px'; 
		winContent.style.left = ((setBG[0]/2) - iframewin) +'px';
		winContent.style.top = ((setBG[1]/8)+22) +'px';
	}  
	else
	{ 
	  winContent.style.width = setWidth+'px'; 
    winContent.style.left = ((setBG[0]/2) - iframewin) +'px';
    winContent.style.top = ((setBG[1]/8)+22) +'px';
	}  
	  
  winBg.style.opacity = '0.80';
	winBg.style.MozOpacity = '0.80';
	winBg.style.KHTMLOpacity = '0.80';
  winBg.style.filter = "alpha(opacity=80)";    
  winContent.style.display = 'block';  
   
  win.style.display = 'block';  
}
 
function switchCountry(cValue,loc)
{
  var today = new Date();
  var expire = new Date();
  var nDays = 30;
  if (nDays==null || nDays==0) nDays=1;
   expire.setTime(today.getTime() + 3600000*24*nDays);
   document.cookie = "sr2Country="+escape(cValue) + ";expires="+expire.toGMTString(); 
   window.location = loc;
} 
 