var IB=new Object;
var posX=0;posY=0;
var xOffset=10;yOffset=10;

// ******************************** SCRIPT BRIOUDE
	var id=6160;
	url1='http://www.pyreneesrepublic.com';
	url2='http://www.referencement-2000.com';
	url3='http://www.plusdehits.com';

	if (document.referrer.length > 0) {
		urlreg = '('+url1+'|'+url2+'|'+url3+')';
		hasard = Math.round(Math.random()*10000);
		var refer= escape(document.referrer);
		var tagdebut= '<LINK rel="stylesheet" type="text/css" href="http://stats.ref2000.com/stats.css?idbrioude='+id;
		tagdebut+='&thereferer=';
		var tagfin ='">';
		var tagmilieu='';
		var pagescript= escape(window.location);
		var page = "&page="+pagescript;
		page+='&hasard=';
		reg1 = /(xml_bi|cpc_bi)/;
		ok2 = reg1.exec(window.location);
		var reg = new RegExp(urlreg,'i');
		ok = reg.exec(document.referrer);
		if ((!ok)&&(!ok2)) {
			document.write(''+tagdebut+refer+tagfin);
		}
	}
// ******************************** SCRIPT BRIOUDE


function frmsubmit(func) {
	frm = document.getElementById ("entryform");
	frm.func.value = func;
	frm.submit();
}	

// ******************************** GESTION INFO BULLES

function AffBulle(texte) {
	contenu="	<TABLE border=0 cellspacing=0 cellpadding="+IB.NbPixel+"><TR bgcolor='"+IB.ColContour+"'><TD><TABLE border=0 cellpadding=2 cellspacing=0 bgcolor='"+IB.ColFond+"'><TR><TD><FONT size='-1' face='arial' color='"+IB.ColTexte+"'>"+texte+"></FONT></TD></TR></TABLE></TD></TR></TABLE>&nbsp;";
	var finalPosX=posX-xOffset;
	if (finalPosX<0) finalPosX=0;
	if (document.layers) {
		document.layers["bulle"].document.write(contenu);
		document.layers["bulle"].document.close();
		document.layers["bulle"].top=posY+yOffset;
		document.layers["bulle"].left=finalPosX;
		document.layers["bulle"].visibility="show";}
	if (document.all) {
		//var f=window.event;
		//doc=document.body.scrollTop;
		bulle.innerHTML=contenu;
		document.all["bulle"].style.top=posY+yOffset;
		document.all["bulle"].style.left=finalPosX;//f.x-xOffset;
		document.all["bulle"].style.visibility="visible";
	}
	//modif CL 09/2001 - NS6 : celui-ci ne supporte plus document.layers mais document.getElementById
	else if (document.getElementById) {
		document.getElementById("bulle").innerHTML=contenu;
		document.getElementById("bulle").style.top=posY+yOffset;
		document.getElementById("bulle").style.left=finalPosX;
		document.getElementById("bulle").style.visibility="visible";
	}
}

function getMousePos(e) {
	if (document.all) {
		posX=event.x+document.body.scrollLeft; //modifs CL 09/2001 - IE : regrouper l'évènement
		posY=event.y+document.body.scrollTop;
	}
	else {
		posX=e.pageX; //modifs CL 09/2001 - NS6 : celui-ci ne supporte pas e.x et e.y
		posY=e.pageY; 
	}
}

function HideBulle() {
	if (document.layers) {document.layers["bulle"].visibility="hide";}
	if (document.all) {document.all["bulle"].style.visibility="hidden";}
	else if (document.getElementById){document.getElementById("bulle").style.visibility="hidden";}
}

function InitBulle(ColTexte,ColFond,ColContour,NbPixel) {
	IB.ColTexte=ColTexte;IB.ColFond=ColFond;IB.ColContour=ColContour;IB.NbPixel=NbPixel;
	if (document.layers) {
		window.captureEvents(Event.MOUSEMOVE);window.onMouseMove=getMousePos;
		document.write("<LAYER name='bulle' top=0 left=0 visibility='hide'></LAYER>");
	}
	if (document.all) {
		document.write("<DIV id='bulle' style='position:absolute;top:0;left:0;visibility:hidden'></DIV>");
		document.onmousemove=getMousePos;
	}
	//modif CL 09/2001 - NS6 : celui-ci ne supporte plus document.layers mais document.getElementById
	else if (document.getElementById) {
			document.onmousemove=getMousePos;
			document.write("<DIV id='bulle' style='position:absolute;top:0;left:0;visibility:hidden'></DIV>");
	}

}

// ******************************** FIN GESTION INFO BULLES


// ******************************** GESTION ZOMM IMAGES

function zoom_image(imgpath) {
	contenudiv  = "<table style=\"border-collapse:collapse; border-width:1px; border:solid; color: #FFFFFF; background-color: #5D5D5D;\" border=0>";
	contenudiv += "<tr><td align='center' onmouseover=\"this.style.cursor='pointer'\" onmouseout=\"this.style.cursor='default'\" onClick=\"javascript:close_zoom()\">";
	contenudiv += "<img src=\""+imgpath+"\"";
	contenudiv += "></img>";
	contenudiv += "<br>Cliquez pour fermer";
	contenudiv += "</td></tr>";
	contenudiv += "</table>";
	document.getElementById("zoom_img").innerHTML = contenudiv;
	document.getElementById("zoom_img").style.visibility = "visible";
}

function close_zoom() {
	document.getElementById("zoom_img").style.visibility = "hidden";
}

// ******************************** GESTION ZOMM IMAGES


function calculDevis(imax) {

	var tot = 0;
	var maxcat = imax + 1;
	for (i = 1; i < maxcat; i++)
	{
		checkpiece = "C" + i;
		checkqty = "Q" + i;
		checkprix = eval("document.f." + checkpiece + ".options[document.f." + checkpiece + ".selectedIndex].value;");
		checkprixArray = checkprix.split("|");
		qte = eval("document.f." + checkqty + ".value;");
		if (qte == null) { 
			qte = eval("document.f." + checkqty + ".options[document.f." + checkqty + ".selectedIndex].value;"); 
		}
		tot = tot + eval(checkprixArray[0] * qte);
	}

	if (tot > 0) {
		tot = tot + 0.25;
		tot = tot.toString();
		totArray = tot.split(".");
	    tot = totArray[0] + "." + totArray[1].substring(0,2);
		tot = tot - 0.25;
	} 
	document.f.montant.value = tot;
	convF(tot);
}

function convF(val) {
	var taux = 6.55957;
	var F = Math.round(100*parseFloat(val)*taux)/100;
	if (isNaN(F)) { 
		alert("Montant incorrect");
	} else {
		document.f.montantFF.value = F;
	}
}

