//validate the form



	

	function validate() {

     
       div = document.getElementById('hiddenList');


		var reg_email = /^\w+(\.\w+)*@\w+\.\w{2,3}$/;

		

		var checker = false;



		var email = document.getElementById( 'email' );

		

		email.onfocus = function() {

			_onfocus( "email_label" );

			checker = false;

		}

		

		if( !reg_email.test( email.value ) ) {

			_notval( "email_label" );

			checker = true;

		}



		//check that important fields are not empty
		
		
		var cityname = document.getElementById('cityname');

		

		cityname.onfocus = function() {

			_onfocus( "cityname_label" );

			checker = false;

		}

		

		if(cityname.value == '-1'){

			_notval( 'cityname_label' );

			checker = true;

		}
		
		

		var fname = document.getElementById('fname');

		

		fname.onfocus = function() {

			_onfocus( "fname_label" );

			checker = false;

		}

		

		if(fname.value == ''){

			_notval( 'fname_label' );

			checker = true;

		}

		

		var lname = document.getElementById('lname');

		

		lname.onfocus = function() {

			_onfocus( "lname_label" );

			checker = false;

		}

		

		if(lname.value == ''){

			_notval( 'lname_label' );

			checker = true;

		}


		/*
		var passport = document.getElementById('passport');

		

		passport.onfocus = function() {

			_onfocus( "passport_label" );

			checker = false;

		}

		

		if(passport.value == ''){

			_notval( 'passport_label' );

			checker = true;

		}
		
		*/
		
		
		var topic = document.getElementById('topic');
	  
	 

		topic.onfocus = function() {
			_onfocus( "topic_label" );
			checker = false;
		}


		if(topic.value == '-1'){
			_notval( 'topic_label' );
			checker = true;
		}
		

		



		if( checker ) {

			/*var message = 'Please correct field(s) with red labels.';

			$('error').setHTML(message);

			

			$('error').setStyles('color :#FF0000;font-size:10px;');*/

			

			alert('Please correct fields(s) with red labels.');

		

			

			return;

		}

		

		//finally submit the form if all data of the form are correct/valid

		goto();

		

	}

	

	function _notval( id ) {

			//document.getElementById( id ).style.backgroundColor = "red";

			document.getElementById( id ).style.color = "red";

	}

		

	function _onfocus( id ) {

			//document.getElementById( id ).style.backgroundColor = "white";

			document.getElementById( id ).style.color = "#c23c97";

	}

	 

	



	function goto() {

		



		$('CheckoutForm').setProperty('action','contact_form_send.php');

		$('CheckoutForm').setProperty('encoding','multipart/form-data');

		

		var task = new Element('input',

							{

								'type': 'hidden', 

								'name':'task', 

								'value':'vieworder'

							}).injectInside($('CheckoutForm'));

		

		$('CheckoutForm').submit();

	

			

	}

	


