
function ValideVerifEmail()
{
if (document.Formulaire.Email.value.length==0)
	alert("Attention, le champ Email n'est pas rempli !!");
else
	document.Formulaire.submit();
}

function fenetre(nom,source,large,haut,params){
window.open(source,nom,'width='+large+',height='+haut+','+params)
}

function isProper(string) {

   if (!string) return true;
   var autorizedChars = "àéèâôêû-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 *";
   	
	// élimine les chaines vides
	
	if (string=="") 
		{
			 alert("vous n'avez pas saisi de mot clef");
			return false;
		}
		
	// élimine les doubles espaces type "  "
	
   for (var i = 0; i < string.length-1; i++)
    {
      if ((string.charAt(i)==" ")&&(string.charAt(i+1)==" ")) 
      	{
      	 alert("un seul espace est nécessaire entre les mots clefs");
      	 return false;
      	}
    }
        
    // élimine les caractères non reconnus      
         	
   for ( i = 0; i < string.length; i++) {
      if (autorizedChars.indexOf(string.charAt(i)) == -1)
      	{
         alert("Veuillez utiliser des caractères alphanumériques standards. Evitez '%,*./@  ...");
         return false;
        }
   }
   
   // élimine les autres cas gênants
	
	if ((string=="-")||(string=="_")||(string==" "))
		{
		  alert("votre mot clef est trop court ou non significatif");
		 return false; 
	    }
   return true;
}        

function Verif(string) {
   
    if (isProper(string.value) == false) 
    {
    string.value=DernierObjetSelectionne.Valeur;
    string.focus();
    return false;
    }
    else
    {
    return true;
	}
}  



 function reg(form)
 { 
  var i=0;
  var ii=0;

  while (!(form.CodeRegion[i].selected))
   ++i;

  if (form.CodeRegion[i].value != '')
  {
   ii=0;
   while (!(form.CodePays[ii].selected))
    ++ii;
   form.CodePays[ii].selected=false;

   ii=0;
   while (form.CodePays[ii].value != '1')
    ++ii;
   form.CodePays[ii].selected=true;
  }
 }

function pay(form)
 { 
  var i=0;
  var ii=0;

  while (!(form.CodePays[i].selected))
   ++i;

  if (form.CodePays[i].value != '1')
  {
   ii=0;
   
   form.CodeRegion[ii].selected=true;
  }
 }


  function copySelectedOptions (src, tgt) {
 	var i, j;
  	
  	for (i=0; i<src.options.length;i++) {
  	  if (src.options[i].selected == true) {
   	    var value = src.options[i].value;
  	    var text  = src.options[i].text;
  	  
  	    for (j=0; j<tgt.options.length;j++) {
  	      if (tgt.options[j].value == value) {
  	        break;
  	      }
  	    }
  	  
  	    if (j == tgt.options.length) {
  	      tgt.options[j] = new Option (text, value, false, false);
  	    }
  	  }
  	}
  }

  function removeSelectedOptions (tgt) {
  	var i,j, newOption = new Array ();

  	for (i=j=0; i<tgt.options.length;i++) {
		  	  if (tgt.options[i].selected == false) {
				  	    if (i != j) {
				   	      tgt.options[j].text     = tgt.options[i].text;
				 	      tgt.options[j].value    = tgt.options[i].value;
				 	      tgt.options[j].selected = false;;
				 	    }
		 	    j++;
  	  }
  	}
  	tgt.options.length = j;
  }
  
  function selectAllOptions (tgt) {
  	for (i=0; i<tgt.options.length;i++) {
  	  tgt.options[i].selected = true;
    } 
  }
  
  function TrackEmpty (tgt) {
  		if (tgt.options.length==0)
    {
    	//pr vider une zone multiple !
    	tgt.options[0] = new Option ("XX99XX", "XX99XX");
    	tgt.options[0].selected = true;
    	tgt.options.length = 1;
    }
  }

// Currency Input Mask
 
