var atn=0;
var hwn
var wwn
var hscr
var wscr

function detnav() {
if (navigator.appName == "Microsoft Internet Explorer") {
	hwn=window.document.body.offsetHeight;
	wwn=window.document.body.offsetWidth;
}
else	{
	hwn=window.innerHeight;
	wwn=window.innerWidth;
}
hscr=screen.availHeight;
wscr=screen.availWidth;
FixeCookie('vnav',navigator.appName);
FixeCookie('vsys',navigator.platform);
FixeCookie('vssz',wscr+"*"+hscr);
//document.getElementById("val_nav").value=navigator.appName;
//document.getElementById("val_sys").value=navigator.platform;
//document.getElementById("val_screen").value=screen.availWidth+"*"+screen.availHeight;
//document.getElementById("val_window").value=wwn+"*"+hwn;
}

//var bgoption = GetValeurCookie("bgoption");

function bodyi(val){
if(val==null)
	{
	if (bgoption!==null)
		{
		document.body.style.backgroundImage="url(images/"+bgoption+".gif)";
		FixeCookie ("bgoption",bgoption);
		}
	else
		{
		document.body.style.backgroundImage="url(images/striped_2.gif)";
		}
	}
else
	{
	document.body.style.backgroundImage="url(images/"+val+".gif)";
	FixeCookie ("bgoption", val);
	}
}

function layrsz(idl,param,val) {
if (idl=="contentpage" || idl=="bottom") val=hwn+parseInt(val);
if (param=="height") document.getElementById(idl).style.height=val+"px";
if (param=="top") document.getElementById(idl).style.top=val+"px";
//alert (val);
}

function wszmini() {
/*
if (msg=="_fr") {
	ms="La zone d\'affichage de votre navigateur ("+document.body.clientHeight+" pixel) est trop réduite\net ne vous permet pas une navigation convenable dans CaillouBaton.";
	ms +="\nSVP, ajustez les affichages des menus, barres des tâches,";
	ms +="\net affichage écran en 1152x864 mini.";
	}
if (msg!=="_fr") {
	ms="SORRY ! The available height of your screen is really too small ("+document.body.clientHeight+" pixel)";
	ms +="\nand does not allow a correct circulation in CaillouBaton.";
	ms +="\nPlease, adjust menubars and screen display properties (1152x864 mini).";
	}
*/
var msg_task
window.resizeTo(830,screen.availHeight);	
if (document.body.clientHeight<730) document.getElementById("szalert").style.visibility="visible";
document.getElementById("sh").value=screen.height;
document.getElementById("sw").value=screen.width;
document.getElementById("ecran").style.height=Math.floor(screen.height/5);
w_ecran=Math.floor(screen.width/5)
document.getElementById("ecran").style.width=w_ecran;
document.getElementById("sah").value=screen.availHeight;

document.getElementById("fenetre").style.height=Math.floor((screen.availHeight/5)-2);
document.getElementById("fenetre").style.width=Math.floor(w_ecran/4*3);
//document.getElementById("wh").value=window.outerHeight;
document.getElementById("wch").value=document.body.clientHeight;
document.getElementById("fenetre_u").style.marginTop=Math.floor(-(document.body.clientHeight/5));
document.getElementById("fenetre_u").style.height=Math.floor((document.body.clientHeight/5)-2);
if (screen.availHeight<screen.height) {
h_task=screen.height-screen.availHeight
document.getElementById("task").style.visibility="inherit";
document.getElementById("task").style.marginTop=Math.floor(-(h_task/5)+1);
document.getElementById("task").style.height=Math.floor(h_task/5);
document.getElementById("htask").value=h_task;
document.getElementById("msgtask").style.visibility="inherit";
}
}

function cover(name) {
document.getElementById(name).style.visibility="hidden";
}
function see(name) {
document.getElementById(name).style.visibility="visible";
}
function seetable(name,visi) {
document.getElementById(name).style.display=visi;
}
function rockcol(cid,col1,col2) {
document.getElementById(cid).style.backgroundColor = col1;
document.getElementById(cid).style.color = col2;
}

function prcs(){
	document.getElementById("titre").value="0";
	document.getElementById("desc").value="0";
	document.getElementById("chstr").value="";
	document.getElementById("titre").checked=false;
	document.getElementById("desc").checked=false;
}

//****************************************************************************SEEFEL
function lflash(val){
document.getElementById("layflash").style.display=val;
}

function fheight(elem,marg){
if (navigator.appName == "Microsoft Internet Explorer") {
	helem=window.document.body.offsetHeight-marg;
	}
else	{
	helem=window.innerHeight-marg;
}
//document.getElementById("val_helem").value=helem;

if (elem) {
document.getElementById(elem).style.height=helem;
}
if (elem=="fd") {
document.getElementById("cont").style.height=helem-90;
}
}

var oo=null

function pageopen(nom,id,tgt,tit,rub){
window.open(nom+"?pid="+id+"&tit="+tit+"&idr="+rub,tgt,"");
oo=1
}

