/* Validation if AGBs were checked */
function chkAGBs(form, target){
    if (!this.document.getElementById(form+':agbConfirm').checked){
        alert("Bitte bestätigen Sie die Datenschutzhinweise und die Allgemeinen Geschäftsbedingungen.");
        target.style.display = 'inline';
        return false;
    }
    return true;
}

/* Validation of Required Fields of Login Form*/
function chkLoginForm(form, target){
	var arrayIndex=0;
	var tempArray=new Array(6);
	var alertText="";		
 
	if (this.document.getElementById(form+':login1').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihre Kunden-Nummer an.";
	arrayIndex++;  
	}
	
	if (!Validator.isNumber(this.document.getElementById(form+':login1').value)){
	tempArray[arrayIndex]="Login darf nur aus Ziffern bestehen.";
	arrayIndex++;  
	}
			
	if (this.document.getElementById(form+':password').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihr Passwort an.";
	arrayIndex++;  
	}	
	
	if ((this.document.getElementById(form+':email'))!=null) {
		var email=this.document.getElementById(form+':email').value; 
		if ((email!='')&&(!Validator.isEmail(email))){
			tempArray[arrayIndex]="Bitte geben Sie eine gültige Email-Adresse an.";
			arrayIndex++;  
		}	
	}
	
  	if (arrayIndex != 0) {
		var i=0;
		for (i=0; i<arrayIndex; i++) {
			alertText=alertText+"\n "+tempArray[i]	
		}
		alert("Bitte geben Sie ihre 7-stellige Kunden-Nummer und Ihr Passwort ein: \n"+alertText);
    	return false;
  	}  	
	else {
		return true;
	}
}


/* Validation of Required Fields of ComfortLogin on OrderSamplesForm Stoffmusterkollektion*/
function chkLoginOnSamplesForm(form, target){
	var arrayIndex=0;
	var tempArray=new Array(6);
	var alertText="";		
 
	if (this.document.getElementById(form+':login1').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihre Kunden-Nummer an.";
	arrayIndex++;  
	}
	
	else if (this.document.getElementById(form+':login2').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihre Kunden-Nummer an.";
	arrayIndex++;  
	}	
	
	if (!Validator.isNumber(this.document.getElementById(form+':login1').value)){
	tempArray[arrayIndex]="Login darf nur aus Ziffern bestehen.";
	arrayIndex++;  
	}
	
	else if (!Validator.isNumber(this.document.getElementById(form+':login2').value)){
	tempArray[arrayIndex]="Login darf nur aus Ziffern bestehen.";
	arrayIndex++;  
	}
	
	if (this.document.getElementById(form+':password').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihr Passwort an.";
	arrayIndex++;  
	}	
	
	if ( !(this.document.getElementById(form+':tailoredShirts').checked) && !(this.document.getElementById(form+':tailoredClothingMen').checked) ){
	tempArray[arrayIndex]="Bitte wählen Sie mindestens eine Kollektion aus.";
	arrayIndex++;  
	}	
		
  	if (arrayIndex != 0) {
		var i=0;
		for (i=0; i<arrayIndex; i++) {
			alertText=alertText+"\n "+tempArray[i]	
		}
		alert("Bitte geben Sie ihre 8-stellige Kunden-Nummer und Ihr Passwort ein: \n"+alertText);
    	return false;
  	}  	
	else {
		return true;
	}
}

/* Validation of Required Fields of ComfortLogin on Signup Newlsetter Form */
function chkLoginOnNewsletterForm(form, target){
	var arrayIndex=0;
	var tempArray=new Array(6);
	var alertText="";		
 
	if (this.document.getElementById(form+':login1').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihre Kunden-Nummer an.";
	arrayIndex++;  
	}
	
	else if (this.document.getElementById(form+':login2').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihre Kunden-Nummer an.";
	arrayIndex++;  
	}	
	
	if (!Validator.isNumber(this.document.getElementById(form+':login1').value)){
	tempArray[arrayIndex]="Login darf nur aus Ziffern bestehen.";
	arrayIndex++;  
	}
	
	else if (!Validator.isNumber(this.document.getElementById(form+':login2').value)){
	tempArray[arrayIndex]="Login darf nur aus Ziffern bestehen.";
	arrayIndex++;  
	}
	
	if (this.document.getElementById(form+':password').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihr Passwort an.";
	arrayIndex++;  
	}	
	
	var email = document.getElementById(form+":email").value;
	if ((email!='')&&(email!=null)&&(!Validator.isEmail(email))){
		tempArray[arrayIndex]="Bitte geben Sie eine gültige Email-Adresse an.";
		arrayIndex++;  	
	}
  
  	if (arrayIndex != 0) {
		var i=0;
		for (i=0; i<arrayIndex; i++) {
			alertText=alertText+"\n "+tempArray[i]	
		}
		alert("Bitte geben Sie ihre 8-stellige Kunden-Nummer und Ihr Passwort ein: \n"+alertText);
    	return false;
  	}  	
	else {
		return true;
	}
}




function chkAccountRemindForm(form, target){
	var arrayIndex=0;
	var tempArray=new Array(6);
	var alertText="";		
 
	if (this.document.getElementById(form+':login1').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihre Kunden-Nummer an.";
	arrayIndex++;  
	}
//	else if (this.document.getElementById(form+':login2').value==""){
//	tempArray[arrayIndex]="Bitte geben Sie Ihre Kunden-Nummer an.";
//	arrayIndex++;  
//	}	
	
	if (!Validator.isNumber(this.document.getElementById(form+':login1').value)){
	tempArray[arrayIndex]="Login darf nur aus Ziffern bestehen.";
	arrayIndex++;  
	}
//	else if (!Validator.isNumber(this.document.getElementById(form+':login2').value)){
//	tempArray[arrayIndex]="Login darf nur aus Ziffern bestehen.";
//	arrayIndex++;  
//	}
//	
  	if (arrayIndex != 0) {
		var i=0;
		for (i=0; i<arrayIndex; i++) {
			alertText=alertText+"\n "+tempArray[i]	
		}
		alert("Bitte geben Sie ihre 7-stellige Kunden-Nummer ein: \n"+alertText);
    	
  	}  	
	else {
		//This is an emulation of the action link on the hidden form being clicked and submitted.
		document.getElementById(form+':'+target).onclick(null);  		
	}
}



