<!--
function initMenu(){
	var menu = document.getElementById('menu');
	var gmenu = menu.getElementsByTagName('li');

	menu.className="menu";

	for (var i=0; i<gmenu.length; i++){
		if (gmenu.item(i).getElementsByTagName('ul')[0]){
			setFunction(gmenu.item(i),'mouseover',showMenu);
			setFunction(gmenu.item(i),'mouseout',hideMenu);
		}
	}
}

function setFunction(mid,moo,functionName){
	eval('mid.on'+moo+'=functionName');
}

function Wait(){
	setTimeout("hidden()", 1000);
}

function hideMenu(){
	this.getElementsByTagName('ul')[0].style.visibility = "hidden";
}

function showMenu(){
	this.getElementsByTagName('ul')[0].style.visibility = "visible";
}

function WriteLayerCSS(LName,funct,wert) {
	if (document.getElementById){
		var newLayer = document.getElementById(LName).style;
		newLayer[funct]=wert;
	}
}

function WriteLayer(LName,funct,wert) {
	if (document.getElementById){
		var newLayer = document.getElementById(LName);
		newLayer[funct]=wert;
	}
}

function getobject(id) {
	var elmID;
	
        for(var i=0; i<document.forms.length; i++) {
            if(document.forms[i][id]) {
                elmID = document.forms[i][id];
                break;
            }
        }

    return elmID;
}

function printPage() { 
	var sOption="toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,width=660,height=580,left=100,top=25"; 
	
	var sWinHTMLHead = document.getElementById('headline_middle').innerHTML;
	var sWinHTML = document.getElementById('content').innerHTML;
	var strBereich = document.title;
	var strBodyClass = document.body.className;
	var strBodyId = document.body.id;
      
	var winprint=window.open("","",sOption); 
       winprint.document.open(); 
       winprint.document.write('<html><title>' + document.title + '</title><link rel="stylesheet" href="style/typo3cache.css" type="text/css"><link rel="stylesheet" href="style/ccc.css" type="text/css"><link rel="stylesheet" href="style/ccc_print.css" type="text/css"><body id="'+strBodyId+'" class="'+strBodyClass+'" onload="window.print();">'); 
       winprint.document.write('<div style="position: relative; z-index: 10;"><img src="image/head_drucken.png" width="640" height="80" border="0"><br>');
       winprint.document.write('<div id="infoDiv" style="position: absolute; left: 300px; top: 60px; width: 360px; height: 16px; z-index: 2;"><span style="font-size: 15px; color: #000; font-family: arial; text-decoration: none;"><strong>' + strBereich + '</strong></span></div></div>');
       winprint.document.write('<div id="content" style="position: relative; padding-top: 10px;">'+sWinHTML+'</div>');
       winprint.document.write('</body></html>');
       winprint.document.close(); 
       winprint.focus(); 
}

