function hidePreloader(){
	document.getElementById("preloader").style.display = "none";
}
function addHash(num){
	location.hash = "page/" + num;	
}
function getHashInfo(){
	var obj = new Object();
	obj.mainPage = location.hash.split("/")[1];
	obj.subPage = 0;
	return obj;
}
function getClientHeight(){
  	return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
}
function getFlashMovie(movieName) {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[movieName] : document[movieName];
}
function callToActionscript(hei) {
     getFlashMovie("flash").getWindowHeight(hei);
}
function initWindowHeight(){
	var block = document.getElementById("site");
	var heightBlock;
	if(block){
		if(getClientHeight() < 711){
			heightBlock = 710;
		}
		else{
			heightBlock = getClientHeight();
		}
		block.style.height = heightBlock + "px";
	}
	try{
		//callToActionscript(getClientHeight());
		callToActionscript(0);
	}
	catch(e){
		
	}
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toUTCString());
}

function checkCookie()
{
username=getCookie('username');
if (username!=null && username!="")
  {
  alert('Welcome again '+username+'!');
  }
else
  {
  username=prompt('Please enter your name:',"");
  if (username!=null && username!="")
    {
    setCookie('username',username,365);
    }
  }
}
function switchLangs(lang){
	if(location.href.indexOf("locale=en") > 0){
		location.href = location.href.split("locale=en")[0] + "locale=fr" + location.href.split("locale=en")[1];	
	}
	else if(location.href.indexOf("locale=fr") > 0){
		location.href = location.href.split("locale=fr")[0] + "locale=en" + location.href.split("locale=fr")[1];	
	}
	else{
		location.href = location.href.split("#page")[0] + "?locale=" + lang + "/#page" + location.href.split("#page")[1];	
	}
}
function getZoomWidth(){
	var wid = document.body.clientWidth;
	if(wid > 900){
		wid = 900;	
	}
	else if(wid < 600){
		wid = 600;	
	}
	return wid;
}
function getZoomHeight(){
	var hei = getClientHeight() - 120;
	return hei;
}
