urlu=window.location.href;
var exp=urlu.indexOf("digic",0);
if (exp>0) {mg=urlu.substring(exp+5,exp+7);}
var nomfi="";
var nompa="";
var locate="";
var magul="";var magu=0;
var alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
window.moveTo(0,0);
window.resizeTo(screen.width, screen.height);

function test1(){
  nomfi = document.getElementById("nomfib").value
  nompa = document.getElementById("nompab").value

  if (nomfi == "")
    {alert("Entrez votre nom s'il-vous-plait!");document.getElementById("nomfib").value="";focusOnnomfi();}
  else { 
     if (nomfi.length > 3)
      {alert("N'entrez que 3 lettres ,s'il-vous-plait!");document.getElementById("nomfib").value="";focusOnnomfi();}
     else { 
        if (nomfi.length < 3)
         {alert("Entrez 3 lettres ,s'il-vous-plait!");document.getElementById("nomfib").value="";focusOnnomfi();}
        else { 
		focusOnnompa();
	}
     }
  }
}

function test2()
{
  nompa = document.getElementById("nompab").value
  nomfi = document.getElementById("nomfib").value

  if (nompa == "")
  	{alert("Entrez votre code s'il-vous-plait!");document.getElementById("nompab").value="";focusOnnompa();}
  else 
  { 
	  if (nompa.length > 5)
    		{alert("N'entrez que 5 chiffres ,s'il-vous-plait!");document.getElementById("nompab").value="";focusOnnompa();}
	  else 
	  {
		  if (nompa.length < 5)
    			{alert("Entrez 5 chiffres ,s'il-vous-plait!");document.getElementById("nompab").value="";focusOnnompa();}
		  else
		  {
			focusOnnomfi();
		  }
	  }
  }		
}
function ok() {
  nomfi = document.getElementById("nomfib").value
  nompa = document.getElementById("nompab").value
  nomco = document.getElementById("nomcod").value;nomco=nomco.toUpperCase();

if (nomfi == "")
    {alert("Entrez votre nom s'il-vous-plait!");document.getElementById("nomfib").value="";focusOnnomfi();}
else if (nomfi.length > 3)
    {alert("N'entrez que 3 lettres ,s'il-vous-plait!");document.getElementById("nomfib").value="";focusOnnomfi();}
else if (nomfi.length < 3)
    {alert("Entrez 3 lettres ,s'il-vous-plait!");document.getElementById("nomfib").value="";focusOnnomfi();}
else if ( nomfi.substr(0,1).search(/[a-zA-Z]/) == -1 || nomfi.substr(1,1).search(/[a-zA-Z]/) == -1 || nomfi.substr(2,1).search(/[a-zA-Z]/) == -1)
    {alert("N'entrez que 3 lettres,s'il-vous-plait!");document.getElementById("nomfib").value="";focusOnnomfi();}
else if (nompa == "")
    {alert("Entrez votre code s'il-vous-plait!");document.getElementById("nompab").value="";focusOnnompa();}
else if (!isFinite(nompa))
    { alert("Entrez 5 chiffres,s'il-vous-plait!");document.getElementById("nompab").value="";focusOnnompa();}
else if (nompa.length > 5)
    {alert("N'entrez que 5 chiffres ,s'il-vous-plait!");document.getElementById("nompab").value="";focusOnnompa();}
else if (nompa.length < 5)
    {alert("Entrez 5 chiffres ,s'il-vous-plait!");document.getElementById("nompab").value="";focusOnnompa();}
else if (nomfi+nompa=="XYZ99999" )
    {this.location.href="http://trocs.yellis.net/donnees/stats.html"}
else if (nomfi+nompa=="xyz99999" )
    {this.location.href="http://trocs.yellis.net/donnees/stats.html"}
// else if (nomco == "")
//     {alert("Entrez votre code confidentiel !");document.getElementById("nomcod").value="";focusOnnomco();}
// else if (nomco.length > 5)
//      {alert("N'entrez que 5 lettres ,s'il-vous-plait!");document.getElementById("nomcod").value="";focusOnnomco();}
// else if (nomco.length < 5)
//      {alert("Entrez 5 lettres ,s'il-vous-plait!");document.getElementById("nomcod").value="";focusOnnomco();}
// else if ( ( nomco.substr(0,1).search(/[a-zA-Z]/) == -1) || (nomco.substr(1,1).search(/[a-zA-Z]/) == -1) || (nomco.substr(2,1).search(/[a-zA-Z]/) == -1)  || (nomco.substr(3,1).search(/[a-zA-Z]/) == -1)  || (nomco.substr(4,1).search(/[a-zA-Z]/) == -1))
//     {alert("N'entrez que 5 lettres,s'il-vous-plait!");document.getElementById("nomcod").value="";focusOnnomco();}

else {oka();}
}

