// JavaScript Document

// Don't edit below!
/*var message="Désolé, cette fonction n’est pas active, eFairJob copyright 2008 \."; // Message for the alert box

if (navigator.appName == 'Microsoft Internet Explorer'){
	function NOclickIE(e) {
		if (event.button == 2 || event.button == 3) {
			alert(message);
			return false;
		}
		return true;
	}
	document.onmousedown=NOclickIE;
	document.onmouseup=NOclickIE;
	window.onmousedown=NOclickIE;
	window.onmouseup=NOclickIE;
}
else {
	function NOclickNN(e){
		if (document.layers||document.getElementById&&!document.all){
			if (e.which==2||e.which==3){
				alert(message);
				return false;
	}}}
	if (document.layers){
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown=NOclickNN; }
	document.oncontextmenu=new Function("alert(message);return false")
}*/
	
function ValidateLogin(comeIn){
	var errorm = "";
	if(!validarEmail(comeIn.Email.value)){
		if(errorm == "")
			comeIn.Email.focus();
		errorm += "- Votre \"Email\" doit être valide.\n";	
	}
	
	if(comeIn.Pass.value.replace(" ","").length  == 0){
		if (errorm == "")comeIn.Pass.focus();
		errorm += "- Please type your password.\n";
	}
	else{
		if(comeIn.Pass.value.length <= 5){
			if (errorm == "")comeIn.Pass.focus();
			errorm += "- Invalid password.\n";
		}
	}
	
	if(errorm == ""){
		comeIn.submit();
	}
	else{
		alert(errorm);
	}
}

function validateContact(comeIn){
	var errorm = "";
	if(!validarEmail(comeIn.Email.value)){
		if(errorm == "")
			comeIn.Email.focus();
		errorm += "- Votre \"Email\" doit être valide.\n";	
	}
	
	/*if(replace_all_occurrences(comeIn.FirstName.value," ","").length == 0){
		if(errorm == "")
			comeIn.FirstName.focus();
		errorm += "- Please type your first name.\n";	
	}
	
	if(replace_all_occurrences(comeIn.LastName.value," ","").length == 0){
		if(errorm == "")
			comeIn.LastName.focus();
		errorm += "- Please type your last name.\n";	
	}
	
	if(replace_all_occurrences(comeIn.CompanyName.value," ","").length == 0){
		if(errorm == "")
			comeIn.CompanyName.focus();
		errorm += "- Please type your company name.\n";	
	}
	
	var regex = /^[0-9]{1,7}$/;
	
	if(replace_all_occurrences(comeIn.Area.value," ","").length == 0 || replace_all_occurrences(comeIn.Phone.value," ","").length == 0){
		if(errorm == "")
			comeIn.Area.focus();
		errorm += "- Please type your company phone number.\n";	
	}
	else{
  		if(regex.test(comeIn.Area.value) == false || regex.test(comeIn.Phone.value) == false){
			if(errorm == "")
				comeIn.Area.focus();
			errorm += "- The company phone number can only contain numbers.\n";	
		}
	}
	
	if(replace_all_occurrences(comeIn.TextSubjectMsj.value," ","").length == 0){
		if(errorm == "")
			comeIn.TextSubjectMsj.focus();
		errorm += "- Please type the subject.\n";	
	}*/
	
	if(replace_all_occurrences(comeIn.ContactDesc.value," ","").length == 0){
		if(errorm == "")
			comeIn.ContactDesc.focus();
		errorm += "- Entrez le \"message\".\n";
	}
	
	if(errorm == ""){
		comeIn.submit();
	}
	else{
		alert(errorm);
	}
}


function DeleteCart(InType, comeIn){
	comeIn.TypeDel.value = InType;
	comeIn.submit();
}

function addCart(chose, comeIn){
	var prix = 0;
	var Type = 0;
	var Province = comeIn.ProvinceState.value;
	var Quantity = 1;//comeIn.Quantity.value;
	var Domain = comeIn.DomainJobSearch.value;
	//alert('-->'+ Province +' -->> '+Quantity);
	switch (chose){
		case 1:
			prix = 3700 * Quantity;
			Type = 1;
		break;
		case 2:
			prix = 2800 * Quantity;
			Type = 2;
		break;
		case 3:
			prix = 1800 * Quantity;
			Type = 3;
		break;
		case 4:
			prix = 1200 * Quantity;
			Type = 4;
		break;
		default : alert("Rien");
	}
	document.getElementById("Cart").src = "cartShoping.asp?type=" + Type + "&province=" + Province + "&quantity=" + Quantity + "&prix=" + prix + "&domain=" + Domain;
}

function validatePostJob2(comeIn,OptAfter){
	var errorm = "";
	if(comeIn.TypePosition.value == 0){
		if(errorm == "")
			comeIn.TypePosition.focus();
		errorm += "- Entrez le \" type de position\"\n";	
	}
	
	if(replace_all_occurrences(comeIn.theDate.value," ","").length == 0){
		if(errorm == "")
			comeIn.theDate.focus();
		errorm += "- Entrez la \"date de début\".\n";	
	}
	
	/*if(replace_all_occurrences(comeIn.NumberWeek.value," ","").length == 0){
		if(errorm == "")
			comeIn.NumberWeek.focus();
		errorm += "- Entrez le\"nombre d’heures par semaine\"\n";	
	}*/
	
	if(comeIn.RequiredEducation.value == 0){
		if(errorm == "")
			comeIn.RequiredEducation.focus();
		errorm += "- Entrez la \"formation requise\"\n";	
	}
	
	if(comeIn.Experience.value == 0){
		if(errorm == "")
			comeIn.Experience.focus();
		errorm += "- Entrez \"l’expérience requise\"\n";	
	}
	
	if(OptAfter == 1)
		comeIn.Versions.value = "1";
	
	if(errorm == ""){
		comeIn.submit();
	}
	else{
		alert(errorm);
	}
}

function validatePostJob(comeIn){
	var errorm = "";
	if(replace_all_occurrences(comeIn.JobTitle.value," ","").length == 0){
		if(errorm == "")
			comeIn.JobTitle.focus();
		errorm += "- Entrez le \"titre de l’emploi\"\n";	
	}
	
	if(comeIn.DomainJobSearch.value == 0){
		if(errorm == "")
			comeIn.DomainJobSearch.focus();
		errorm += "- Vous devez choisir \" un domaine d’activité \"\n";	
	}
	
	if(replace_all_occurrences(comeIn.JobDesc.value," ","").length == 0){
		if(errorm == "")
			comeIn.JobDesc.focus();
		errorm += "- Entrez la \" description de poste\"\n";	
	}
	
	if(replace_all_occurrences(comeIn.PostalCode.value," ","").length == 0){
		if(errorm == "")
			comeIn.PostalCode.focus();
		errorm += "- Entrez votre \"code postale\"\n";	
	}
	else{
		if(!isPostCode(comeIn.PostalCode.value)){
			if(errorm == "")
				comeIn.PostalCode.focus();
			errorm += "- Votre \"code postal\" doit être valide\n";	
		}
	}
	
	if(errorm == ""){
		comeIn.submit();
	}
	else{
		alert(errorm);
	}
}

