function addfavWindows(url,title){
	if (document.all){
		window.external.AddFavorite(url,title);
	}
}
function bookmarksite(){
	if (document.all){
		// For IE
		window.external.AddFavorite(location.href, document.title);
	}
	else if (window.sidebar){
		// For Firefox
		window.sidebar.addPanel(document.title, location.href, "");
	}
}
function hd(id,c) {
	var d=document.getElementById(id);
	d.className=c;
	//trace(c);
}
function setFlashVariables2(movieid, flashquery, docum, fm) {
	var i,values;
	if(isPcIe()){
		var chunk = flashquery.split("&");
		for(i in chunk){
			values = chunk[i].split("=");
			docum[movieid].SetVariable(values[0],values[1]);
		}
	}else{
		var divcontainer = "flash_setvariables_"+movieid;
		if(!docum.getElementById(divcontainer)) {
			var divholder = docum.createElement("div");
			divholder.id = divcontainer;
			docum.body.appendChild(divholder);
		}
		docum.getElementById(divcontainer).innerHTML = "";
		var divinfo = "<embed src='/swf/gateway.swf' FlashVars='lc="+movieid+"&fq="+escape(flashquery)+"' width='0' height='0' type='application/x-shockwave-flash' id='gateway_swf_"+movieid+"'></embed>";
		docum.getElementById(divcontainer).innerHTML = divinfo;
	}
}
function isPcIe() {
	var ua=navigator.userAgent.toLowerCase(); 
	return((ua.indexOf('msie')!=-1)&&(ua.indexOf('win')!=-1)&&(ua.indexOf('opera')==-1)&&(ua.indexOf('webtv')==-1));
}
function checkBrwsr() {
	return (isPcIe() ? '_ie' : '');
}