/* Validation of Required Fields of Order-Catalogs Form*/
function chkOrderCatalogForm(form, target, locale) {
	var arrayIndex=0;
	var tempArray=new Array(22);
	var alertText="";
	var element ="";		
	locale = useCountryLocaleIfPossible(locale, this.document.getElementById(form+':country').value);
	if (this.document.getElementById(form+':firstname').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihren Vornamen ein.";
	arrayIndex++;  
	}	
	if (this.document.getElementById(form+':lastname').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihren Nachnamen ein.";
	arrayIndex++;  
	}	
	if (this.document.getElementById(form+':street').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihre Straße und Nr. ein.";
	arrayIndex++;  
	}	
	if (this.document.getElementById(form+':country').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihr Land ein.";
	arrayIndex++;  
	}	

	if (this.document.getElementById(form+':town').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihren Ort ein.";
	arrayIndex++;  
	}	
	
	element = document.getElementById(form+":postalcode");
	if (locale == "de"){
		if (element.value.length != 5){
			tempArray[arrayIndex] = "Bitte geben Sie eine PLZ mit 5 Ziffern an.";
			arrayIndex++;
		}
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte geben Sie eine gültige PLZ ein.";
			arrayIndex++;
		}
	}
	
	if (locale == "at" || locale == "ch"){
		if (element.value.length != 4){
			tempArray[arrayIndex] = "Bitte geben Sie eine PLZ mit 4 Ziffern an.";
			arrayIndex++;
		}
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte geben Sie eine gültige PLZ ein.";
			arrayIndex++;
		}
	}
	
	element = document.getElementById(form+":phone");
	if (element.value != ""){
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte bei der Telefonnummer nur Ziffern eingeben.";
			arrayIndex++;
		}
	}
	
	element = document.getElementById(form+":cellphone");
	if (element.value != ""){
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte bei der Handynummer nur Ziffern eingeben.";
			arrayIndex++;
		}
	}
	
	element = document.getElementById(form+":fax");
	if (element.value != ""){
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte bei der Faxnummer nur Ziffern eingeben.";
			arrayIndex++;
		}
	}
	
	var birthDay = this.document.getElementById(form+':birthDay').value;
	var birthMonth = this.document.getElementById(form+':birthMonth').value;
	var birthYear = this.document.getElementById(form+':birthYear').value;	
	if ( (""!=birthDay) || (""!=birthMonth) || (""!=birthYear)   ) {
  		if ( !( (""!=birthDay)&&(""!=birthMonth)&&(""!=birthYear)  )  ) {
			tempArray[arrayIndex]="Bitte geben Sie ein gültiges Datum für den Geburtstag ein!";
			arrayIndex++; 
		}
		else {	
			if (  ( !Validator.isNumber(birthDay) )  ||  ( (Validator.isNumber(birthDay)) && (!(0<birthDay&&birthDay<32))  )   ) {
				tempArray[arrayIndex] = "Bitte geben Sie ein gültiges Datum für den Geburtstag ein:"+"\n"+"Bitte geben Sie einen gültigen Wert für \"Tag\" (zwischen 01 und 31) an.";
				arrayIndex++;
			}
			if (  ( !Validator.isNumber(birthMonth) )  ||  ( (Validator.isNumber(birthMonth)) && (!(0<birthMonth&&birthMonth<13))  )   ) {
				tempArray[arrayIndex] = "Bitte geben Sie ein gültiges Datum für den Geburtstag ein:"+"\n"+"Bitte geben Sie einen gültigen Wert für \"Monat\" (zwischen 01 und 12) an.";
				arrayIndex++;
			}
			if (  ( !Validator.isNumber(birthYear) )  ||  ( (Validator.isNumber(birthYear)) && (!(1900<birthYear&&birthYear<2100))  )   ) {
				tempArray[arrayIndex] = "Bitte geben Sie ein gültiges Datum für den Geburtstag ein:"+"\n"+"Bitte geben sie eine gültige vierstellige Zahl für \"Jahr\" an.";
				arrayIndex++;
			} 
		}	  	
  	}
	
	var email = document.getElementById(form+":email").value;
	if ((email=='')||(email!='')&&(!Validator.isEmail(email))){
		tempArray[arrayIndex]="Bitte geben Sie eine gültige Email-Adresse an.";
		arrayIndex++;  	
	}
		
  	if (arrayIndex != 0) {
		var i=0;
		for (i=0; i<arrayIndex; i++) {
			alertText=alertText+"\n "+tempArray[i]	
		}
		alert("Bitte geben Sie alle mit (*) gekennzeichneten Felder ein: \n\n"+alertText);    	
  	}
  	else {
	  	//This is an emulation of the action link on the hidden form being clicked and submitted.
		document.getElementById(form+':'+target).onclick(null);  
	}
}

	

