var monX, monY;
function getMouse(e){
if (!document.all)
	{
	monX = e.clientX;
	monY = e.clientY;
	}
}
document.onmousemove=getMouse;

function openWin(nom, taille, lang) {
  var fenetreImage;
  contenu="<html>\n<head>\n<title>Photo</title>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=iso-8859-1\">\n</head>\n<BODY topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" onLoad=\"window.focus()\" onBlur=\"self.close();\" ";
  contenu = contenu + "background=\"" + nom + "\">\n</body></html>\n";
  fenetreImage = window.open("", "capture", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,"+taille+",screenX=50,screenY=50,top=50,left=50");
fenetreImage.document.open();
fenetreImage.document.write(contenu);
fenetreImage.document.close();
}


function showHint(nomHint)
{
var b;

if(document.all)
	{
	b =	eval("document.all." + nomHint);
	diff = window.event.clientX + 15 + parseInt(b.style.width) - document.body.clientWidth;
	if (diff > 0)
		b.style.left = window.event.clientX + 15 - diff;
	else
		b.style.left = window.event.clientX+15;
	b.style.top = window.event.clientY + document.body.scrollTop;
	b.style.visibility = 'visible';
	}
else
	{
	b = document.getElementById(nomHint);
	diff = monX + 15 + parseInt(b.style.width) - document.body.clientWidth;
	if (diff > 0)
		b.style.left = monX+15-diff;
	else
		b.style.left = monX+15;
	b.style.top = monY+window.pageYOffset;
	b.style.visibility = 'visible';
	}
}

function hideHint(nomHint)
{
if(document.all)
	eval("document.all." + nomHint + ".style.visibility = 'hidden'");
else
	document.getElementById(nomHint).style.visibility = 'hidden';

}

function EdWin(lien, titre) {
  var fenetreImage;
  titre = "Table des mati&egrave;res " + titre;
//  contenu="<html>\n<head>\n<title>Image</title>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=iso-8859-1\">\n</head>\n<BODY topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" onBlur=\"self.close();\" background=\"captures/img" + nom + "." + type + "\">\n</body></html>\n";
  fenetreImage = window.open(lien, titre, "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=640,height=480,screenX=50,screenY=50,top=50,left=50");
//fenetreImage.document.open();
//fenetreImage.document.write(contenu);
//fenetreImage.document.close();
}

function modDuo(appelant)
{
var duotmp = document.formcomm.sauvDuo.value;
var aChanger = appelant.name.substr(3, appelant.name.length);
var newTab = new Array();
if (duotmp == "")
	duotmp = new Array()
else
	duotmp = duotmp.split(",");

if (appelant.checked == false)
	duotmp.push(aChanger);
else
	{
	for(var tmp=0; tmp<duotmp.length; tmp++)
		if (duotmp[tmp] != aChanger)
			newTab.push(duotmp[tmp]);
	duotmp = newTab
	}

document.formcomm.sauvDuo.value = duotmp.join(",");
}

function verif(param) 
{ 
var retour=false, undebon = 0, maQuantite=0, champQuantite = 0, version = ""; 

for (i=0; document.formcomm[i]; i++) 
	{ 
	if (document.formcomm[i].name == "quantite")
		{
	  	maQuantite = parseInt(document.formcomm[i].value)
		champQuantite=i;
		if ((isNaN(maQuantite)) || (maQuantite<0))
			document.formcomm[i].value = "";
		else
			undebon = undebon + 1;
		}
		
	if (document.formcomm[i].name == "ver")	
		version = document.formcomm[i].value;
		
	if (document.formcomm[i].name == "sto")
		{
		if (document.formcomm[i].value > 0)
			if (maQuantite > document.formcomm[i].value)
				{
				document.formcomm[champQuantite].value = document.formcomm[i].value;
				if (param == "GR")
					alert("Die gewünschte Menge von " + version + " ist nicht mehr vorhanden. Die Anzahl wurde auf den verbleibenden Rest reduziert.");
				else
					alert("Le stock de " + version + " est épuisé. La quantité a été réduite en conséquence.");
				}
		}
	}

if (undebon == 0) 
	if (param == "GR")
		alert("Die Anzahl im Eingabefeld ist ungültig");
	else
		alert("Vous n'avez pas saisi de quantité correcte dans les champs de saisie");
else 
	retour = true;

return retour; 
} 

function testParents(param)
{
//if (window.navigator.appName == "Microsoft Internet Explorer")
//if ((top == self)  || (document.referrer.substring(11,19) != "educatic"))
//	self.location.href = "../../../../indexc.asp?pagebas=" + self.location.pathname;
}