function popimg(mpict, mtit, minfo)
{
w = window.open('','chargement','width=10,height=10,top=0,left=0');
w.document.write( "<html><head><title>"+mtit+"</title>\n" );
w.document.write( "<script language='JavaScript'>\n");
w.document.write( "IE5=NN4=NN6=false;\n");
w.document.write( "if(document.all)IE5=true;\n");
w.document.write( "else if(document.getElementById)NN6=true;\n");
w.document.write( "else if(document.layers)NN4=true;\n");
w.document.write( "function autoSize() {\n");
w.document.write( "if(IE5) self.resizeTo(document.images[0].width+10,document.images[0].height+80);\n");
w.document.write( "else if(NN6) self.sizeToContent();\n");
w.document.write( "else window.resizeTo(document.images[0].width+30,document.images[0].height+30);\n");
w.document.write( "self.focus();\n");
w.document.write( "}\n</scri");
w.document.write( "pt>\n");

w.document.write( "</head><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onLoad='javascript:autoSize();' onContextMenu='return false;'> \n");
w.document.write( "<a href='javascript:window.close();'><img src='"+mpict+"' border=0 alt='cliquer ici pour fermer' \n");
w.document.write( " onselectstart='return false' oncontextmenu='return false' ondragstart='return false'></a> \n");
w.document.write( " <span style='font-size:10px;font-family:verdana;color:gray;'><i>cliquez sur l''image pour fermer le popup</i> \n");
w.document.write( "<div style='position: absolute; width: 200px; left: 2px; top: 2px; height: 20px; z-index: 3; visibility: visible;'>" );
w.document.write( "<table><tr><td><font color='white' face='verdana' size='1'>"+minfo+"</font></td></tr></table></div>" );
w.document.write( "<div style='position: absolute; width: 200px; left: 3px; top: 3px; height: 20px; z-index: 2; visibility: visible;'>" );
w.document.write( "<table><tr><td><font face='verdana' size='1'>"+minfo+"</font></td></tr></table></div>" );
w.document.write( "</body></html>" );
w.document.close();
}


function changeCouleur(cellule,couleurFond) {
cellule.style.backgroundColor = couleurFond;
}

function coverp(name,info) {
document.getElementById(name).style.visibility="hidden";
}

function seep(name,info) {
document.getElementById(name).style.visibility="visible";
document.all.infoprod.innerHTML= info
}

var ww = null;
function popps(page,fenetre,largeur,hauteur,ratt,ratl,options)
{
var top = (screen.height-hauteur-17)/ratt;
var left = (screen.width-largeur-17)/ratl;
ww = window.open(page,fenetre,"top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
ww.focus();
}
function ferme(idw)
{
if (ww) ww.close(idw);
ww = null;
}

function supprime(page,isup,retour) 
{
if (confirm('Souhaitez vous supprimer cet élément ?')) {
document.location=page +"?id="+ isup +"&ret="+ retour
} 
}

function actualise(iact,page,parpage,typ_prod,sfamille,tri,filtre,refprod)
{
document.location="list_prod.asp?id="+ iact +"&pg="+ page +"&parpage="+ parpage +"&typ_prod="+ typ_prod +"&sfamille="+ sfamille +"&tri=" +tri +"&filtre=" +filtre+ "&refprod=" +refprod+ "#but"
} 

pv=0
pu=0
qte=0

function seelaycountry(val1,val2,val3) {
/*alert("la valeur saisie est : " + val1 +" \n la couche est : "+ val2);*/
if (val1=="d_diff")
	{
	see(val2);cover(val3);
	}
else	{
	see(val3);cover(val2);
	}
}

function cleancountry(nform,nfield) {
document.nform.nfield.value= '';
}

function checkl(val,orig,dest) {
strl=document.getElementById(orig).value.length
if (parseInt(strl) > parseInt(val)) 
{
document.getElementById(dest).value = "chaine trop longue";
document.getElementById(dest).style.color="#FF661C";
document.getElementById(dest).style.fontWeight="bold";
}
else
{
document.getElementById(dest).value = parseInt(val-strl) +" car. restant";
document.getElementById(dest).style.color="#9BBD24";
}
}

function bgcol(col,nc,el){
if (col==null){col="#FFAA5E";}
document.bgColor=col;
for (i=1; i<=nc; i++) 
	{
	(document.getElementById("col"+i).name==el) ? document.getElementById("col"+i).style.borderColor="black" : document.getElementById("col"+i).style.borderColor=col
	}
}


function redir(lien,param) {
document.location.href=lien+param;
}

function distab(targ,stat) {
document.getElementById(targ).style.display=stat;
}

function distaball(n,stat) {
for (i=0;i<n;i++) {
lay="detj"+i;
document.getElementById(lay).style.display=stat;
}
}

nbp=0;
function selbut(nbh,nhead,nbp,ipage,nimg)
{
nimg="url(images/"+nimg+")"
//document.getElementById("nbhvalue").value=nbh;
//document.getElementById("nheadvalue").value=nhead;
//document.getElementById("nbpvalue").value=nbp;
//document.getElementById("ipagevalue").value=ipage;
//document.getElementById("nimgvalue").value=nimg;

for (i=0;i<=nbp;i++)
	{
	if (document.getElementById("lpage"+i).name==ipage)
		{
		document.getElementById("lpage"+i).style.backgroundImage="url(images/trans.gif)";
		}
	else
		{
		document.getElementById("lpage"+i).style.backgroundImage=nimg;
		}
	}
for (j=0;j<nbh;j++)
	{
	if (document.getElementById("h"+j).name==nhead)
		{
		document.getElementById("h"+j).style.backgroundImage="url(images/trans.gif)";
		}
	else
		{
		document.getElementById("h"+j).style.backgroundImage=nimg;
		}
	}
}
