var anim=0;

function setanim(){
	if(document.cookie){
		deb = document.cookie.indexOf("anim=") + 4;
		fin = document.cookie.indexOf(";",deb);
		if (fin < 0){
			 fin = document.cookie.length
		}
			 anim=unescape(document.cookie.substring(deb,fin));
	}
	else{
		var echeance = new Date();
		var maintenant = echeance.getTime() + (24 * 60 * 60 * 1000);
		echeance.setTime(maintenant);
		document.cookie = "anim=1; expires=" +echeance.toGMTString();
	}
}

function PositionCenterDiv(id, pwidth, height) {
	var width = document.documentElement.clientWidth || document.width;
    document.getElementById(id).style.left = ((width - pwidth) / 2) + "px";
}

function stopBubble(e) {
    if (window.event)
        window.event.cancelBubble = true;
    else
        e.stopPropagation();
}

function over(obj){
	if(obj.className!="TitleMenuActif" && obj.className!="TitleMenu2Actif" && obj.className!="TitleMenu3Actif"){
		if(obj.id.match("^itemnv1")){
			obj.className="TitleMenuHover";
		}
		else if(obj.id.match("^itemnv2")){
			obj.className="TitleMenu2Hover";
		}
		else if(obj.id.match("^itemnv3")){
			obj.className="TitleMenu3Hover";
		}
	}
}

function out(obj){
	if(obj.className!="TitleMenuActif" && obj.className!="TitleMenu2Actif" && obj.className!="TitleMenu3Actif"){
		if(obj.id.match("^itemnv1")){
			obj.className="TitleMenu";
		}
		else if(obj.id.match("^itemnv2")){
			obj.className="TitleMenu2";
		}
		else if(obj.id.match("^itemnv3")){
			obj.className="TitleMenu3";
		}			
	}
}

function closeall(id, url){
	document.getElementById("newproducts").className="HiddenBloc";
	document.getElementById("products").className="HiddenBloc";
	document.getElementById("EPSXPS").className="HiddenBloc";
	document.getElementById("Materiaux").className="HiddenBloc";
	document.getElementById("Poncage").className="HiddenBloc";
	document.getElementById("donwloads").className="HiddenBloc";
	document.getElementById("itemnv1accueil").className="TitleMenu";
	document.getElementById("itemnv1newproducts").className="TitleMenu";
	document.getElementById("itemnv1products").className="TitleMenu";
	document.getElementById("itemnv1download").className="TitleMenu";
	document.getElementById("itemnv2EPSXPS").className="TitleMenu2";
	document.getElementById("itemnv2Decoupe").className="TitleMenu2";
	document.getElementById("itemnv2poncage").className="TitleMenu2";
	document.getElementById("itemnv2download1").className="TitleMenu2";
	document.getElementById("itemnv2download2").className="TitleMenu2";
	document.getElementById("itemnv2download3").className="TitleMenu2";
	switch(id){
		case "newproducts" :
			document.getElementById("itemnv1newproducts").className="TitleMenuActif";
			document.getElementById("newproducts").className="VisibleBloc";
			break;
		case "products" :
			document.getElementById("itemnv1products").className="TitleMenuActif";
			document.getElementById("products").className="VisibleBloc";
			break;
		case "EPSXPS" :
			document.getElementById("itemnv1products").className="TitleMenuActif";
			document.getElementById("itemnv2EPSXPS").className="TitleMenu2Actif";
			document.getElementById("products").className="VisibleBloc";
			document.getElementById("EPSXPS").className="VisibleBloc";
			break;
		case "Materiaux" :
			document.getElementById("itemnv1products").className="TitleMenuActif";
			document.getElementById("itemnv2Decoupe").className="TitleMenu2Actif";
			document.getElementById("products").className="VisibleBloc";
			document.getElementById("Materiaux").className="VisibleBloc";
			break;
		case "Poncage" :
			document.getElementById("itemnv1products").className="TitleMenuActif";
			document.getElementById("itemnv2poncage").className="TitleMenu2Actif";
			document.getElementById("products").className="VisibleBloc";
			document.getElementById("Poncage").className="VisibleBloc";
			break;
		case "download" :
			document.getElementById("itemnv1download").className="TitleMenuActif";
			document.getElementById("donwloads").className="VisibleBloc";
			break;
		case "accueil" :	
			document.getElementById("itemnv1accueil").className="TitleMenuActif";
			break;
		case "download1" :
			document.getElementById("itemnv1download").className="TitleMenuActif";
			document.getElementById("itemnv2download1").className="TitleMenu2Actif";
			document.getElementById("donwloads").className="VisibleBloc";
			break;
		case "download2" :
			document.getElementById("itemnv1download").className="TitleMenuActif";
			document.getElementById("itemnv2download2").className="TitleMenu2Actif";
			document.getElementById("donwloads").className="VisibleBloc";
			break;
		case "download3" :
			document.getElementById("itemnv1download").className="TitleMenuActif";
			document.getElementById("itemnv2download3").className="TitleMenu2Actif";
			document.getElementById("donwloads").className="VisibleBloc";
			break;
	}
	if(url!=""){
		window.location=url;
	}
}

function ClearTxtbox(obj, originaltext){
	if(obj.value==originaltext){
		obj.value="";
		obj.style.color="#000000";
		obj.style.fontStyle="normal";
	}
}

function FillTxtbox(obj, originaltext){
	if(obj.value==originaltext || obj.value==""){
		obj.value=originaltext;
		obj.style.color="#bbbbbb";
		obj.style.fontStyle="italic";
	}
}

function ShowForm(){
	var width = document.documentElement.clientWidth || document.width;
	var height = document.documentElement.scrollHeight || document.height ;
	document.getElementById("hidder").style.width=width + "px";
	document.getElementById("hidder").style.height=height + "px";
	document.getElementById("hidder").style.visibility = "visible";
    document.getElementById("ContactBloc").style.visibility = "visible";
	document.getElementById("ContactBloc").style.top=(height - 60 - document.getElementById("ContactBloc").offsetHeight) + "px";
	PositionCenterDiv("ContactBloc", 520, document.getElementById("ContactBloc").offsetHeight)
}

function CloseModifier() {
    document.getElementById("hidder").style.visibility = "hidden";
    document.getElementById("ContactBloc").style.visibility = "hidden";
}

function HoverItem(obj){
	obj.style.cursor="pointer";
}

function LeaveItem(obj){
	obj.style.cursor="default";
}


function HoverImg(obj, img){
	HoverItem(obj);
	obj.src='images/' + img + '.jpg';
}

function LeaveImg(obj, img){
	obj.src='images/' + img + '.jpg';
}

function verifcontactform(){
	if(document.contactform.txt_nom.value=="" || document.contactform.txt_mail.value=="" || document.contactform.txt_msg.value==""){
		alert("Sie remplire alle Informationen.");
		return false;
	}
	else{
		return true;
	}
}

function verifloginform(){
	if(document.contactform.txt_login.value=="" || document.contactform.txt_mdp.value==""){
		alert("Sie remplire alle Informationen.");
		return false;
	}
	else{
		return true;
	}
}

function checkmail(){
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(document.newl.txt_mail.value)) {
		alert('Pfropfen Sie ein gesundes E-mail adresse, bitte.');
		document.newl.txt_mail.focus();
		return false;
	}
	else{
		return true;
	}
}