function validateCreateCompany(comeIn){
	var errorm = "";
	if(replace_all_occurrences(comeIn.CompanyName.value," ","").length == 0){
		if(errorm == "")
			comeIn.CompanyName.focus();
		errorm += "-  Entrez le nom de \"votre entreprise \"\n";	
	}
	
	if(replace_all_occurrences(comeIn.CompanyDesc.value," ","").length == 0){
		if(errorm == "")
			comeIn.CompanyDesc.focus();
		errorm += "- Entrez votre \"description d’entreprise\"\n";	
	}
	
	if(replace_all_occurrences(comeIn.IndustrySector.value," ","").length == 0){
		if(errorm == "")
			comeIn.IndustrySector.focus();
		errorm += "- Entrez votre\"domaine d’activité\"\n";	
	}
	
	if(replace_all_occurrences(comeIn.Advantage.value," ","").length == 0){
		if(errorm == "")
			comeIn.Advantage.focus();
		errorm += "- Entrez vos\"avantages d’entreprise \"\n";	
	}
	
	if(errorm == ""){
		comeIn.submit();
	}
	else{
		alert(errorm);
	}
}

function validateCreateFiles(comeIn){
	var errorm = "";
	var MsgStringCheck = "";
	var StringCheck = comeIn.CheckFile.value.split("|");
	var StringCheckSize = StringCheck.length;
	for(w = 0; w < StringCheckSize; w++){
		if((w+1) == StringCheckSize)
			MsgStringCheck = MsgStringCheck + StringCheck[w];
		else
			MsgStringCheck = MsgStringCheck + StringCheck[w] + ", ";
		}
	
	if(comeIn.archivo_1.value != "")
		{
		var temp = comeIn.archivo_1.value.split(".");
		/*Validate file length*/
		temp2 = comeIn.archivo_1.value.split("\\");
		temp2= temp2[temp2.length-1];
		if(temp2.length > 204 )errorm = errorm + "Le nom du fichier ne peut excéder 200 caractères.\n";
		temp2 = temp2.split(".");			
		temp2=temp2[temp2.length-2];
		
		if(errorm == ""){
			var ValFile = 0;
			for(w = 0; w < StringCheckSize; w++){
				if(temp[temp.length-1].toLowerCase() != StringCheck[w] && ValFile == 0){
					if(errorm == "")
						errorm = errorm + "Vous pouvez uniquement télécharger les fichiers "+MsgStringCheck+".\n";
					}
				else{
					if(replace_all_occurrences(temp2," ","").length>250 && ValFile == 0){
						if(errorm == "")
							errorm = errorm + "Le nom du fichier ne peut excéder 200 caractères.\n";
					}
					else{
						ValFile = 1;
						errorm = "";
						}
					}
				}
			}
		}
	else
		errorm = errorm + "Vous pouvez uniquement télécharger les fichiers "+MsgStringCheck+".\n";
	
	if(errorm == ""){
		comeIn.submit();
		//showGets(comeIn.Type_File.value,comeIn.archivo_1.value,comeIn.name.value,0);
	}
	else{
		alert(errorm);
	}
}

function validateRegEmp(comeIn){
	var errorm = "";
	if(!validarEmail(comeIn.Email.value)){
		if(errorm == "")
			comeIn.Email.focus();
		errorm += "- Votre \"Email\" doit être valide\n";	
	}
	
	if(comeIn.Password.value.replace(" ","").length  == 0){
		if (errorm == "")comeIn.Password.focus();
		errorm += "- Entrez votre\"mot de passe\".\n";
	}
	else{
		if(comeIn.Password.value.length <= 5){
			if (errorm == "")comeIn.Password.focus();
			errorm += "- Le \"mot de passe\" doit avoir un minimum de 6 caractères\n";
		}
		else{
			if(comeIn.Password.value != comeIn.ConfPassword.value){
				if (errorm == "")comeIn.Password.focus();
				errorm += "- Le \"mot de passe\" et \" votre confirmation de mot de passe\" doivent être les mêmes\n";
			}
		}
	}
	
	if(replace_all_occurrences(comeIn.FirstName.value," ","").length == 0){
		if(errorm == "")
			comeIn.FirstName.focus();
		errorm += "- Entrez votre\"prénom\".\n";	
	}
	
	if(replace_all_occurrences(comeIn.LastName.value," ","").length == 0){
		if(errorm == "")
			comeIn.LastName.focus();
		errorm += "- Entrez votre \"nom de famille\".\n";	
	}
	
	if(replace_all_occurrences(comeIn.CompanyName.value," ","").length == 0){
		if(errorm == "")
			comeIn.CompanyName.focus();
		errorm += "- Entrez le\"  nom de votre entreprise \"\n";	
	}
	
	var regex = /^[0-9]{1,7}$/;
	
	if(replace_all_occurrences(comeIn.Area.value," ","").length == 0 || replace_all_occurrences(comeIn.Phone.value," ","").length == 0){
		if(errorm == "")
			comeIn.Area.focus();
		errorm += "- Entrez votre \"numéro de téléphone d’ entreprise \"\n";	
	}
	else{
  		if(regex.test(comeIn.Area.value) == false || regex.test(comeIn.Phone.value) == false){
			if(errorm == "")
				comeIn.Area.focus();
			errorm += "- Le \" numéro de téléphone d’entreprise \" doit uniquement contenir des caractères numériques\n";	
		}
	}
	
	if(replace_all_occurrences(comeIn.City.value," ","").length == 0){
		if(errorm == "")
			comeIn.City.focus();
		errorm += "- Entrez la \"ville\".\n";	
	}
	
	if(replace_all_occurrences(comeIn.PostalCode.value," ","").length == 0){
		if(errorm == "")
			comeIn.PostalCode.focus();
		errorm += "- Entrez votre \"code postal\"\n";	
	}
	else{
		if(!isPostCode(comeIn.PostalCode.value)){
			if(errorm == "")
				comeIn.PostalCode.focus();
			errorm += "- S.V.P entrez un \"code postal valide\"\n";	
		}
	}
	
	if(errorm == ""){
		comeIn.submit();
	}
	else{
		alert(errorm);
	}
}

function validateApplyJob(comeIn){
	var errorm = "";
	
	if(!comeIn.cv_attach.disabled){
		if(replace_all_occurrences(comeIn.cv_attach.value," ","").length == 0){
			if(errorm == "")
				comeIn.cv_attach.focus();
			errorm += "- Sélectionnez votre CV\n";	
		}
		else{
			var temp = comeIn.cv_attach.value.split(".");
			/*Validate file length*/
			temp2 = comeIn.cv_attach.value.split("\\");
			temp2= temp2[temp2.length-1];
			if(temp2.length > 204 )errorm = errorm + "Le nom de votre CV ne peut excéder 200 caractères\n";
			temp2 = temp2.split(".");			
			temp2=temp2[temp2.length-2];
			
			if(temp[temp.length-1].toLowerCase() != "pdf" && temp[temp.length-1].toLowerCase() != "doc")
				errorm = errorm + " Vous pouvez uniquement télécharger les fichiers .doc, .pdf ou .xls \n";
			else
				if(replace_all_occurrences(temp2," ","").length>250)
					errorm = errorm + " Le nom du fichier ne peut excéder 200 caractères\n";
		}
	}
	
	if(comeIn.cboScolarite.value == '0'){
		if(errorm == "")
			comeIn.cboScolarite.focus();
		errorm += "- Faire un choix pour la question #1\n";	
	}
	if(comeIn.cboExperience.value == '0'){
		if(errorm == "")
			comeIn.cboExperience.focus();
		errorm += "- Faire un choix pour la question #2.\n";	
	}
	
	if(errorm == ""){
		comeIn.submit();
	}
	else{
		alert(errorm);
	}
}

//test numeric
function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

