//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++   Style Weiche für content-Frame  +++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// 
if((navigator.appName.indexOf("Netscape")!=-1) && (navigator.appVersion.indexOf("Win")!=-1))
{
 	document.write("<link rel='stylesheet' type='text/css' href='/css/ie/content.css'>");
}
 else
{
	document.write("<link rel='stylesheet' type='text/css' href='/css/ie/content.css'>");
}

var checkFormFields = new Array();
var Standardmeldung = new Array();
Standardmeldung["Kontaktdaten"] = "\nFehlerhafte Eingabe der Kontaktdaten!\nBitte geben Sie entweder Ihre vollständige Anschrift, Ihre Faxnummer, Telefonnummer oder Ihre E-Mailadresse an."
Standardmeldung["Emailadresse"] = "\nFehlerhafte Eingabe der Emailadresse!\nBitte korrigieren Sie Ihre Angaben!"
Standardmeldung["AnschriftVorname"] = "\n- Geben Sie bitte Ihren Vornamen an."
Standardmeldung["AnschriftNachname"] = "\n- Geben Sie bitte Ihren Nachnamen an."
Standardmeldung["AnschriftStrasse"] = "\n- Geben Sie bitte Ihre Strasse an."
Standardmeldung["AnschriftPlz"] = "\n- Geben Sie bitte Ihre PLZ an."
Standardmeldung["AnschriftOrt"] = "\n- Geben Sie bitte Ihre Ort an."
Standardmeldung["AnschriftVnr"] = "\n- Geben Sie bitte die Versicherungsscheinnummer an."
Standardmeldung["Wohnflaeche"] = "\n- Geben Sie bitte die Wohnfläche an."
	
pflichtFeldColor = "#ffffff"
standardFeldColor = "#dddddd"
fehlerFeldColor = "#ff9999"
function generateCheckFormFields(){
	theFormular = document.forms[0]
	checkFields = checkFormFields["standard"]
	for (i=0; i< theFormular.length; i++){
		type = theFormular[i].type
		switch (type){
			case "radio":
				currentElement = theFormular[i].name+"_"+theFormular[i].value
				if (theFormular[i].checked && checkFormFields [currentElement]) checkFields = checkFields+checkFormFields [currentElement]
			break;
			case "checkbox":
				currentElement = theFormular[i].name
				if (theFormular[i].checked && checkFormFields [currentElement]) checkFields = checkFields+checkFormFields [currentElement]
			break;
			case "text":
				currentElement = theFormular[i].name
				if ((theFormular[i].value != "") && checkFormFields [currentElement]) checkFields = checkFields+checkFormFields [currentElement]
			break;
		}	
	}
	return checkFields
}
function addFehlermeldung(wich){
	if (Standardmeldung[wich]) DetailFehler = DetailFehler + Standardmeldung[wich]
}
function validateFields(){
	Fehlermeldung=""
	DetailFehler=""
	checkFields = generateCheckFormFields()
	theRadios = new Array()
	for (i=0; i< theFormular.length; i++){
		if ((checkFields.indexOf(theFormular[i].name) != -1) && (theFormular[i].type == "radio")){
			if (!theRadios[theFormular[i].name]) theRadios[theFormular[i].name] = false
			if (theFormular[i].checked) theRadios[theFormular[i].name] = true 
		}
	}
	hasError = 0
	for (i=0; i< theFormular.length; i++){
		markable = (((theFormular[i].type == "text") || (theFormular[i].type == "textarea")) && (theFormular[i].style))
		if (checkFields.indexOf(theFormular[i].name) != -1){
			if (theFormular[i].value == ""){
				hasError++
				if (markable) theFormular[i].style.background = fehlerFeldColor
				addFehlermeldung (theFormular[i].name)
			} else {
				if (markable) theFormular[i].style.background = pflichtFeldColor
			}
			if (theFormular[i].type == "checkbox"){
				if (!theFormular[i].checked){
					theFormular[i].style.background = fehlerFeldColor
					hasError++
					addFehlermeldung (theFormular[i].name)
				} else {
					theFormular[i].style.background = "#000000"
				}
			}
			if (theFormular[i].type == "radio"){
				if (theRadios[theFormular[i].name]){
					theFormular[i].style.background = "transparent"
				} else {
					theFormular[i].style.background = fehlerFeldColor
				}
			}
		} else {
			if (markable) theFormular[i].style.background = standardFeldColor
		}
	}
	for (var Name in theRadios){
		if (theRadios[Name] == false ){ 
			hasError++ 
			addFehlermeldung (Name)
			}
	}
	if (hasError || plausibilitaet()){
		Fehlertext = "Beim Ausfüllen des Formulars ist ein Fehler aufgetreten!\n" 
		if (hasError > 1) Fehlertext = "Beim Ausfüllen des Formulars sind " + hasError + " Fehler aufgetreten!\n"
		if (document.all) Fehlertext = Fehlertext + "Fehler sind rot markiert!" 
		if (Fehlermeldung != "") Fehlertext = Fehlermeldung
		if (DetailFehler != "") Fehlertext = Fehlertext+"\n" + DetailFehler
		alert(Fehlertext)
		return false
	} else {
		return true
	}
}
function markFields(){
	checkFields = generateCheckFormFields()
	for (i=0; i< theFormular.length; i++){
		markable = (((theFormular[i].type == "text") || (theFormular[i].type == "textarea"))&&(theFormular[i].style))
		if (checkFields.indexOf(theFormular[i].name) != -1){
			if (markable) theFormular[i].style.background = pflichtFeldColor
		} else {
			if (markable) theFormular[i].style.background = standardFeldColor

		}
	}
}

function checkForEmail(mailadresse){
	var mailresult = false
	var Emailmuster = /(.*)\@(.*)\.(.*)/;
	Emailmuster.exec(mailadresse)
	mailresult = ((RegExp.$1 != "") || (mailadresse == ""))
	return mailresult
}
	
function changeimage(wich,state){
	oldsource = document.images[wich].src
	if (state == 0){newsource=oldsource.replace('1.','0.')}
	if (state == 1){newsource=oldsource.replace('0.','1.')}
	document.images[wich].src = newsource
}
function drucken(){
	
	window.print();
}
function initSite(){
	IMAGEOBJECTS = new Array()
	for (x=0; x<document.images.length; x++){
		if (document.images[x].src.indexOf("_0.") != -1){
		IMAGEOBJECTS[document.images[x].name+"0"] = new Image()
		IMAGEOBJECTS[document.images[x].name+"0"].src = document.images[x].src
		IMAGEOBJECTS[document.images[x].name+"1"] = new Image()
		IMAGEOBJECTS[document.images[x].name+"1"].src = document.images[x].src.replace("_0.","_1.")
		}
	}
}
function changeimg (wich,source){
	if (IMAGEOBJECTS [wich+source]){
		document.images[wich].src = IMAGEOBJECTS [wich+source].src
	}
}	
	