function bvpopup(mylink, windowname) { 
	if(!window.focus) return true;
	openWin(mylink,windowname,550,768,1,0,1,1);
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
	if(!window.focus) return true;
	openWin(theURL,winName,550,768,1,0,1,1);
 	//window.open(theURL,winName,features);
	return false; 
}
function popup(mylink, windowname) {
	if(!window.focus) return true;
	openWin(mylink,windowname,618,340,0,0,1,0);
	return false; 
}
function popup2(mylink, windowname) { 
	if(!window.focus) return true;
	openWin(mylink,windowname,317,550,0,0,1,0);
	return false; 
	//window.open(href, windowname, 'top='+((screen.height - 600) / 2)+',left='+((screen.width - 600) / 2)+'+,toolbar=0 status=1,resizable=0,Width=317,height=550,scrollbars=0');
}
function openWin1(uurl,w,h) {
	var winH;
	var winW;
	var ttop;
	var lleft;
	winH=h/2;
	winW=w/2;
	ttop=screen.availHeight/2-winH;
	lleft=screen.availWidth/2-winW;
	window.open(uurl,'','top='+ttop+',left='+lleft+',width='+w+',height='+h+',scrollbars=1,toolbars=0,resizable=1,status=0');
}
function openWin(uurl,n,w,h,sb,tb,st,rz) { // url, name, width, heigth, scrollbars, toolbar, status, resize
	if(uurl) {
		if(!w) w=647;
		if(!h) h=350;
		if(sb=="") sb=0;
		if(tb=="") tb=0;
		if(st=="") st=0;
		if(rz=="") rz=0;
		var winH;
		var winW;
		var ttop;
		var lleft;
		winH=h/2;
		winW=w/2;
		ttop=screen.availHeight/2-winH;
		lleft=screen.availWidth/2-winW;
		window.open(uurl,'','top='+ttop+',left='+lleft+',width='+w+',height='+h+',scrollbars='+sb+',toolbars='+tb+',resizable='+rz+',status='+st);
	}
	return false;
}
function resizeDiv(d) {
	//var h=document.forms['q_form'].sys_h.value;
	//if(h=="0") document.forms['q_form'].sys_h.value="-1";
	//else d.style.height = parseInt(document.forms['q_form'].sys_h.value);
}
function doMenu(datoY) {
	//document.forms['q_form'].sys_h.value=datoY;
	//alert(document.forms['q_form'].sys_h.value);
	xcSet('x', 'xc');
}
function showStatus(sMsg) {
	window.status = sMsg;
	return true;
}
function newSizeXY(datoX,datoY,divo) {
	var d=document.getElementById(divo);
	d.style.height = datoY;
	alert(getInternetExplorerVersion());
	if(document.all && !document.getElementById) {
 		document.all[divo].style.pixelWidth = datoX;
 		document.all[divo].style.pixelHeight = datoY;
	} else {
		document.getElementById(divo).style.width = datoX+"px";
		document.getElementById(divo).style.height = datoY+"px";
	}
}
function doNull(data) {
	return data;
}
function newSize(datoX,datoY,divo) {
	var d=document.getElementById(divo);
	h=getWindowHeight();
	if(h[1]>datoY) datoY=h[1]+250;
	if(document.all && !document.getElementById) {
 		document.all[divo].style.pixelHeight = datoY;
	} else {
		if(getInternetExplorerVersion()!=-1) {
			if(document.getElementById('browse_swf'))
				document.getElementById('browse_swf').style.height=datoY;
		}
		document.getElementById(divo).style.height = datoY+"px";
	}
	d.style.height = datoY;
	//if(document.forms['q_form'].sys_h.value=="0") doMenu(datoY);
	//alert(datoY);
}
function getInternetExplorerVersion() {
	var rv = -1; // Return value assumes failure.
	if (navigator.appName == 'Microsoft Internet Explorer') {
		var ua = navigator.userAgent;
		var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
		if(re.exec(ua) != null) rv = parseFloat( RegExp.$1 );
	}
	return rv;
}
function newSizeDG(datoX,datoY,divo) {
	var d=document.getElementById(divo);
	d.style.height = datoY;
	d.style.width = datoX;
	//alert(datoX);
	if(document.all && !document.getElementById) {
 		document.all[divo].style.pixelWidth = datoX;
 		document.all[divo].style.pixelHeight = datoY;
	} else {
		document.getElementById(divo).style.width = datoX+"px";
		document.getElementById(divo).style.height = datoY+"px";
	}
	// 
	//alert(datoX);
}
function getWindowHeight() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  //window.alert( 'Width = ' + myWidth );
  //alert(myHeight);
  return Array(myWidth,myHeight);
}
function canResizeFlash(){
	// verify if user can resize divs dynamically. Please leave. _ssarrasin
	var ua = navigator.userAgent.toLowerCase();
	var opera = ua.indexOf("opera");
	if( document.getElementById ){
		if(opera == -1) return true;
		else if(parseInt(ua.substr(opera+6, 1)) >= 7) return true;
	}
	return false;
}
function SetCookie(cookieName,cookieValue,nDays) {
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 expire.setTime(today.getTime() + 3600*24*nDays);
 document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
} 
function addToWishlist(pid,txt) {
	var cookieName='wishlist';
	var currentValue=getCookie(cookieName);
	if(currentValue.indexOf("["+pid+"]")==-1) {
		var cookieValue="["+pid+"]"+currentValue;
		var nDays=365;
		var today = new Date();
		var expire = new Date();
		if (nDays==null || nDays==0) nDays=1;
		expire.setTime(today.getTime() + 3600*24*nDays);
		document.cookie = cookieName+"="+escape(cookieValue)
				 + ";expires="+expire.toGMTString();
	}
	var c=getCookie('wishlist');
	switchWLtext(pid,txt)
	alert(c);
}
function switchWLtext(pid,txt) {
	var e=document.getElementById('wl-'+pid);
	e.innerHTML=txt;
}
function getCookie(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
        end = dc.length;
    }
	var val=unescape(dc.substring(begin + prefix.length, end));
	//alert(typeof val);
    return val;
}
function IsAge(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-() ";
   var strChar;
   var blnResult = true;

   //if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   if (strString.length < 1){
		  
		   return false
		}
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
	  
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
		  
         }
      }
	  
   return blnResult;
   }
function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-() ";
   var strChar;
   var blnResult = true;
   //if (strString.length == 0) return false;
   //  test strString consists of valid characters listed above
   if (strString.length < 8){
		    return false
		}
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
	  
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
		  
         }
      }
	  
   return blnResult;
  }
