var hwn=0;
var wwn=0;
var nav="";

function detnav() {
if (navigator.appName == "Microsoft Internet Explorer") 
	{
	hwn=window.document.body.offsetHeight;
	wwn=window.document.body.offsetWidth;
//	nav="iexp";
	}
else	{
	hwn=window.innerHeight;
	wwn=window.innerWidth;
//	nav="ffox";
	}
//alert (hwn);
}

function distab(name,val) {
document.getElementById(name).style.display=val;
}

function cover(name) {
document.getElementById(name).style.visibility="hidden";
}

function see(name) {
document.getElementById(name).style.visibility="visible";
}

function movlay(nid,arg,val) {
if (arg=="top") document.getElementById(nid).style.top=hwn-val;
if (arg=="height") document.getElementById(nid).style.height=hwn-val;
}

function ckf() {
var f=document.forms.fmaj;
//alert(f.elements.length);
for(i=0;i<f.elements.length;++i)
if (f[i].value=="")
	{
//	alert (f[i].value);
	f[i].value=0;
	}
//f.submit();
}

function ckfaddress() {
var f=document.formnlieu;
if ((f.adresse.value=="") || (f.ville.value=="")) {document.getElementById('msgdist').style.display="block";}
else 
	{
	strmaps="http://";
	document.getElementById('msgdist').href.location=strmaps;
	}
}

function update() {
distab("maskupdate","block");document.fmaj.submit();
}

function preview_i(pimg){
//alert (pimg);
document.getElementById("lprevimg").style.display="block";
document.getElementById("previmg").src=pimg;
document.getElementById("previmg").style.width=100;
document.getElementById("previmg").style.borderWidth=1;
}


function bgmenu(btn,ni,fd1,fd2){
for (i=0;i<=ni;i++) {
(document.getElementById("b"+i).name==btn) ? document.getElementById("b"+i).style.backgroundColor=fd2 : document.getElementById("b"+i).style.backgroundColor=fd1
}
}

function resizePopUp(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+31);\n");
w.document.write( "else if(NN6) self.sizeToContent();\n");
w.document.write( "else window.resizeTo(document.images[0].width+20,document.images[0].height+40);\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();'> \n");
w.document.write( "<a href='javascript:window.close();'><img src='"+mpict+"' border=0 alt='cliquer ici pour fermer'></a> \n");
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(fenetre);
}
function ferme()
{
if (ww) ww.close();
ww = null;
}

function supprime(isup,nom,table,ret) 
{
if (confirm('Souhaitez vous supprimer '+nom+'?')) {
document.location="suppr_"+table+".asp?pid="+isup+"&ret="+ret
} 
}

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 Calculprix(formulaire) {
pu=parseFloat(formulaire.pu.value);	
qte=parseInt(formulaire.qte.value);
pcalcul=pu*100
formulaire.pv.value=pcalcul/100;
formulaire.resultat.value=parseFloat(pcalcul*qte/100);
resultat=formulaire.resultat.value;
}


function addcaddy(choix,fam,refsfam,sfam,num,page,delai,coeff)
{
if (qte<1) 
{
document.getElementById("msgqte").style.visibility="visible";
}
else
{
document.getElementById("msgqte").style.visibility="hidden";
document.location="addcaddy.asp?reffam="+choix+"&fam="+fam+"&refsfam="+refsfam+"&sfam="+sfam+"&num="+num+"&page="+page+"&qte="+qte+"&delai="+delai+"&coeff="+coeff;
}
}

function transcompte(choix,fam,refsfam,sfam,num,page)
{
document.location="compte.asp?reffam="+choix+"&fam="+fam+"&refsfam="+refsfam+"&sfam="+sfam+"&num="+num+"&page="+page
}

var f1=null;
var f2=null;
var f3=null;
var f4=null;

function ow(urlp,xy){
var wl=parseInt(screen.availWidth/2);
var wh=parseInt(screen.availHeight/2);
var opt="menubar=no,toolbar=no, locationbar=no, scrollbars=yes,resizable,yes";
if (xy==1){
x0=0;
y0=0;
f1=window.open(urlp,xy, opt);
f1.resizeTo(wl,wh);
f1.moveTo(x0,y0);
}
if (xy==2){
x0=parseInt(screen.availWidth/2);
y0=0;
f2=window.open(urlp,xy, opt);
f2.resizeTo(wl,wh);
f2.moveTo(x0,y0);
}
if (xy==3){
x0=0;
y0=parseInt(screen.availHeight/2);
f3=window.open(urlp,xy, opt);
f3.resizeTo(wl,wh);
f3.moveTo(x0,y0);
}
if (xy==4){
x0=parseInt(screen.availWidth/2);
y0=parseInt(screen.availHeight/2);
f4=window.open(urlp,xy, opt);
f4.resizeTo(wl,wh);
f4.moveTo(x0,y0);
}
}

function wrs(){
window.resizeTo(screen.availWidth/2,screen.availHeight/2);
window.moveTo(screen.availWidth/2,screen.availHeight/2);
}

function wc(){
f1.close();
f2.close();
f3.close();
f4.close();
}

function redim_planning() {
window.moveTo(0,screen.availHeight/2);
window.resizeTo(screen.availWidth,350);
}

function bgcol(col){
if (col==null){col="#DDEBF0";}
document.bgColor=col;
}
