// Anti-mail non prévu.
// Usage : NoMail( 'fin DNS', 'compte', 'début DNS', 'title du lien' );
function NoMail( s1, s2, s3, title )
{
	document.write( "<a title='" + title + "' href='mailto:" + s2 + "@" + s3 + s1 + "'>" + s2 + "@" + s3 + s1 + "</a>" );
}

// Dessine un flash (correctif pour IE, afin d'éviter le cadre clignotant désagréable)
function draw_flash( name, width, height )
{
	document.write( "<object type=\"application/x-shockwave-flash\" data=\"" + name + "\" style=\"width: " + width + "px; height: " + height + "px\">" );
	document.write( "<param name=\"movie\" value=\"" + name + "\">" );
	document.write( "<param name=\"quality\" value=\"high\">" );
	document.write( "<param name=\"menu\" value=\"false\">" );
	document.write( "</object>" );
}

function recherche()
{
	texte = document.Recherche.Texte.value;
	valid = true;
	if (texte=="")
	{
		alert("Le champ de recherche est vide");
		document.Recherche.Texte.focus();
		valid=false;
	}
	if (valid)
	{
		document.location.href = document.location.href.split("?")[0] + "?p=Search&search="+texte;
	}

}
function fixPNG() {
	if(navigator.appName == 'Microsoft Internet Explorer') {
		var png = /\.png$/;
		var imgs = document.getElementsByTagName("img");
		for(var i = 0 ; i < imgs.length; i++) {
			if(imgs.item(i).src.indexOf(".png")>0) {
				imgs.item(i).style.width = imgs.item(i).offsetWidth;
				imgs.item(i).style.height = imgs.item(i).offsetHeight;
				imgs.item(i).style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + imgs.item(i).src + '\',sizingMethod=\'image\')';
				imgs.item(i).src = '/img/pix.gif';
			}
		}
	}
}

function deconnecte()
{
	document.getElementById( "commandDeconn" ).value = "Deconnexion";
	document.forms[ "AccesClient" ].submit();
}

function ToutAfficher()
{
	document.getElementById("ToutVoir").value="true";
	document.forms[ "FrmMain" ].submit();
}	
	
function AddPanier(idproduit)
{
	
	verif = true;
	document.getElementById( "CommandName" ).value = "AddPanier";
	document.getElementById( "CommandArgument" ).value =idproduit;
	document.getElementById( "CommandQuantite" ).value = document.getElementById("quantite").value;
	
	if (document.getElementsByTagName("select").length>0)
	{
		for(i=0;i<document.getElementsByTagName("select").length;i++)
		{
			select = document.getElementsByTagName("select").item(i);
			if(select.name.indexOf("Contenances")>=0)
			{	if (select.selectedIndex==0)
				{
					alert("N'oubliez pas de choisir la contenance");
					return;
				}
				else
					document.getElementById( "CommandContenance" ).value = select.options[select.selectedIndex].value;
			}
		}
	}
	
	document.forms[ "FrmMain" ].submit();
}