function echeck2(str){
	var emailRegEx = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-\.])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if(str.match(emailRegEx)){
		return true;
	} else {
		return false;
	}
}
function echeck(str) {
	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length;
	var ldot=str.indexOf(dot);
			
	if (str.indexOf(at)==-1){
	 //  alert("Invalid E-mail ")
	   return false;
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	  // alert("Invalid E-mail ")
	   return false;
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	 //   alert("Invalid E-mail ")
		return false;
	}
	if (str.indexOf(at,(lat+1))!=-1){
		//  alert("Invalid E-mail ")
		return false;
 	}
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		//  alert("Invalid E-mail ")
		return false;
	}
	if (str.indexOf(dot,(lat+2))==-1){
		//  alert("Invalid E-mail ")
		return false;
	}
	//if (str.indexOf(" ")!=-1){
		//   alert("Invalid E-mail ")
		//   return false
	// }
	 return true;		
}
function PopupCentrer(page,largeur,hauteur,options) {
	var top=(screen.height-hauteur)/2;
	var left=(screen.width-largeur)/2;
	window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}
function EcrireCookie(nom, valeur) {
	var argv=EcrireCookie.arguments;
	var argc=EcrireCookie.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	document.cookie=nom+"="+escape(valeur)+
	((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
	((path==null) ? "" : ("; path="+path))+
	((domain==null) ? "" : ("; domain="+domain))+
	((secure==true) ? "; secure" : "");
}
function js_getURL(spage,sdiv) {
	document.getElementById(sdiv).innerHTML="";
	document.location.href=spage;
}
function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function print_page() {
	document.write('<form><input type="button" value="Imprimer" onClick="javascript:window.print();"></form>');
}
function change_img1(i) {
	if (i==0) document.img1.src='d_images/b_play_online_soon_over.gif';
	if (i==1) document.img1.src='d_images/b_play_online_over.gif';
	if (i==2) document.img1.src='d_images/b_play_online.gif';
}
function change(imageName, imagesrc) {
	document.images[imageName].src = imagesrc.src;
}
function validate_poll() {
    return true;
}
function validercomment() {
	document.forms['formqst'].method = "POST";
	document.forms['formqst'].action = "comments.php";
	document.forms['formqst'].submit(); 
}
// PLEASE LEAVE! ssarrasin
// USE THIS FUNCTION TO TRACE ON THE SCREEN
// FOR DEBUG PURPOSES
// EX: 	trace(my_var,true); <- true if you want to clear the content, false if you want to see all trace contents
function trace(v,clr) {
	//return;
	//alert(v);
	var divcontainer = "tracer";
	if(!document.getElementById(divcontainer)){
		var divholder = document.createElement("div");
		divholder.id = divcontainer;
		document.body.appendChild(divholder);
		divholder.style.zIndex="999";
		divholder.style.position="absolute";
		divholder.style.display="block";
		divholder.style.width="200px";
		divholder.style.height="auto";
		divholder.style.padding="10px";
		divholder.style.top="";
		divholder.style.left="0";
		//divholder.style.backgroundColor="#FFF";
	}
	//u=="+" ? document.getElementById(divcontainer).innerHTML+=v : 
	clr ? document.getElementById(divcontainer).innerHTML="<p>"+v+"</p>" : document.getElementById(divcontainer).innerHTML+="<p>"+v+"</p>";
	//if(u!="") window.open(u);
}
function randStr() {
	var rand=Math.random();
	var a;
	a=rand.toString().split(".");
	return a[1];
}
function createXMLHTTPObject() {
	var XMLHttpFactories = [
	function () {return new XMLHttpRequest()},
	function () {return new ActiveXObject("Msxml2.XMLHTTP")},
	function () {return new ActiveXObject("Msxml3.XMLHTTP")},
	function () {return new ActiveXObject("Microsoft.XMLHTTP")}
	];
	var xmlhttp = false;
	for (var i=0;i<XMLHttpFactories.length;i++) {
		try {
			xmlhttp = XMLHttpFactories[i]();
		}
		catch (e) {
			continue;
		}
		break;
	}
	return xmlhttp;
}
function gebi(id) {
	return document.getElementById(id);
}
/*//////////////////
// IMAGES PRELOADS //
//////////////////*/
/*##############################################################
## Following content has been copied hre from : /js/imageTools/preload.js 
## by : Bruno Valentin 
## (in order to reduce number of js files requested)
/*##############################################################*/
function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function preloadImg(image) {
	var img = new Image();
	img.src = image;
}