
var sah=screen.availHeight;
var saw=screen.availWidth;
var sh=screen.height;
var sw=screen.width;
var wiw=0;
var wih=0;
var va=0

function sznav() {
if( typeof( window.innerWidth ) == 'number' ) {
  wiw=window.innerWidth;
  wih=window.innerHeight;
  }
else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
  wiw=window.document.documentElement.clientWidth;
  wih=window.document.documentElement.clientHeight;
  }
else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
  wiw=window.document.body.clientWidth;
  wih=window.document.body.clientHeight;
  }
}

function affnav(){
document.getElementById("hwih").value=wih;
document.getElementById("wwiw").value=wiw;
document.getElementById("hmin").value=vwh;
document.getElementById("wmin").value=vww;
}

function alertnav(vwh,vww){
//if (document.cookie="testnav"+"!=="+"1") {
document.getElementById("hwih").value=wih;
document.getElementById("wwiw").value=wiw;
document.getElementById("hmin").value=vwh;
document.getElementById("wmin").value=vww;
	if (wih<vwh || wiw<vww) 	{document.getElementById("alertsize").style.visibility="visible";}
	else 			{document.getElementById("alertsize").style.visibility="hidden";}
document.cookie="testnav"+"="+"1";
if (navigator.userAgent.search("MSIE") >0)  document.getElementById("pasbonnav").style.visibility="hidden";
//}
}

function layheight(nlay,marg){
if(wih>marg){
ecart=wih-marg
if (ecart/2 !== Math.round(ecart/2)) {ecart=ecart-1;}
document.getElementById(nlay).style.height=ecart;
document.getElementById("hcontent").value=ecart;
	}
if (nlay=="conteneur1") {document.getElementById("bottomline").style.top=ecart;}
}

function laycenter(nlay,marg){
if(wih>marg){
ecart=wih-marg
if (ecart/2 !== Math.round(ecart/2)) {ecart=ecart-1;}
document.getElementById(nlay).style.height=ecart;
document.getElementById(nlay).style.marginTop=-(ecart)/2;
document.getElementById("hcontent").value=ecart;
	}
}


function ftop(nlay,hval,marg) {
if (wih<hval-marg) {
//document.getElementById(nlay).style.backgroundColor="blue";
document.getElementById(nlay).style.top=hval-marg;
document.getElementById("htop").value=hval-marg;
}
else {
//document.getElementById(nlay).style.backgroundColor="green";
document.getElementById(nlay).style.top="100%";
document.getElementById(nlay).style.marginTop="-20";
document.getElementById("htop").value=hval-marg;
}
}



//------------------------------------------------------- AFFICHAGES -------------------------------------------

function cover(name) {
document.getElementById(name).style.visibility="hidden";
}
function see(name) {
document.getElementById(name).style.visibility="visible";
}
function coverp(name,info) {
document.getElementById(name).style.visibility="hidden";
}
function seep(name,info) {
document.getElementById(name).style.visibility="visible";
document.getElementById(name).innerHTML= info
}
function seetable(name,visi) {
document.getElementById(name).style.display=visi;
}
function changeCouleur(cellule,couleurFond) {
cellule.style.backgroundColor = couleurFond;
}
function bgcol(id,couleurFond) {
document.getElementById(id).style.backgroundColor=couleurFond;
}
function txtcol(id,couleurtxt) {
document.getElementById(id).style.color=couleurtxt;
}

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="#60BE01";
}
}


//------------------------------------------------------- APPELS PAGES -------------------------------------------
var ww= null
function popimg(id,fs,vp)
{
if (navigator.userAgent.search("MSIE") >0) 
{
ww = window.open(''+vp+'common/track_img.asp?id='+id+'&fs='+fs+'','popimage','width=10,height=10,top=0,left=0');
}
else
{
ww = window.open(''+vp+'common/track_img.asp?id='+id+'&fs='+fs+'','popimage','width=800,height=700,top=0,left=0');
}
ww.focus();
}

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()
{
if (ww) ww.close();
ww = null;
}

//------------------------------------------------------- ACTIONS DATA-------------------------------------------

function supprime(isup,page,parpage,typ_prod,sfamille,tri,filtre) 
{
if (confirm('Souhaitez vous supprimer ce produit?')) {
document.location="suppr_prod.asp?id="+ isup +"&pg="+ page +"&parpage="+ parpage +"&typ_prod="+ typ_prod +"&sfamille="+ sfamille +"&tri=" +tri +"&filtre=" +filtre
} 
}

function suppcom(idcom) 
{
if (confirm('Attention, vous allez supprimer cette commande!')) {
document.location="suppr_com.asp?id="+ idcom 
} 
}
