// script original: Pascal Thomas// Adaptation pour Softwise, Pascal Thomas  var bIE =false;var bNS4=false;var bNS6=false;var bMAC=false;// Roll-Overfunction imgT(imgObject,imgObjectetat,message) {imgObject.src=imgObjectetat;window.status=message;return true;}function platformDetect(){	bIE =false;	bNS4=false;	bNS6=false;	bIE = (document.all) ? true:false;	bNS4 = (document.layers) ? true:false;	bNS6 = (navigator.vendor == ("Netscape6") || navigator.product == ("Gecko"));	bMAC = (navigator.appVersion.indexOf('Mac')>0)}function fieldvalue(pf){	if (pf.type=="select-one"){		i=pf.selectedIndex		if (i>=0)return pf[i].value	}	else if (pf.type=="checkbox"){		if (pf.checked)return pf.value	}	else if (pf.type=="radio"){		if (pf.checked)return pf.value		return ""	}	else if (pf.type=="img"){		if (pf.checked)return pf.value		return ""	}	else if (pf.type=="text"){		return pf.value	}	else{//		alert(pf.type)	}	return ""}function formvalues (pwindow,formName){	var f,j,sf,s;		if (bIE) {f = document.forms[formName];}	else	{f = pwindow.document.forms[formName];}	s = "";	// champs				for (j=0;j<f.length;j++) {		sf=fieldvalue(f[j])		if (sf!=""){			if(s!="")s = s + "&";			s = s + f[j].name + "=" + escape(sf);		}	}	return (s) ;}function checkrequired(pwindow,formName){	var f,j,sf,s;		if (bIE) {f = document.forms[formName];}	else	{f = pwindow.document.forms[formName];}	s = "";	// champs				for (j=0;j<f.length;j++) {		if (f[j].comment){			sf=fieldvalue(f[j])			if (sf==""){				alert(f[j].comment);				return false;			}		}	}	return (true) ;		}function to800(p){/*var w;w = ""+document.body.clientWidth;if (w=="" || w=="undefined") w =""+innerWidth;w =parseInt(w);	if (!p)return;	x0=parseInt(p.style.left);	if (w>800){		x1=(w-800)/2+x0;		p.style.left=x1+"px";	}*/}//------------------------------------------------------// cookiesfunction getCookieVal (offset) {	var endstr = document.cookie.indexOf (";", offset);	if (endstr == -1) endstr = document.cookie.length;	return unescape(document.cookie.substring(offset, endstr));}function GetCookie (name) {	var arg = name + "=";	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 "";}function SetCookie (name, value) {	var argv = SetCookie.arguments;	var argc = SetCookie.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 = name + "=" + escape (value) +		((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +		((path == null) ? "" : ("; path=" + path)) +		((domain == null) ? "" : ("; domain=" + domain)) +		((secure == true) ? "; secure" : "");}	function Expiration() {	var expdate = new Date ();	expdate.setTime (expdate.getTime() + (14* 24 * 60 * 60 * 1000));	return expdate;}//------------------------------------------------------function formatNumber(somme){testleftm = parseInt(somme);testright = somme - testleftm; fixright = (Math.round(testright*100))/100; if (fixright)     {    if (fixright*100 % 10)       {      return ( eval(testleftm)+eval(fixright) );      }    else       {      return (eval(testleftm)+eval(fixright) + '0');      }    }  else     {  return (eval(testleftm)+eval(fixright) + ',00');    }  }//-- JavaScript code written by Alan Simpson - www.coolnerds.comfunction currency(v) {}// --></script>//------------------------------------------------------// lecture de la valeur d'un champ de saisiefunction GetValue (pField)	{	var sret 		if (pField.type=="checkbox")	{		if (pField.checked)			return  (pField.defaultValue);		return  "";	}	else	if (pField.type=="select-one")	{		var iSelected		iSelected = pField.selectedIndex 		if (iSelected<0)			return ""		sret = pField.options[iSelected].value		if (sret=="") sret = pField.options[iSelected].text	}	else	{		sret = pField.value	}	return sret}function GetValueCB (pField)	{	return GetValue(pField)}function SetValue (pField, sValue)	{	if (pField.type=="select-multiple")	{		var iSelected		for ( iSelected=0; iSelected<pField.length; iSelected++)		{			if (sValue == pField.options[iSelected].value)			{					pField.options[iSelected].selected = true			}		}	} else	if (pField.type=="select-one")	{		var iSelected		pField.selectedIndex=-1		for ( iSelected=0; iSelected<pField.length; iSelected++)		{			if (sValue == pField.options[iSelected].value)			{					pField.selectedIndex=iSelected				break;			}		}	}	else	if (pField.type=="checkbox")	{		pField.checked = (sValue=pField.defaultValue)	}	else	{		pField.value = sValue	}}function SetSelect (pField, sValue)	{	if (pField.type=="select-multiple")	{		var iSelected		for ( iSelected=0; iSelected<pField.length; iSelected++)		{			if (sValue == pField.options[iSelected].value)			{					pField.options[iSelected].selected = true			}		}	}}//------------------------------------------------------// nettoie un chiffre, en sortie separateur '.'function CleanNumber(sIn){	var i, sOut	i = 0	sOut=""	while(i<sIn.length)	{		c =sIn.charAt(i)		if (c==',') c='.'		if (((c>='0') && (c<='9')) || (c=='.'))		{			sOut = sOut + c		}		i=i+1	}	return sOut}// nettoie chainefunction rtrim(s){	var i	i = s.length	while(i>0)	{		i=i-1		if (s.charAt(i)!=" ")			return s.substring(0,i+1)	}	return ("")}function ltrim(s){	var i	i = 0	while(i<s.length)	{		if (s.charAt(i)!=" ")			return s.substring(i)		i=i+1	}	return ""}function trim(s){	return ltrim(rtrim(s))}function		divSet (sname,svalue){var p;	if (document.layers){		p = document.layers[sname];		p.document.write(svalue);		p.document.close();/*		p = document.layers[sname];		if (p === undefined) {			alert(sname + " not found");			return;		}		//p.document.write("<font size=-1>"+svalue+"</font>");		p.document.write("<font size=1 face=arial color=black>a</font>");		p.document.close();*/	}	else{		p = document.getElementById(sname);		if (p) p.innerHTML=svalue;	}}p = document.getElementById("caddieState");to800(p);p = document.getElementById("caddieText");to800(p);p = document.getElementById("caddie");to800(p);var t7,e7,e6;function viewCaddie(){var s="";	caddieGet();	fContent = e7;	if (top.document.layer){		s+="&nbsp;<font face=verdana size=1>"+e6+"&nbsp;produits&nbsp;"+fContent+" euros</font>";	}else{		s+="<a class=c1g href=javascript:editCaddie()>";  if (e6==0)    {s+="Aucun produit command&eacute;";}  else  {if (e6>1)		{s+=e6 + " produits pour " + fContent + " euros";}  else    {s+="Un produit pour " + fContent + " euros";}	}		s+="&nbsp;<img src=[lookm]caddie_on.gif align=absmiddle></a>&nbsp;";	}	divSet ("caddieState",s);//?//if ($bDHTML){?//	s+=e6 + " art/ " + e7;//	s+="</span>";//	p = document.getElementById("caddieState");//	p.innerHTML=s;//}else{ //+="&nbsp;<font face=arial size=1>"+e6+"&nbsp;art/&nbsp;"+e7+"</font>";//	p = document.layers.caddieState;//	p.document.write(s);//	p.document.close();//?}function caddieGet(){var stContent,sfValue,se6;	stContent = GetCookie("t7");	if (stContent=="") stContent="";	se7 = GetCookie("e7");	if (se7=="") se7="0";	se6 = GetCookie("e6");	if (se6=="") se6="0";		e7=parseFloat(se7);	e6=parseInt(se6);	if (stContent!="")		t7 = stContent.split(";");	else		t7 = new Array();}function caddieSet(){var i,stContent;	stContent="";	if (e6>0){		for (i=0; i<t7.length;i++){			if (i>0) stContent+=";";			stContent+=t7[i];		}	}	SetCookie ("t7", stContent);	SetCookie ("e7", e7);	SetCookie ("e6", e6);}function selectLanguage(lang){	SetCookie ("userLang", lang);	document.location.reload();}function caddieReset(){	SetCookie ("t7", "");	SetCookie ("e7", "");	SetCookie ("e6", "");}function toCaddie(codProd,prxProd,qteProd){var s,i;	if (!qteProd) qteProd=1;	caddieGet();	i = 0;	if (e6>0) i=t7.length;	t7[i] = codProd+ ":" + qteProd + ":" +prxProd ;	e6++;	e7+=parseFloat(prxProd);	caddieSet();	viewCaddie();}function editCaddie(){	document.location="/4DCGI/bt_commande";}function caddieOnLoad(){		viewCaddie();}caddieOnLoad();function setCookieExpire(nom, valeur, year, month, day) {dateExp = new Date (year,month,day);dateExp = dateExp.toGMTString();document.cookie = nom + "=" + valeur + "; expires=" + dateExp + ";";}// Image Check-Boxvar c_imgon = "on.gif";var c_imgoff = "off.gif";var c_imgchk = "r";function c_seekimg(sname){var i;for(i=0;i<document.images.length;i++)if(document.images[i].name==sname) return document.images[i];}function c_clknm(simg){	c_clk(document.images[simg]);}function c_evt(e){	if (!e) var e = window.event;	if (e.target)c_clk(e.target);	else if (e.srcElement)c_clk(e.srcElement);}function c_a(idimg){	//if(!bns4)return;	c_clk(c_seekimg(idimg));}function c_clk(pimg){	pimg.c_state=!pimg.c_state;	if(c_imgchk!="")pimg.src=(pimg.c_state ? pimg.c_osrcchk:pimg.c_osrc);	else	pimg.src=(pimg.c_state ? c_imgon:c_imgoff);	pimg.c_pfield.value=pimg.c_pfield.value.substr(0,pimg.c_index)+(pimg.c_state ? "1":"0")+pimg.c_pfield.value.substr(pimg.c_index+1);}function c_init(pfield, idimg,vstate){var	pimg;	if (document.getElementById)pimg=document.getElementById(idimg);	else pimg=c_seekimg(idimg);	if(!pfield || !pimg)return;	if(!vstate)vstate=pfield.value;	if(c_imgchk!=""){pimg.c_osrc=pimg.src;pimg.c_osrcchk=pimg.c_osrc.replace(/\.gif/gi,c_imgchk+".gif");}	pimg.c_state=(vstate!="1");pimg.c_pfield=pfield;pimg.onclick=c_evt;	pimg.c_index=0;	c_clk(pimg);}function c_initpack(pfield, pimg){var	pimg;	if(!pfield || !pimg)return;	if(!pfield.c_nimg)pfield.c_nimg=1; else pfield.c_nimg++;	if(c_imgchk!=""){pimg.c_osrc=pimg.src;pimg.c_osrcchk=pimg.c_osrc.replace(/\.gif/gi,c_imgchk+".gif");}	pimg.c_index=pfield.c_nimg-1;	pimg.c_state=(pfield.value.substr(pimg.c_index,1)!="1");pimg.c_pfield=pfield;pimg.onclick=c_evt;	c_clk(pimg);}function c_initauto(pfrm, sprefiximg, sprefixfield){var i, sname;	for(i=0;i<document.images.length;i++){		sname=document.images[i].name;		spre = sname.substr(0,sprefiximg.length);		spost = sname.substr(sprefiximg.length);				if (spre==sprefiximg)			if (spost=="") 					c_initpack(pfrm.elements[sprefixfield], document.images[i]);			else	c_init(pfrm.elements[sprefixfield+spost], sname);	}}function frmloaded(){	c_initauto(document.frm, "img_A", "chk");	c_initauto(document.frm, "img_B", "fld_B");}