/* Validation of Required Fields of Order-Samples Form Stoffmusterkollektion */
function chkOrderSamplesForm(form, target, locale){
	var arrayIndex=0;
	var tempArray=new Array(22);
	var alertText="";
	var element ="";		
	locale = useCountryLocaleIfPossible(locale, this.document.getElementById(form+':land').value); 
	if (this.document.getElementById(form+':anrede').value==""){
	tempArray[arrayIndex]="Anrede";
	arrayIndex++;  
	}	
	if (this.document.getElementById(form+':FirstNameTextfield').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihren Vornamen ein.";
	arrayIndex++;  
	}	
	if (this.document.getElementById(form+':LastNameTextfield').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihren Nachnamen ein.";
	arrayIndex++;  
	}	
	if (this.document.getElementById(form+':streetAddressTextfield').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihre Straße und Nr. ein.";
	arrayIndex++;  
	}	
	if (this.document.getElementById(form+':land').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihr Land ein.";
	arrayIndex++;  
	}	

	if (this.document.getElementById(form+':cityTextfield').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihren Ort ein.";
	arrayIndex++;  
	}	
	
	element = document.getElementById(form+":zipCodeTextfield");
	if (locale == "de"){
		if (element.value.length != 5){
			tempArray[arrayIndex] = "Bitte geben Sie eine PLZ mit 5 Ziffern an.";
			arrayIndex++;
		}
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte geben Sie eine gültige PLZ ein.";
			arrayIndex++;
		}
	}
	
	if (locale == "at" || locale == "ch"){
		if (element.value.length != 4){
			tempArray[arrayIndex] = "Bitte geben Sie eine PLZ mit 4 Ziffern an.";
			arrayIndex++;
		}
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte geben Sie eine gültige PLZ ein.";
			arrayIndex++;
		}
	}
	
	element = document.getElementById(form+":telTextfield");
	if (element.value != ""){
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte bei der Telefonnummer nur Ziffern eingeben.";
			arrayIndex++;
		}
	}
	
	element = document.getElementById(form+":mobileTextfield");
	if (element.value != ""){
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte bei der Handynummer nur Ziffern eingeben.";
			arrayIndex++;
		}
	}
	
	element = document.getElementById(form+":faxTextfield");
	if (element.value != ""){
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte bei der Faxnummer nur Ziffern eingeben.";
			arrayIndex++;
		}
	}
	
	var birthDay = this.document.getElementById(form+':birthDay').value;
	var birthMonth = this.document.getElementById(form+':birthMonth').value;
	var birthYear = this.document.getElementById(form+':birthYear').value;	
	if ( (""!=birthDay) || (""!=birthMonth) || (""!=birthYear)   ) {
  		if ( !( (""!=birthDay)&&(""!=birthMonth)&&(""!=birthYear)  )  ) {
			tempArray[arrayIndex]="Bitte geben Sie ein gültiges Datum für den Geburtstag ein!";
			arrayIndex++; 
		}
		else {	
			if (  ( !Validator.isNumber(birthDay) )  ||  ( (Validator.isNumber(birthDay)) && (!(0<birthDay&&birthDay<32))  )   ) {
				tempArray[arrayIndex] = "Bitte geben Sie ein gültiges Datum für den Geburtstag ein:"+"\n"+"Bitte geben Sie einen gültigen Wert für \"Tag\" (zwischen 01 und 31) an.";
				arrayIndex++;
			}
			if (  ( !Validator.isNumber(birthMonth) )  ||  ( (Validator.isNumber(birthMonth)) && (!(0<birthMonth&&birthMonth<13))  )   ) {
				tempArray[arrayIndex] = "Bitte geben Sie ein gültiges Datum für den Geburtstag ein:"+"\n"+"Bitte geben Sie einen gültigen Wert für \"Monat\" (zwischen 01 und 12) an.";
				arrayIndex++;
			}
			if (  ( !Validator.isNumber(birthYear) )  ||  ( (Validator.isNumber(birthYear)) && (!(1900<birthYear&&birthYear<2100))  )   ) {
				tempArray[arrayIndex] = "Bitte geben Sie ein gültiges Datum für den Geburtstag ein:"+"\n"+"Bitte geben Sie eine gültige vierstellige Zahl für \"Jahr\" an.";
				arrayIndex++;
			} 
		}	  	
  	}
	
	var email = document.getElementById(form+":emailTextfield").value;
	if ((email=='')||(email!='')&&(!Validator.isEmail(email))){
		tempArray[arrayIndex]="Bitte geben Sie eine gültige Email-Adresse an.";
		arrayIndex++;  	
	}
	
	if ( null!=(this.document.getElementById(form+':tailoredShirts'))) {		
	  	if ( !(this.document.getElementById(form+':tailoredShirts').checked) && !(this.document.getElementById(form+':tailoredClothingMen').checked) ){
		tempArray[arrayIndex]="Bitte wählen Sie mindestens eine Kollektion aus.";
		arrayIndex++;  
		}	
	}
	else {	
		if ( null!=(this.document.getElementById(form+':WalbuschKatalog'))) {	
		  	if ( !(this.document.getElementById(form+':WalbuschKatalog').checked) && !(this.document.getElementById(form+':KlepperKatalog').checked) && !(this.document.getElementById(form+':DamenKatalog').checked) && !(this.document.getElementById(form+':HosenKatalog').checked) && !(this.document.getElementById(form+':HemdenKatalog').checked) ){
			tempArray[arrayIndex]="Bitte wählen Sie mindestens einen Katalog aus.";
			arrayIndex++;  
			}	
		}
		else {
			if (this.document.getElementById(form+':KlepperKatalog') && !(this.document.getElementById(form+':KlepperKatalog').checked) ){
			tempArray[arrayIndex]="Bitte wählen Sie mindestens einen Katalog aus.";
			arrayIndex++;  
			}	
		}
	}
		
  	if (arrayIndex != 0) {
		var i=0;
		for (i=0; i<arrayIndex; i++) {
			alertText=alertText+"\n "+tempArray[i]	
		}
		alert("Bitte geben Sie alle mit (*) gekennzeichneten Felder ein: \n\n"+alertText);    	
  	}
  	else {
	  	//This is an emulation of the action link on the hidden form being clicked and submitted.
		document.getElementById(form+':'+target).onclick(null);  
	}
}

	
/* Validation of Required Fields of Email-Contact Form*/
function chkContactForm (form, target, locale) {

	var arrayIndex=0;
	var tempArray=new Array(14);
	var alertText="";
		
	locale = useCountryLocaleIfPossible(locale, this.document.getElementById(form+':land').value); 
	if (this.document.getElementById('contactForm:MailSubject').value==""){
	tempArray[arrayIndex]="Bitte geben Sie einen Betreff an.";
	arrayIndex++;  
	}	 
	if (this.document.getElementById('contactForm:FeedbackText').value==""){
	tempArray[arrayIndex]="Bitte geben Sie eine Mitteilung ein.";
	arrayIndex++;  
	}	
	if (this.document.getElementById('contactForm:anrede').value==""){
	tempArray[arrayIndex]="Bitte wählen Sie die passende Anrede";
	arrayIndex++;  
	}	
	if (this.document.getElementById('contactForm:FirstNameTextfield').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihren Vornamen ein.";
	arrayIndex++;  
	}	
	if (this.document.getElementById('contactForm:LastNameTextfield').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihren Nachnamen ein.";
	arrayIndex++;  
	}	
	if (this.document.getElementById('contactForm:streetAddressTextfield').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihre Straße und Nr. ein.";
	arrayIndex++;  
	}	
	element = document.getElementById(form+":zipCodeTextfield");
	if (locale == "de"){
		if (element.value.length != 5){
			tempArray[arrayIndex] = "Bitte geben Sie eine PLZ mit 5 Ziffern an.";
			arrayIndex++;
		}
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte geben Sie eine gültige PLZ ein.";
			arrayIndex++;
		}
	}
	if (locale == "at" || locale == "ch"){
		if (element.value.length != 4){
			tempArray[arrayIndex] = "Bitte geben Sie eine PLZ mit 4 Ziffern an.";
			arrayIndex++;
		}
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte geben Sie eine gültige PLZ ein.";
			arrayIndex++;
		}
	}
	if (this.document.getElementById('contactForm:cityTextfield').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihren Ort ein.";
	arrayIndex++;  
	}	
	if (this.document.getElementById('contactForm:land').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihr Land ein.";
	arrayIndex++;  
	}	
	if (this.document.getElementById('contactForm:emailTextfield').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihre Email-Adresse ein.";
	arrayIndex++;  
	}	
	else if (this.document.getElementById('contactForm:emailTextfield').value.indexOf("@") == -1) {
		tempArray[arrayIndex]="Bitte geben Sie eine gültige Email-Adresse ein.";
		arrayIndex++;  
	}	
	else if (this.document.getElementById('contactForm:emailTextfield').value.indexOf(".") == -1) {
		tempArray[arrayIndex]="Bitte geben Sie eine gültige Email-Adresse ein.";
		arrayIndex++;  
	}
  	if (arrayIndex != 0) {
		var i=0;
		for (i=0; i<arrayIndex; i++) {
			alertText=alertText+"\n "+tempArray[i]	
		}
		alert("Bitte geben Sie alle mit (*) gekennzeichneten Felder ein: \n\n"+alertText);
  	}
	else {
		//This is an emulation of the action link on the hidden form being clicked and submitted.
		document.getElementById(form+':'+target).onclick(null);  		
	}
}
	


/* Validation of Required Fields of CallbackRequest Form*/
function chkCallbackForm(form, target){	
	var arrayIndex=0;		
	var tempArray=new Array(10);		
	var alertText="";		
	
	if (this.document.getElementById('callbackForm:MailSubject').value==""){		
	tempArray[arrayIndex]="Bitte wählen Sie ein Thema.";
	arrayIndex++;  
	}
	if (  (this.document.getElementsByName('callbackForm:isClientRadioButton')[0].checked) && (this.document.getElementById('callbackForm:customerIdTextfield').value=="") ){
	tempArray[arrayIndex]="Bitte geben Sie eine Kundennummer an oder wählen Sie -Nein- aus.";
	arrayIndex++;  
	}
	if (  (this.document.getElementsByName('callbackForm:callbacktime')[0].checked) && ( (this.document.getElementById('callbackForm:date').value!="") || (this.document.getElementById('callbackForm:time').value!="") )){
	tempArray[arrayIndex]="Bitte wählen Sie entweder -In 15 min- oder -zu folgendem Termin-, nicht beides!";
	arrayIndex++;  
	}
	if (this.document.getElementById('callbackForm:anrede').value==""){		
	tempArray[arrayIndex]="Bitte wählen Sie eine Anrede.";
	arrayIndex++;  
	}	
	if (this.document.getElementById('callbackForm:FirstNameTextfield').value==""){		
	tempArray[arrayIndex]="Bitte geben Sie Ihren Vornamen ein.";
	arrayIndex++;  
	}	
	if (this.document.getElementById('callbackForm:LastNameTextfield').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihren Nachnamen ein.";
	arrayIndex++;  
	}		
	element = document.getElementById(form+":telTextfield");
	if (element.value != ""){
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte bei der Telefonnummer nur Ziffern eingeben.";
			arrayIndex++;
		}
	}
	else{
		tempArray[arrayIndex]="Bitte geben Sie eine Rückrufnummer an.";
		arrayIndex++;
	}
	
	var email = document.getElementById(form+":emailTextfield").value;
	if ((email!='')&&(!Validator.isEmail(email))){
		tempArray[arrayIndex]="Bitte geben Sie eine gültige Email-Adresse an.";
		arrayIndex++;  	
	}
	
  	if (arrayIndex != 0) {
		var i=0;
		for (i=0; i<arrayIndex; i++) {
			alertText=alertText+"\n "+tempArray[i]	
		}
		alert("Bitte geben Sie alle mit (*) gekennzeichneten Felder ein: \n\n"+alertText);  
		}
	else {
		//This is an emulation of the action link on the hidden form being clicked and submitted.
		document.getElementById(form+':'+target).onclick(null);  		
	}
}