function nx_send(){
	nx_win = window.open("nx_mail_news.php?url="+escape(document.location)+"&title="+escape(document.title),"_danke", 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=360,height=420');
	nx_win.focus();
	return false;
}

function collect() {
	for (i=0;i<document.forms.length;i++) {
		if (document.forms[i].name=='mailform') {
			fe=document.getElementsByTagName("form").item(i);
			os=fe.getAttribute("onsubmit")+'';
			os=os.substr(os.indexOf('\'mailform\',\'')+12);
			os=os.substr(0,os.indexOf('\')'));
			arros=os.split('\',\'');
	
			vf=validateForm(document.forms[i],arros[0],arros[1],arros[2],arros[3]);
		
			if(typeof(vf)!="undefined" && !vf) {
				return false;
			}
		}
	}

	formdata = new Object();
	formdata['Gesamtpreis']=0;
	for (i=0;i<document.forms.length;i++) {
		if (document.forms[i].name=='mailform') {
			for (j=0;j<document.forms[i].elements.length;j++) {
				fe=document.forms[i].elements[j];
				switch(fe.type)
				{
					case 'checkbox':
						if (fe.checked) {
							if (formdata[fe.name]) {
								formdata[fe.name]=formdata[fe.name]+',ja';
							} else {
								formdata[fe.name]='ja';
							}
						//} else {
						//	if (formdata[fe.name]) {
						//		formdata[fe.name]=formdata[fe.name]+',nein';
						//	} else {
						//		formdata[fe.name]='nein';
						//	}
							preis=getobject(fe.name+'_preis');
							if (preis) {
								formdata['Gesamtpreis']=(formdata['Gesamtpreis']*1)+(preis.value*1);
							}
							if (document.forms[i].modell) {
								formdata['Modell']=fe.name;
							}
						}
						break;
					case 'radio':
						if (fe.checked) {
							feldwert=fe.value+'';
							feldwert=feldwert.toLowerCase()+'';
							if (feldwert.indexOf('__')>=0) {
								feldwert=feldwert.replace(/<i>/,'');
								feldwert=feldwert.replace(/<\/i>/,'');
								tarr=feldwert.split('__');
								
								if (!formdata['Modell']) {
									formdata['Modell']=tarr[0];
								} else {
									formdata[fe.name]=tarr[0];
								}
								formdata['Gesamtpreis']=(formdata['Gesamtpreis']*1)+(tarr[1]*1);
							} else {
								if (formdata[fe.name]) {
									formdata[fe.name]=formdata[fe.name]+','+fe.value;
								} else {
									formdata[fe.name]=fe.value;
								}
							}
							
						}
						break;
					case 'text':
					case 'textarea':
					case 'hidden':
						feldname=fe.name+'';
						feldname=feldname.toLowerCase()+'';
						if (feldname.indexOf('_preis')<0) {
							if (formdata[fe.name]) {
								formdata[fe.name]=formdata[fe.name]+','+fe.value;
							} else {
								formdata[fe.name]=fe.value;
							}
						}
						break;
					case 'select-one':
						if (fe.selectedIndex>=0) {
							if (formdata[fe.name]) {
								formdata[fe.name]=formdata[fe.name]+','+fe.options[fe.selectedIndex].value;
							} else {
								formdata[fe.name]=fe.options[fe.selectedIndex].value;
							}
						}
						break;
					case 'undefined':
						break;
					default:
						break;
				}
			}
		}
	}
	
	
	formdata['Gesamtpreis']=round_decimals(formdata['Gesamtpreis'],2);
	
	
	var myform=document.createElement("form");
	myform.setAttribute("name","mycollectedform");
	myform.setAttribute("method","POST");
	myform.setAttribute("action","index.php?id="+document.forms.collectedform.targetid.value);
	count=0;
	for (var Eigenschaft in formdata) {
		myvalue = document.createElement("input");
		myvalue.setAttribute("type","hidden");
		myvalue.setAttribute("id","my"+count+"Value");
		myvalue.setAttribute("name",Eigenschaft);
		myvalue.setAttribute("value",formdata[Eigenschaft]);
		myform.appendChild(myvalue);
		count++;
	}
	myvalue = document.createElement("input");
	myvalue.setAttribute("type","hidden");
	myvalue.setAttribute("id","my"+count+"Value");
	myvalue.setAttribute("name","kunde");
	myvalue.setAttribute("value",document.forms.collectedform.kunde.value);
	myform.appendChild(myvalue);
	
	document.body.appendChild(myform);
	myform.submit();
		
	return false;
	
}

function round_decimals(original_number, decimals) {
    var result1 = original_number * Math.pow(10, decimals)
    var result2 = Math.round(result1)
    var result3 = result2 / Math.pow(10, decimals)
    return pad_with_zeros(result3, decimals)
}

function pad_with_zeros(rounded_value, decimal_places) {

    // Convert the number to a string
    var value_string = rounded_value.toString()
    
    // Locate the decimal point
    var decimal_location = value_string.indexOf(".")

    // Is there a decimal point?
    if (decimal_location == -1) {
        
        // If no, then all decimal places will be padded with 0s
        decimal_part_length = 0
        
        // If decimal_places is greater than zero, tack on a decimal point
        value_string += decimal_places > 0 ? "." : ""
    }
    else {

        // If yes, then only the extra decimal places will be padded with 0s
        decimal_part_length = value_string.length - decimal_location - 1
    }
    
    // Calculate the number of decimal places that need to be padded with 0s
    var pad_total = decimal_places - decimal_part_length
    
    if (pad_total > 0) {
        
        // Pad the string with 0s
        for (var counter = 1; counter <= pad_total; counter++) 
            value_string += "0"
        }
    return value_string
}


//-->