//submission scripts
$('.contactForm').submit( function(){
		//statements to validate the form	
		var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		var email = document.getElementById('e-mail');
		if (!filter.test(email.value)) {
			$('.email-missing').show();
		} else {$('.email-missing').hide();}
		if (document.cform.name.value == "Name") {
			$('.name-missing').show();
		} else {$('.name-missing').hide();}	
		if (document.cform.message.value == "Type your message here") {
			$('.message-missing').show();
		} else {$('.message-missing').hide();}		
		if ((document.cform.name.value == "Name") || (!filter.test(email.value)) || (document.cform.message.value == "Type your message here")){
			return false;
		} 
		
		if ((document.cform.name.value != "") && (filter.test(email.value)) && (document.cform.message.value != "")) {
			//hide the form
			$('.contactForm').hide();
		
			//show the loading bar
			$('.loader').append($('.bar'));
			$('.bar').css({display:'block'});
		
			//send the ajax request
			$.post('mail.php',{name:$('#name').val(),
							   email:$('#e-mail').val(),
							   message:$('#message').val(),
							  },
		
			//return the data
			function(data){
				
			  //hide the graphic
			  $('.bar').css({display:'none'});
			  $('.loader').append(data);
			});
			Cufon.replace('h3');
			//waits 2000, then closes the form and fades out
			//setTimeout('$("#backgroundPopup").fadeOut("slow"); $("#contactForm").slideUp("slow")', 2000);
			
			//stay on the page
			return false;
		} 
  });
//submission scripts
$('.quote').submit( function(){	
		var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		var email = document.getElementById('e-mail2');
		if (!filter.test(email.value)) {
			$('.emailq-missing').show();
		} else {$('.emailq-missing').hide();}
		if (document.qform.customer.value == "Name") {
			$('.nameq-missing').show();
		} else {$('.nameq-missing').hide();}	
		if ((document.qform.customer.value == "Name") || (!filter.test(email.value))){
			return false;
		} 
		
		if ((document.qform.customer.value != "") && (filter.test(email.value))) {
			//hide the form
			$('.quote').hide();
		
			//show the loading bar
			$('.qloader').append($('.bar'));
			$('.qbar').css({display:'block'});
			//send the ajax request
			$.post('mail-quote.php',{
				    deadline:$('#deadline').val(),
					budget:$('#budget').val(),
					customer:$('#customer').val(),
					company:$('#company').val(),
					email:$('#e-mail2').val(),
					telephone:$('#telephone').val(),
					projectothers:$('#projectothers').val(),
					web:$('div.web input:checkbox:checked').getValue(),
					prnt:$('div.prnt input:checkbox:checked').getValue(),
					branding:$('div.branding input:checkbox:checked').getValue(),
					marketing:$('div.marketing input:checkbox:checked').getValue(),
					},
							  
		
			//return the data
			function(data){
				
			  //hide the graphic
			  $('.qbar').css({display:'none'});
			  $('.qloader').append(data);
			});
			Cufon.replace('h3');
			//waits 2000, then closes the form and fades out
			//setTimeout('$("#backgroundPopup").fadeOut("slow"); $("#contactForm").slideUp("slow")', 2000);
			
			//stay on the page
			return false;
		} 
 });