function popup(adr,nompop,larg,haut,res){window.open(adr,nompop,'width='+larg+',height='+haut+',scrollbars=1,toolbar=0,location=0,status=0,menubar=0,resizable='+res);}
function imgPopup(nomPop,img,fond,txt,css){
   imgPop = window.open("",nomPop,"scrollbars=yes,width=700,height=550");
   imgPop.document.write("<html>\n\n");
   imgPop.document.write("<head><title>Apercu d'image</title></head>\n\n");
   imgPop.document.write("<body bgcolor=\""+fond+"\">\n");
   imgPop.document.write("  <table border=\"0\" cellpadding=\"0\" cellspacing=\"2\" width=\"100%\">\n");
   imgPop.document.write("    <tr><td align=\"center\"><img src=\"ressources/"+img+"\"></td></tr>\n");
   imgPop.document.write("    <tr><td align=\"center\">\n");
   imgPop.document.write("      <table border=\"0\" cellpadding=\"0\" cellspacing=\"2\">\n");
   imgPop.document.write("        <tr><td><span style=\""+css+"\">"+txt+"</span></td></tr>\n");
   imgPop.document.write("      </table>\n");
   imgPop.document.write("    </td></tr>\n");
   imgPop.document.write("  </table>\n");
   imgPop.document.write("</body>\n\n");
   imgPop.document.write("</html>");
}
function MakepopPicture(img,my_l,my_h,my_s,my_status,my_resize,my_name){
	/* Version 1.0 */
	/* Creation  Imed Azaza */
	addPop=open("",my_name,"width="+my_l+",height="+my_h+",scrollbars="+my_s+",toolbar=0,location=0,status="+my_status+",menubar=no,resizable="+my_resize);
    addPop.focus();
	addPop.document.write("<HTML><HEAD><TITLE>"+my_name+"</TITLE></HEAD>");
	addPop.document.write("<SCRIPT language=javascript>function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+12,document.images[0].height+30); window.focus();} else { setTimeout('check()',250) } }</"+"SCRIPT>");
	addPop.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0><IMG src='"+img+"' border=0>");
	addPop.document.write("");
	addPop.document.write("</BODY></HTML>");
	addPop.document.close();
}

function Makepop(url,my_l,my_h,my_s,my_status,my_resize,my_name){
	/* Version 1.0 */
	/* Creation Marc alias DMC */
	addPop=window.open(url,my_name,"width="+my_l+",height="+my_h+",scrollbars="+my_s+",toolbar=0,location=0,status="+my_status+",menubar=no,resizable="+my_resize);addPop.focus();
}

/* ////////////////////////////////////////////// */
/*	Test un ensemble de caract ?res                */
/*	@return true ou false                         */
/* ////////////////////////////////////////////// */
function defendu(string) {
if (!string){return false;}

   var iChars = "abcdefghijklmnopqrstuvwxyz@-_.~0123456789";
   for (var i = 0; i < string.length; i++) {
		if (iChars.indexOf(string.charAt(i).toLowerCase()) == -1){
			return false;
		}
   }
   return true;
} 
/* ////////////////////////////////////////////// */
/*	Test l'email                                  */
/*	@return false ou String                       */
/* ////////////////////////////////////////////// */
function is_Email(emails){
	// emails=trim(emails);
	if (emails.indexOf("@") != -1 && emails.indexOf("..")==-1 && defendu(emails)==true){
			var longueur = emails.split("@");
			if((longueur.length==2) && (longueur[0]!="" && longueur[1]!="")){
				var taille=longueur[1].lastIndexOf(".");
				if(taille!=-1){
					if((longueur[1].length-1-taille)==2 || (longueur[1].length-1-taille)==3 ){
						return true;
					}
					return false;
				}
				return false;
			}
			return false;
	}
	return false;		
}
function isselectionne(champformulaire) {return (champformulaire.selectedIndex>0);} 
function isremplit(valeur){return (valeur!="");} 
function isValidTVA(valeur){
	var formatTVA=new RegExp("^([A-Z]{1,2}||[A-Z]{2}[a-zA-Z0-9]*)$");
	 if(formatTVA.test(valeur) == true){
	  return true;
	 }else{
	  return false;
	 }
}
function isValidMdp(valeur){
	var formatMdp=new RegExp("^([a-zA-Z0-9]*)$");
	 if(formatMdp.test(valeur) == true){
	  return true;
	 }else{
	  return false;
	 }
}

function isValidFormatAdress(valeur){
var regAdress=new RegExp("^[0-9a-zA-Z ]+$");
if (regAdress.test(valeur)==true){
return false;
}else{
return true;
}
}

function majuscule(obj)
{
	var minus = "aàâäbcçdeéèêëfghiîïjklmnoôöpqrstuùûvwxyz"
	var majus = "AAAABCCDEEEEEFGHIIIJKLMNOOOPQRSTUUUVWXYZ"
	var entree = obj.value;
	var sortie = "";
	for (var i = 0 ; i < entree.length ; i++)
	{
		var car = entree.substr(i, 1);
		sortie += (minus.indexOf(car) != -1) ? majus.substr(minus.indexOf(car), 1) : car;
	}
	obj.value = sortie;
} 

function getselectionRadio(valeur){
	if (valeur[0]) {
		for (var i = 0 ; i < valeur.length ; i++){
			if (valeur[i].checked == true){
				return valeur[i].value;
			}
		}
	} else {
		if (valeur.checked) {
			return valeur.value;
		}
	}
	return null;
} 

function getSelectedRadioValue (radiobutton){
        var returnValue = "";       
         if (radiobutton.length == 1){ 
                    returnValue = radiobutton.value;       
                     } else 
                     {            
                     for (i=0;i<radiobutton.length;i++){               
                      if (radiobutton[i].checked==true) {                    
                      returnValue=radiobutton[i].value;                
                      }            
                      }        
                      }        return returnValue;    }

function setClass(champformulaire,action,classn,classer) {if(action==true){champformulaire.className=classn;} else {champformulaire.className=classer;} } 

function afficherecherche(){
	var _layerRech = Dmc_Layer.is_object("layerrechercher");
	var pos_x=((getEcranX()-770)/2);
	if(_layerRech!=false){
	Dmc_Layer.set_posx(_layerRech,pos_x+342);Dmc_Layer.f_visible(_layerRech);
	}
}
function cacherecherche(){
	var _layerRech = Dmc_Layer.is_object("layerrechercher");
	if(_layerRech!=false){Dmc_Layer.f_cacher(_layerRech);}
}
function annulecopy(objinput){
	if(window.clipboardData){
	var texte= window.clipboardData.getData("Text"); 
	window.clipboardData.setData("Text","");
	return false;
	}
}