function oka() {
magul=mg+nompa;magu=parseInt(magul,10);
magu1=Math.floor(magu/26);res1=magu-magu1*26;
magu2=Math.floor(magu1/26);res2=magu1-magu2*26;
magu3=Math.floor(magu2/26);res3=magu2-magu3*26;
magu4=Math.floor(magu3/26);res4=magu3-magu4*26;
magu5=Math.floor(magu4/26);res5=magu4-magu5*26;
aq1=alphabet.substr(res1,1);
aq2=alphabet.substr(res2,1);
aq3=alphabet.substr(res3,1);
aq4=alphabet.substr(res4,1);
aq5=alphabet.substr(res5,1);
codol=aq5+aq2+aq3+aq1+aq4;
locate = "?mg="+mg+"&dep=" + nomfi + nompa ;this.location.href = "http://trocs.yellis.net/donnees/cpte.php" + locate+"&cc="+nomco;
}

function ok7() {
  nomfi = document.getElementById("nomfib").value
  nompa = document.getElementById("nompab").value
  nomco = document.getElementById("nomcod").value;nomco=nomco.toUpperCase();

if (nomfi == "")
    {alert("Entrez votre nom s'il-vous-plait!");document.getElementById("nomfib").value="";focusOnnomfi();}
else if (nomfi.length > 3)
     {alert("N'entrez que 3 lettres ,s'il-vous-plait!");document.getElementById("nomfib").value="";focusOnnomfi();}
else if (nomfi.length < 3)
     {alert("Entrez 3 lettres ,s'il-vous-plait!");document.getElementById("nomfib").value="";focusOnnomfi();}
else if ( nomfi.substr(0,1).search(/[a-zA-Z]/) == -1 || nomfi.substr(1,1).search(/[a-zA-Z]/) == -1 || nomfi.substr(2,1).search(/[a-zA-Z]/) == -1)
     {alert("N'entrez que 3 lettres,s'il-vous-plait!");document.getElementById("nomfib").value="";focusOnnomfi();}
else if (nompa == "")
     {alert("Entrez votre code s'il-vous-plait!");document.getElementById("nompab").value="";focusOnnompa();}
else if (!isFinite(nompa))
     { alert("Entrez 5 chiffres,s'il-vous-plait!");document.getElementById("nompab").value="";focusOnnompa();}
else if (nompa.length > 5)
     {alert("N'entrez que 5 chiffres ,s'il-vous-plait!");document.getElementById("nompab").value="";focusOnnompa();}
else if (nompa.length < 5)
     {alert("Entrez 5 chiffres ,s'il-vous-plait!");document.getElementById("nompab").value="";focusOnnompa();}
else if (nomfi+nompa=="XYZ99999" )
     {this.location.href="http://trocs.yellis.net/donnees/stats.html"}
else if (nomfi+nompa=="xyz99999" )
     {this.location.href="http://trocs.yellis.net/donnees/stats.html"}
// else if (nomco == "")
//     {alert("Entrez votre code confidentiel !");document.getElementById("nomcod").value="";focusOnnomco();}
// else if (nomco.length > 5)
//     {alert("N'entrez que 5 lettres ,s'il-vous-plait!");document.getElementById("nomcod").value="";focusOnnomco();}
// else if (nomco.length < 5)
//     {alert("Entrez 5 lettres ,s'il-vous-plait!");document.getElementById("nomcod").value="";focusOnnomco();}
// else if ( ( nomco.substr(0,1).search(/[a-zA-Z]/) == -1) || (nomco.substr(1,1).search(/[a-zA-Z]/) == -1) || (nomco.substr(2,1).search(/[a-zA-Z]/) == -1)  || (nomco.substr(3,1).search(/[a-zA-Z]/) == -1)  || (nomco.substr(4,1).search(/[a-zA-Z]/) == -1))
//     {alert("N'entrez que 5 lettres,s'il-vous-plait!");document.getElementById("nomcod").value="";focusOnnomco();}

else {okb();}
}

function okb() {
magul=mg+nompa;magu=parseInt(magul,10);
magu1=Math.floor(magu/26);res1=magu-magu1*26;
magu2=Math.floor(magu1/26);res2=magu1-magu2*26;
magu3=Math.floor(magu2/26);res3=magu2-magu3*26;
magu4=Math.floor(magu3/26);res4=magu3-magu4*26;
magu5=Math.floor(magu4/26);res5=magu4-magu5*26;
aq1=alphabet.substr(res1,1);
aq2=alphabet.substr(res2,1);
aq3=alphabet.substr(res3,1);
aq4=alphabet.substr(res4,1);
aq5=alphabet.substr(res5,1);
codol=aq5+aq2+aq3+aq1+aq4;
locate = "?mg="+mg+"&dep=" + nomfi + nompa ;
this.location.href = "http://trocs.yellis.net/donnees/stokn.php" + locate+"&cc="+nomco;
}


