﻿//
function ajouterAuPanier(ref)
{
	var choix = ""
	var nc	 = ""
	try
	{
		choix	 = document.aspnetForm.choix1.value
		if(choix=="")
		{
			alert("Selectionnez votre premier choix.")
			return false;
		}	
		
	}
	catch(e)
	{}
	
	try
	{
		var choix2		 = document.aspnetForm.choix2.value
		if(choix2=="")
		{
			alert("Selectionnez votre 2  choix. ")
			return false;
		}	
	}   
	catch(e)
	{} 
	
	
	document.aspnetForm.action = "boutique/panier_add.aspx"
	
	return true;
	
	//document.aspnetForm.submit()
}

function imprimerCMD(cmd)
{
  window.open("ImprimerCmd.aspx?cmd="+cmd+"&d="+(new Date()),"","channelmode=no,directories=no,fullscreen=no,height=600px,width=750px,location=no,menubar=no,resizable=yes,scrollbars=no,status=no,titlebar=no,toolbar=no")
}

function imprimerCMD2(url,cmd)
{
  window.open(url+"commander/ImprimerCmd.aspx?cmd="+cmd+"&c=1&d="+(new Date()),"","channelmode=no,directories=no,fullscreen=no,height=600px,width=750px,location=no,menubar=no,resizable=yes,scrollbars=no,status=no,titlebar=no,toolbar=no")
}
    
function viewOnglet(obj,num)
{
    try{
    
    
    switch(num)
    {
        case 1 :
            document.getElementById("ongletNotreAvis").style.display = "none"
            document.getElementById("ongletNotreAvis").style.visibility = "hidden"
            document.getElementById("ongletDescriptif").style.display = "block"
            document.getElementById("ongletDescriptif").style.visibility = "visible"
            
            document.getElementById("imgDescriptif1").src = "picto/descriptifactif.gif"
            document.getElementById("imgDescriptif2").src = "picto/descriptifactif.gif"
            
            document.getElementById("imgNotreAvis1").src = "picto/notreavis.gif"
            document.getElementById("imgNotreAvis2").src = "picto/notreavis.gif"
            
        break
        case 2 :
            document.getElementById("ongletDescriptif").style.display = "none"
            document.getElementById("ongletDescriptif").style.visibility = "hidden"
            
            document.getElementById("ongletNotreAvis").style.display = "block"
            document.getElementById("ongletNotreAvis").style.visibility = "visible"
            
            document.getElementById("imgNotreAvis1").src = "picto/notreavisactif.gif"
            document.getElementById("imgNotreAvis2").src = "picto/notreavisactif.gif"
            
            document.getElementById("imgDescriptif1").src = "picto/descriptif.gif"
            document.getElementById("imgDescriptif2").src = "picto/descriptif.gif"
        break
    }
    }
    catch(e){}
}

function viewPhoto(url,univers,photo)
{	
    name = (new Date()).getSeconds()
    var myWindow = window.open("", name+(new Date()).getSeconds(), 'toolbar=no,width=520,height=520,resize=yes');
    //myWindow.document.write("<html><body><table height=100% width=100% cellspacing=0 cellpadding=0><tr><td align=center valign=middle><img src='photos/"+univers+"_zoom/"+photo+"' alt='Zoom'></td></tr></table></body></html>");
    myWindow.document.write("<html><head><META HTTP-EQUIV=\"imagetoolbar\" CONTENT=\"no\"></head><body oncontextmenu=\"return false;\"><table height=100% width=100% cellspacing=0 cellpadding=0><tr><td align=center valign=middle><img src='"+url+"photos/"+univers+"_zoom/"+photo+"' alt='Zoom'></td></tr></table></body></html>");
    myWindow.document.close();
}



var doc  = document.all
function inc(obj)
{

	id = new String(obj.id).replace("btninc","Quantity")
	if (document.all)
		doc[id].value = parseInt(doc[id].value) +1
	else if (document.getElementById) 
		document.getElementById(id).value = parseInt(document.getElementById(id).value) +1
}

function dec(obj)
{
	id = new String(obj.id).replace("btndec","Quantity")
	if (document.all){
		if(parseInt(doc[id].value)>1)
			doc[id].value = parseInt(doc[id].value) - 1
	}
	else if (document.getElementById){
		if(document.getElementById(id).value>1)
			document.getElementById(id).value = parseInt(document.getElementById(id).value) -1
	} 
}

//COMPARAISON
var NbrMax = 4
function comparer(obj)
{   
    var NbrChecked=0
    checkBox  = document.getElementsByTagName("input")
    for(c in checkBox)
        (checkBox[c].checked)?NbrChecked++:""
    
    if(document.getElementById(obj.id).checked)
    {
        if(NbrChecked>NbrMax){
            document.getElementById(obj.id).checked=false;
            alert("comparer jusqu'a "+NbrMax+" produits")
        }    
    }            
    
}

function  cgv()
{
    window.open("../nos-services/Condition-generale-de-vente.html","","width=650, height=500, location=0, menubar=0, resizable=1,scrollbars=1, status=0, toolbar=0, scroll=auto");
}


/*
function voleur(e)
{ return false; }

function bien()
{ return true; }

document.onselectstart=new Function ("return false");
if (window.sidebar)
{
  document.onmousedown=voleur;
  document.onclick=bien;
}
*/