//Test code canada post codes 
function isPostCode(entry){ // CANADIAN CODES ONLY
	var CharValid = 0;
	strlen=entry.length; if(strlen!=5 && strlen!=6 && strlen!=7) {CharValid = 1;}
	entry=entry.toUpperCase();    // in case of lowercase characters
	// Check for legal characters in string - note index starts at zero
	
	if(CharValid == 0 && (strlen==6 || strlen==5)){
		if('ABCEGHJKLMNPRSTVXY'.indexOf(entry.charAt(0))<0) {CharValid = 1;}
		if('0123456789'.indexOf(entry.charAt(1))<0) {CharValid = 1;}
		if('ABCDEFGHJKLMNPQRSTUVWXYZ'.indexOf(entry.charAt(2))<0) {CharValid = 1;}
		if('0123456789'.indexOf(entry.charAt(3))<0) {CharValid = 1;}
		if('ABCDEFGHJKLMNPQRSTUVWXYZ'.indexOf(entry.charAt(4))<0) {CharValid = 1;}
		if('0123456789'.indexOf(entry.charAt(5))<0) {CharValid = 1;}
		
		if(CharValid == 1){
			CharValid = 0;
			if('0123456789'.indexOf(entry.charAt(0))<0) {CharValid = 1;}
			if('0123456789'.indexOf(entry.charAt(1))<0) {CharValid = 1;}
			if('0123456789'.indexOf(entry.charAt(2))<0) {CharValid = 1;}
			if('0123456789'.indexOf(entry.charAt(3))<0) {CharValid = 1;}
			if('0123456789'.indexOf(entry.charAt(4))<0) {CharValid = 1;}
		}
	}
	
	if(CharValid == 0 && strlen==7){
		if('ABCEGHJKLMNPRSTVXY'.indexOf(entry.charAt(0))<0) {CharValid = 1;}
		if('0123456789'.indexOf(entry.charAt(1))<0) {CharValid = 1;}
		if('ABCDEFGHJKLMNPQRSTUVWXYZ'.indexOf(entry.charAt(2))<0) {CharValid = 1;}
		if(' -'.indexOf(entry.charAt(3))<0) {CharValid = 1;}
		if('0123456789'.indexOf(entry.charAt(4))<0) {CharValid = 1;}
		if('ABCDEFGHJKLMNPQRSTUVWXYZ'.indexOf(entry.charAt(5))<0) {CharValid = 1;}
		if('0123456789'.indexOf(entry.charAt(6))<0) {CharValid = 1;}
	}
	
	if(CharValid == 1 && strlen==5){
		CharValid = 0;
		if('23456789'.indexOf(entry.charAt(0))<0) {CharValid = 1;}
		if('0123456789'.indexOf(entry.charAt(1))<0) {CharValid = 1;}
		if('0123456789'.indexOf(entry.charAt(2))<0) {CharValid = 1;}
		if('0123456789'.indexOf(entry.charAt(3))<0) {CharValid = 1;}
		if('0123456789'.indexOf(entry.charAt(4))<0) {CharValid = 1;}
	}
	
	if(CharValid == 0)
		return true;
	else
		return false;
}

//Function that valid RegCandidate.asp
function validateRegCan(comeIn){
	var errorm = "";
	if(!validarEmail(comeIn.Email.value)){
		if(errorm == "")
			comeIn.Email.focus();
		errorm += "- Votre \"Email\" doit être valide\n";	
	}
	
	if(comeIn.Password.value.replace(" ","").length  == 0){
		if (errorm == "")comeIn.Password.focus();
		errorm += "- Entrez votre \"mot de passe\"\n";
	}
	else{
		if(comeIn.Password.value.length <= 5){
			if (errorm == "")comeIn.Password.focus();
			errorm += "- Le \"mot de passe\" doit avoir un minimum de 6 caractères\n";
		}
		else{
			if(comeIn.Password.value != comeIn.ConfPassword.value){
				if (errorm == "")comeIn.Password.focus();
				errorm += "- Le \"mot de passe\" et \" votre confirmation de mot de passe\" doivent être les mêmes \n";
			}
		}
	}
	
	if(replace_all_occurrences(comeIn.FirstName.value," ","").length == 0){
		if(errorm == "")
			comeIn.FirstName.focus();
		errorm += "- Entrez votre \"prénom\"\n";	
	}
	
	if(replace_all_occurrences(comeIn.LastName.value," ","").length == 0){
		if(errorm == "")
			comeIn.LastName.focus();
		errorm += "- Entrez votre \"nom de famille\"\n";
	}
	
	/*if(replace_all_occurrences(comeIn.Area.value," ","").length != 0){
		if(!isInteger(comeIn.Area.value)){
			if(errorm == "")
				comeIn.Area.focus();
			errorm += "- Entrez votre \"numéro de téléphone\" valide\n";
		}
		if(!isInteger(comeIn.Phone.value) || replace_all_occurrences(comeIn.Phone.value," ","").length == 0){
			if(errorm == "")
				comeIn.Phone.focus();
			errorm += "- Entrez votre \" numéro de téléphone \" valide\n";
		}
	}*/
	
	if(replace_all_occurrences(comeIn.PostalCode.value," ","").length == 0){
		if(errorm == "")
			comeIn.PostalCode.focus();
		errorm += "- Entrez votre \"code postal\"\n";	
	}
	else{
		if(!isPostCode(comeIn.PostalCode.value)){
			if(errorm == "")
				comeIn.PostalCode.focus();
			errorm += "- S.V.P entrez un \"code postal valide\"\n";	
		}
	}
	
	if(errorm == ""){
		comeIn.submit();
	}
	else{
		alert(errorm);
	}
}

function validateRegCan2(comeIn){
	var errorm = "";
	if(comeIn.WantedPosition.value.replace(" ","").length  == 0){
		if(errorm == "")
			comeIn.WantedPosition.focus();
		errorm += "- Entrez le\"titre de l’emploi recherché";
	}
	
	DomainSelected = 0;
	for (var j = 0; j <= 22; j++) {
		box = eval("comeIn.DomainJobSearch" + j);
		if (box.checked == true) DomainSelected = 1;
	}
	if(DomainSelected == 0){
		if(errorm == "")
			comeIn.DomainJobSearch1.focus();
		errorm += "- Sélectionnez \"les domaines recherchés\".\n";
	}
	
	/*type of job*/
	TypePositionSelected = 0;
	for (var j = 0; j <= 10; j++) {
		box = eval("comeIn.TypePosition" + j);
		if (box.checked == true) TypePositionSelected = 1;
	}
	if(TypePositionSelected == 0){
		if(errorm == "")
			comeIn.TypePosition1.focus();
		errorm += "- Sélectionnez \"le type de position\".\n";
	}	
	
	if(comeIn.Salary.value.replace(" ","").length  == 0 && (comeIn.Salary1.value.replace(" ","").length  == 0 || comeIn.Salary2.value.replace(" ","").length  == 0) && comeIn.TypeSalaryChoix[2].checked == false){
		if(errorm == "")
			comeIn.Salary.focus();
		errorm += "- Sélectionnez \"le salaire\".\n";	
	}
	
	if(comeIn.Education.value == 0){
		if(errorm == "")
			comeIn.Education.focus();
		errorm += "- Sélectionnez votre \"formation\"\n";	
	}
	
	if(comeIn.Experience.value == 0){
		if(errorm == "")
			comeIn.Experience.focus();
		errorm += "- Sélectionnez votre \"expérience\"\n";	
	}
	
	if(comeIn.archivo_1.value != "")
		{
		var temp = comeIn.archivo_1.value.split(".");
		/*Validate file length*/
		temp2 = comeIn.archivo_1.value.split("\\");
		temp2= temp2[temp2.length-1];
		if(temp2.length > 204 )errorm = errorm + "Le nom de votre CV ne peux excéder 200 caractères\n";
		temp2 = temp2.split(".");			
		temp2=temp2[temp2.length-2];
		
		if(temp[temp.length-1].toLowerCase() != "pdf" && temp[temp.length-1].toLowerCase() != "doc")
			errorm = errorm + " Vous pouvez uniquement télécharger les fichiers .doc ou .pdf \n";
		else
			if(replace_all_occurrences(temp2," ","").length>250)
				errorm = errorm + "Le nom du fichier ne peut excéder 200 caractères\n";
		}
	
	if(replace_all_occurrences(comeIn.TgsJob.value," ","").length != 0){
		ErrorMaxChart = 0;
		chaine = comeIn.TgsJob.value;
		reg = new RegExp("[,;]+", "g");
		tableau = chaine.split(reg);
		for (var i = 0; i < tableau.length; i++) {
			s = tableau[i];
			ValSize = s.length;
			if(ValSize > 25)ErrorMaxChart = 1;
		}
		if(ErrorMaxChart == 1){
			if(errorm == "")
				comeIn.TgsJob.focus();
			errorm += "- Les \" Tag d’emploi\" ne peuvent excéder 25 caractères\n";
		}
	}
	
	if(replace_all_occurrences(comeIn.TgsPersonal.value," ","").length != 0){
		ErrorMaxChart = 0;
		chaine = comeIn.TgsPersonal.value;
		reg = new RegExp("[,;]+", "g");
		tableau = chaine.split(reg);
		for (var i = 0; i < tableau.length; i++) {
			s = tableau[i];
			ValSize = s.length;
			if(ValSize > 25)ErrorMaxChart = 1;
		}
		if(ErrorMaxChart == 1){
			if(errorm == "")
				comeIn.TgsPersonal.focus();
			errorm += "- Les \" Tag personnels\" ne peuvent excéder 25 caractères\n";
		}
	}
	
	if(errorm == ""){
		comeIn.submit();
	}
	else{
		alert(errorm);
	}
}