/* Validation of Required Fields of RecommendationForm*/
function chkRecommendForm(form, target){	
	var arrayIndex=0;		
	var tempArray=new Array(10);		
	var alertText="";	
	
	if (this.document.getElementById(form+':receiverFirstName').value==""){		
	tempArray[arrayIndex]="Bitte geben Sie den Vornamen des Empfängers ein.";
	arrayIndex++;  
	}	
	if (this.document.getElementById(form+':senderFirstName').value==""){		
	tempArray[arrayIndex]="Bitte geben Sie Ihren Vornamen ein.";
	arrayIndex++;  
	}	
	if (this.document.getElementById(form+':senderLastName').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihren Nachnamen ein.";
	arrayIndex++;  
	}		
	if (this.document.getElementById(form+':senderLastName').value==""){
	tempArray[arrayIndex]="Bitte geben Sie den Nachnamen des Empfängers ein.";
	arrayIndex++;  
	}
    if (this.document.getElementById(form+':receiverEmail').value==""){
	tempArray[arrayIndex]="Bitte geben Sie eine Empfänger-Emailadresse ein.";
	arrayIndex++;
	}
    if (!Validator.isEmail(this.document.getElementById(form+':receiverEmail').value)){
	tempArray[arrayIndex]="Bitte geben Sie eine gültige Empfänger-Emailadresse an.";
	arrayIndex++;  
	}
    if (this.document.getElementById(form+':senderEmail').value==""){
	tempArray[arrayIndex]="Bitte geben Sie eine Absender-Emailadresse ein.";
	arrayIndex++;
	}
    if (!Validator.isEmail(this.document.getElementById(form+':senderEmail').value)){
	tempArray[arrayIndex]="Bitte geben Sie eine gültige Absender-Emailadresse an.";
	arrayIndex++;  
	}
    if (this.document.getElementById(form+':captcha').value==""){
    tempArray[arrayIndex]="Bitte geben Sie einen Sicherheitscode an.";
    arrayIndex++;
    }
    if (arrayIndex != 0) {
		var i=0;
		for (i=0; i<arrayIndex; i++) {
			alertText=alertText+"\n "+tempArray[i]	
		}
		alert("Bitte geben Sie alle mit (*) gekennzeichneten Felder ein: \n\n"+alertText);  
  	}  	
	else {
		//This is an emulation of the action link on the hidden form being clicked and submitted.
		document.getElementById(form+':'+target).onclick(null);  		
	} 	
}

function chkWishlistForm(form, target){
		var arrayIndex=0;
		var tempArray=new Array(10);
		var alertText="";

		if (this.document.getElementById(form+':senderLastName').value==""){
		tempArray[arrayIndex]="Bitte geben Sie Ihren Namen ein.";
		arrayIndex++;
		}
	    if (this.document.getElementById(form+':receiverEmail').value==""){
		tempArray[arrayIndex]="Bitte geben Sie eine Empfänger-Emailadresse ein.";
		arrayIndex++;
		}
	    if (!Validator.isEmail(this.document.getElementById(form+':receiverEmail').value)){
		tempArray[arrayIndex]="Bitte geben Sie eine gültige Empfänger-Emailadresse an.";
		arrayIndex++;
		}
	    if (this.document.getElementById(form+':senderEmail').value==""){
		tempArray[arrayIndex]="Bitte geben Sie eine Absender-Emailadresse ein.";
		arrayIndex++;
		}
	    if (this.document.getElementById(form+':captcha').value==""){
		tempArray[arrayIndex]="Bitte geben Sie den Sicherheitscode an.";
		arrayIndex++;
		}
        if (!Validator.isEmail(this.document.getElementById(form+':senderEmail').value)){
		tempArray[arrayIndex]="Bitte geben Sie eine gültige Absender-Emailadresse an.";
		arrayIndex++;
		}
          if (arrayIndex != 0) {
			var i=0;
			for (i=0; i<arrayIndex; i++) {
				alertText=alertText+"\n "+tempArray[i]
			}
			alert("Bitte geben Sie alle mit (*) gekennzeichneten Felder ein: \n\n"+alertText);
	  	}
		else {
			//This is an emulation of the action link on the hidden form being clicked and submitted.
			document.getElementById(form+':'+target).onclick(null);
		}
}


