function blackBoxClose() {
	newWin = window.open("../img/laraud_blackbox_big_c.jpg", "newWin", "menubar=no,toolbar=0,location=0,directories=0,copyhistory=0,scrollbars=no,resizable=yes,status=no,height=600,width=750,dependent=yes");
	newWin.focus();
}

function blackBoxOpen() {
	newWin = window.open("../img/laraud_blackbox_big_o.jpg", "newWin", "menubar=no,toolbar=0,location=0,directories=0,copyhistory=0,scrollbars=no,resizable=yes,status=no,height=720,width=620,dependent=yes");
	newWin.focus();
}
	
function brownBoxClose() {
	newWin = window.open("../img/laraud_brownbox_big_c.jpg", "newWin", "menubar=no,toolbar=0,location=0,directories=0,copyhistory=0,scrollbars=no,resizable=yes,status=no,height=600,width=750,dependent=yes");
	newWin.focus();
}

function brownBoxOpen() {
	newWin = window.open("../img/laraud_brownbox_big_o.jpg", "newWin", "menubar=no,toolbar=0,location=0,directories=0,copyhistory=0,scrollbars=no,resizable=yes,status=no,height=720,width=620,dependent=yes");
	newWin.focus();
}

function deleteAdressGerman() {
	var delchk = window.confirm('Wollen Sie diese Adresse wirklich entfernen ?');
	return (delchk);
}

function deleteCheck(id) {
	var delchk = window.confirm('Delete entry with billnumber ' + id + ' ?');
	return (delchk);
}

function confirmCheck(id) {
	var conchk = window.confirm('Set entry with the billnumber ' + id + ' as finished ?');
	return (conchk);
}

function checkLoginNew() {
	document.getElementById("login").setAttribute("disabled","disabled")
	document.getElementById("login").setAttribute("value","")
}

function checkLoginReg() {
	document.getElementById("login").removeAttribute("disabled")
}

function selectBillingAdress(number) {
	document.getElementById("adress_slot_" + number).setAttribute("action","index.php?navi=shop&action=shipping");
}

function selectShippingAdress(number) {
	document.getElementById("adress_slot_" + number).setAttribute("action","index.php?navi=shop&action=payment");
}

/*function updateCart() {
	if(document.Cart.good_1.value == "0" && document.Cart.good_2.value == "0") {
	} else {

		if (navigator.appName == "Microsoft Internet Explorer")
			var mySelect = document.createElement("<input type='image' src='../img/buttons/de_big_next.png' name='submit' id='SubmitCart' value='Weiter'>");					
		else
		{
			var mySelect = document.createElement("input");
			mySelect.setAttribute("type","image");
			mySelect.setAttribute("src","../img/buttons/de_big_next.png");
			mySelect.setAttribute("name","submit");
			mySelect.setAttribute("id","SubmitCart");
			mySelect.setAttribute("value","Weiter");
		}

		document.getElementById("btnSpace").appendChild(mySelect);
	}
}*/

function submitCart() {
	var ok = true;
	if (isNaN(parseInt(document.cart.good_1.value)))
	{
	    alert("Bitte geben Sie als Bestellmenge eine Zahl ein.");
		ok = false;
	}
	else
	{
		if (parseInt(document.cart.good_1.value) < 0 )
		{
		    alert("Bitte geben Sie eine positive Bestellmenge ein.");
			ok = false;
		}

	}


	if (isNaN(parseInt(document.cart.good_2.value)))
	{	alert("Bitte geben Sie als Bestellmenge eine Zahl ein.");
		ok = false;
	}
	else
	{
		if (parseInt(document.cart.good_2.value) < 0 )
		{
		    alert("Bitte geben Sie eine positive Bestellmenge ein.");
			ok = false;
		}

	}

	if (ok == true)
	{
		if (!(parseInt(document.cart.good_1.value) != 0 || parseInt(document.cart.good_2.value) != 0))
		{
		    alert("Bitte geben Sie zumindest eine positive Bestellmenge an.");
			ok = false;
		}
	}

    return ok;
}

function addAdress() {
	if(document.AddAdress.sex.value == "none") {
	    alert("Bitte Ihre Anrede angeben!");
	    return false;
	}
	if(document.AddAdress.name.value == "" || document.AddAdress.name.value.length < 5) {
    alert("Bitte Ihren Namen eingeben!");
    document.AddAdress.name.focus();
    return false;
	}
	if(document.AddAdress.adress.value == "" || document.AddAdress.adress.value.length < 2) {
    alert("Bitte Ihre Adresse eingeben!");
    document.AddAdress.adress.focus();
    return false;
	}
	if(document.AddAdress.country.value == "" || document.AddAdress.country.value.length < 2) {
		alert("Bitte Ihr Land eingeben!");
		document.AddAdress.country.focus();
		return false;
	}
	if(document.AddAdress.plz.value == "") {
		alert("Bitte Ihre Postleitzahl eingeben!");
		document.AddAdress.plz.focus();
		return false;
	}
	else
	{
		if(document.AddAdress.country.value == "Austria")
		{
			if(document.AddAdress.plz.value.length != 4)
			{	alert("Ihre Postleitzahl ist nicht korrekt!");
			    document.AddAdress.plz.focus();
			    return false;
			}

			if(isNaN(parseInt(document.AddAdress.plz.value.length)))
			{	alert("Ihre Postleitzahl ist nicht korrekt!");
			    document.AddAdress.plz.focus();
			    return false;
			}
		}
	}
	if(document.AddAdress.city.value == "" || document.AddAdress.city.value.length < 2) {
		alert("Bitte Ihren Wohnort eingeben!");
		document.AddAdress.city.focus();
		return false;
	}

}

function contactcheck() {
	if(document.deContact.sex.value == "none") {
	    alert("Bitte Ihre Anrede angeben!");
	    return false;
	}
	if(document.deContact.name.value == "") {
    alert("Bitte Ihren Namen eingeben!");
    document.deContact.name.focus();
    return false;
	}
	if(document.deContact.email.value == "") {
    alert("Bitte Ihre E-Mail Adresse eingeben!");
    document.deContact.email.focus();
    return false;
	}
	if(document.deContact.country.value == "") {
    alert("Bitte Ihr Land eingeben!");
    document.deContact.country.focus();
    return false;
	}
}