//Function that valid uploadFiles.asp
function validateUpdFiles(comeIn){
	var errorm = "";
	
	if(comeIn.archivo_1.value != "")
		{
		var temp = comeIn.archivo_1.value.split(".");
		/*Validate file length*/
		temp2 = comeIn.archivo_1.value.split("\\");
		temp2= temp2[temp2.length-1];
		if(temp2.length > 204 )errorm = errorm + "Le nom du logo ne peut excéder 200 caractères \n";
		temp2 = temp2.split(".");			
		temp2=temp2[temp2.length-2];
		
		if(temp[temp.length-1].toLowerCase() != "gif" && temp[temp.length-1].toLowerCase() != "jpg")
			errorm = errorm + " Vous pouvez uniquement télécharger les fichiers image .gif  ou .jpeg \n";
		else
			if(replace_all_occurrences(temp2," ","").length>250)
				errorm = errorm + "Le nom du fichier ne peut excéder 200 caractères\n";
		}
	
	if(comeIn.archivo_2.value != "")
		{
		var temp = comeIn.archivo_2.value.split(".");
		/*Validate file length*/
		temp2 = comeIn.archivo_2.value.split("\\");
		temp2= temp2[temp2.length-1];
		if(temp2.length > 204 )errorm = errorm + "Le nom du fichier video ne peut exéder 200 caractères \n";
		temp2 = temp2.split(".");			
		temp2=temp2[temp2.length-2];
		
		if(temp[temp.length-1].toLowerCase() != "avi" && temp[temp.length-1].toLowerCase() != "mpg" && temp[temp.length-1].toLowerCase() != "wmv" && temp[temp.length-1].toLowerCase() != "mov")
			errorm = errorm + " Vous pouvez uniquement télécharger les fichiers vidéos en.avi, .wmv, .mov ou .mpg \n";
		else
			if(replace_all_occurrences(temp2," ","").length>250)
				errorm = errorm + "Le nom du fichier ne peut excéder 200 caractères\n";
		}
	
	if(errorm == ""){
		comeIn.submit();
	}
	else{
		alert(errorm);
	}
}

function validRefer(comeIn){
	var errorm = "";
	if(!validarEmail(comeIn.emailTxt.value)){
		if(errorm == "")
			comeIn.emailTxt.focus();
		errorm += "- Le \"Email\" doit être valide\n";	
	}
	
	if(errorm == ""){
		comeIn.submit();
	}
	else{
		alert(errorm);
	}
}

//Function that valid a chain of characters.
function replace_all_occurrences(str,str_rep,str_fin){
	while(str.indexOf(str_rep) > -1){
		str = str.replace(str_rep,str_fin);
	}
	return str;
}

//Function that valid a email structure.
function validarEmail(email_p)
{
  var email = email_p;

  var regEx = new RegExp("^[\\w\.=-]+@([\\w\-]+\\.)+[a-zA-Z]{2,4}$");
  if(!regEx.test(email)) 
	return false
  else
	  return true;
}

function NumberLang(comeIn){
if(comeIn.NumberLenguages.value == 1){
	document.getElementById("LanguageNumber2").style.display = 'none';
	document.getElementById("LanguageNumber3").style.display = 'none';
	document.getElementById("LanguageNumber4").style.display = 'none';
}
else if(comeIn.NumberLenguages.value == 2){
	document.getElementById("LanguageNumber2").style.display = '';
	document.getElementById("LanguageNumber3").style.display = 'none';
	document.getElementById("LanguageNumber4").style.display = 'none';
}
else if(comeIn.NumberLenguages.value == 3){
		document.getElementById("LanguageNumber2").style.display = '';
	document.getElementById("LanguageNumber3").style.display = '';
	document.getElementById("LanguageNumber4").style.display = 'none';
	}
else if(comeIn.NumberLenguages.value == 4){
		document.getElementById("LanguageNumber2").style.display = '';
	document.getElementById("LanguageNumber3").style.display = '';
	document.getElementById("LanguageNumber4").style.display = '';
	}
}

function CVedit(comeIn){
	if(document.getElementById("CV").style.display == 'none'){
		document.getElementById("CV").style.display = '';
		document.getElementById("ImageFlecha").src = '../images/prev-active.gif';
	}
	else{
		document.getElementById("CV").style.display = 'none';
		document.getElementById("ImageFlecha").src = '../images/next-active.gif';
	}
}

function ShowTextCommentary(){
	if(document.getElementById("Comentarios").style.display == 'none'){
		document.getElementById("Comentarios").style.display = '';
		document.getElementById("ImageFlecha").src = '../images/left.gif';
		if(document.getElementById("Comentarios2"))document.getElementById("Comentarios2").style.display = 'none';
	}
	else{
		document.getElementById("Comentarios").style.display = 'none';
		document.getElementById("ImageFlecha").src = '../images/right.gif';
		if(document.getElementById("Comentarios2"))document.getElementById("Comentarios2").style.display = '';
	}
}

function makeUppercase(Income){
	Income.value = Income.value.toUpperCase();
}

//Function that valid My Messajes Form
function validateMessaje(comeIn){
	var errorm = "";
	
	if(comeIn.contact.value == 0){
		if(errorm == "")
			comeIn.contact.focus();
		errorm += "- Sélectionnez \"To\"\n";	
	}
	
	if(replace_all_occurrences(comeIn.subject.value," ","").length == 0){
		if(errorm == "")
			comeIn.subject.focus();
		errorm += "- Entrez le\"sujet de votre message\".\n";	
	}
	
	if(replace_all_occurrences(comeIn.messaje.value," ","").length == 0){
		if(errorm == "")
			comeIn.messaje.focus();
		errorm += "- Entrez votre \"message\".\n";
	}
	
	if(errorm == ""){
		comeIn.submit();
	}
	else{
		alert(errorm);
	}
}

