		function checkContactForm(){
			var error=false;
			if($('#iAm').val()=='no'){
				error=false;
			}else{
				/*
				if($('#cName').val()==''){
					error=true;
				}
				if($('#cFirstname').val()==''){
					error=true;
				}
				*/
				if($('#cEmail').val().search(/^[0-9a-zA-Z]([0-9a-zA-Z-_.]*[0-9a-zA-Z])?@[0-9a-zA-Z]([0-9a-zA-Z-_.]*[0-9a-zA-Z])?\.[a-zA-Z]{2,9}$/)==-1){
					error=true;
				}
			}
			
			disableBtn(error);
			
		}
		
		function disableBtn(off){
			document.getElementById('sendContactForm').disabled=off;
		}
		
		function workForm(){
			var response='/acp/lib/event_frontend_contact.php';
			switch($('#iAm').val()){
				case 'no' :
					tb_remove();
					break;
				case 'cBand':
					if($('#cBandname').val()==""){
						alert('Helfen Sie uns, uns vorzubereiten:\nGeben Sie bitte den Namen der Band und ggf. ein Genre an.');
					}else{
						$.post(response,{fname:$('#cFirstname').val(),lname:$('#cName').val(),email:$('#cEmail').val(),phone:$('#cMePhone').val(),type:'band',bandName:$('#cBandname').val(),genre:$('#cBandgenre').val(),bandEmail:$('#cBandEmail').val()},function(data){workForm_callback(data);},'json');
					}
					break;
				case 'agency':
					if($('#cAgencyName').val()==""){
						alert('Helfen Sie uns, uns vorzubereiten:\nGeben Sie bitte den Namen der Agentur an.');
					}else{
						$.post(response,{fname:$('#cFirstname').val(),lname:$('#cName').val(),email:$('#cEmail').val(),phone:$('#cMePhone').val(),type:'agency',agency:$('#cAgencyName').val()},function(data){workForm_callback(data);},'json');
					}
					break;
				case 'other':
					$.post(response,{fname:$('#cFirstname').val(),lname:$('#cName').val(),email:$('#cEmail').val(),phone:$('#cMePhone').val(),type:'other'},function(data){workForm_callback(data);},'json');
					break;
				case 'cLocation':
					if($('#cClubname').val()==""){
						alert('Helfen Sie uns, uns vorzubereiten:\nGeben Sie bitte den Namen des Clubs an.');
					}else if($('#cClubCity').val()==""){
						alert('Helfen Sie uns, uns vorzubereiten:\nGeben Sie bitte die Stadt an, in der man Ihren Club findet\n(Ideal ist die ganze Adresse).');
					}else{
						$.post(response,{fname:$('#cFirstname').val(),lname:$('#cName').val(),email:$('#cEmail').val(),phone:$('#cMePhone').val(),type:'location',locationName:$('#cClubname').val(),locationEmail:$('#cClubEmail').val(),locationStreet:$('#cClubStreet').val(),locationZip:$('#cClubZip').val(),locationCity:$('#cClubCity').val()},function(data){workForm_callback(data);},'json');
					}
					break;
			}
		}
		
		function workForm_callback(data){
			if(data.error!=""){
				alert(data.error);
			}else{
				alert('Danke für Ihr Interesse. Wir werden uns umgehend um Ihr Anliegen kümmern.');
			}
			tb_remove();
		}
		
		function tb_selfinit(){
			var t = '';
			var a = '#TB_inline?height=570&width=570&inlineId=NoteModalFrame&modal=true';
			var g = false;
			tb_show(t,a,g);
			return false;
		};
		  
		$('document').ready(function(){
			
			$('a.iAm').mouseover(function(event){
				event.target.style.color='#e7501b';
			})
			
			$('a.iAm').mouseout(function(event){
				if(event.target.id!=$('#iAm').val())
					event.target.style.color='#ee841e';
			})
			
			
			$('#cLocation').click(function(){
				$('a.iAm').css('color','#ee841e');
				$('#cLocation').css('color','#e7501b');
				$('#iAm').val('cLocation');
				$('.subForm').hide();
				$('#generalForm').show('fast');
				$('#cLocationForm').show('fast');
				$('#sendContactForm').val('Zugang anfordern');
				checkContactForm();
			});
			$('#cBand').click(function(){
				$('a.iAm').css('color','#ee841e');
				$('#cBand').css('color','#e7501b');
				$('#iAm').val('cBand');
				$('.subForm').hide();
				$('#generalForm').show('fast');
				$('#cBandForm').show('fast');
				$('#sendContactForm').val('Zugang anfordern');
				checkContactForm();
			});
			$('#agency').click(function(){
				$('a.iAm').css('color','#ee841e');
				$('#agency').css('color','#e7501b');
				$('#iAm').val('agency');
				$('.subForm').hide();
				$('#generalForm').show('fast');
				$('#agencyForm').show('fast');
				$('#sendContactForm').val('Zugang anfordern');
				checkContactForm();
			});
			$('#other').click(function(){
				$('a.iAm').css('color','#ee841e');
				$('#other').css('color','#e7501b');
				$('#iAm').val('other');
				$('.subForm').hide();
				$('#generalForm').show('fast');
				$('#sendContactForm').val('Zugang anfordern');
				checkContactForm();
			});
			$('#no').click(function(){
				$('a.iAm').css('color','#ee841e');
				$('#no').css('color','#e7501b');
				$('#iAm').val('no');
				$('#generalForm').hide('fast');
				$('.subForm').hide('fast');
				$('#sendContactForm').val('weiter');
				checkContactForm();
			});
			$('.textForm').keyup(function(){
				checkContactForm();
			});
		  tb_selfinit();
		});