/* Validation of Required Fields of Newsletter-Signup Form*/
function chkNewsletterForm (form, target, locale) {

	var arrayIndex=0;
	var tempArray=new Array(14);
	var alertText=""; 	
	if (this.document.getElementById(form+':salutation').value==""){
	tempArray[arrayIndex]="Bitte wählen Sie die passende Anrede";
	arrayIndex++;  
	}	
	if (this.document.getElementById(form+':firstname').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihren Vornamen ein.";
	arrayIndex++;  
	}	
	if (this.document.getElementById(form+':lastname').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihren Nachnamen ein.";
	arrayIndex++;  
	}	
		
	element = document.getElementById(form+":postalcode");
	if (element.value != ""){
		if (locale == "de"){
			if (element.value.length != 5){
				tempArray[arrayIndex] = "Bitte geben Sie eine PLZ mit 5 Ziffern an.";
				arrayIndex++;
			}
			if (!Validator.isNumber(element.value)){
				tempArray[arrayIndex] = "Bitte geben Sie eine gültige PLZ ein.";
				arrayIndex++;
			}
		}
		
		if (locale == "at" || locale == "ch"){
			if (element.value.length != 4){
				tempArray[arrayIndex] = "Bitte geben Sie eine PLZ mit 4 Ziffern an.";
				arrayIndex++;
			}
			if (!Validator.isNumber(element.value)){
				tempArray[arrayIndex] = "Bitte geben Sie eine gültige PLZ ein.";
				arrayIndex++;
			}
		}
	}
		
	element = document.getElementById(form+":phone");
	if (element.value != ""){
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte bei der Telefonnummer nur Ziffern eingeben.";
			arrayIndex++;
		}
	}
	
	element = document.getElementById(form+":cellphone");
	if (element.value != ""){
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte bei der Handynummer nur Ziffern eingeben.";
			arrayIndex++;
		}
	}
	
	element = document.getElementById(form+":fax");
	if (element.value != ""){
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte bei der Faxnummer nur Ziffern eingeben.";
			arrayIndex++;
		}
	}
	
	var birthDay = this.document.getElementById(form+':birthDay').value;
	var birthMonth = this.document.getElementById(form+':birthMonth').value;
	var birthYear = this.document.getElementById(form+':birthYear').value;	
	if ( (""!=birthDay) || (""!=birthMonth) || (""!=birthYear)   ) {
  		if ( !( (""!=birthDay)&&(""!=birthMonth)&&(""!=birthYear)  )  ) {
			tempArray[arrayIndex]="Bitte geben Sie ein gültiges Datum für den Geburtstag ein!";
			arrayIndex++; 
		}
		else {	
			if (  ( !Validator.isNumber(birthDay) )  ||  ( (Validator.isNumber(birthDay)) && (!(0<birthDay&&birthDay<32))  )   ) {
				tempArray[arrayIndex] = "Bitte geben Sie ein gültiges Datum für den Geburtstag ein:"+"\n"+"Bitte geben Sie einen gültigen Wert für \"Tag\" (zwischen 01 und 31) an.";
				arrayIndex++;
			}
			if (  ( !Validator.isNumber(birthMonth) )  ||  ( (Validator.isNumber(birthMonth)) && (!(0<birthMonth&&birthMonth<13))  )   ) {
				tempArray[arrayIndex] = "Bitte geben Sie ein gültiges Datum für den Geburtstag ein:"+"\n"+"Bitte geben Sie einen gültigen Wert für \"Monat\" (zwischen 01 und 12) an.";
				arrayIndex++;
			}
			if (  ( !Validator.isNumber(birthYear) )  ||  ( (Validator.isNumber(birthYear)) && (!(1900<birthYear&&birthYear<2100))  )   ) {
				tempArray[arrayIndex] = "Bitte geben Sie ein gültiges Datum für den Geburtstag ein:"+"\n"+"Bitte geben Sie eine gültige vierstellige Zahl für \"Jahr\" an.";
				arrayIndex++;
			} 
		}	  	
  	}
	
	var email = document.getElementById(form+":email").value;
	if ((email=='')||(email==null)){
		tempArray[arrayIndex]="Bitte geben Sie eine Email-Adresse an.";
		arrayIndex++;  	
	}
	if ((email!='')&&(!Validator.isEmail(email))){
		tempArray[arrayIndex]="Bitte geben Sie eine gültige Email-Adresse an.";
		arrayIndex++;  	
	}
  
  	if (arrayIndex != 0) {
		var i=0;
		for (i=0; i<arrayIndex; i++) {
			alertText=alertText+"\n "+tempArray[i]	
		}
		alert("Bitte geben Sie alle mit (*) gekennzeichneten Felder ein: \n\n"+alertText);
		return false;
  	}  	
	else {
		//This is an emulation of the action link on the hidden form being clicked and submitted.
		return true;  		
	} 	  	
}


/* Validation of Required Field of the specific E-Mail field: 'emailTextfield'  NewlsetterBox     */
function chkEmailField (form, target) {

	var arrayIndex=0;
	var tempArray=new Array(3);
	var alertText="";
			
	if (this.document.getElementById(form+':emailTextfield').value==""){
		tempArray[arrayIndex]="Bitte geben Sie Ihre Email-Adresse ein.";
		arrayIndex++;  
	}	
	else if (!Validator.isEmail(this.document.getElementById(form+':emailTextfield').value)){
		tempArray[arrayIndex]="Bitte geben Sie eine gültige Email-Adresse an.";
		arrayIndex++;  
	}	
  	if (arrayIndex != 0) {
		var i=0;
		for (i=0; i<arrayIndex; i++) {
			alertText=alertText+tempArray[i]+"\n"	
		}
		alert(alertText);    	
  	}  	
	else {
		//This is an emulation of the action link on the hidden form being clicked and submitted.
		document.getElementById(form+':'+target).onclick(null);  		
	} 	
}



/* Validation of Required Field of an E-Mail field, taking the variable 'emailField' as a parameter   newsletterUnsubscribe*/
function chkEmailFieldDyn (emailField, form, target) {

	var arrayIndex=0;
	var tempArray=new Array(3);
	var alertText="";
			
	if (this.document.getElementById(form+':'+emailField).value==""){
		tempArray[arrayIndex]="Bitte geben Sie Ihre Email-Adresse ein.";
		arrayIndex++;  
	}	
	else if (!Validator.isEmail(this.document.getElementById(form+':'+emailField).value)){
		tempArray[arrayIndex]="Bitte geben Sie eine gültige Email-Adresse an.";
		arrayIndex++;  
	}	
  	if (arrayIndex != 0) {
		var i=0;
		for (i=0; i<arrayIndex; i++) {
			alertText=alertText+tempArray[i]+"\n"	
		}
		alert(alertText);    	
  	}  	
	else {
		//This is an emulation of the action link on the hidden form being clicked and submitted.
		document.getElementById(form+':'+target).onclick(null);  		
	} 	
}



/* Validation of Fields in Chnage E-Mail Form: OldEMail, 2times new Email (the latter have to be equal)  */
function chkChangeEmailFields (oldEmailField, newEmailField1, newEmailField2, form, target) {

	var arrayIndex=0;
	var tempArray=new Array(5);
	var alertText="";
			
	if (   ( this.document.getElementById(form+':'+oldEmailField).value=="" ) || ( this.document.getElementById(form+':'+newEmailField1).value=="" )  || ( this.document.getElementById(form+':'+newEmailField2).value=="" ) )
	{
		tempArray[arrayIndex]="Bitte geben Sie in allen Feldern Email-Adressen ein.";
		arrayIndex++;  
	}	
	
	if (     (!Validator.isEmail(this.document.getElementById(form+':'+oldEmailField).value))  || (!Validator.isEmail(this.document.getElementById(form+':'+newEmailField1).value))  || (!Validator.isEmail(this.document.getElementById(form+':'+newEmailField2).value))    ) 
	{
		tempArray[arrayIndex]="Bitte geben Sie gültige Email-Adressen an.";
		arrayIndex++;  
	}
	if(     (this.document.getElementById(form+':'+newEmailField1).value)  != (this.document.getElementById(form+':'+newEmailField2).value)  ) 
	{
		tempArray[arrayIndex]="Die letzten beiden Felder müssen übereinstimmen.";
		arrayIndex++;  
	}
		
  	if (arrayIndex != 0) {
		var i=0;
		for (i=0; i<arrayIndex; i++) {
			alertText=alertText+tempArray[i]+"\n"	
		}
		alert(alertText);    	
  	}  	
	else {
		//This is an emulation of the action link on the hidden form being clicked and submitted.
		document.getElementById(form+':'+target).onclick(null);  		
	} 	
}