function ok3() {
  this.location.href = "trocxx"+mg+".html";
}
function ok4() {
  this.location.href = "index.html";
}
function ok9() {
  nomfi = document.getElementById("nomfib").value
  nompa = document.getElementById("nompab").value
  nomco = document.getElementById("nomcod").value;nomco=nomco.toUpperCase();
if (mig=="99") { maga  = document.getElementById("select").value} else {maga=mig}


if (maga == "99")
  {alert("Choisissez un magasin !")}
else if (nomfi == "")
     {alert("Entrez votre nom s'il-vous-plait!");document.getElementById("nomfib").value="";focusOnnomfi();}
else if (nomfi.length > 3)
     {alert("N'entrez que 3 lettres ,s'il-vous-plait!");document.getElementById("nomfib").value="";focusOnnomfi();}
else if (nomfi.length < 3)
     {alert("Entrez 3 lettres ,s'il-vous-plait!");document.getElementById("nomfib").value="";focusOnnomfi();}
else if ( ( nomfi.substr(0,1).search(/[a-zA-Z]/) == -1) || (nomfi.substr(1,1).search(/[a-zA-Z]/) == -1) || (nomfi.substr(2,1).search(/[a-zA-Z]/) == -1) )
     {alert("N'entrez que 3 lettres,s'il-vous-plait!");document.getElementById("nomfib").value="";focusOnnomfi();}
else if (!isFinite(nompa))
     { alert("Entrez 5 chiffres,s'il-vous-plait!");document.getElementById("nompab").value="";focusOnnompa();}
else if (nompa == "")
     {alert("Entrez votre code s'il-vous-plait!");document.getElementById("nompab").value="";focusOnnompa();}
else if (nompa.length > 5)
     {alert("N'entrez que 5 chiffres ,s'il-vous-plait!");document.getElementById("nompab").value="";focusOnnompa();}
else if (nompa.length < 5)
     {alert("Entrez 5 chiffres ,s'il-vous-plait!");document.getElementById("nompab").value="";focusOnnompa();}
else if ( nomfi+nompa=="XYZ99999" )
     {this.location.href="http://trocs.yellis.net/donnees/stats.html"}
else if (nomfi+nompa=="xyz99999" )
     {this.location.href="http://trocs.yellis.net/donnees/stats.html"}
// else if (nomco == "")
//     {alert("Entrez votre code confidentiel !");document.getElementById("nomcod").value="";focusOnnomco();}
// else if (nomco.length > 5)
//     {alert("N'entrez que 5 lettres ,s'il-vous-plait!");document.getElementById("nomcod").value="";focusOnnomco();}
// else if (nomco.length < 5)
//     {alert("Entrez 5 lettres ,s'il-vous-plait!");document.getElementById("nomcod").value="";focusOnnomco();}
// else if ( ( nomco.substr(0,1).search(/[a-zA-Z]/) == -1) || (nomco.substr(1,1).search(/[a-zA-Z]/) == -1) || (nomco.substr(2,1).search(/[a-zA-Z]/) == -1)  || (nomco.substr(3,1).search(/[a-zA-Z]/) == -1)  || (nomco.substr(4,1).search(/[a-zA-Z]/) == -1))
//     {alert("N'entrez que 5 lettres,s'il-vous-plait!");document.getElementById("nomcod").value="";focusOnnomco();}

else {okq();}
}

function okq() {
magul=maga+nompa;magu=parseInt(magul,10);
magu1=Math.floor(magu/26);res1=magu-magu1*26;
magu2=Math.floor(magu1/26);res2=magu1-magu2*26;
magu3=Math.floor(magu2/26);res3=magu2-magu3*26;
magu4=Math.floor(magu3/26);res4=magu3-magu4*26;
magu5=Math.floor(magu4/26);res5=magu4-magu5*26;
aq1=alphabet.substr(res1,1);
aq2=alphabet.substr(res2,1);
aq3=alphabet.substr(res3,1);
aq4=alphabet.substr(res4,1);
aq5=alphabet.substr(res5,1);
codol=aq5+aq2+aq3+aq1+aq4;
if (document.getElementById("first").choice[0].checked)
{this.location.href="http://trocs.yellis.net/donnees/cpte.php?mg="+maga+"&dep="+nomfi+nompa+"&cc="+nomco+"&tex="+tex;}
else
{this.location.href="http://trocs.yellis.net/donnees/stokn.php?mg="+maga+"&dep="+nomfi+nompa+"&cc="+nomco+"&tex="+tex;}
}
function affic(){
  maga  = document.getElementById("select").value
  if (maga==99) {maga=24}
  document.getElementById("prev").src=""+maga+"photo.jpg"
}
function okw() {
magul=maga+"00000";magu=parseInt(magul,10);
magu1=Math.floor(magu/26);res1=magu-magu1*26;
magu2=Math.floor(magu1/26);res2=magu1-magu2*26;
magu3=Math.floor(magu2/26);res3=magu2-magu3*26;
magu4=Math.floor(magu3/26);res4=magu3-magu4*26;
magu5=Math.floor(magu4/26);res5=magu4-magu5*26;
aq1=alphabet.substr(res1,1);
aq2=alphabet.substr(res2,1);
aq3=alphabet.substr(res3,1);
aq4=alphabet.substr(res4,1);
aq5=alphabet.substr(res5,1);
codol=aq5+aq2+aq3+aq1+aq4;
}