function validateSuggestion(comeIn){
	var errorm = "";
	
	if(replace_all_occurrences(comeIn.subject.value," ","").length == 0){
		if(errorm == "")
			comeIn.subject.focus();
		errorm += "- Entrez le \"sujet de votre message\".\n";	
	}
	
	if(replace_all_occurrences(comeIn.messaje.value," ","").length == 0){
		if(errorm == "")
			comeIn.messaje.focus();
		errorm += "- Entrez votre \"message\".\n";
	}
	
	if(errorm == ""){
		comeIn.submit();
	}
	else{
		alert(errorm);
	}
}

function OpenVideo(){
	window.open('videoEmployer.asp','Video','height=500,width=300,status=yes,toolbar=no');
}

function OpenFile(FileAddress){
	window.open(FileAddress,'File','height=500,width=300,status=yes,toolbar=no,resizable=1');
}

function ChangeInfoBarTiker(ID,FileAddress){
	ID = ID - 1000;
	document.getElementById("txtClicker").innerHTML="<table width='190'><tr align='center'><td><img src='../files/"+FileAddress+"' alt='LOGO' width='56' height='58'></td></tr></table>";
}

function showAccionNet(comeIn,Type,ID,Funct,Name){
	var answer = confirm("Êtes-vous sûr de "+Funct+" "+Name+" à votre réseau?");	
	if (answer){
		ID = ID - 1000;
		comeIn.action = "../includes/asp/ProcessNetwork.asp";
		comeIn.Type.value = Type;
		comeIn.ID.value = ID;
		comeIn.Name.value = Name;
		comeIn.Funct.value = Funct;
		comeIn.submit();
	}
}

function showInvitation(comeIn,Type,ID,Funct,Name){
	if(Type < 3)
			var answer = confirm("Êtes-vous sûr de "+Funct+" "+Name+" à ce group?");
		else
			var answer = confirm("Êtes-vous sûr de "+Funct+" "+Name+" à votre réseau?");	
	if (answer){
		ID = ID - 1000;
		if(Type < 3)
			comeIn.action = "../includes/asp/ProcessComunity.asp";
		else
			comeIn.action = "../includes/asp/ProcessNetwork.asp";
		comeIn.Type.value = Type;
		comeIn.ID.value = ID;
		comeIn.Name.value = Name;
		comeIn.Funct.value = Funct;
		comeIn.submit();
	}
}

function showProfil(comeIn,Type,ID){
	ID = ID - 1000;
	if(Type == 4)
		comeIn.action = "ProfilCandidate.asp";
	else
		comeIn.action = "ViewEmployerProfil.asp";
	comeIn.Type.value = Type;
	comeIn.ID.value = ID;
	comeIn.Name.value = "";
	comeIn.Funct.value = "";
	comeIn.submit();
}


function showProfilfromApply(comeIn,Type,ID,url){
	ID = ID - 1000;
	if(Type == 4)
		comeIn.action = "ProfilCandidate.asp";
	else
		comeIn.action = "ProfilEmployer.asp";
	comeIn.Type.value = Type;
	comeIn.ID.value = ID;
	comeIn.Name.value = url;
	comeIn.Funct.value = "";
	comeIn.submit();
}

function SendMessaje(comeIn,Type,ID,TypeUser,Name){
	ID = ID - 1000;
	comeIn.action = "SendMessaje.asp";
	comeIn.Type.value = Type;
	comeIn.ID.value = ID;
	comeIn.Name.value = Name;
	comeIn.Funct.value = TypeUser;
	comeIn.Menu2.value = "Messaje";
	comeIn.submit();
}

//Function that valid Invitation Form in My Comunity
function validateInvitation(comeIn){
	var errorm = "";
	var varReplace = comeIn.emailCatcher.value;
	comeIn.emailCatcher.value = varReplace.replace(" ","");
	if(replace_all_occurrences(comeIn.emailCatcher.value," ","").length == 0){
		if(errorm == "")
			comeIn.emailCatcher.focus();
		errorm += "- s.v.p entrez une \"adresse email valide\".\n";	
	}
	else{
		var chaine = comeIn.emailCatcher.value;
		var reg = new RegExp("[,;]+", "g");
		var tableau = chaine.split(reg);
		if(tableau.length > 10){
			if(errorm == "")
				comeIn.emailCatcher.focus();
			errorm += "- Vous pouvez inclure un maximum de 10 emails par invitation\n";	
		}
		else{
			for (var i = 0; i < tableau.length; i++) {
				s = tableau[i];
				if(!validarEmail(s)){
					if(errorm == "")
						comeIn.emailCatcher.focus();
					errorm += "- Les \" emails\" doivent être valide\n";	
					i = tableau.length;
				}
			}
		}
	}
	
	if(errorm == ""){
		comeIn.submit();
	}
	else{
		alert(errorm);
	}
}

//Function that valid Links.asp
function validateLink(comeIn){
	var errorm = "";
	var pailas = 1;
	
	if(replace_all_occurrences(comeIn.links.value," ","").length == 0){
		if(errorm == "")
			comeIn.links.focus();
		errorm += "- Vos \"favoris\"\n";	
	}
	
	if(replace_all_occurrences(comeIn.tags.value," ","").length != 0){
		pailas = 2;
		var ErrorMaxChart = 0;
		var chaine = comeIn.tags.value;
		var reg = new RegExp("[,;]+", "g");
		var tableau = chaine.split(reg);
		for (var i = 0; i < tableau.length; i++) {
			s = tableau[i];
			ValSize = s.length;
			if(ValSize > 25)ErrorMaxChart = 1;
		}
		if(ErrorMaxChart == 1){
			if(errorm == "")
				comeIn.tags.focus();
			errorm += "- Un \"Tag\" peut avoir un maximum de 25 caractères\n";
			pailas = 1;
		}
	}
	
	if(replace_all_occurrences(comeIn.links.value," ","").length != 0 || pailas == 2)
		errorm = "";
		
	if(errorm == ""){
		comeIn.links.value = comeIn.links.value.toLowerCase();
		comeIn.submit();
	}
	else{
		alert(errorm);
	}
}

function DeleteMessaje (comeIn,IDMsg){
	var answer = confirm("Are you sure that you want to delete this ?");
	if (answer){
		IDMsg = IDMsg - 101979;
		comeIn.Type.value = "DELETE";
		comeIn.ID.value = IDMsg;
		comeIn.submit();
	}
}

function showThisComunity(comeIn,ID,Permition){
	ID = ID - 1000;
	comeIn.action = "../content/ProfilComunity.asp";
	comeIn.Type.value = Permition;
	comeIn.ID.value = ID;
	comeIn.Name.value = "";
	comeIn.Funct.value = "";
	comeIn.Menu2.value = "Comunity";
	comeIn.submit();
}

function showThisComunity2(comeIn,ID,Permition){
	ID = ID - 1000;
	if(comeIn.action == "")
		comeIn.action = "../content/ProfilComunity.asp";
	comeIn.Type.value = Permition;
	comeIn.ID.value = ID;
	comeIn.Name.value = "";
	comeIn.Funct.value = "";
	comeIn.Menu2.value = "Comunity";
	comeIn.submit();
}

function showJobs(comeIn,Lang,ID){
	ID = ID - 1000;
	comeIn.action = "ProfilJob.asp";
	comeIn.Type.value = "";
	comeIn.ID.value = ID;
	comeIn.Name.value = "";
	comeIn.Funct.value = "";
	comeIn.Menu2.value = "";
	comeIn.submit();
}

function showJobsScrap(comeIn,Lang,ID){
	ID = ID - 1000;
	comeIn.action = "ProfilJobScrape.asp";
	comeIn.Type.value = "";
	comeIn.ID.value = ID;
	comeIn.Name.value = "";
	comeIn.Funct.value = "";
	comeIn.Menu2.value = "";
	comeIn.submit();
}

