
var BANNER_MSG = "Hey kids, you are now leaving www.ubiworld.com and going to a website that is beyond UbiSoft's control. UbiSoft is not responsible for the content and does not guarantee the privacy and security of data collected and maintained by the site you are going to. Don't forget: never give out your full name, address, phone number, or other important information on the Internet without checking with your parents first.";


function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
         }
      }
   }    
}

function toggleNight()
{
      document.getElementsByTagName("BODY")[0].style.backgroundImage = "images/skybg_nightpurple.jpg";
 }
 function launchPopup(url,h,w)
 {
	window.open(url,'PopUpWindow','height='+h+',width='+w+',toolbar=no,scrollbars=yes,resizable=yes');
 }
  function sendTracking(tag) {
	pageTracker._trackPageview(tag);
  }
  
var adHideTimer = 0;
var adHideDefaultTime = 30000;
  
function insiteBannerStart(adHideTime){
	clearTimeout ( adHideTimer );

	//hide ad banner
	document.getElementById("adLabel").style.display = "none";
	
	if (adHideTime){
		adHideTimer = setTimeout ( "showAdBanner()", adHideTime );
	} else {
		adHideTimer = setTimeout ( "showAdBanner()", adHideDefaultTime );
	}
}

function showAdBanner(){
	//show ad banner
	document.getElementById("adLabel").style.display = "";
	clearTimeout ( adHideTimer );
}






function queryString(parameter) { 
	var loc = location.toString().substring(location.toString().indexOf('?')+1,location.toString().length);
	var param_value = false;

	var params = loc.split("&");
	
	for (i=0; i<params.length;i++) {
		param_name = params[i].substring(0,params[i].indexOf('='));
		
		if (param_name == parameter) {
		  param_value = params[i].substring(params[i].indexOf('=')+1)
		}
	}
	if (param_value) {
		return param_value;
	}
	else {
		return false; //Here determine return if no parameter is found
	}
}

function getFlashMovie(movieName) {
  var isIE = navigator.appName.indexOf("Microsoft") != -1;
  return (isIE) ? window[movieName] : document[movieName];
}

function loadHouse(url_name){
	getFlashMovie("ubisite").handleJSDeeplink("houses/"+url_name);
}

function loadIsland(url_name){
	getFlashMovie("ubisite").handleJSDeeplink("islands/"+url_name);
}

function exitBumper(url){
	getFlashMovie("ubisite").handleExternalLink(url);
}

 