/*
*************************************************************************************
Fonctions de navigation
*************************************************************************************
*/

function opn_window(page,nom,proprietes){	
	window.open(page,nom,proprietes)
}

/*
*************************************************************************************
Fonctions d'inscription
*************************************************************************************
*/

function verif_theForm(formulaire,lng){
	oForm = document.forms[formulaire];
	switch(lng){
		case '1':		
			txt_alert_destination			= "Veuillez saisir une destination";	
			txt_alert_email					= "Veuillez saisir E-mail";
			txt_alert_email_inc 			= "E-mail invalide\nvérifiez la syntaxe";			
			txt_alert_nom 					= "Veuillez saisir votre nom";
			txt_alert_prenom 				= "Veuillez saisir votre prénom";
			txt_alert_societe 				= "Veuillez saisir le champ société";
			txt_alert_adresse 				= "Veuillez saisir votre adresse";
			txt_alert_code_postal 			= "Veuillez saisir votre code postal";
			txt_alert_code_ville			= "Veuillez saisir votre ville";
			txt_alert_code_tel 				= "Veuillez saisir votre n° de téléphone";
			txt_alert_fax					= "Veuillez saisir votre n° de fax";
			txt_alert_destination			= "Veuillez saisir votre destination";
		break;
		case '2':
			txt_alert_email					= "Please type your E-mail";
			txt_alert_email_inc 			= "Incorrect E-mail ";			
			txt_alert_nom 					= "Please type your last name";
			txt_alert_prenom 				= "Please type your first name";
			txt_alert_societe 				= "Please type the company";
			txt_alert_adresse 				= "Please type your adress";
			txt_alert_code_postal 			= "Please type your zip code";
			txt_alert_code_ville			= "Please type your city";
			txt_alert_code_tel 				= "Please type your phine number";
			txt_alert_fax					= "Veuillez saisir votre n° de fax";
			txt_alert_besoins				= "please specify your needs";
		break;
		case '3':
			txt_alert_email					= "Please type your E-mail";
			txt_alert_email_inc 			= "Incorrect E-mail ";			
			txt_alert_nom 					= "Please type your last name";
			txt_alert_prenom 				= "Please type your first name";
			txt_alert_societe 				= "Please type the company";
			txt_alert_adresse 				= "Please type your adress";
			txt_alert_code_postal 			= "Please type your zip code";
			txt_alert_code_ville			= "Please type your city";
			txt_alert_code_tel 				= "Please type your phine number";
			txt_alert_fax					= "Veuillez saisir votre n° de fax";
			txt_alert_besoins				= "please specify your needs";
		break;
	}	
	switch(formulaire){		
		case 'mailing':
			if(!oForm.nom.value){
				alert(txt_alert_nom)
				oForm.nom.focus();
				return false
			}
			
			if(!oForm.prenom.value){
				alert(txt_alert_prenom)
				oForm.prenom.focus();
				return false
			}
			
			if(!oForm.email.value){
				alert(txt_alert_email)
				oForm.email.focus();
				return false
			}
			
			if ((oForm.email.value.indexOf("@",1)>1)&&(oForm.email.value.indexOf(".",1)>0)){			
			}else{
				alert(txt_alert_email_inc);
				oForm.email.focus();
				return false
			}		
		break;
		case 'devis':
			if(!oForm.societe.value){
				alert(txt_alert_societe)
				oForm.societe.focus();
				return false
			}
			
			if(!oForm.nom.value){
				alert(txt_alert_nom)
				oForm.nom.focus();
				return false
			}
			
			if(!oForm.adresse.value){
				alert(txt_alert_adresse)
				oForm.adresse.focus();
				return false
			}
			
			if(!oForm.code_postal.value){
				alert(txt_alert_code_postal)
				oForm.code_postal.focus();
				return false
			}
			
			if(!oForm.ville.value){
				alert(txt_alert_code_ville)
				oForm.ville.focus();
				return false
			}
			
			if(!oForm.email.value){
				alert(txt_alert_email)
				oForm.email.focus();
				return false
			}
			
			if ((oForm.email.value.indexOf("@",1)>1)&&(oForm.email.value.indexOf(".",1)>0)){			
			}else{
				alert(txt_alert_email_inc);
				oForm.email.focus();
				return false
			}	
			
			if(!oForm.besoins.value){
				alert(txt_alert_besoins)
				oForm.besoins.focus();
				return false
			}
		break;
		case 'commande':
			
			if(!oForm.nom.value){
				alert(txt_alert_nom)
				oForm.nom.focus();
				return false
			}			
			
			if(!oForm.telephone.value){
				alert(txt_alert_code_tel)
				oForm.telephone.focus();
				return false
			}
			
			if(!oForm.email.value){
				alert(txt_alert_email)
				oForm.email.focus();
				return false
			}
			
			if ((oForm.email.value.indexOf("@",1)>1)&&(oForm.email.value.indexOf(".",1)>0)){			
			}else{
				alert(txt_alert_email_inc);
				oForm.email.focus();
				return false
			}		
		break;
	}
}
/*
*************************************************************************************
Fonctions d'inscription
*************************************************************************************
*/
function verif_seach(formulaire,lng){
	switch(lng){
		case '1':	
			txt_alert_mot					= "Veuillez saisir un mot clé";
		break;
		case '2':
			txt_alert_mot					= "Please type a key word";
		break;
	}
	oForm = document.forms[formulaire]
	if(!oForm.mot.value){	
		alert(txt_alert_mot)
		oForm.mot.focus()
		return false
	}
}