var decEntryWasPress = false;
var decZeroPress = false;
function currencyFormat(fld, milSep, decSep, e) {
	
	var sep = 0;
	var key = '';
	var i = j = 0;
	var len = len2 = decPos = 0;
	var strCheck = '0123456789';
	var strDec = ',';
	var aux = aux2 = entVal = decVal = '';
	var parDec = false;
	var whichCode = (window.Event) ? e.which : e.keyCode;
		
	if (whichCode == 0) return true;
	if (whichCode == 8) return true; // Backspace
	if (whichCode == 13) return true;  // Enter
	
	key = String.fromCharCode(whichCode);  // Get key value from key code
	

	// If key Press equal . or , set decEntryWasPress to Thrue
	if (key == '.' || key == ','){
		decEntryWasPress = true;
		vr = false;
		len = fld.value.length;
		for (i = 0; i < len; i++) {
			if (fld.value.charAt(i) == ',') vr = true;
		}
		if (vr) 
			return false; // dec entry exist in string
		else 
			return true;     // put dec entry in string
	}

	// Not a valid Key do nothing
	if (strCheck.indexOf(key) == -1) return false;

	// Check if backspace delete the ',' from the string 
	//	if does not exist then considere integer entry ( set decEntryWasPress to false )
	vr = false;
	len = fld.value.length;
	for (i = 0; i < len; i++) {
  		if (fld.value.charAt(i) == ',') 
  			vr = true;
	}
	if (vr == false) 
		decEntryWasPress = false;

	// put ",00" if is the first key press 
//	if (fld.value.length == 0) {
//  		fld.value = key + ',00';
//  		return false;
//	}

	len = fld.value.length;
	aux = '';
	aux2 = '';

	if (key == '0' && decEntryWasPress) {
		decZeroPress = true;
		return false;
	}

	// Save Decimal Part
	parDec = false;
	for(i = 0; i <= len - 1; i++){
		if (strDec.indexOf(fld.value.charAt(i))!= -1 ){ 
			parDec = true;
  		} else {
			if (parDec) 
				decVal += fld.value.charAt(i);
    			else 
    				if (strCheck.indexOf(fld.value.charAt(i))!=-1) 
    					entVal += fld.value.charAt(i);
  		}
	}


	// if decVal = '00' reset decimal value
	if (decVal == '00') {
		decVal = '';
		parDec = false;
	}


	// remove non signifiant decimal digit
	if (decVal.charAt(1)== '0') 
		decVal = decVal.charAt(0);

	// Max two decimal entry
	if (decEntryWasPress && decVal.length > 1 ) 
		return false;

	fld.value = entVal;
	len = fld.value.length;

	// Push Numerical Entry in the FILO stack aux
	for(i = 0; i < len; i++){
		if (strCheck.indexOf(fld.value.charAt(i))!=-1) 
			aux += fld.value.charAt(i);
	}
	len = aux.length;
	if (parDec || decEntryWasPress) 
		len -= 1;

	// Restore the Stack
	for (j = 0, i = len; i >= 0; i--) {
		if (j == 3) {
			aux2 += milSep;
			j = 0;
		}
		aux2 += aux.charAt(i);
		j++;
	}

	aux = '';
	len = aux2.length;
	for (i = len; i >= 0; i--) {
		aux += aux2.charAt(i);
	}

	aux2 = aux ;

	if (decZeroPress && decEntryWasPress) {
		aux = aux2 + ',0' + key;
		decZeroPress = false;
		fld.value = aux;
		return false;
	}

	if ((parDec || decEntryWasPress ) && decVal.length == 0) 
		key = key + '0';

	if (parDec || decEntryWasPress) {
		aux = aux2 + ',' + decVal + key;
	} else {
  		// aux = aux2 + key + ',00';
  		aux = aux2 + key;
  	}

	fld.value = aux;

	return false;
}

var TRange = null;
var dupeRange = null;
var TestRange = null;
var win = null;

var nom = navigator.appName.toLowerCase();
var agt = navigator.userAgent.toLowerCase();
var is_major   = parseInt(navigator.appVersion);
var is_minor   = parseFloat(navigator.appVersion);
var is_ie      = (agt.indexOf("msie") != -1);
var is_ie4up   = (is_ie && (is_major >= 4));
var is_not_moz = (agt.indexOf('netscape')!=-1)
var is_nav     = (nom.indexOf('netscape')!=-1);
var is_nav4    = (is_nav && (is_major == 4));
var is_mac     = (agt.indexOf("mac")!=-1);
var is_gecko   = (agt.indexOf('gecko') != -1);
var is_opera   = (agt.indexOf("opera") != -1);

var is_rev=0
if (is_gecko) {
	temp = agt.split("rv:")
	is_rev = parseFloat(temp[1])
}
var frametosearch = self;

function findInPage(value, whichframe) {
	
	if (is_ie4up && is_mac) return;
	if (is_gecko && (is_rev <1)) return;
	if (is_opera) return;
	if(value!='') {
		str = value;
		win = whichframe;
		var frameval=false;
		if(win!=self) {
			frameval=true;
			win = parent.frames[whichframe];
		}
	} else return;

	var strFound;
	if(is_nav4 && (is_minor < 5)) {
		strFound=win.find(str);
        }

	if (is_gecko && (is_rev >= 1)) {
		if(frameval!=false) win.focus();
		strFound=win.find(str, false, false, true, false, frameval, false);
	}

	if (is_ie4up) {
		if (TRange!=null) {
			TestRange=win.document.body.createTextRange();
			if (dupeRange.inRange(TestRange)) {
				TRange.collapse(false);
				strFound=TRange.findText(str);
				if (strFound) {
					win.document.body.scrollTop = win.document.body.scrollTop + TRange.offsetTop;
					TRange.select();
				}
			} else {
				TRange=win.document.body.createTextRange();
				TRange.collapse(false);
				strFound=TRange.findText(str);
				if (strFound) {
					win.document.body.scrollTop = TRange.offsetTop;
					TRange.select();
				}
			}
  		}
		if (TRange==null || strFound==0) {
			TRange=win.document.body.createTextRange();
			dupeRange = TRange.duplicate();
			strFound=TRange.findText(str);
			if (strFound) {
				win.document.body.scrollTop = TRange.offsetTop;
				TRange.select();
			}
		}
	}
}
 