function swap_img(imgname,imgpic){
document.images[imgname].src='/mariage/images/cartes/'+imgpic;
}

function choisirListe() {
	combo = document.forms["listeMariage"].elements["magasin"];

	//selectValue = combo.options[combo.selectedIndex].value;

	//var path = "/mariage/ouvrirListe.do?f=37ce277c6d3400d1" + "&mag=" + selectValue + "&nomListe=";
	var path = "/mariage/ouvrirListe.do?f=37ce277c6d3400d1" + "&nomListe=";

	radio = document.forms["listeMariage"].elements["liste"];
	if (radio[0].checked) {
		document.location.href= path + radio[0].value;
	} // if
	else if (radio[1].checked) {
		document.location.href= path + radio[1].value;
	} // else if
	else if (radio[2].checked) {
		document.location.href= path + radio[2].value;
	} // else if	
	else {
		alert("Veuillez s&eacute;lectionner une liste avant de valider !");
	} // else
}

function goTo() {
	combo = document.getElementById("combomagasin");
	idM = combo.options[combo.selectedIndex].value;

	var url = "/mariage/index.jsp?mag=" + idM;
	document.location.href=url;
} // goTo

function goToActu() {
	combo = document.getElementById("combomagasin");
	idM = combo.options[combo.selectedIndex].value;

	var url = "/mariage/actuMagasin.do?mag=" + idM;
	document.location.href=url;
} // goTo

function goPrestataire() {
	var theform = document.forms["presta"];
	if (theform.elements["region"].value=='') {
		alert ("Veuillez s&eacute;lectionner une r&eacute;gion !");
		return false;
	} // if
	else {
		theform.submit();
	} // else
} // goPrestataire

function goToBeaute() {
	var url = "/beaute/rechercheMarques.do?categorieId="

	combo0 = document.forms["formToBeaute"].elements["cataloguebeaute0"];
	combo1 = document.forms["formToBeaute"].elements["cataloguebeaute1"];
	combo2 = document.forms["formToBeaute"].elements["cataloguebeaute2"];
	combo3 = document.forms["formToBeaute"].elements["cataloguebeaute3"];

	id0 = combo0.options[combo0.selectedIndex].value;
	id1 = combo1.options[combo1.selectedIndex].value;
  id2 = combo2.options[combo2.selectedIndex].value;	
	id3 = combo3.options[combo3.selectedIndex].value;
	
	if (id0!="") {
		document.location.href = url + id0;
	} // if
	else if (id1!="") {
		document.location.href = url + id1;
	} // if
	else if (id2!="") {
		document.location.href = url + id2;
	} // if
	else if (id3!="") {
		document.location.href = url + id3;
	} // if
	else {
		alert ("Veuillez saisir une cat&eacute;gorie !");
	} // else
	
} // goTo

function verifiermail(mail) {
    re = /^[-\.\w_]+@[-\.\w_]+\.[A-Za-z]{2,3}$/; 
    test = re.test(mail);
    return test; 
} 

function checkFrm() {
    var strStdMessage='\n';
    var mail = document.forms["newsletterform"].elements["email"].value;
    if (!verifiermail(mail)) {
    	alert('Veuillez saisir une adresse e-mail valide SVP');
    	document.forms["newsletterform"].elements["email"].focus();
    	return false;
   	}	// if
    var winNews=window.open('/saisieInscriptionNewsletter.do?email='+mail,'winNews','scrollbars,width=650,height=640');
    winNews.focus();
	return false;
}

function testFrame() {
	if(window == top)
	{
		//on est pas dans une iframe : on affiche tous les elements (menu flash, centre, footer)
		document.body.style.background='#EDEDEF url(/mariage/images/bg.jpg) center top no-repeat';
		document.body.style.backgroundAttachment='fixed';
		document.getElementById("contenu").style.backgroundColor='#ffffff';
		document.getElementById("div_contenu").style.height='auto';
		
		if(navigator.appName == 'Microsoft Internet Explorer' ){
			celldisplay = 'block';
		}else{
			celldisplay = 'table-cell';
		}
		document.getElementById("colGauche").style.display = celldisplay;
		document.getElementById("logo").style.display = celldisplay;
		document.getElementById("piedPage").style.display = celldisplay;

	} else {
		//on est dans une iframe : on affiche que le centre
		if(navigator.appName == 'Microsoft Internet Explorer' ){
			document.getElementById("global").id = 'globalFrameIE';
		}else{
			document.getElementById("global").id = 'globalFrame';
		}
		
	}
}

	
//permet d'enlever le dernier s?parateur
function modifStyleLastLi()
{

   // Test des m?thodes
   if(!document.getElementById || !document.getElementsByTagName)
   {
      return;
   }


   // Tableau r?capitulatif des ?l?ments 'sLink' du conteneur 'sId'
   var menu = document.getElementById("menu");
   var listLi = menu.getElementsByTagName("li");

   if(!listLi)
   {
      return;
   }//if
  
   //R?cup?ration du dernier li
   var lastLi;
   var i = 0;
   for(i ; i < listLi.length; i++)
   {
      lastLi = listLi[i];
   }//for
    
   if(lastLi.currentStyle){
  
   		if (lastLi.currentStyle.backgroundImage.indexOf("droite") == -1){
   			lastLi.style.background = "url(/mariage/images/blanc.gif) right 1px no-repeat";
   			
   		}else{
   			lastLi.style.background = "url(/mariage/images/menuHaut_on_droite.gif) right 1px no-repeat";
   		}
   	}else{ 
   		if (document.defaultView.getComputedStyle(lastLi, null).getPropertyValue("background-image").indexOf("droite2") == -1){
   			lastLi.style.background = "url(/mariage/images/blanc.gif) right 1px no-repeat";
   		}else{
   			lastLi.style.background = "url(/mariage/images/menuHaut_on_droite.gif) right 1px no-repeat";
   		}
   	}
   		
   
   
}	