function ouvrir_fenetre(page,nom,proprietes){
	largeur = 600;
	hauteur = 420;
	M_largeur = (screen.width /2)-(largeur/2);
	M_hauteur = 185;	
	window.open(page,nom,"width="+largeur+" height="+hauteur+" top="+M_hauteur+" left="+M_largeur+"status=1 scrollbars=yes")
}

function echanger(img1,img2){
	if(document.images){
		img1.src = img2
	}
}

function verif_list(formulaire,champ,active_td,champ_active){
	oForm = document.forms[formulaire];
	switch(formulaire){
		case 'devis':
			switch(champ){
				case 'fonction':
					if(oForm.elements[champ].selectedIndex == oForm.elements[champ].options.length-1){
						active_cell(active_td,'1')
						oForm.elements[champ_active].disabled = false
					}else{
						active_cell(active_td,'0')
						oForm.elements[champ_active].disabled = true
					}
				break;
			}
		break;
	}	
}

function active_cell(identifiant,act){
	all_obj=zone_devis.getElementsByTagName("TD");	
	for(i=0;i<all_obj.length;i++){
		if(all_obj[i].id==identifiant){
			switch(act){
				case '0':
					dsp_object = 'none';
				break;
				case '1':
					dsp_object = 'block';	
				break;
			}
		  all_obj[i].style.display=dsp_object;
		}		
	}   
}


function opn_window(page,nom,proprietes){
	window.open(page,nom,proprietes)
}

function dsp_rdv(formulaire,champ,active_td){	
	oForm = document.forms[formulaire]
	if(champ.id == 'rdv'){
		if(champ.checked == true){
			active_cell(active_td,'1')
		}else{
			active_cell(active_td,'0')
		}		
	}
}

function changeTsearch(tSearch){
	document.search.tSearch.value = tSearch
}

function uncheckall(check_elem,activ_f){
	is_checked = document.search.elements[check_elem].checked
	check_s = document.getElementsByName('check_field');
	search_field = document.getElementsByName('search_field');
	
	for(i=0;i<check_s.length;i++){
		check_s[i].checked = false		
	}
	
	for(i=0;i<search_field.length;i++){
		search_field[i].disabled = true
	}
	
	
	switch(is_checked){
		case true:
			document.search.elements[check_elem].checked = true
			document.search.elements[activ_f].disabled = false
		break;
		case false:
			document.search.tSearch.value = ''
		break;
	}
}

function print_page(MID,lng){
	window.open('print_page.php?MID='+MID+'&langue_id='+lng)
}

/************************ suppression du contour flash ****************************/

function AxRep(){
if (!document.all || !window.print || window.opera) return;
if (document.getElementsByTagName) { 

//object 
var theObjects = document.getElementsByTagName("object");
for (var i = 0; i < theObjects.length; i++) {
//ajout d'un div autour de object
div = theObjects[i].parentNode.insertBefore(document.createElement("div"), theObjects[i]);
div.style.display="none";
div.appendChild(theObjects[i]);

if(div.firstChild.data){
// Fix for Flash Satay style objects
div.firstChild.removeAttribute('data');
}

//Recuperation des flashvars
var theParams = div.getElementsByTagName("param");
for (var j = 0; j < theParams.length; j++) {
if(theParams[j].name.toLowerCase() == 'flashvars'){
var theFlashVars = theParams[j].value;
break;
}
}

//changement des flashvars
var theInnnerHTML = div.innerHTML;
var re = theInnnerHTML = theInnnerHTML.replace(re, "<param name='FlashVars' value='" + theFlashVars + "'>");
div.outerHTML = theInnnerHTML;
}

//embed
var embs = document.getElementsByTagName("embed");
for (i=0; i<embs.length; i++) {
embs[i].outerHTML = embs[i].outerHTML;
}
}
}

/************************ suppression du contour flash ****************************/