function chkRegistrationForm(form, target,locale){
	var arrayIndex = 0;
	var tempArray=new Array(22);
	var alertText = "";	
	locale = useCountryLocaleIfPossible(locale, this.document.getElementById(form+':country').value); 
	if (this.document.getElementById(form+':salutation').value==""){
	tempArray[arrayIndex]="Anrede";
	arrayIndex++;  
	}	
	if (this.document.getElementById(form+':firstname').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihren Vornamen ein.";
	arrayIndex++;  
	}	
	if (this.document.getElementById(form+':lastname').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihren Nachnamen ein.";
	arrayIndex++;  
	}	
	if (this.document.getElementById(form+':street').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihre Straße und Nr. ein.";
	arrayIndex++;  
	}	
	if (this.document.getElementById(form+':country').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihr Land ein.";
	arrayIndex++;  
	}	

	if (this.document.getElementById(form+':town').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihren Ort ein.";
	arrayIndex++;  
	}	
	
	element = document.getElementById(form+":postalcode");
	if (locale == "de"){
		if (element.value.length != 5){
			tempArray[arrayIndex] = "Bitte geben Sie eine PLZ mit 5 Ziffern an.";
			arrayIndex++;
		}
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte geben Sie eine gültige PLZ ein.";
			arrayIndex++;
		}
	}
	
	if (locale == "at" || locale == "ch"){
		if (element.value.length != 4){
			tempArray[arrayIndex] = "Bitte geben Sie eine PLZ mit 4 Ziffern an.";
			arrayIndex++;
		}
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte geben Sie eine gültige PLZ ein.";
			arrayIndex++;
		}
	}
	
	element = document.getElementById(form+":phone");
	if (element.value != ""){
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte bei der Telefonnummer nur Ziffern eingeben.";
			arrayIndex++;
		}
	}
	
	element = document.getElementById(form+":cellphone");
	if (element.value != ""){
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte bei der Handynummer nur Ziffern eingeben.";
			arrayIndex++;
		}
	}
	
	element = document.getElementById(form+":fax");
	if (element.value != ""){
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte bei der Faxnummer nur Ziffern eingeben.";
			arrayIndex++;
		}
	}
	
	
	var email = document.getElementById(form+":email").value;
	if ((email!='')&&(!Validator.isEmail(email))){
		tempArray[arrayIndex]="Bitte geben Sie eine gültige Email-Adresse an.";
		arrayIndex++;  	
	}	
	
	var birthDay = this.document.getElementById(form+':birthDay').value;
	var birthMonth = this.document.getElementById(form+':birthMonth').value;
	var birthYear = this.document.getElementById(form+':birthYear').value;	
	if ( (""!=birthDay) || (""!=birthMonth) || (""!=birthYear)   ) {
  		if ( !( (""!=birthDay)&&(""!=birthMonth)&&(""!=birthYear)  )  ) {
			tempArray[arrayIndex]="Bitte geben Sie ein gültiges Datum für den Geburtstag ein!";
			arrayIndex++; 
		}
		else {	
			if (  ( !Validator.isNumber(birthDay) )  ||  ( (Validator.isNumber(birthDay)) && (!(0<birthDay&&birthDay<32))  )   ) {
				tempArray[arrayIndex] = "Bitte geben Sie ein gültiges Datum für den Geburtstag ein:"+"\n"+"Bitte geben Sie einen gültigen Wert für \"Tag\" (zwischen 01 und 31) an.";
				arrayIndex++;
			}
			if (  ( !Validator.isNumber(birthMonth) )  ||  ( (Validator.isNumber(birthMonth)) && (!(0<birthMonth&&birthMonth<13))  )   ) {
				tempArray[arrayIndex] = "Bitte geben Sie ein gültiges Datum für den Geburtstag ein:"+"\n"+"Bitte geben Sie einen gültigen Wert für \"Monat\" (zwischen 01 und 12) an.";
				arrayIndex++;
			}
			if (  ( !Validator.isNumber(birthYear) )  ||  ( (Validator.isNumber(birthYear)) && (!(1900<birthYear&&birthYear<2100))  )   ) {
				tempArray[arrayIndex] = "Bitte geben Sie ein gültiges Datum für den Geburtstag ein:"+"\n"+"Bitte geben Sie eine gültige vierstellige Zahl für \"Jahr\" an.";
				arrayIndex++;
			} 
		}	  	
  	}
	
	if ( null!=(this.document.getElementById(form+':dataProtection'))) {		
	  	if ( !(this.document.getElementById(form+':dataProtection').checked)  ){
		tempArray[arrayIndex]="Bitte Datenschutz akzeptieren.";
		arrayIndex++;  
		}	
	}
	
	
	var element1 = document.getElementById(form+":password");
	var element2 = document.getElementById(form+":passwordRepeat");
	if ( (element1 != null && element1.value != "") || (element2 != null && element2.value != "") ){
		if (element1.value.length < 5){
			tempArray[arrayIndex]="Das Passwort muss mindestens 5 Zeichen lang sein.";
			arrayIndex++;
		}
		if (element2 == null){
			tempArray[arrayIndex]="Bitte bestätigen Sie das Passwort.";
			arrayIndex++;  
		}
		if (element2 != null){
			if (element1.value.length != element2.value.length && element1.value.length > 5) {
				tempArray[arrayIndex]="Bitte geben Sie zweimal das gleiche Passwort an.";
				arrayIndex++;
			} 
			else{
				var equal = true;
				for (var i = 0; i < element1.value.length; i++){
					if (equal && element1.value[i] != element2.value[i]) {
						equal = false;
						break;
					}
				}
				if (!equal==true){
					tempArray[arrayIndex]="Bitte geben Sie zwei mal das gleiche Passwort an.";
					arrayIndex++;
				}
			}
		}
	}	
	
	if (arrayIndex != 0) {
		var i=0;
		for (i=0; i<arrayIndex; i++) {
			alertText=alertText+"\n "+tempArray[i]	
		}
		alert(alertText);    	
  	}  	
	else {
		//This is an emulation of the action link on the hidden form being clicked and submitted.
		document.getElementById(form+':'+target).onclick(null);  		
	}	
}



function chkAdressEditForm(form,target,locale){
	var arrayIndex = 0;
	var tempArray=new Array(22);
	var alertText = "";	
	locale = useCountryLocaleIfPossible(locale, this.document.getElementById(form+':country').value); 
	if (this.document.getElementById(form+':salutation').value==""){
	tempArray[arrayIndex]="Anrede";
	arrayIndex++;  
	}	
	if (this.document.getElementById(form+':firstname').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihren Vornamen ein.";
	arrayIndex++;  
	}	
	if (this.document.getElementById(form+':lastname').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihren Nachnamen ein.";
	arrayIndex++;  
	}	
	if (this.document.getElementById(form+':street').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihre Straße und Nr. ein.";
	arrayIndex++;  
	}	
	if (this.document.getElementById(form+':country').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihr Land ein.";
	arrayIndex++;  
	}	

	if (this.document.getElementById(form+':town').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihren Ort ein.";
	arrayIndex++;  
	}	
	
	element = document.getElementById(form+":postalcode");
	if (locale == "de"){
		if (element.value.length != 5){
			tempArray[arrayIndex] = "Bitte geben Sie eine PLZ mit 5 Ziffern an.";
			arrayIndex++;
		}
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte geben Sie eine gültige PLZ ein.";
			arrayIndex++;
		}
	}
	
	if (locale == "at" || locale == "ch"){
		if (element.value.length != 4){
			tempArray[arrayIndex] = "Bitte geben Sie eine PLZ mit 4 Ziffern an.";
			arrayIndex++;
		}
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte geben Sie eine gültige PLZ ein.";
			arrayIndex++;
		}
	}
	
	if (arrayIndex != 0) {
		var i=0;
		for (i=0; i<arrayIndex; i++) {
			alertText=alertText+"\n "+tempArray[i]	
		}
		alert(alertText);    	
  	}  	
	else {
		//This is an emulation of the action link on the hidden form being clicked and submitted.
		document.getElementById(form+':'+target).onclick(null);  		
	}
}