function validateCommentary(comeIn){
	var errorm = "";
	if(replace_all_occurrences(comeIn.coment.value," ","").length == 0){
		if(errorm == "")
			comeIn.coment.focus();
		errorm += "- Entrez vos \"commentaires\"\n";	
	}
	
	if(errorm == ""){
		comeIn.submit();
	}
	else{
		alert(errorm);
	}
}

function SearchEngine(comeIn,TypeSearch,WhereClick){
	if(WhereClick == 0){
		if(document.getElementById("txt").value != "Recherche >> " && replace_all_occurrences(document.getElementById("txt").value," ","").length != 0){
			comeIn.action = "SearchAdvance.asp";
			comeIn.Type.value = TypeSearch;
			comeIn.ID.value = document.getElementById("txt").value;
			comeIn.submit();
		}
		else{
			alert("Entrez une donnée valide.");
			document.getElementById("txt").focus();
		}
	}
	else{
		if(document.Reg.txt.value != "Recherche >> " && replace_all_occurrences(document.Reg.txt.value," ","").length != 0){
			comeIn.action = "SearchAdvance.asp";
			if(document.Reg.types[0].checked == true) comeIn.Type.value = 2;
			if(document.Reg.types[1].checked == true) comeIn.Type.value = 3;
			if(document.Reg.types[2].checked == true) comeIn.Type.value = 1;
			if(document.Reg.types[0].checked == true && document.Reg.types[1].checked == true) comeIn.Type.value = 4;
			if(document.Reg.types[0].checked == true && document.Reg.types[2].checked == true) comeIn.Type.value = 5;
			if(document.Reg.types[1].checked == true && document.Reg.types[2].checked == true) comeIn.Type.value = 6;
			if(document.Reg.types[0].checked == false && document.Reg.types[1].checked == false && document.Reg.types[2].checked == false) comeIn.Type.value = 0;
			if(document.Reg.types[0].checked == true && document.Reg.types[1].checked == true && document.Reg.types[2].checked == true) comeIn.Type.value = 0;
			comeIn.ID.value = document.Reg.txt.value;
			comeIn.submit();
		}
		else{
			alert("Entrez une donnée valide.");
			document.getElementById("txt").focus();
		}
	}
}



function SearchEngineTag(comeIn,TypeSearch,SearchText){
	document.location.href = "SearchAdvance.asp?ID="+SearchText+"&Type="+TypeSearch;
}

function CallFunctionAld(Func,str,lng,ID)
{
//ID = ID - 1000;
var url="../content/Maps.asp";
url=url+"?funct="+Func+"&q="+str+"&Type="+lng+"&ID="+ID;
var ventana = window.open(url,"Mapa","width=630,height=475,status=no,toolbar=no");
ventana.focus();
}

function CallFunctionAldcp(){
	var errorm = "";
	var CodePostal = document.FindCP.CodePostal.value;
	if(replace_all_occurrences(CodePostal," ","").length == 0){
		if(errorm == "")
			document.FindCP.CodePostal.focus();
		errorm += "- S.V.P entrez un \"code postal valide\"\n";	
	}
	else{
		if(!isPostCode(CodePostal)){
			if(errorm == "")
				document.FindCP.CodePostal.focus();
			errorm += "- S.V.P entrez un \"code postal valide\"\n";	
		}
	}
	
	if(errorm == ""){
		var url="../content/MapsCP.asp";
		url=url+"?funct=&q="+CodePostal+"&Type=&ID=";
		var ventana = window.open(url,"Mapa","width=630,height=475,status=no,toolbar=no");
		ventana.focus();
	}
	else{
		alert(errorm);
	}
}

function SaveSalon(comeIn){
	if(comeIn.province.value == "Qu")msgProvince = "Québec"
	if(comeIn.province.value == "Al")msgProvince = "Alberta"
	if(comeIn.province.value == "On")msgProvince = "Ontario"
	var answer = confirm("Êtes-vous sure de vouloir changer de " + msgProvince + "  section?");	
	if (answer){
		comeIn.submit();
	}
}

function ConfirmSalon(comeIn){
	if(comeIn.province.value == "Qu")msgProvince = "Québec";
	if(comeIn.province.value == "Al")msgProvince = "Alberta";
	if(comeIn.province.value == "On")msgProvince = "Ontario";
	var answer = confirm("Êtes vous sure  ce nombre de kiosque par" + msgProvince + " section?");	
	if (answer){
		comeIn.confirmado.value = "1";
		comeIn.submit();
	}
}

function ConfirmSuggestion(comeIn){
	var answer = confirm("confirmez  la suggestion?");	
	if (answer){
		comeIn.confirmado.value = "1";
		comeIn.submit();
	}
}

function OpenLogo(Logo){
	window.open('Logo.asp?Logo='+Logo,'AdminLogo','height=500,width=600,status=no,toolbar=no');
}

function Filter(comeIn,TypeUser,TypeFilter){
	if(TypeFilter == 'LastSession' || TypeFilter == 'Sector'){
		if(TypeUser == 'CA')
			comeIn.action = "ListCandidate.asp";
		if(TypeUser == 'EM')
			comeIn.action = "ListEmployer.asp";
	}
	comeIn.Type.value = TypeFilter;
	comeIn.submit();
}

function ShowNetwork(comeIn,ID,TypeUser){
	ID = ID - 1000;
	comeIn.action = "Network.asp";
	comeIn.Type.value = TypeUser;
	comeIn.ID.value = ID;
	comeIn.Name.value = "";
	comeIn.Funct.value = "";
	comeIn.Menu2.value = "";
	comeIn.submit();
}

function ShowListJobsByEmployer(comeIn,ID){
	ID = ID - 1000;
	comeIn.action = "ListJobs.asp";
	comeIn.Type.value = "FromEmployer";
	comeIn.ID.value = ID;
	comeIn.Name.value = "";
	comeIn.Funct.value = "";
	comeIn.Menu2.value = "";
	comeIn.submit();
}

function ShowListJobsByApplication(comeIn,ID){
	ID = ID - 1000;
	comeIn.action = "ListCandidate.asp";
	comeIn.Type.value = "FromApplication";
	comeIn.ID.value = ID;
	comeIn.Name.value = "";
	comeIn.Funct.value = "";
	comeIn.Menu2.value = "";
	comeIn.submit();
}

function AplyJob(comeIn,ID){
	ID = ID - 1000;
	comeIn.action = "ApplyJob.asp";
	comeIn.Type.value = "";
	comeIn.ID.value = ID;
	comeIn.Name.value = "";
	comeIn.Funct.value = "";
	comeIn.Menu2.value = "";
	comeIn.submit();
}
/*function AplyJobIE(comeIn,ID,candId){
	ID = ID - 1000;
	candId= candId - 1000;
	comeIn.action = "ApplyJob.asp";
	comeIn.Type.value = "";
	comeIn.ID.value = ID;
	comeIn.Name.value = candId;
	comeIn.Funct.value = "";
	comeIn.Menu2.value = "";
	comeIn.submit();
}*/
function openCV(comeIn,ID,NameDoc,TypeDoc){
	ID = ID - 1000;
	CV = window.open('../files/Candidates/'+ID+'/'+NameDoc+'.'+TypeDoc,'CV','height=500,width=600,toolbar=no,resizable=yes');
}

