// JavaScript Document
///debut code set div pour IE
		var messageCases="Remplir les cases vides !";
		
		
		
		
function ficheUV600(){

		window.open("UV600.html","UV600",

		"width=900,height=800,left=10,top=10,location=no,status=no,toolbar=no,scrollbars=yes");

		}
function ficheX700unie(){

		window.open("X700unie.html","X700",

		"width=900,height=800,left=10,top=10,location=no,status=no,toolbar=no,scrollbars=yes");

		}
function ficheX700raye(){

		window.open("X700raye.html","X700",

		"width=900,height=800,left=10,top=10,location=no,status=no,toolbar=no,scrollbars=yes");

		}


function ficheECO600(){

		window.open("ECO600.html","ECO600",

		"width=850,height=700,left=10,top=10,location=no,status=no,toolbar=no,scrollbars=yes");

		}



function ficheSoltis92(){

		window.open("soltis92.html","P905",

		"width=850,height=800,left=10,top=10,location=no,status=no,toolbar=no,scrollbars=yes");

		}
function ficheSuneos(){

		window.open("suneos.html","SUNEOS",

		"width=850,height=800,left=10,top=10,location=no,status=no,toolbar=no,scrollbars=yes");

		}
function ficheOrche(){

		window.open("Orchestra.php","Orchestra",

		"width=900,height=800,left=10,top=10,location=no,status=no,toolbar=no,scrollbars=yes");

		}
function ficheRythm(){

		window.open("Rythm.php","Rythm_et_Harmony",

		"width=900,height=800,left=10,top=10,location=no,status=no,toolbar=no,scrollbars=yes");

		}
function ficheEco(){

		window.open("ecoparticipation.html","Eco participation",

		"width=770,height=900,left=10,top=10,location=no,status=no,toolbar=no,scrollbars=yes");

		}
		
function ficheGarantie(){

		window.open("garantie.html","Termes de la garantie",

		"width=770,height=800,left=10,top=10,location=no,status=no,toolbar=no,scrollbars=yes");

		}
		

		
	   var ns4 = (document.layers)? true:false;         //NS 4
	   var ie4 = (document.all)? true:false;         //IE 4
	   var dom = (document.getElementById)? true:false;   //NS 6 ou IE 5
	   
function SetDiv(ID,Content)
		{
 		if (dom) 
		{
		if(document.getElementById(ID) != null)
 	    document.getElementById(ID).innerHTML = Content;
 		return;
 		}
		if (ie4) 
		{
 		if(document.all[ID]!=null)
     	document.all[ID].innerHTML = Content;
    	return;
		}
		if (ns4) 
 		{
  		if(eval('document.'+ID)!=null)
  		{
    	with (eval('document.'+ID+'.document'))
      	{
      	open();
       	write(Content);
      	close();
     	}
    	}
     	return;
 		}
		}


function GetVal(Id, message){

	var resultat = 0;

	var valeur = document.getElementById(Id).value;

	valeur=valeur.replace(",",".");

	document.getElementById(Id).value = valeur;

	if(valeur.match(/[^0-9\.]/gi)){

	document.getElementById(Id).value="";

	alert(message);

	}

	else

	resultat = parseFloat(valeur);

	if(resultat > 3000){document.getElementById(Id).value=""; alert("Attention de bien saisir les dimensions en Centimètres");}

	return resultat;

}
function Verrif(elems)
		{
 		var errors =false;
 		for(i=0;i<elems.length;i++)
 		{
  		var Id = elems[i];
  		if(document.getElementById(Id).value =="")
  		{
   		errors=true;
   		document.getElementById(Id).style.backgroundColor="red";
  		}
  		else
  		{
   		document.getElementById(Id).style.backgroundColor="white";
 		}
 		}
 		if(errors)
  		alert("Veuillez saisir les cases en rouge");
 		return !errors;
		}
		
function VerrifToile(elems)
		{
 		var errors =false;
 		for(i=0;i<elems.length;i++)
 		{
  		var Id = elems[i];
  		if(document.getElementById(Id).value =="")
  		{
   		errors=true;
   		document.getElementById(Id).style.backgroundColor="red";
  		}
  		else
  		{
   		document.getElementById(Id).style.backgroundColor="white";
 		}
 		}
 		if(errors)
  		alert("Veuillez choisir une toile");
 		return !errors;
		}	
