function pop()
{
	var pop = document.getElementById('pop');
      // document.getElementById("pop").innerHTML=msg;
	if (pop) {pop.style.display = 'block';};
	if (pop) {pop.onclick = function() {this.style.display = 'none';};};
}

//window.onload = pop;


function NewWindow(mypage, myname, scroll) {
winprops = 'width=775,height=620,top=200,left=200,directories=no,toolbar=no,location=no,scrollbars=yes';
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function ValiderChoixMultiple(){
var produit;
//alert(document.stationmaker.produit.value);
//if(document.forms.name==stationmaker){
 produit = document.stationmaker.produit.value;
 if(document.stationmaker.temoin.value>=1){
  if(confirm('Voulez vous valider le(s) composant(s) selectionné(s)1 ?')){
  
   document.stationmaker.submit();
    document.stationmaker.temoin.value=0;
  }
 }else if(document.stationmaker.temoinlog.value>=1){
  alert(document.stationmaker.temoinlog.value);
  if(confirm('Voulez vous valider le(s) logiciel(s) selectionné(s) ?')){
   
   document.stationmaker.submit();
   document.stationmaker.temoinlog.value=0;
  }
 }
}

function testAlert(cid) {
  MyAppAlert(document.getElementById(cid + "_content").innerHTML, document.getElementById(cid + "_title").innerHTML);
  alertDialog.setWidth(boxWidth);
}

function posConfirm(ev) {
  var e = jt_fixE(ev);
  if (aConfirmBox == null) {
    aConfirmBox = new jt_AppConfirm(jt_AppAlert.Warning, confirmYes, confirmNo);
    aConfirmBox.setTitle("Boite de Dialogue - Action!");
    }
  aConfirmBox.moveTo(e.clientX, e.clientY + document.body.scrollTop);
  }


function Envoyer(ART,DES,P,FSB,FSBMax,SUPP,INTER,MemMIN,MemMAX,STATUT,COMP,E,V){
//
 

//alert(E);
var Message="";
var integrer="Les composants suivants sont integrés à cette carte mère :<br><br>";
var video=INTER.search(/VIDEO/);
var reseau=INTER.search(/RESEAU/);
var son=INTER.search(/SON/);
var alim=INTER.search(/ALIM/);
var watt=INTER.search(/450W/);
var antec=DES.search(/ANTEC/);
//var fort=DES.search(/FORTRON/);
//alert(reseau);
i=1;
if(video != -1) {integrer += "Carte graphique<br>"; i++;}
if(reseau != -1) {integrer += "Carte réseau<br>"; i++}
if(son != -1) {integrer += "Carte son<br>";i++}



if(integrer!= "Les composants suivants sont integrés à cette carte mère :<br><br>")    
//alert(integrer);
Message=integrer;
 //MyAppAlert(document.getElementById("wsd_content").innerHTML + integrer, document.getElementById("wsd_title").innerHTML);
 //alertDialog.setWidth(boxWidth);

//}

//


if((INTER=="VENTILATEUR")&&(COMP=="Processeurs")){
Message="Ce processeur est livré avec un <b>ventilateur</b>.<br>Cependant vous pouvez en commander un autre si vous le désirez.<br><br>";
//  MyAppAlert(document.getElementById("wsd_content").innerHTML + Ventilo, document.getElementById(cid + "_title").innerHTML);
  //alertDialog.setWidth(boxWidth);

 //alert("Ce composant est livré avec un ventilateur, cependant vous pouvez en commander un autre si vous le désirez.\n\n");
 }

if(STATUT=="ATTENTE ARRIVAGE"){
// alert("Ce "+ "est en attente d'arrivage.\nVotre configuration ne sera prête que lorsque tous les composants commandés seront disponibles en stock.\n\n");
Message +="Ce(tte) "+COMP +" est en attente d'arrivage.<br>Votre configuration ne sera prête que lorsque tous les composants commandés seront disponibles en stock.<br><br>";
 }
else if(STATUT=="PROCHAINEMENT"){
 //alert("Ce composant sera disponible prochainement.\nVotre configuration ne sera prête que lorsque tous les composants commandés seront disponibles en stock.<br><br>");
Message += "Ce(tte) "+COMP +" sera disponible prochainement.<br>Votre configuration ne sera prête que lorsque tous les composants commandés seront disponibles en stock.";
 }

if(alim != -1) {Message = "Ce boitier est livré avec une <b>alimentation</b>.<br>Cependant vous pouvez en commander une autre si vous le désirez.<br><br>";}
/*
if((watt == -1)&&(V!="")) {
 //if(V!=""){
//  alert(V)
  Message = "Une alimentation FORTRON ou ANTEC d'au moins <b>450W</b> est fortement recommandée pour la carte graphique selectionnée.<br><br>";
 //}

}else if((antec == -1)&&(V!="")) {
 Message = "Une alimentation FORTRON ou ANTEC d'au moins <b>450W</b> est fortement recommandée pour la carte graphique selectionnée.<br><br>";
}
*/
 document.stationmaker1.codeart.value=ART;
 document.stationmaker1.designation.value=DES;
 document.stationmaker1.prixttc.value=P;
 document.stationmaker1.ecotax.value=E;
 document.stationmaker1.fsb.value=FSB;
 document.stationmaker1.fsb_max.value=FSBMax;
 document.stationmaker1.support.value=SUPP;
 document.stationmaker1.interf.value=INTER;
 document.stationmaker1.Mem_min.value=MemMIN;
 document.stationmaker1.Mem_max.value=MemMAX;
 
 if(Message!=""){
   //aConfirmBox.askUser(Message);
   //
   //MyAppAlert(document.getElementById("wsd_content").innerHTML + Message, document.getElementById("wsd_title").innerHTML);
   //alertDialog.setWidth(boxWidth);
   //alert(Message);
   //document.getElementById("pop").innerHTML + Message;
   
   document.stationmaker1.msg.value=Message;
 
   document.stationmaker1.submit();
   //pop(Message);
   //
 }else
  document.stationmaker1.submit();

}

function Envoyer1(ART,DES,P,id_r,E){

 //alert(ART+" "+DES);
 //alert("Envoyer "+ART+" "+DES+" "+P);
 if(document.getElementById(id_r).checked==true){
  document.stationmaker1["codeart_update"].value="update";
 }
 
 document.stationmaker1.codeart.value=ART;
 document.stationmaker1.designation.value=DES;
 document.stationmaker1.prixttc.value=P;
 document.stationmaker1.ecotax.value=E;
 
 //if(confirm('Voulez vous valider l\'article selectionné ?')){
   document.stationmaker1.submit();
   //document.stationmaker1.temoin.value=0;
// }

}

function Envoyer2(num,ART,DES,P,E){

//alert(num +" "+ART+" "+DES);
//alert("Envoyer2 "+ART+" "+DES+" "+P);

document.stationmaker["codeart"].value=ART;
document.stationmaker["designation"].value=DES;
document.stationmaker["prixttc"].value=P;
document.stationmaker["ecotax"].value=E;

if(document.stationmaker["art"+num].checked==true){
 
 document.stationmaker["coche"].value="1";
 //alert(document.stationmaker["coche"].value);
}else{
 //alert("décoché");
 document.stationmaker["coche"].value="";
}

//if(document.stationmaker["art"+num].checked==true){
 //if(confirm('Voulez vous valider le logiciel selectionné ?')){
   document.stationmaker.submit();
  document.stationmaker.temoinlog.value=0;
 //}
 //}
}
	      

function nbreSelection(num,nbre,produit,selObj,designation,prix,ART,FSB,FSBMax,SUPP,INTER,MemMIN,MemMAX,ecotax){
 var Selection;
 var ok=false;
 
  Selection=parseInt(selObj.options[selObj.selectedIndex].value);
  tmp = parseInt(document.stationmaker.temoin.value);
 document.stationmaker.produit.value=produit;
 
 if(Selection==2){ 
  document.stationmaker["art"+num].checked=true;
  document.stationmaker.temoin.value = 2; 
  ok=true;
 } else if(Selection==1){
   document.stationmaker["art"+num].checked=true;
   document.stationmaker.temoin.value = 1; 
   selObj.selectedIndex=0;
   ok=true;
 }
  
  if (ok==true){
   document.stationmaker["codeart1"].value=ART;
   document.stationmaker["designation1"].value=designation;
   document.stationmaker["prixttc1"].value=prix;
   document.stationmaker["ecotax1"].value=ecotax;
   document.stationmaker["fsb1"].value=FSB;
   document.stationmaker["fsb_max1"].value=FSBMax;
   document.stationmaker["support1"].value=SUPP;
   document.stationmaker["interf1"].value=INTER;
   document.stationmaker["Mem_min1"].value=MemMIN;
   document.stationmaker["Mem_max1"].value=MemMAX;
   document.stationmaker["q1"].value=Selection;
   

  if(document.stationmaker["CurrQte"].value!=""){
    document.stationmaker["codeart_update"].value="update";
   }
 
   ok=false;   
  
   if(document.stationmaker["CurrQte"].value==""){ 
    document.stationmaker.msg.value="Pour vous permettre de choisir plusieurs composants,<br>le passage automatique à la page suivante a été desavtivé.<br />";
   }

   if(document.stationmaker.temoin.value != 0){
     document.stationmaker.submit();
     document.stationmaker.temoin.value=0;
   }
 } 
}

function nbreCheckBox(num,nbre_max,nbre,produit,designation,prix,ART,FSB,FSBMax,SUPP,INTER,MemMIN,MemMAX,ecotax){ 

var tmp =0; 
var nbre_max; 
var nbre; 
var num; 
var first=false;
var second=false;
var annulé=false;
//if(document.stationmaker.temoin.value=="")document.stationmaker.temoin.value=0;
 //if(produit=="")produit='Logiciels';
 tmp = parseInt(document.stationmaker.temoin.value);

 if((document.stationmaker["art"+num].checked)==true){ 
  //alert("ok");
  tmp =tmp+nbre ;
  document.stationmaker.temoin.value = tmp;
  //if(document.stationmaker.q1.value=="") first=true; else second=true;
  document.stationmaker["codeart1"].value=ART;
  document.stationmaker["designation1"].value=designation;
  document.stationmaker["prixttc1"].value=prix;
  document.stationmaker["ecotax1"].value=ecotax;
  document.stationmaker["fsb1"].value=FSB;
  document.stationmaker["fsb_max1"].value=FSBMax;
  document.stationmaker["support1"].value=SUPP;
  document.stationmaker["interf1"].value=INTER;
  document.stationmaker["Mem_min1"].value=MemMIN;
  document.stationmaker["Mem_max1"].value=MemMAX;
  document.stationmaker["q1"].value=1;
 }else if((document.stationmaker["art"+num].checked)==false){ 
  document.stationmaker["codeart_supp"].value=ART;
 }
  if(document.stationmaker["CurrQte"].value==""){ 
   document.stationmaker.msg.value="Pour vous permettre de choisir plusieurs composants,<br>le passage automatique à la page suivante a été desavtivé.<br />";
  }   
  document.stationmaker.submit();
  document.stationmaker.temoin.value=0;
 
 

/*else { 
  document.stationmaker["art"+num].checked=false;
  alert("decoché art: "+num); 
 if(document.stationmaker["qte"+num].selectedIndex==1){
   document.stationmaker["qte"+num].selectedIndex=0;
   tmp=0;  
   
  }else{
  tmp = tmp-nbre;
  }
  document.stationmaker.temoin.value = tmp;
  annulé=true;
 } 
 
 if(tmp > nbre_max){
  tmp = tmp-nbre;
  document.stationmaker.temoin.value = tmp;
  alert('Désolé, vous ne pouvez choisir que ' + nbre_max +' '+  produit); 
  document.stationmaker["art"+num].checked=false; 
  //alert("tmp > nbre_max"); 
 } 
 if((annulé==true)&&(document.stationmaker.q2.value!="")){
  document.stationmaker["codeart2"].value="";
  document.stationmaker["designation2"].value="";
  document.stationmaker["prixttc2"].value="";
  document.stationmaker["fsb2"].value="";
  document.stationmaker["fsb_max2"].value="";
  document.stationmaker["support2"].value="";
  document.stationmaker["interf2"].value="";
  document.stationmaker["Mem_min2"].value="";
  document.stationmaker["Mem_Max2"].value="";
  document.stationmaker["q2"].value="";
   alert('A2eme');
  annulé=false;
 }else if((annulé==true)&&(document.stationmaker.q1.value!="")){
  document.stationmaker["codeart1"].value="";
  document.stationmaker["designation1"].value="";
  document.stationmaker["prixttc1"].value="";
  document.stationmaker["fsb1"].value="";
  document.stationmaker["fsb_max1"].value="";
  document.stationmaker["support1"].value="";
  document.stationmaker["interf1"].value="";
  document.stationmaker["Mem_min1"].value="";
  document.stationmaker["Mem_Max1"].value="";
  document.stationmaker["q1"].value="";
  alert('A1er');
  annulé=false;
 }
 if(first==true){
  document.stationmaker["codeart1"].value=ART;
  document.stationmaker["designation1"].value=designation;
  document.stationmaker["prixttc1"].value=prix;
  document.stationmaker["fsb1"].value=FSB;
  document.stationmaker["fsb_max1"].value=FSBMax;
  document.stationmaker["support1"].value=SUPP;
  document.stationmaker["interf1"].value=INTER;
  document.stationmaker["Mem_min1"].value=MemMIN;
  document.stationmaker["Mem_Max1"].value=MemMAX;
  document.stationmaker["q1"].value=1;
 alert('1er');
 }
 if(second==true){
  document.stationmaker["codeart2"].value=ART;
  document.stationmaker["designation2"].value=designation;
  document.stationmaker["prixttc2"].value=prix;
  document.stationmaker["fsb2"].value=FSB;
  document.stationmaker["fsb_max2"].value=FSBMax;
  document.stationmaker["support2"].value=SUPP;
  document.stationmaker["interf2"].value=INTER;
  document.stationmaker["Mem_min2"].value=MemMIN;
  document.stationmaker["Mem_Max2"].value=MemMAX;
  document.stationmaker["q2"].value=1;
 alert('2eme');
 }

  alert("temoin final : "+tmp);
  if((tmp == 1)||(tmp == 2)){

 //if(confirm('Voulez vous valider ce(s) '+  produit +'(s) ?')){
   document.stationmaker.submit();
   document.stationmaker.temoin.value=0;
// }

 }*/ 
} 

function nbreCheckLog(num,produit,designation,prix,ART,ecotax){ 
 var tmp=0;
 //alert(num+' '+produit+' '+designation+' '+prix+' '+ART);
 tmp = parseInt(document.stationmaker.temoinlog.value);
  //alert(document.stationmaker.temoinlog.value); 
 
 if((document.stationmaker["art"+num].checked)==true){ 
  document.stationmaker["codeart"+num].value=ART;
  document.stationmaker["designation"+num].value=designation;
  document.stationmaker["prixttc"+num].value=prix;
  document.stationmaker["ecotax"].value=ecotax;
  document.stationmaker["coche"+num].value=1;
  document.stationmaker.temoinlog.value=tmp+1;
 }else{
  document.stationmaker["codeart"+num].value="";
  document.stationmaker["designation"+num].value="";
  document.stationmaker["prixttc"+num].value="";
  document.stationmaker["ecotax"].value="";
  document.stationmaker["coche"+num].value=0;
  document.stationmaker.temoinlog.value = tmp-1;
 }
  if(document.stationmaker.temoinlog.value>=1){
    alert(document.stationmaker.temoinlog.value);
    if(confirm('Voulez-vous valider le(s) logiciel(s) selectionné(s) ?')){
      document.stationmaker.submit();
      document.stationmaker.temoinlog.value=0;
    }
  }
//  document.stationmaker.submit();

}

function SupprCommande(){
  //alert(document.location);
     if(confirm('Etes-vous sûr de vouloir supprimer cette commande ?')){
       top.document.location = 'config.php?suppr=all';
     }

 return
 
}


var TitreBar = "";

var boxWidth = 240;

function testAlert(cid) {
        boxWidth = 320;
        MyAppAlert(document.getElementById(cid + "_content").innerHTML, document.getElementById(cid + "_title").innerHTML,"btn_envoyer.gif");
        alertDialog.setWidth(boxWidth);
        }
function toggleWidth() {
        boxWidth = (boxWidth == 240) ? 300 : 240;
        alertDialog.setWidth(boxWidth);
        alertDialog.show();
        }

var aConfirmBox = null;
var aPromptBox = null;
var veilBox = null;

function hideDialogs() {
        if (alertDialog) alertDialog.hide();
        if (aConfirmBox) aConfirmBox.hide();
        if (aPromptBox) aPromptBox.hide();
        if (veilBox) veilBox.hide();
        }
function veilClass(className) {
        jt_Veil.veil.className = ""; // disable
        for (var prop in jt_Veil.css) jt_Veil.veil.style[prop] = "";
        jt_Veil.veil.className = className; // CSS className
        }
function allVeils(ev) {
        var e = jt_fixE(ev);
        if (veilBox == null) {
                veilBox = new jt_AppAlert(jt_AppAlert.Info);
                veilBox.setTitle(document.getElementById("veils_title").innerHTML);
                veilBox.setContent(document.getElementById("veils_content").innerHTML);
                }
        veilBox.show();
        veilBox.moveTo(e.clientX, e.clientY + document.body.scrollTop);
        }

