if (ns4){layerRef="document.layers['";		styleSwitch="']";	layerStyleRef=".document";}
if (ie4){layerRef="document.all['";		styleSwitch="'].style";	layerStyleRef="";}
if (dom){layerRef="document.getElementById('";	styleSwitch="').style";	layerStyleRef="";}

function montre(layerName)	{eval(layerRef+layerName+styleSwitch+'.visibility = "visible"')}
function cache(layerName)	{eval(layerRef+layerName+styleSwitch+'.visibility = "hidden"')}
function xpos(layerName)	{return parseInt(eval(layerRef+layerName+styleSwitch+'.left'));}
function ypos(layerName)	{return parseInt(eval(layerRef+layerName+styleSwitch+'.top'));}
function tox(layerName,x)	{eval(layerRef+layerName+styleSwitch+'.left = '+x);}
function toy(layerName,y)	{eval(layerRef+layerName+styleSwitch+'.top = '+y);}
function byx(layerName,x)	{eval(layerRef+layerName+styleSwitch+'.left = '+xpos(layerName)+'+'+x);}
function byy(layerName,y)	{eval(layerRef+layerName+styleSwitch+'.top = '+ypos(layerName)+'+'+y);}

function hauteur(layerName){
	if (ns4){h = document.layers[layerName].document.height}
	if (ie4){h = document.all[layerName].offsetHeight}
	if (dom){h = document.getElementById(layerName).offsetHeight}
	return parseInt(h)
	}

function SetDiv(IDcouche,Content){
	if (dom) {document.getElementById(IDcouche).innerHTML = Content;return;}
	if (ie4) {document.all[IDcouche].innerHTML = Content;return;}
	if (ns4) {with (eval('document.'+IDcouche+'.document')) {open();write(Content);close();}return;}
	}

function change_img(img_name,img_var){
	img=eval(img_var+".src");
	document[img_name].src=img;
	}

function change_img_layer(layer_name,img_name,img_var){
        img=eval(img_var+".src");
	if (ns4){document.layers[layer_name].document[img_name].src=img;}
	else {document.images[img_name].src=img;}
        }

var fen
function pop_up(sURL, iWidth, iHeight, X0, Y0, bScrollbar){
	if(bScrollbar){iWidth+=16;}
	var sName, sFeatures;
	sName = 'pop_up';
	if(ie4||dom){if((fen)&&(!fen.closed)){fen.close();}}
	sFeatures = 'toolbar=no,location=no,directories=no,status=no,menubar=no';
	if ( bScrollbar == false )
		sFeatures += ',scrollbars=no';
	else
		sFeatures += ',scrollbars=yes';
	sFeatures += ',resizable=no,screenY='+Y0+',screenX='+X0+',top='+Y0+',left='+X0+',width='+iWidth+',height='+iHeight;
	fen=window.open(sURL, sName, sFeatures);
	}

function pop_up_centre(sURL, iWidth, iHeight, bScrollbar){
	if (window.screen) {
		X0 = (screen.availWidth - iWidth)/2
		Y0 = (screen.availHeight - iHeight)/2
		}
	else {
		X0=0
		Y0=0
		}
	if(bScrollbar){iWidth+=16;}
	var sName, sFeatures;
	sName = 'pop_up';
	if(ie4||dom){if((fen)&&(!fen.closed)){fen.close();}}
	sFeatures = 'toolbar=no,location=no,directories=no,status=no,menubar=no';
	if ( bScrollbar == false )
		sFeatures += ',scrollbars=no';
	else
		sFeatures += ',scrollbars=yes';
	sFeatures += ',resizable=no,screenY='+Y0+',screenX='+X0+',top='+Y0+',left='+X0+',width='+iWidth+',height='+iHeight;
	fen=window.open(sURL, sName, sFeatures);
	}


function change_select_url(formName, menuName){
	
	theForm = document.forms[formName];
	theMenu = theForm.elements[menuName];
	choix = theMenu.options[theMenu.selectedIndex].value;
	
	if (choix != "" && choix != -1){
		location.href = eval('"'+choix+'"')
		}
		
	}


function change_select_url2(formName, menuName){
	
	theForm = document.forms[formName];
	theMenu = theForm.elements[menuName];
	choix = theMenu.options[theMenu.selectedIndex].value;
	alert(document.forms[formName].action)
	document.forms[formName].action = choix
	alert(document.forms[formName].action)
	
//	if (choix != "" && choix != -1){
		document.forms[formName].submit()
//		}
		
	}




function format_chiffre(valeur){
	i=valeur.length;
	valeur_format="";
	while(i >= 0) {
		valeur_format=valeur.substring(i-3,i)+" "+valeur_format;
		i=i-3;
		}
	return valeur_format;
	}

function format_prix(valeur){
	
	valeur_str = new String(valeur)	
	valeur_str = valeur_str.replace(/,/,"\.");
	if (valeur_str != 0){valeur_str = Math.round(valeur_str*100);}
	else {valeur_str = "000"}
	valeur_str = new String(valeur_str)		
	decimal_str = valeur_str.substr(valeur_str.length-2);
	valeur_str = Math.floor(valeur_str/100);
	valeur_str = new String(valeur_str)		

	i=valeur_str.length;
	valeur_format="";
	while(i >= 0) {
		valeur_format=valeur_str.substring(i-3,i)+" "+valeur_format;
		i=i-3;
		}
	
	valeur_format = new String(valeur_format)
	valeur_format = valeur_format.replace(/\s$/,"");
	valeur_format = valeur_format.replace(/^\s/,"");
	valeur_format = valeur_format.replace(/\s/g,"&nbsp;");		
	valeur_format = valeur_format + "," + decimal_str;
			
	return valeur_format;
	}






