// JavaScript Document

var KatalogbestellungError = "Fehler bei Anmelden!"
var KatalogbestellungSuccess = 'Vielen Dank für die Anforderung des Summit Club Katalogs. Der Katalog wird Ihnen in den nächsten Tagen per Post zugesandt.';










function checkDatalogbestellunForm()
{
	var error = '';
	getId('katalogbestellunName').className = 'inputStyle';
	getId('katalogbestellunVorname').className = 'inputStyle';
	getId('katalogbestellunLand').className = 'inputStyle';
	getId('katalogbestellunTelefon').className = 'inputStyle';
	getId('katalogbestellunEMailAdresse').className = 'inputStyle';
	getId('katalogbestellunAnrede').className = '';
	getId('kat_know_us').className = 'inputStyle';
	getId("datalogbestellungTitleInfo").style.color="";
	
	var katalog_type=document.getElementsByName("katalog_arr[]");

	var hasChecked=false;
	
	if(katalog_type){
		for(var j=0;j<katalog_type.length;j++){
	
			if(katalog_type[j].checked){
				hasChecked=true;
				break;
			}
		}
	
		if(!hasChecked){
			error = all_error;
			getId("datalogbestellungTitleInfo").style.color="#D80202";	
		}
	}
	
	if(!(getId('katalogbestellunAnredeHerr').checked == true || getId('katalogbestellunAnredeFrau').checked == true))
	{
		//error += redanrede+'<br />';
		error = all_error;
		getId('katalogbestellunAnrede').className = 'anredeSex';
	}
	 
	if(getId('katalogbestellunName').value == '')
	{
		//error += name+'<br />';
		error = all_error;
		getId('katalogbestellunName').className = 'erroreStyle';
	}
	if(getId('katalogbestellunVorname').value == '')
	{
		//error += name+'<br />';
		error = all_error;
		getId('katalogbestellunVorname').className = 'erroreStyle';
	}
	
	if(getId('katalogbestellunLand').value == '')
	{
		//error += name+'<br />';
		error = all_error;
		getId('katalogbestellunLand').className = 'erroreStyle';
	}
	
	if(getId('katalogbestellunTelefon').value == '')
	{
		//error += name+'<br />';
		error = all_error;
		getId('katalogbestellunTelefon').className = 'erroreStyle';
	}
	
	//email validate
	if(!validate_email(getId('katalogbestellunEMailAdresse').value))
	{
		error = all_error;
		getId('katalogbestellunEMailAdresse').className = 'erroreStyle';
	}
	
	if(getId('kat_know_us').value == '')
	{
		//error += name+'<br />';
		error = all_error;
		getId('kat_know_us').className = 'erroreStyle';
	}
	
	if(error != '')
	{
		show_newsletter_error('KatalogbestellunError',error);
		setFooterStyle();
		return false;
	}
	else
	{
		var tempimg=new Image();
		tempimg.src="fileadmin/templates/images/loading_small.gif";
		
		getId('KatalogbestellunError').innerHTML=' <span class="loadingText"><img src="fileadmin/templates/images/loading_small.gif" class="formloading" /> Loading...</span>';
		getId('katalogbestellun_mail').disabled=true;
		
		//var url = getId('Gutscheinform').action;
		startRequest("POST",'index.php?id=186',true,'katalogbestellungOp=Submit&'+$('mailkatalogbestellunForm').toQueryString(),"form", 4);	
	}	
}

/**
 * Back gutschein
 */
function BackKatalogbestellun()
{
	getId('katalogbestellunFormSucceed').style.display = 'none';
	getId('KatalogbestellunError').style.display = 'none';
	getId('mailkatalogbestellunForm').style.display = '';
	getId('datalogbestellungTitleInfo').style.display = '';
	getId('katalogbestellun_mail').disabled=false;
    getId('form_notice_text').style.display= ''; 
	setFooterStyle();
}

function checkbox(name,id)
{

	theValue = '';
	thePermition = document.getElementsByName(name);
	for(i=0;i<thePermition.length;i++)
	{
		if(thePermition[i].checked)
		{
			if(theValue == '')
				theValue = thePermition[i].value;
			else
				theValue += ','+thePermition[i].value;
		}
	}
	getId(id).value = theValue;
}

