function verifContact(obj){
	myAlert.temp=5;
	testMail = verifMail('contactnews','email_client3');
	
	if(obj.destinataire.value=="0"){
		obj.destinataire.focus();
		messageAlert('<br /><br />You have to choose an address',"destinataire");
		return false;
	}
	if(obj.email_client3.value==""){
		obj.email_client3.focus();
		messageAlert('<br /><br />You have to enter a correct mail !',"email_client3");
		return false;
	}
	if(testMail == false){
		obj.email_client3.focus();
		messageAlert('<br /><br />Your mail is not valid !',"email_client3");
		return false;
	}	
	if(obj.sujet_contact.value==""){
		obj.sujet_contact.focus();
		messageAlert('<br /><br />You have to seize a subject',"sujet_contact");
		return false;
	}
	if(obj.comments2.value==""){
		obj.comments2.focus();
		messageAlert('<br /><br />You have to enter a message',"comments2");
		return false;
	}
	if(obj.verif_contact.value==""){
		obj.verif_contact.focus();
		messageAlert('<br /><br />You have to enter the letter for security check',"verif_contact");
		return false;
	}
	return true;
}

function ctrlchamp(obj){
	obj.setAttribute("autocomplete","on");	
	var theid=$(obj).id;
	if($(theid+'ctrl')!= null){
		var texte,p,i,l,t,c;
		l=trim($(obj).value).length;
		t=$(obj).value;
		coul1 = '#1A7917';
		coul2 = '#cc0000';
		//alert(verifMail('inscriptnews','email_client3'));
		switch(theid){
			case 'email_client3':var rmail=false;if(t!=''){var rmail=verifMail('contactnews','email_client3');}if(rmail==false){i='avisko.gif';p='You have to enter a correct mail !';c=coul2;}else{i='avisok.gif';p='Ok';c=coul1;}break;
			//case 'email_client3':if(t==""){i='avisko.gif';p='Email invalide. Veuillez le ressaisir';c=coul2;}else{i='avisok.gif';p='Ok';c=coul1;}break;
			case 'verif_contact':if(t==""||l<4){i='avisko.gif';p='You have to enter the letter for security check.';c=coul2;}else{i='avisok.gif';p='Ok';c=coul1;}break;
		}			
		if(p!=undefined){
			$(theid+'ctrl').innerHTML='<span style="color:'+c+'"><img src="http://www.e-vingroom.com/canape-cuir/'+i+'" align="middle" />&nbsp;'+p+'</span>';
			if(c=='#1A7917'){
				$(obj).parentNode.className="input_form_div";
			}else{
				$(obj).parentNode.className="input_form_div_over";
			}
		}
	}
}
function CheckLen(Target,maxLength,type) {
	if (Target.value.length > maxLength) {
		Target.value = Target.value.substring(0,maxLength);
		CharsLeft = 0;
		myAlert.temp=5;
	} else {
		CharsLeft = maxLength - Target.value.length;      
	}
	var carac = eval("document.getElementById('"+type+"')");
	carac.value = CharsLeft;
}