function chkAdressEditFormAllFields(form,target,locale){
	var arrayIndex = 0;
	var tempArray=new Array(22);
	var alertText = "";
	locale = useCountryLocaleIfPossible(locale, this.document.getElementById(form+':country').value); 
	if (this.document.getElementById(form+':salutation').value==""){
	tempArray[arrayIndex]="Anrede";
	arrayIndex++;  
	}	
	if (this.document.getElementById(form+':firstname').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihren Vornamen ein.";
	arrayIndex++;  
	}	
	if (this.document.getElementById(form+':lastname').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihren Nachnamen ein.";
	arrayIndex++;  
	}	
	if (this.document.getElementById(form+':street').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihre Straße und Nr. ein.";
	arrayIndex++;  
	}	
	if (this.document.getElementById(form+':country').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihr Land ein.";
	arrayIndex++;  
	}	

	if (this.document.getElementById(form+':town').value==""){
	tempArray[arrayIndex]="Bitte geben Sie Ihren Ort ein.";
	arrayIndex++;  
	}	
	
	element = document.getElementById(form+":postalcode");
	if (locale == "de"){
		if (element.value.length != 5){
			tempArray[arrayIndex] = "Bitte geben Sie eine PLZ mit 5 Ziffern an.";
			arrayIndex++;
		}
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte geben Sie eine gültige PLZ ein.";
			arrayIndex++;
		}
	}
	
	if (locale == "at" || locale == "ch"){
		if (element.value.length != 4){
			tempArray[arrayIndex] = "Bitte geben Sie eine PLZ mit 4 Ziffern an.";
			arrayIndex++;
		}
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte geben Sie eine gültige PLZ ein.";
			arrayIndex++;
		}
	}
	
	element = document.getElementById(form+":phone");
	if (element.value != ""){
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte bei der Telefonnummer nur Ziffern eingeben.";
			arrayIndex++;
		}
	}
	
	element = document.getElementById(form+":cellphone");
	if (element.value != ""){
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte bei der Handynummer nur Ziffern eingeben.";
			arrayIndex++;
		}
	}
	
	element = document.getElementById(form+":fax");
	if (element.value != ""){
		if (!Validator.isNumber(element.value)){
			tempArray[arrayIndex] = "Bitte bei der Faxnummer nur Ziffern eingeben.";
			arrayIndex++;
		}
	}
	
	var email = document.getElementById(form+":email").value;
	if ((email!='')&&(!Validator.isEmail(email))){
		tempArray[arrayIndex]="Bitte geben Sie eine gültige Email-Adresse an.";
		arrayIndex++;  	
	}
	
	var birthDay = this.document.getElementById(form+':birthDay').value;
	var birthMonth = this.document.getElementById(form+':birthMonth').value;
	var birthYear = this.document.getElementById(form+':birthYear').value;	
	if ( (""!=birthDay) || (""!=birthMonth) || (""!=birthYear)   ) {
  		if ( !( (""!=birthDay)&&(""!=birthMonth)&&(""!=birthYear)  )  ) {
			tempArray[arrayIndex]="Bitte geben Sie ein gültiges Datum für den Geburtstag ein!";
			arrayIndex++; 
		}
		else {	
			if (  ( !Validator.isNumber(birthDay) )  ||  ( (Validator.isNumber(birthDay)) && (!(0<birthDay&&birthDay<32))  )   ) {
				tempArray[arrayIndex] = "Bitte geben Sie ein gültiges Datum für den Geburtstag ein:"+"\n"+"Bitte geben Sie einen gültigen Wert für \"Tag\" (zwischen 01 und 31) an.";
				arrayIndex++;
			}
			if (  ( !Validator.isNumber(birthMonth) )  ||  ( (Validator.isNumber(birthMonth)) && (!(0<birthMonth&&birthMonth<13))  )   ) {
				tempArray[arrayIndex] = "Bitte geben Sie ein gültiges Datum für den Geburtstag ein:"+"\n"+"Bitte geben Sie einen gültigen Wert für \"Monat\" (zwischen 01 und 12) an.";
				arrayIndex++;
			}
			if (  ( !Validator.isNumber(birthYear) )  ||  ( (Validator.isNumber(birthYear)) && (!(1900<birthYear&&birthYear<2100))  )   ) {
				tempArray[arrayIndex] = "Bitte geben Sie ein gültiges Datum für den Geburtstag ein:"+"\n"+"Bitte geben Sie eine gültige vierstellige Zahl für \"Jahr\" an.";
				arrayIndex++;
			} 
		}	  	
  	}
	
	if (arrayIndex != 0) {
		var i=0;
		for (i=0; i<arrayIndex; i++) {
			alertText=alertText+"\n "+tempArray[i]	
		}
		alert(alertText);    	
  	}  	
	else {
		//This is an emulation of the action link on the hidden form being clicked and submitted.
		document.getElementById(form+':'+target).onclick(null);  		
	}
}
	


/* Validation of Required Fields of cartQuickAdd Form*/
function chkQuickAddForm(form, target)
{
	var arrayIndex=0;
	var tempArray=new Array(3);
	var alertText="";		
 
	var pc1 = this.document.getElementById(form+':productCode1').value;
	var pc2 = this.document.getElementById(form+':productCode2').value;
	var pc3 = this.document.getElementById(form+':productCode3').value;
	var pSize = this.document.getElementById(form+':productSize').value;
	
	if ( (pc1=="")||(pc2=="")||(pc3=="") )
	{
		tempArray[arrayIndex]="Bitte geben Sie eine vollständige Artikelnummer an.";
		arrayIndex++;  
	}	
	
	if (arrayIndex != 0)
	{
		var i=0;
		for (i=0; i<arrayIndex; i++)
		{
			alertText=alertText+"\n "+tempArray[i]	
		}
		alert(alertText);
		return false;    	
  	}  	
	else
	{
		return true;  	
	}
}	
	
function chkLengthAndGoToNext(form,source,target,length){
	var src = document.getElementById(form+':'+source);
	var trg = document.getElementById(form+':'+target);
	if (src.value.length >= length ){
		trg.focus();
	}
}
//tests if the text of a field is a Number and changes the focus for input fields
//if the text is not a Number, all "not a Digit"'s are deleted from this text (Firefox)
//if the text is not a Number, then the text is set to "empty" (IE6,IE7)  
function chkFieldAndGoToNext(form,source,target,length){

	var src = document.getElementById(form+':'+source);
	var trg = document.getElementById(form+':'+target);
	if (!Validator.isNumber(src.value)){
		alert("Bitte geben Sie nur Zahlen ein!");
		var newValue =new Array();
		for (var i = 0; i < src.value.length; i++){
			if (Validator.isDigit(src.value[i])){
				newValue[i] = src.value[i];
			}
		}
		src.value = "";
		for (var i = 0 ; i < newValue.length; i++){
			if (Validator.isDigit(newValue[i])){
				src.value = src.value + newValue[i];
			}
		}
		return;
	}
	if (src.value.length >= length ){
		trg.focus();
	}
}