function openFile(comeIn,ID,NameDoc,TypeDoc,TypeUser){
	ID = ID - 1000;
	if(TypeUser == 'EM')
		FILE = window.open('../files/Employers/'+ID+'/'+NameDoc+'_'+ID+'.'+TypeDoc,'CV','height=500,width=600,toolbar=no,resizable=yes');
	if(TypeUser == 'CA')
		FILE = window.open('../files/Candidates/'+ID+'/'+NameDoc+'_'+ID+'.'+TypeDoc,'CV','height=500,width=600,toolbar=no,resizable=yes');
}

function ValidatePassForget(comeIn){
	var errorm = "";
	if(!validarEmail(comeIn.Email.value)){
		if(errorm == "")
			comeIn.Email.focus();
		errorm += "- Votre \"Email\" doit être valide\n";	
	}
	
	if(errorm == ""){
		comeIn.submit();
	}
	else{
		alert(errorm);
	}
}

function Registration(comeIn,Type){
	comeIn.action = "Registry.asp";
	comeIn.Type.value = Type;
	comeIn.ID.value = "";
	comeIn.Name.value = "";
	comeIn.Funct.value = "";
	comeIn.Menu2.value = "";
	comeIn.submit();
}

function ChangetypeRegister(){
	if(document.Reg.TypeReg[0].checked)window.frames[0].location = "RegCandidate.asp?v=WHDFG5DFG41";
	if(document.Reg.TypeReg[1].checked)window.frames[0].location = "RegEmployer.asp";
	/*if(document.Reg.TypeReg[1].checked)window.frames[0].location = "RegCandidate.asp?v=WHDFO5DhG41";
	if(document.Reg.TypeReg[2].checked)window.frames[0].location = "RegEmployer.asp";*/
}

function ShowEmployer(comeIn,ID){
	comeIn.action = "../content/ProfilEmployer.asp";
	window.open("", "popup", "height=640,width=900,menubar='no',toolbar='no',location='no',status='no'");
	comeIn.Type.value = "";
	comeIn.ID.value = ID;
	comeIn.Name.value = "";
	comeIn.Funct.value = "";
	comeIn.Menu2.value = "";
	comeIn.target = "popup";
	comeIn.submit();
}

function ShowCandidate(comeIn,ID){
	comeIn.action = "../content/ProfilCandidate.asp";
	window.open("", "popup", "height=640,width=900,menubar='no',toolbar='no',location='no',status='no'");
	comeIn.Type.value = "";
	comeIn.ID.value = ID;
	comeIn.Name.value = "";
	comeIn.Funct.value = "";
	comeIn.Menu2.value = "";
	comeIn.target = "popup";
	comeIn.submit();
}

function ConfirmEmployer(comeIn, ID, Type){
	comeIn.action = "ConfirmEmployer.asp";
	if(Type == "0") comeIn.Type.value = "Innactif";
	if(Type == "1") comeIn.Type.value = "Actif";	
	comeIn.ID.value = ID;
	comeIn.Name.value = "";
	comeIn.Funct.value = "";
	comeIn.Menu2.value = "";
	comeIn.target = "popup";
	comeIn.submit();
}

function validatePrivacy(comeIn, Type){
	var ValidCheck = 0;
	if(comeIn.privacy[0].checked) ValidCheck = 1;
	if(comeIn.privacy[1].checked) ValidCheck = 1;
	if(Type == "CA")
		if(comeIn.privacy[2].checked) ValidCheck = 1;
	if(ValidCheck == 0)
		alert("Sélectionnez vos options de confidentialité");
	else
		comeIn.submit();
}

function NotAppropriate(comeIn,ID,Type,Filter){
	ID = ID - 1000;
	comeIn.action = "../includes/asp/NotAppropriate.asp";
	window.open("", "popup", "height=50,width=50,menubar='no',toolbar='no',location='no',status='no'");
	comeIn.Type.value = Type;
	comeIn.ID.value = ID;
	comeIn.Name.value = "";
	comeIn.Funct.value = Filter;
	comeIn.Menu2.value = "";
	comeIn.target = "popup";
	comeIn.submit();
	alert("Votre message à été envoyé à l’équipe EfairJob")
}

function Appropriate(comeIn,ID,Type,Filter,ID_Active){
	ID = ID - 1000;
	comeIn.action = "../includes/asp/Appropriate.asp";
	window.open("", "popup", "height=50,width=50,menubar='no',toolbar='no',location='no',status='no'");
	comeIn.Type.value = Type;
	comeIn.ID.value = ID;
	comeIn.Name.value = ID_Active;
	comeIn.Funct.value = Filter;
	comeIn.Menu2.value = "";
	comeIn.target = "popup";
	comeIn.submit();
	alert("File Active.")
}

function checkChoise(comeIn){
	/*if(comeIn.Choice[3].checked)document.getElementById("Opp").style.display = '';
	else document.getElementById("Opp").style.display = 'none';*/
}

function secureCheckOut(comeIn){
	var errorm = "";
	if(document.AddCart1.depend.value.replace(" ","").length  != 0){
		if(!validarEmail(document.AddCart1.depend.value)){
			if(errorm == "")
				document.AddCart1.depend.focus();
			errorm += "- The Associated Email must be valid.\n";	
		}
	}
	
	if(errorm == ""){
		var answer = confirm("Submit information?");	
		if (answer){
			comeIn.action = "../includes/asp/secureCheckOut.asp";
			comeIn.Type.value = "";
			comeIn.ID.value = "";
			comeIn.Name.value = "";
			comeIn.Funct.value = "";
			comeIn.Menu2.value = "";
			comeIn.submit();
		}
	}
	else{
		alert(errorm);
	}
}

function saveCheckOut(){
	Save = window.open("../includes/asp/SaveCart.asp", "save", "height=50,width=50,menubar='no',toolbar='no',location='no',status='no'");
}

function ValidCountry(){
	if(document.Register.Country.value != "1"){
		document.getElementById("FirstOpt").style.display = 'none';
		document.getElementById("SecondOpt").style.display = '';
	}
	else{
		document.getElementById("FirstOpt").style.display = '';
		document.getElementById("SecondOpt").style.display = 'none';
	}
}

function ValidCountryPost(){
	if(document.PostJob.Country.value != "1"){
		document.getElementById("FirstOpt").style.display = 'none';
		document.getElementById("SecondOpt").style.display = '';
	}
	else{
		document.getElementById("FirstOpt").style.display = '';
		document.getElementById("SecondOpt").style.display = 'none';
	}
}

function GoAddress(comeIn, ID, Action, OtherField, OtherField2){
	ID = ID - 1000;
	comeIn.action = Action;
	comeIn.ID.value = ID;
	comeIn.Name.value = OtherField;
	comeIn.Funct.value = OtherField2;
	comeIn.Menu2.value = "";
	comeIn.submit();
}

function GoAddressConfirm(comeIn, ID, Action, OtherField, OtherField2){
	ID = ID - 1000;
	if(OtherField == "Delete")OtherField = "Supprimer";
	var answer = confirm("Êtes-vous sûr de vouloir "+OtherField+"?");
	if (answer){
		comeIn.action = Action;
		comeIn.ID.value = ID;
		comeIn.Name.value = OtherField;
		comeIn.Funct.value = OtherField2;
		comeIn.Menu2.value = "";
		comeIn.submit();
	}
}