function GetFloat(Id)
		{
 		var resultat = 0.0;
		var valeur = document.getElementById(Id).value;
 		if(valeur =="")
  		return resultat;
 		if(!valeur.match(/[^0-9\.]/gi))
 		resultat = parseFloat(valeur);
 		return resultat;
		}

function SetDivParent(ID,Content)
		{
 		if (dom) 
 		{
		if(window.opener.document.getElementById(ID) != null)
  	    window.opener.document.getElementById(ID).innerHTML = Content;
   		return;
 		}
		}
function ajax_get(url)
{
 if(window.XMLHttpRequest) // FIREFOX
  xhr_object = new XMLHttpRequest();
 else if(window.ActiveXObject) // IE
  xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
 else
  return(false);
 xhr_object.open("GET", url, false);
 xhr_object.send(null);
 if(xhr_object.readyState == 4)
  return(xhr_object.responseText);
 else
  return(false);
}
 

function getVarCSV(x,y,csv)
{
 url="csv.php?csv="+csv+"&x="+x+"&y="+y;
 contenu=ajax_get(url);
 return contenu;
}

function getVarCSV2(x,y,csv)
{
 url="csv2.php?csv="+csv+"&x="+x+"&y="+y;
 contenu=ajax_get(url);
 return contenu;
}

   ///fin code set div pour IE


function choixtoile(){
		var coloris=document.getElementById('coloristoile').value;
		var type=document.getElementById('typetoile').value;
		if(coloris != "")
		SetDiv("choixtoile","<strong>"+"Toile PVC "+type+"<br>"+"Coloris : "+coloris+"</strong>");
		}
function choixtoile2(){
		var coloris=document.getElementById('coloristoile').value;
		var type=document.getElementById('typetoile').value;
		var toileno=document.getElementById('toileno').value;
		if ((coloris != "") && ((type == "Orchestra") || (type == "Rythm et Harmony"))) {
		SetDiv("choixtoile","<strong>"+"Toile acrylique "+type+", R&eacute;f&eacute;rence Coloris : N&deg; "+toileno+"</strong>");
		} else if (coloris != "") 
		SetDiv("choixtoile","<strong>"+"Toile acrylique "+type+", R&eacute;f&eacute;rence Coloris : N&deg; "+coloris+"</strong>");
		}  
 function EcrireCookie(nom, valeur){

		var argv=EcrireCookie.arguments;

		var argc=EcrireCookie.arguments.length;

		var expires=(argc > 2) ? argv[2] : null;

		var path=(argc > 3) ? argv[3] : null;

		var domain=(argc > 4) ? argv[4] : null;

		var secure=(argc > 5) ? argv[5] : false;

		document.cookie=nom+"="+escape(valeur)+

		((expires==null) ? "" : ("; expires="+expires.toGMTString()))+

		((path==null) ? "" : ("; path="+path))+

		((domain==null) ? "" : ("; domain="+domain))+

		((secure==true) ? "; secure" : "");

		}



function getCookieVal(offset)
{

	var endstr=document.cookie.indexOf (";", offset);
	
	if (endstr==-1) endstr=document.cookie.length;
	
	return unescape(document.cookie.substring(offset, endstr));

}		
function LireCookie(nom)
{

		var arg=nom+"=";

		var alen=arg.length;

		var clen=document.cookie.length;

		var i=0;

		while (i<clen)

		{

		var j=i+alen;

		if (document.cookie.substring(i, j)==arg) return getCookieVal(j);

		i=document.cookie.indexOf(" ",i)+1;

		if (i==0) break;



		}

		return null;
}
function calculmo(surftoile){

	if(surftoile < 10)

	return 11.05;

	if(surftoile < 20)

	return 7.33;

	if(surftoile < 40)

	return 4.75;

	if(surftoile < 60)

	return 3.51;

	return 2.3;//cas superieur ?20

}
