/* * * * * * * * * * * * * * * * * * * */
/* Copyright 2006 by Mono Systems GmbH */
/*         All Rights Reserved         */
/* * * * * * * * * * * * * * * * * * * */

/* Expand Or Collapse Child Objects */

function expand(id) {
	var i=0;
	var s;
	var obj;
	while (obj = document.getElementById(id+"_"+i)) {
		if (obj.style.display == "block") {
		obj.style.display = "none";
		} else {
		obj.style.display = "block";
		}
		i++;
	}
}


/* Calculate Total Price */

function calculate() {
	var q=document.calculator.qty.value;

	if (document.calculator.produkt[0].checked) {
			if (document.calculator.update[1].checked) {
				var price=149;
			} else {
				var price=399;
			}
	} else if (document.calculator.produkt[1].checked) {
			if (document.calculator.update[1].checked) {
				var price=39;
			} else {
				var price=99;
			}
	}
	var result;
	if (q>=20) {
		result=price*q-(price*q*0.3)
	} else if (q>=10) {
		result=price*q-(price*q*0.2)
	} else if (q>=5) {
		result=price*q-(price*q*0.1)
	} else {
		result=price*q
	}

	if (document.calculator.curr[0].checked) {
		document.getElementById("sumfield").value = "EUR "+result.toFixed(2);
		document.getElementById("sumbruttofield").value = "EUR "+(result*1.19).toFixed(2);
		document.getElementById("mwst").style.display = "inline";
		document.getElementById("sumbruttofield").style.display = "inline";
		
	} else if (document.calculator.curr[1].checked) {
		document.getElementById("sumfield").value = "CHF "+(result*1.65).toFixed(2);
		document.getElementById("mwst").style.display = "none";
		document.getElementById("sumbruttofield").style.display = "none";
	}
	
}


/* Open Link In Popup Window */

function popup(url,t,w,h) {
	fenster=window.open(url,t,w,h,resizable="yes");
	fenster.focus();
	return false;
}