function createContact(comeIn) {
	var errorm = "";
	
	if(!validarEmail(comeIn.txtEmail1.value)){
		if(errorm == "")
			comeIn.txtEmail1.focus();
		errorm += "- Your email must be valid.\n";	
	}
	if(comeIn.txtPassword1_1.value.replace(" ","").length  == 0){
		if (errorm == "")comeIn.txtPassword1_1.focus();
		errorm += "- Please type your Password.\n";
	}
	else{
		if(comeIn.txtPassword1_1.value.length <= 5){
			if (errorm == "")comeIn.txtPassword1_1.focus();
			errorm += "- The Password must have 6 or more characters.\n";
		}
		else{
			if(comeIn.txtPassword1_1.value != comeIn.txtPassword2_1.value){
				if (errorm == "")comeIn.txtPassword1_1.focus();
				errorm += "- The Password and Confirm Password must be the same.\n";
			}
		}
	}		
	if(comeIn.txtLastName1.value.replace(" ","").length  == 0){
		if(errorm == "")
			comeIn.txtLastName1.focus();
		errorm += "- Your last name must be valid.\n";
	}
	if(comeIn.txtFirstName1.value.replace(" ","").length  == 0){
		if(errorm == "")
			comeIn.txtFirstName1.focus();
		errorm += "- Your name must be valid.\n";
	}
	/*if (comeIn.txtPhone1_1.value.replace(" ","").length  == 0 && comeIn.txtPhone2_1.value.replace(" ","").length  == 0){
		if(errorm == "")
			comeIn.txtPhone1_1.focus();
		errorm += "- Please type a telephone number.\n";
	}*/

	if(errorm == ""){
		comeIn.submit();
	}
	else{
		alert(errorm);
	}
}

function createViewEmployer(comeIn) {
	var errorm = "";
	
	if(comeIn.txtCompanyName.value.replace(" ","").length  == 0){
		if(errorm == "")
			comeIn.txtCompanyName.focus();
		errorm += "- Entrez le nom de \"votre entreprise \"\n";	
	}
	if(replace_all_occurrences(comeIn.Description.value," ","").length == 0){
		if(errorm == "")
			comeIn.Description.focus();
		errorm += "- Entrez votre \"description d’entreprise\"\n";	
	}
	if (comeIn.region.options[comeIn.region.selectedIndex].value ==0) {
		comeIn.region.focus();
  		errorm += "- Choisir au moins une région. \n";
	}
	if (comeIn.city.options[comeIn.city.selectedIndex].value ==0) {
		comeIn.city.focus();
  		errorm += "- Choisir au moins une ville.\n";
	}
	
	var Regions = getSelectedValues(comeIn.region);
    comeIn.Regions.value = Regions;
	var Cities= getSelectedValues(comeIn.city);
	comeIn.Cities.value= Cities;
	
	if(!validarEmail(comeIn.ctEmail.value)){
		if(errorm == "")
			comeIn.ctEmail.focus();
		errorm += "- Votre \"Email\" doit être valide.\n";
	}
	if(replace_all_occurrences(comeIn.ctPostal.value," ","").length == 0){
		if(errorm == "")
			comeIn.ctPostal.focus();
		errorm += "- Entrez votre \"code postale\"\n";	
	}
	else{
		if(!isPostCode(comeIn.ctPostal.value)){
			if(errorm == "")
				comeIn.ctPostal.focus();
			errorm += "- Votre \"code postal\" doit être valide\n";		
		}
	}
	
	if(comeIn.ctAdresse.value.replace(" ","").length  == 0 || comeIn.ctName.value == "" || comeIn.ctVille.value == "" || comeIn.ctProvince.value == ""){
		if(errorm == "")
			comeIn.ctAdresse.focus();
		errorm += "- Entrer toutes les informations pour votre contact.\n";
	}
	
	
	if(errorm == ""){
		comeIn.submit();
	}
	else{
		alert(errorm);
	}
}
function uploadEmployerLogo(comeIn) {
	var errorm = "";
	
	if(errorm == ""){
		comeIn.submit();
	}
	else{
		alert(errorm);
	}
}
function getSelectedValues (select) {
  var r = new Array();
  for (var i = 0; i < select.options.length; i++)
    if (select.options[i].selected)
      r[r.length] = select.options[i].value;
  return r;
}

function AddFavorite(comeIn,TypeUser,ID){
	ID = ID - 1000;
	if(TypeUser == 4)
		Favorite = window.open("../includes/asp/AddFavorite.asp?ID="+ID, "Favorite", "height=50,width=50,menubar='no',toolbar='no',location='no',status='no'");
}

function DelFavorite(comeIn,TypeUser,ID){
	ID = ID - 1000;
	if(TypeUser == 4)
		Favorite = window.open("../includes/asp/DelFavorite.asp?ID="+ID, "Favorite", "height=50,width=50,menubar='no',toolbar='no',location='no',status='no'");
}

function validSearchText(comeIn){
	if(comeIn.TagJob.value.replace(" ","").length  == 0 && comeIn.DomainJobSearch.value == 0 && comeIn.Language.value == "" && comeIn.Education.value == "" && comeIn.TypePosition.value == "" && comeIn.Experience.value == 0 && comeIn.Country.value == 1 && comeIn.City.value == 0 && comeIn.PostalCode.value.replace(" ","").length  == 0){
		alert("Merci de choisir une option.");
	}
	else
		comeIn.submit();
}

function validSearchTextJob(comeIn){
	if(comeIn.TagJob.value.replace(" ","").length  == 0 && comeIn.DomainJobSearch.value == 0 && comeIn.Language.value == "" && comeIn.TypePosition.value == "" && comeIn.Country.value == 1 && comeIn.City.value == 0 && comeIn.PostalCode.value.replace(" ","").length  == 0){
		alert("Merci de choisir une option.");
	}
	else
		comeIn.submit();
}

function JobCounterScrape(ID_Job,Link){
	Counter = window.open("../includes/asp/JobCounterScrape.asp?ID_Job="+ID_Job+"&Link="+Link, "save", "height=600,width=800,menubar='yes',toolbar='yes',location='no',status='yes',resizable=1, scrollbars=1");
}

// GESTION POPUP
function loadPopup(popURI,width_,height_) {
	inlinePop('embedpopup','on',width_,height_);
	parent.document.getElementById('popupiframe').src = popURI
	scrollTo(0, 0);
}

// TOGGLE INLINE DISPLAY OF IMAGE USING SHADED BACKGROUND
function inlinePop(layerId,state,objWidth,objHeight) {	

	document.location = "#top";
	
	if (state == 'on') {
		// store available page width and height into variables
		pageWidth = document.documentElement.clientWidth;
		pageHeight = document.documentElement.clientHeight;	
		
		// calculate centered position for element
		// + 30 = height of div containing close button
		popLeft = (pageWidth - objWidth) / 2;
		popTop = (pageHeight - objHeight) / 2;	
		
		// position element centered (x,y) on page
		document.getElementById(layerId).style.left = popLeft + "px";
		document.getElementById(layerId).style.top = popTop + "px";
	}

	switch(state) {
		case (state = "on"):
			showShader(1);
			document.getElementById(layerId).style.display = "block";
		break
		case (state = "off"):
			document.getElementById(layerId).style.display = "none";
			showShader(0);
		break		
	}
}

// APPLY SHADER TO PAGE FOR POPUP DISPLAY
function showShader(status) {
   var x,y;
   var arrbody = document.getElementsByTagName("body");
   var test1 = arrbody[0].scrollHeight;
   var test2 = arrbody[0].offsetHeight;
    
   if (test1 > test2) // all but Explorer Mac
   {
      x = arrbody[0].scrollWidth;
      y = arrbody[0].scrollHeight;
   }
   else // Explorer Mac;
        //would also work in Explorer 6 Strict, Mozilla and Safari
   {
      x = arrbody[0].offsetWidth;
      y = arrbody[0].offsetHeight;
   }
   
	document.getElementById('shaderdiv').style.width = x + "px";
	document.getElementById('shaderdiv').style.height = (y + 100) + "px";
   
	if (status == 1) {
		document.getElementById('shaderdiv').style.display = "block";
	}
	else {
		document.getElementById('shaderdiv').style.display = "none";
	}

}
