function wszmini() {
var msg_task
if (document.body.clientWidth<830) 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 listshop_height(){
document.getElementById("nomnavigateur").value=navigator.userAgent;
if (navigator.userAgent.search("Firefox")>0) {
document.getElementById("laycont").style.height=window.innerHeight-150;
document.getElementById("listshopers").style.height=window.innerHeight-245;
}
else {
document.getElementById("laycont").style.height=window.document.body.clientHeight-150 //document.offsetHeight;
document.getElementById("listshopers").style.height=window.document.body.clientHeight-245 //document.offsetHeight;
}
document.getElementById("listshopers").style.borderWidth=1
}

var hw=0;
var vyop=0;
function fheight(){
	if (navigator.userAgent.search("Firefox")>0) 
	{
	hw=window.innerHeight;
	vtop=87
	}
	else 
	{
	hw=window.document.body.clientHeight;
	vtop=81
	}
FixeCookie ("hw", hw,null,"/");
FixeCookie ("vtop", vtop,null,"/");

//document.getElementById("sch").value=hw;
document.getElementById("lay2").style.height=hw-vtop;
document.getElementById("lay3").style.height=hw-vtop;
document.getElementById("lay4").style.top=hw-35;
//document.getElementById("sch").value=hw;
if (document.getElementsByName("textaccueil")[0]) {document.getElementsByName("textaccueil")[0].style.height=hw-250;}
if (document.getElementsByName("textaccueil")[1]) {document.getElementsByName("textaccueil")[1].style.height=hw-250;}
if (document.getElementById("lay3")) {document.getElementById("lay3").style.height=hw-87;}
	if (document.getElementById("schp")) 
	{
	document.getElementById("schp").style.height=hw-165;
	//document.getElementById("schp").style.overflow="auto";
	}

}

function fheightsf(nom,marg){
if (navigator.userAgent.search("Gecko")>0) {
hw=window.innerHeight;
vtop=87
}
else {
hw=window.document.body.clientHeight;
vtop=81
}
document.getElementById(nom).style.height=hw-marg;
if (nom=="lay_rssfam") {
	document.getElementById("lay_rssfam").style.height=hw-marg;
	document.getElementById("defilant1").style.height=hw-marg;
	}

}

var hscript=0
function hbottom(lay){
wh=window.document.body.offsetHeight
if (navigator.userAgent.search("Firefox")>0) {wh=window.innerHeight;}
if (document.getElementById("hallprod")) {hscript=document.getElementById("hallprod").value;}
if (document.getElementById("whval")) {document.getElementById("whval").value=wh;}

if (hscript<wh) 
	{
	document.getElementById(lay).style.top=wh;
	}
else	{
	document.getElementById(lay).style.top=hscript
	}
}

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;
}

//document.cookie="alertnav="+"0"

function detNav() {
if (document.cookie="alertnav"+"!=="+"1")
{

if (navigator.userAgent.search("Firefox")>0) {
stralert="welcome Firefox ! cailloubaton.com n'est pas encore totalement otimisé pour vous";
stralert=stralert+" :\nSi vous rencontrez quelque bug, nous les corrigerons dès que nous en aurons connaissance\nDeux mots ci_dessous: remarques ou suggestion ? - Merci d'avance";
alert (stralert);
}
if (navigator.userAgent.search("Safari")>0) {
stralert="welcome Safari ! cailloubaton.com n'est pas encore totalement otimisé pour vous";
if (navigator.userAgent.search("3.1")<0) stralert=stralert+" :\nAssurez vous d'avoir la dernière version : SAFARI 3.1 ...\nSinon, quelques surprises possibles";
stralert=stralert+" :\nSi vous rencontrez quelque bug, nous les corrigerons dès que nous en aurons connaissance\nDeux mots ci_dessous: remarques ou suggestion ? - Merci d'avance";
alert (stralert);
}
if (navigator.userAgent.search("Opera")>=0) {
stralert="welcome Opera ! cailloubaton.com n'est pas encore totalement otimisé pour vous";
if (navigator.userAgent.search("9.27")<0) stralert=stralert+" :\nAssurez vous d'avoir la dernière version : OPERA 9.27 ...\nSinon, quelques surprises possibles";
stralert=stralert+" :\nSi vous rencontrez quelque bug, nous les corrigerons dès que nous en aurons connaissance\nDeux mots ci_dessous: remarques ou suggestion ? - Merci d'avance";
alert (stralert);
}
document.cookie="alertnav"+"="+"1"

}
}

//------------------------------------------------------- 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 hcontent(id1,id2,id3,visi) 
	{
	if(document.getElementById(id1).style.height>=document.getElementById(id2).style.height){
	document.getElementById(id3).style.visibility=visi;
	}
}

function Calculprix(formulaire) {
puv=formulaire.pu.value
puv=puv.replace(",",".");
part=parseFloat(puv)*100;
qte=parseInt(formulaire.qte.value);
tpart=part*qte
//formulaire.pv.value=part/100;
formulaire.resultat.value=parseFloat(tpart/100);
resultat=formulaire.resultat.value;
}

function seelaycountry(val1,val2,val3) {
//alert("la valeur saisie est : " + val1 +" \n la couche est : "+ val2);
if (val1=="d_diff")
	{
	seetable(val2,'block');seetable(val3,'none');
	}
else	{
	seetable(val3,'block');seetable(val2,'none');
	}
}

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="#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;
}

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' src='../cbava.js'></script>\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,document.images[0].height+20);\n");
	w.document.write( "w.focus();\n");
	w.document.write( "}\n");

	w.document.write( "</script>\n");
	w.document.write( "<link href='../cbstyle.css' rel='stylesheet' type='text/css'>");
	w.document.write( "<link href='../cbdhtml.css' rel='stylesheet' type='text/css'>");
	w.document.write( "</head><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onLoad='javascript:autoSize();'>" );
	w.document.write( "<div id='pict' class=pict'><table><tr><td>" );
	w.document.write( "<a href='javascript:window.close();'><img src='"+mpict+"' border=0 alt='cliquer ici pour fermer'></a>" );
	w.document.write( "</td></tr></table></div>" );
	w.document.write( "<div class='auteur'><table><tr><td><font color='white'>"+minfo+"</font></td></tr></table></div>" );
	w.document.write( "<div class='auteurb'><table><tr><td>"+minfo+"</td></tr></table></div>" );
	w.document.write( "</body></html>" );
	w.document.close();
}

//------------------------------------------------------- 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 
} 
}

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"
} 

function addcaddy(choix,fam,refsfam,sfam,num,pu,uniq,page,delai)
{
document.getElementById("msgqte").style.visibility="hidden";
document.location="../common/addcaddy.asp?reffam="+choix+"&fam="+fam+"&refsfam="+refsfam+"&sfam="+sfam+"&num="+num+"&pu="+pu+"&uniq="+uniq+"&page="+page+"&delai="+delai+"&qte="+qte;
}

function transcompte(choix,fam,refsfam,sfam,num,page)
{
document.location="compte.asp?reffam="+choix+"&fam="+fam+"&refsfam="+refsfam+"&sfam="+sfam+"&num="+num+"&page="+page
}


