function openwin(whichLink, whichName, width, height) {
	var breit = screen.availWidth;
	var hoch = screen.availHeight;
	var x = (breit-width)/2;
	var y = (hoch-height)/2;
	window.open(whichLink, whichName, 'top='+(hoch-height)/2+',left='+(breit-width)/2+',width='+width+',height='+height+',hotkeys=no,directories=no,menubar=no,location=no,personalbar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no');
	//self.blur();
}
function openwinscroll(whichLink, whichName, width, height) {
	var breit = screen.availWidth;
	var hoch = screen.availHeight;
	var x = (breit-width)/2;
	var y = (hoch-height)/2;
	window.open(whichLink, whichName, 'top='+(hoch-height)/2+',left='+(breit-width)/2+',width='+width+',height='+height+',hotkeys=no,directories=no,menubar=no,location=no,personalbar=no,resizable=no,scrollbars=yes,status=no,titlebar=no,toolbar=no');
	//self.blur();
}
function mymail(prefix, suffix) {
	var tl = 'de';
	location = 'mailto:'+prefix+"@"+suffix+"."+tl;
}
function framecheck(currentpage, client) {
	if (parent.frames.length == 0) {
		if (client="christl-schowalter") {
			var mytitle = "Autohaus Christl-Schowalter Ihr Audi- und Volkswagen-Partner";
			var bottomframe = "aktionen_cs.htm";
		}
		var topframe = currentpage;
		document.close();
		document.open();
		document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">');
		document.write('<html>');
		document.write('<head>');
		document.write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">');
		document.write('<title>'+mytitle+'</title>');
		document.write('</head>');
		document.write('<frameset rows="*,110" frameborder="NO" border="0" framespacing="0">');
		document.write('<frame src="" name="mainFrame">');
		document.write('<frame src="" name="bottomFrame" scrolling="NO" noresize>');
		document.write('</frameset>');
		document.write('<noframes><body>');
		document.write('</body></noframes>');
		document.write('</html>');
		document.close();
		top.frames[0].location = topframe;
		top.frames[1].location = bottomframe;
	} else {
		return;
	}
}
//THIS FUNCTION IS ADJUSTED FOR THE SCHOWALTER AND CHRISTL VERSION
function adresswahl(partner) {
	if (partner == "christl"){
		empfaengerliste = new Array("disposition@christl.de", "disposition@christl.de", "disposition@christl.de", "thomas.schula@christl.de", "vw.service@christl.de", "ralf.mautner@christl.de");
		bereichsliste = new Array("Audi", "Volkswagen", "Freizeitmobile/Nutzfahrzeuge", "Gebrauchte", "Service", "Zubehoer");	
	} else {
		empfaengerliste = new Array("disposition@autohaus-schowalter.de", "disposition@autohaus-schowalter.de", "disposition@autohaus-schowalter.de", "disposition@autohaus-schowalter.de", "schowalter-kundendienst@autohaus-schowalter.de", "schowalter.teiledienst@autohaus-schowalter.de");
		bereichsliste = new Array("Audi", "Volkswagen", "Freizeitmobile/Nutzfahrzeuge", "Gebrauchte", "Service", "Zubehoer");	
	}

	var myform = document.forms[1];
	mandatory = new Array(myform.Name, myform.PLZ, myform.Ort, myform.Telefon, myform.EMail);
	ids = new Array("txtname", "txtplz", "txtort", "txttelefon", "txtemail");
	// Check Formfields
	failure = new Array();
	checkfields = true;
	for (i=0; i<mandatory.length; i++) {
		if (mandatory[i].value == "" || mandatory[i].value == " ") {
			failure[failure.length] = i;
			var ok = document.getElementById(ids[i]);
			if (ok) {
				ok.style.color = "#FF0000";
				var check = false;
			}
		} else {
			if (document.getElementById) {
				var ok = document.getElementById(ids[i]);
				if (ok) {
					ok.style.color = "#000000";
					var check = true;
				}
			}
		}
	}
	// Display Error Message	
	if (!(check)) {
		document.getElementById("txtmessage").style.color = "#FF0000";
	} else {

			for (i=0; i<bereichsliste.length; i++) {
				if (document.forms[0].Bereich[i].checked) {
					myform.Empfaenger.value = empfaengerliste[i];
					myform.Bereich.value = bereichsliste[i];
					break;
				} else {
					myform.Empfaenger.value = empfaengerliste[0];
					myform.Bereich.value = "Nicht selektiert";
				}
			}
			
			document.getElementById("txtmessage").style.color = "#000000";
			if (partner == "christl"){
				myform.action = "email.php?partner=christl";
			}else{
				myform.action = "email.php?partner=schowalter";
			}
			myform.submit();
	}
}
function FP_openNewWindow(w, h, nav, loc, sts, menu, scroll, resize, name, url) {
	var windowProperties = '';
	if (nav == false) {
		windowProperties += 'toolbar=no,';
	} else {
		windowProperties += 'toolbar=yes,';
	}
	if (loc == false) {
		windowProperties += 'location=no,';
	} else {
		windowProperties += 'location=yes,';
	}
	if (sts == false) {
		windowProperties += 'status=no,';
	} else {
		windowProperties += 'status=yes,';
	}
	if (menu == false) {
		windowProperties += 'menubar=no,';
	} else {
		windowProperties += 'menubar=yes,';
	}
	if (scroll == false) {
		windowProperties += 'scrollbars=no,';
	} else {
		windowProperties += 'scrollbars=yes,';
	}
	if (resize == false) {
		windowProperties += 'resizable=no,';
	} else {
		windowProperties += 'resizable=yes,';
	}
	if (w != "") {
		windowProperties += 'width='+w+',';
	}
	if (h != "") {
		windowProperties += 'height='+h;
	}
	if (windowProperties != "") {
		if (windowProperties.charAt(windowProperties.length-1) == ',') {
			windowProperties = windowProperties.substring(0, windowProperties.length-1);
		}
	}
	window.open(url, name, windowProperties);
}
function open_konfiguratorBanner() {
	var url = "http://ak4-de.audi.de/entry.html";
	/*
	if (typeof (_partner_id) != "undefined") {
		url += "&partner="+_partner_id;
	}
	*/
	sat = window.open(url, "AK4SATELLIT", "scrollbars=yes,directories=no,menubar=no,toolbar=no,width=800,height=600,status=yes,resizable=yes");
	sat.focus();
}

