function addEvent(elm, evType, fn, useCapture){if(elm.addEventListener){elm.addEventListener(evType, fn, useCapture);return true;}else if (elm.attachEvent){var r = elm.attachEvent('on' + evType, fn);return r;}else{elm['on' + evType] = fn;}} 
								
function controlepres()
{
	if (document.getElementById("cp").value=="")
	{
		document.getElementById("erreur21").style.display="block";
		document.getElementById("erreur21").innerHTML="Le code postal est obligatoire";
		document.getElementById("cp").focus();
		document.getElementById("cp").select();										
		return false;
	}
	else if (!EstNumerique(document.getElementById("cp").value))
	{
		document.getElementById("erreur21").style.display="block";
		document.getElementById("erreur21").innerHTML="Le code postal est incorrect";
		document.getElementById("cp").focus();
		document.getElementById("cp").select();										
		return false;									
	}
	else if (document.getElementById("producteur").checked==false && document.getElementById("preparateur").checked==false && document.getElementById("importateur").checked==false && document.getElementById("distributeur").checked==false)
	{						
		document.getElementById("erreur21").style.display="block";
		document.getElementById("erreur21").innerHTML="Le type d'op&eacute;rateur est obligatoire";													
		return false;
	}
	else
	{
		return true;
	}
	
}

function EstNumerique (num)
{
	reg = new RegExp(/^[0-9]+$/);
    return reg.test(num);										
}

//ouvre une fenetre fille retaillable    	
function new_browser(src,name,w,h)
{
	size=",width="+w+",height="+h
	browser=window.open(src,name,"resizable=yes,scrollbars=yes,toolbar=no,status=no,menubar=no,location=0,directories=no"+size)
}


//ouvre une fenetre fille de taille fixe   
function new_browser3(src,name,w,h)
{
	size=",width="+w+",height="+h
	browser=window.open(src,name,"resizable=no,scrollbars=no,toolbar=no,status=no,menubar=no,location=0,directories=no"+size)
}	


//ouvre une photo dans une fenetre fille à la taille de la photo
function fenetrephoto2 (repimages, lo, ha, nomimage,id)
{	
	browser=window.open("visualisation.asp?image="+repimages+"&id="+id, nomimage,"resizable=no,scrollbars=auto,toolbar=no,status=no,menubar=no,location=0,directories=no,width="+lo+",height="+ha)
}




