
var NomPage = 'index';
 var TypPage = '.php';
 var PgeZero = 'index.php';
 var PgeLang = '';
 var DocuURL = document.URL;         			// "http://www.escaliers-decors.fr/"
 var PosCtrl = DocuURL.lastIndexOf('/')+1;
 
 if (PosCtrl != DocuURL.length) {
   PgeZero = DocuURL.substr(PosCtrl);
   DocuURL = DocuURL.substr(0,PosCtrl);
   
   PosCtrl = PgeZero.lastIndexOf('.');
   TypPage = PgeZero.substr(PosCtrl);
   NomPage = PgeZero.substr(0,PosCtrl);
   PosCtrl = NomPage.length-3;
   if (NomPage.substr(PosCtrl,1) == '_') {
     PgeLang = NomPage.substr(PosCtrl+1);
	 NomPage = NomPage.substr(0,PosCtrl);
   }
 }

function fd_gotoLang(vLang)
{
	if (vLang != PgeLang)
	{
		var ptiotr = (vLang == '')? '' : '_';
		document.location = DocuURL+NomPage+ptiotr+vLang+TypPage;
	}
}

var wiwi=0;
function MM_openBrWindow(theURL,winName,features) { //v2.0
  if(wiwi) { if(!wiwi.closed) wiwi.close(); }
//  wiwi = window.open(theURL,winName,features);
  wiwi = window.open("","",features);
  wiwi.location = theURL;
  wiwi.name = winName;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function popup_milieu(link,name,larg,haut,options)
{
  var top=(screen.height-haut)/2;
  var left=(screen.width-larg)/2;

window.open(link,name,'top=' + top + ',left=' + left + ',width=' +larg+ ',height=' + haut + ',' + options);
}

function go(x) {
	document.location.href=x;	
}


function right(str,nbr)  { return str.substr(str.length-nbr) }
function SansBlancs(str) { return str.replace(/(^\s*)|(\s*$)/g,''); }


var wiwi=0;

function fct_PopWindow(theURL,winName,features) 
{
  if(wiwi) { if(!wiwi.closed) wiwi.close(); }
  wiwi = window.open(theURL,winName,features);
//  wiwi = window.open("","",features);
//  wiwi.location = theURL;
//  wiwi.name = winName;
}



function fct_EvtSubmit(Args)
{
  var nbArgs = fct_EvtSubmit.arguments.length;
  
  if(wiwi) { if(!wiwi.closed) wiwi.close(); }
  if(nbArgs < 2) return; 

  var Cible   = fct_EvtSubmit.arguments[0];
   //  var NomForm = 'f_'+f_NomPage(Menu_Ref);         // inutile puisque les pages n'ont qu'une seule balise <FORM>
  var ValEvmt = fct_EvtSubmit.arguments[1];
 
 
 // alert(ValEvmt);
 
 
  var x_offset = 1;
  var pStart   = 2;
  var resp     = 1;

  TestConfirm = ValEvmt.substr(0,8);
  if (TestConfirm == 'CONFIRM_') 
  {
	  ValEvmt = ValEvmt.substr(8);
      x_offset++;
      pStart++;
      resp = confirm(unescape(fct_EvtSubmit.arguments[2]));
  }
  for (var i=pStart; i<nbArgs; i++)
  {
    No_Arg = i-x_offset;
    EvtArg = 'EvtArg'+No_Arg
    document.forms[0].elements[EvtArg].value= fct_EvtSubmit.arguments[i];
  }
  if (resp == 1) 
  {
    document.forms[0].action = Cible;
    document.forms[0].elements['EvtCod'].value = ValEvmt;
    document.forms[0].submit();
  } 
}


function fct_ChgImg(refImg,posImg)
{
  document.images[refImg].src = posImg;
}


function Set_Actif_pge_1(On_Off)	
{
  if (On_Off == 1)
  {
    document.getElementById('Blk_i1').style.display        = 'block';
    document.getElementById('Blk_i2').style.display        = 'block';
    document.getElementById('Blk_o1').style.display        = 'none';
    document.getElementById('Blk_o2').style.display        = 'none';
    document.forms['f_pge_1'].elements['quantite'].disabled   = false;
    //document.forms['f_pge_1a'].elements['iP_TTC'].disabled = false;
  } else {
    document.getElementById('Blk_i1').style.display        = 'none';
    document.getElementById('Blk_i2').style.display        = 'none';
    document.getElementById('Blk_o1').style.display        = 'block';
    document.getElementById('Blk_o2').style.display        = 'block';
    document.forms['f_pge_1'].elements['quantite'].disabled   = true;
    //document.forms['f_pge_1a'].elements['iP_TTC'].disabled = true;
  }
}


function f_TelechargeImage(On_Off)
{
    Set_Actif_pge_1(On_Off);
  if (On_Off == 1)
  {
    Set_Actif_pge_1a(0);
    document.getElementById("DialTelechargeImage").style.visibility = "visible";
  } else {
    Set_Actif_pge_1a(1);
    document.getElementById("DialTelechargeImage").style.visibility = "hidden";
  }
}

function Linkeo_newwin(url)
{
	date=new Date();
	id=date.getTime();
	window.open(url,id,'width=100,height=100,top=5,left=5,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=1');
}

function go(){ 
if (document.selecter.select1.options[document.selecter.select1.selectedIndex].value != "none") { 
document.getElementById('def').childNodes[0].nodeValue  = document.selecter.select1.options[document.selecter.select1.selectedIndex].value; 
        } 
    } 