//checks if the SelectMenus are checked
function chkAddToCartForm(form, target){
	var arrayIndex=0;
	var alertText="";	
	
    var selectField1 = document.getElementById('chooseVariant:productDetailVariantsForm:datalist:0:selectVariantAttribute');
    var selectField2 = document.getElementById('chooseVariant:productDetailVariantsForm:datalist:1:selectVariantAttribute');
    var selectField3 = document.getElementById('chooseVariant:productDetailVariantsForm:datalist:2:selectVariantAttribute');
    
    if (selectField1) {
	    if (selectField1.value == 0) {
	    	alertText="Bitte wählen Sie aus allen Bereichen etwas aus! ";
			arrayIndex++; 
		}
    }
    
    if (selectField2) {
	    if (selectField2.value == 0) {
	  		alertText="Bitte wählen Sie aus allen Bereichen etwas aus! ";
			arrayIndex++; 
		}
    }
   
    if (selectField3) {
    	if (selectField3.value == 0) {
    		alertText="Bitte wählen Sie aus allen Bereichen etwas aus! ";
			arrayIndex++; 
    	}
    }
	
	if (arrayIndex != 0) {
		alert(alertText);    	
  	}  	
	else {
		//This is an emulation of the action link on the hidden form being clicked and submitted.
		document.getElementById(form+':'+target).onclick(null);  	
	}
}	

// Checks if an option is selected in all selects on the product detail page.
// Uses JQuery.
function checkSelectionBeforeCart(el, context, isocode, selectName)
{
	var form = $(el).parents().map(function () {if ($(this).hasClass("product")) return this;});
	var submit = true;
    var theSelectName = selectName!=null?"select."+selectName:"select.variants_select";

    form.find(theSelectName).each(function () {submit = submit * (this.value != "0")})
	if(!submit) alert("Bitte wählen Sie aus allen Bereichen etwas aus!");

// Check if cookies are enabled, if no go to specific errorpage
	if (!document.cookie)
	{
  		var browser = navigator.appName;
  		if (browser == 'Netscape')
  		{
  			var url = "pages/page.jsf?pageid=datenschutz_cookies_" + isocode + "_textpage";
  		}
  		else
  		{
  			var url = context + "/pages/page.jsf?pageid=datenschutz_cookies_" + isocode + "_textpage";
  		}
  		cookieErrorPage = window.open( url , '_self' );
  		cookieErrorPage.focus();
  		submit = false;
	}
	return submit;
}




// An onkeypress event on an inputTextfield can call this function and pass the event 
// as parameter as well as the encapsulating form and the target command, that needs 
// to be called to submit the form.
// The entered key in the textfield triggeres the onkeypress event. That ascii code of 
// that key can be retrieved via event.keyCode or event.CharCode or event.which depending on browser
function checkAndSubmitOnEnterKey(evt, form, target) { 
	var keycode; 
	if (evt) ; 
	else 
		if (window.event) evt = window.event; 
		else 
			if (event) evt = event; 
			else return true; 
	if (evt.charCode) keycode = evt.charCode; 
	else 
		if (evt.keyCode) keycode = evt.keyCode;  //character code is contained in IE's keyCode property
		else 
			if (evt.which) keycode = evt.which; //character code is contained in NN4's which property
			else keycode = 0; 
	if (keycode == 13) { 				//if character code of pressed key is equal to ascii 13 (if ENTER key)
		chkEmailField(form,target);		//call a validation function before submitting
		//alternatively submit directly:
		//document.getElementById(form+':'+target).onclick(null);
		return false; 
	} 
	else return true; 
}














/**********************************************************************************************************
 ***********************************    External Code    **************************************************
 ******************************************************************************************************** */

/**
 * Various form validation methods.
 *
 * @author Moxiecode
 * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
 */

/**
	// String validation:

	if (!Validator.isEmail('myemail'))
		alert('Invalid email.');

	// Form validation:

	var f = document.forms['myform'];

	if (!Validator.isEmail(f.myemail))
		alert('Invalid email.');
*/
var Validator = {
	isEmail : function(s) {
		return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
	},

	isAbsUrl : function(s) {
		return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');
	},

	isSize : function(s) {
		return this.test(s, '^[0-9]+(px|%)?$');
	},

	isId : function(s) {
		return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$');
	},

	isEmpty : function(s) {
		var nl, i;

		if (s.nodeName == 'SELECT' && s.selectedIndex < 1)
			return true;

		if (s.type == 'checkbox' && !s.checked)
			return true;

		if (s.type == 'radio') {
			for (i=0, nl = s.form.elements; i<nl.length; i++) {
				if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked)
					return false;
			}

			return true;
		}

		return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s);
	},

	isNumber : function(s, d) {
		return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$'));
	},
	
	isDigit : function(s) {
		var p = '[0-9]';
		return s == '' || new RegExp(p).test(s);
	},

	test : function(s, p) {
		s = s.nodeType == 1 ? s.value : s;

		return s == '' || new RegExp(p).test(s);
	}
};

function useCountryLocaleIfPossible(locale, countryLocale) {
	if(locale == countryLocale) {
	    return locale;
	}
	if(countryLocale == 'de' || countryLocale == 'ch' || countryLocale == 'at')
	{
		return countryLocale;
	}
	return locale;
}
function chkPasswordChangeForm(form, target) {
	var arrayIndex = 0;
	var tempArray=new Array(22);
	var alertText = "";	
	var element1 = document.getElementById(form+":password_new");
	var element2 = document.getElementById(form+":password_confirmed");

	if ( (element1 != null && element1.value != "") || (element2 != null && element2.value != "") ){
		if (element1.value.length < 5){
			tempArray[arrayIndex]="Das Passwort muss mindestens 5 Zeichen lang sein.";
			arrayIndex++;
		}
		if ((element2 == null) || (element2.value.length == 0)){
			tempArray[arrayIndex]="Bitte bestätigen Sie das Passwort.";
			arrayIndex++;  
		}
		if (element2 != null){
			if (element1.value.length != element2.value.length && element1.value.length > 5) {
				tempArray[arrayIndex]="Bitte geben Sie zweimal das gleiche Passwort an.";
				arrayIndex++;
			} 
			else{
				var equal = true;
				for (var i = 0; i < element1.value.length; i++){
					if (equal && element1.value[i] != element2.value[i]) {
						equal = false;
						break;
					}
				}
				if (!equal==true){
					tempArray[arrayIndex]="Bitte geben Sie zwei mal das gleiche Passwort an.";
					arrayIndex++;
				}
			}
		}
	}else{
		tempArray[arrayIndex]="Bitte geben Sie zwei mal das gleiche Passwort an.";
		arrayIndex++;
		tempArray[arrayIndex]="Das Passwort muss mindestens 5 Zeichen lang sein.";
	}	
	
	if (arrayIndex != 0) {
		var i=0;
		for (i=0; i<arrayIndex; i++) {
			alertText=alertText+"\n "+tempArray[i]	
		}
		alert(alertText);    	
  	}  	
	else {
		
		//This is an emulation of the action link on the hidden form being clicked and submitted.
		document.getElementById(form+':'+target).onclick(null);  		
	}	
}

//alert(this.document.getElementById(form+':country').value);
/*********************************************************************************************************
 ***********************************  End Of External Code    ********************************************
 ******************************************************************************************************* */		