var nn
var sh
var sw

sah=screen.availHeight;
saw=screen.availWidth;
sh=screen.height;
sw=screen.width;

if (navigator.userAgent.search("Gecko")>0) 
{
wiw=document.width;
wih=document.height;
}
else
{
wiw=document.body.clientWidth;
wih=document.body.clientHeight;
}

function wszmini() {
var msg_task
if ((saw<1130)||(sah<800)) {
document.getElementById("szalert").style.visibility="visible";
window.resizeTo(1130,sah);
window.moveTo(0,0);
}
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 addfav(ptit,purl) {
document.getElementById("nomnavigateur").value=navigator.userAgent;
if (navigator.userAgent.search("Gecko")>0) {
window.sidebar.addPanel(ptit,purl,"");
}
else {
window.external.AddFavorite(purl,ptit);
}
}

function listshop_height(){
document.getElementById("nomnavigateur").value=navigator.userAgent;
if (navigator.userAgent.search("Gecko")>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
}

function fheight(elem,delta){
if (navigator.userAgent.search("Gecko")>0) {
document.getElementById("sch").value=window.innerHeight;
}
else {
document.getElementById("sch").value=window.document.body.clientHeight;
}
//if (elem) {
//document.getElementById(elem).value=window.document.body.clientHeight;
//}

}

function hbottom(lay){
hscript=document.getElementById("hallprod").value
if (hscript<window.document.body.offsetHeight) 
	{
	document.getElementById(lay).style.top=window.document.body.offsetHeight;
	}
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;
}

pv=0
pu=0
qte=1

function Calculprix(formulaire) {
part=parseFloat(formulaire.pu.value)*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;
}


//------------------------------------------------------- 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+" target='_top'";
}

function transcompte(choix,fam,refsfam,sfam,num,page)
{
document.location="compte.asp?reffam="+choix+"&fam="+fam+"&refsfam="+refsfam+"&sfam="+sfam+"&num="+num+"&page="+page
}


