function confirmAction($action)	{
	switch($action)	{
		case 1 :
			if(confirm("Are you sure you want to modify the record ?"))	{
				return true ;
			}
			else	{
				return false ;
			}
			break ;
		case 2 :
			if(confirm("Are you sure you want to delete the record ?"))	{
				return true ;
			}
			else	{
				return false ;
			}
			break ;
	}
}

function openWin(theURL,winName,features) { 
  window.open(theURL,winName,features);
}

function linker(where) {
	top.location = where ;
}
function redirect(where)
{
window.location=where ;
}

function postSelfForm(theForm,theUrl)
	{
	    eval('document.' + theForm + '.action = "' + theUrl + '"') ;
	    eval('document.' + theForm + '.submit()') ;
	}
	
	function postFormPop(theForm,theInput)
	{
		if(eval('document.'+theForm+'.'+theInput+'.value') != '')	{
			myUrl = 'wysiwyg.php?cnt=' + eval('document.'+theForm+'.'+theInput+'.value') ;
	     window.open(myUrl,'pop','width=620,height=520,left=100,top=100,toolbar=no, statusbar=no, scrollbars=yes');
		}
	}
	
	<!-- a function to make a button available -->
function buttGen(theForm,theHandler,theButton)	{
	if(eval('document.' + theForm + '.' + theHandler + '.checked == true'))	{
		eval('document.' + theForm + '.' + theButton + '.disabled = false') ;
	}
	else	{
		eval('document.' + theForm + '.' + theButton + '.disabled = true') ;
	}
}

function postInOpener(theForm,theInput) {
	if(eval('document.'+theForm+'.'+theInput+'.value') != '')	{
		window.opener.document.forms[0].contenten.value = eval('document.'+theForm+'.'+theInput+'.value') ;
	}
}

function openWysiwygPopup(ctrlName)
	{
		window.open('/admin/WYSIWYG/index.php?ctrlName=' + ctrlName, 'titre', 'resizable=yes, toolbar=no, statusbar=no, scrollbars=yes, width=750, height=620') ;
	}
	
	function openCategPopup(obj)
	{
		if(obj == null)
			curKey = 0 ;
		else
			curKey = obj.options[obj.selectedIndex].value ;

		window.open('elementcateg.php?idRubr=DV_IDRUBR&idParent=' + curKey, 'titre', 'resizable=no, toolbar=no, statusbar=no, scrollbars=yes, width=416, height=500') ;
	}
	
//	afficher le calque
	function affiche(idCalque)	{
		if (document.getElementById) {
	    // Navigateur qui supporte DHTML
		document.getElementById(idCalque).style.visibility  = 'visible' ;
				document.getElementById(idCalque).style.display  = 'block' ;
	    }

		if (document.layers) {
	    // Navigateur Netscape 4.X
		document.layers[idCalque].visibility = 'visible' ;
	  }

	  if ((document.all)&&(!document.getElementById)) {
	  	//Explorer 4 uniquement
	    document.all[idCalque].style.visibility = 'visible' ;
	  }

	  if ((!document.layers)&&(!document.all)&&(!document.getElementById)) {
	    // Navigateur trop ancien !
	  }
	}

//	masquer le calque
	function masque(id)	{
		if (document.getElementById) {
	    // Navigateur qui supporte DHTML
	    document.getElementById(id).style.display  = 'none' ;
		document.getElementById(id).style.visibility  = 'hidden' ;
	    }

		if (document.layers) {
	    // Navigateur Netscape 4.X
		document.layers[id].visibility = 'hide' ;
	  }

	  if ((document.all)&&(!document.getElementById)) {
	  	//Explorer 4 uniquement
	    document.all[id].style.visibility = 'hidden' ;
	  }

	  if ((!document.layers)&&(!document.all)&&(!document.getElementById)) {
	    // Navigateur trop ancien !
	  }
	}
	
	function masqueTout()	{
		masque('smenu1a') ;
		masque('smenu1b') ;
		masque('smenu1c') ;
		
		masque('smenu4a') ;
		masque('smenu4b') ;
		masque('smenu4c') ;
		
		masque('smenu5a') ;
		masque('smenu5b') ;
	}
	
	function MM_swapImgRestore() { //v3.0
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}
	
	function MM_preloadImages() { //v3.0
	  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
	
	function MM_findObj(n, d) { //v4.01
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
	
	function MM_swapImage() { //v3.0
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
	
	function hideX(n) {
	 var x = document.getElementById(n);
	
	 if (x.style.display == "block") {
	  x.style.display = "none";
	 } else {
	  x.style.display = "block";
	 }
	 
	 var y = document.getElementById('img'+n) ;
	 
	 if (y.alt == "close") {
	  y.src = "images/jobdumois-close.gif" ; //le lien vers l'image
	  y.alt = "open" ;   //la balise alt
	 } else{
	  y.src = "images/jobdumois-open.gif" ;
	  y.alt = "close" ;
	 }
 
}

// ie hack to avoid activating control trouble
function writeFlash(swf, hauteur, largeur, couleur, nom) {
	document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\""+hauteur+"\" height=\""+largeur+"\" id=\""+nom+"\" align=\"middle\">\n");
	document.write("<param name=\"allowScriptAccess\" value=\"sameDomain\" />\n");
	document.write("<param name=\"movie\" value=\""+swf+"\" /><param name=\"quality\" value=\"high\" /><embed src=\""+swf+"\" quality=\"high\" width=\""+hauteur+"\" height=\""+largeur+"\" name=\""+nom+"\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />\n");
	document.write("</object>\n");
}
//	afficher le calque
	function afficheImg(idCalque,pSrc)	{
		if (document.getElementById) {
	    // Navigateur qui supporte DHTML
		document.getElementById(idCalque).src  = pSrc ;
	    }

		if (document.layers) {
	    // Navigateur Netscape 4.X
		document.layers[idCalque].visibility = 'visible' ;
	  }

	  if ((document.all)&&(!document.getElementById)) {
	  	//Explorer 4 uniquement
	    document.all[idCalque].style.visibility = 'visible' ;
	  }

	  if ((!document.layers)&&(!document.all)&&(!document.getElementById)) {
	    // Navigateur trop ancien !
	  }
	}
	
function submitForm(TheForm)	{
	document.forms[TheForm].submit() ;
}

function valider(frm){
  if(frm.elements['nom'].value == "" || frm.elements['msg'].value == "" || !isValidEmail(frm.elements['email'].value)) {
    alert("Please fill in all the fields!");
    return false;
  }
}

function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}