function validSearch(){
	var status = true;
	str = document.forms["form2"].str;
			if (str.value.length <= 2 || str.value == 'SEARCH ON THIS SITE'){
			status = false;
			alert ('Please enter a valid search');
			str.focus();
			}
	if (status == true){
		document.forms["form2"].submit();
	}		
}

function validLogin(){
	var status = true;
			if (document.forms["formLogin"].login.value== '' || document.forms["formLogin"].password.value == ''){
			status = false;
			alert ('Please enter a login and a password');
			document.forms["formLogin"].login.focus();
			}
	if (status == true){
		document.forms["formLogin"].submit();
	}		
}

function validRegister(){
	var firstName = document.form3.firstName;
	var lastName = document.form3.lastName;
	var company = document.form3.company;
	var jobTitle = document.form3.jobTitle;
	var city = document.form3.city;
	var province = document.form3.province;
	var email = document.form3.email;
	var membershipBBM = document.form3.membershipBBM;
/*company.value== '' || jobTitle.value== '' || || membershipBBM.value== ''*/
	var status = true;
			if (firstName.value== '' || lastName.value== '' ||  city.value== '' || province.value== '' || email.value== ''){
			status = false;
			alert ('Please complete all fields');
			}
			
	if (status == true){
				if ((email.value.indexOf('@',0)==-1) || (email.value.indexOf('.',0)==-1)) {
					alert ('Please complete the field Email correctly');
					status = false;
				}
	}		
	
	if (status == true){
		document.form3.submit();
	}		
}

function validEmail(email){
var status = true;
		if ((email.indexOf('@',0)==-1) || (email.indexOf('.',0)==-1)) {
			status = false;
		}
return status;
}

function validContest(){

var vname = document.form3.name;
var vcompany = document.form3.company;
var vcity = document.form3.city;
var vprovince = document.form3.province;
var vemail = document.form3.email ;
var vemail1 = document.form3.email1 ;
var vemail2 = document.form3.email2 ;
var vemail3= document.form3.email3 ;
var vemail4 = document.form3.email4 ;
	var status = true;
			if (vname.value== '' || vname.value== 'Name' ){
			status = false;
			alert ('Please complete the field Name');
			}
			if (vcity.value== '' || vcity.value== 'City' ){
			status = false;
			alert ('Please complete the field City');
			}
			if (vprovince.value== '' || vprovince.value== 'Province' ){
			status = false;
			alert ('Please complete the field Province');
			}
	if (status == true){
				if ((vemail.value.indexOf('@',0)==-1) || (vemail.value.indexOf('.',0)==-1)) {
					alert ('Please complete the field Email correctly');
					status = false;
				}
	}
		if (status == true){
			for(var i=1;i<=4;i++){
				if( (eval('vemail'+i).value != "Email friend") &&  (eval('vemail'+i).value != "") ){
					if ((eval('vemail'+i).value.indexOf('@',0)==-1) || (eval('vemail'+i).value.indexOf('.',0)==-1)) {
						alert ('Please complete the field Email '+i+' correctly ');
						eval('vemail'+i).focus();
						status = false;
						break;
					}
				}
			}
	}	
	if (status == true){
		document.form3.submit();
		/*alert ('ok');*/
	}	
}

function validerFormulaire(param1){
	var champValide = true;
	for (i=0 ; i < validerFormulaire.arguments.length ; i ++){
		if (document.forms[0][validerFormulaire.arguments[i]].value == "" || document.forms[0][validerFormulaire.arguments[i]].value == " "){
			alert ('Veuillez compléter le champs "'+validerFormulaire.arguments[i]+'"');
			document.forms[0][validerFormulaire.arguments[i]].focus();
			champValide = false;
			break;
		}
	}
	if (champValide == true){
		document.forms[0].submit();
	}		
}

function validSend(){
	if(document.form3.email == undefined)var email = ''; else var email = document.form3.email.value;
	if(document.form3.email_f == undefined)var email_f = ''; else var email_f = document.form3.email_f.value;
	if(document.form3.name == undefined)var name = ''; else var name = document.form3.name.value;
	var champValide = true;
		if(!email || !email_f || !name){
				alert ('Please complete all the fields!');
				champValide = false;
		}
			if (champValide == true){
				if ((email.indexOf('@',0)==-1) || (email.indexOf('.',0)==-1) || (email_f.indexOf('@',0)==-1) || (email_f.indexOf('.',0)==-1)) {
					alert ('Please complete the field Email correctly');
					champValide = false;
				}
			}
	if (champValide == true){
		document.forms["form3"].submit();
	}
}

function validerRadio(param1){
	var champValide = true;
	for (j=0 ; j< validerRadio.arguments.length ; j ++){
		var unchampValide = false;
		for (i=0; i<document.forms[0][validerRadio.arguments[j]].length ; i++) {
				if (document.forms[0][validerRadio.arguments[j]][i].checked){
					unchampValide = true;
					break;
				}
		}
		if (unchampValide == false){
			alert ('Veuillez compléter le champs "'+document.forms[0][validerRadio.arguments[j]][0].name+'"');
			document.forms[0][validerRadio.arguments[j]][0].focus();
			champValide = false;
			break;
		}
	}
	
	if (champValide == true){
		document.forms[0].submit();
	}
}

function showPage(show,nb){
	var p = show.substr(0,1);
	var s = show.substr(1,2);
for (i=1; i<=nb ; i++) {
	document.getElementById('n'+i).style.visibility='hidden';
	document.getElementById('d'+i).style.visibility='hidden';
}
document.getElementById(show).style.visibility='visible';
document.getElementById('n'+s).style.visibility='visible';
}

function OpenWin(page,nom,option) {
var w=window.open(page,nom,option);
w.document.close();
w.focus();
}

