	$(document).ready(function() {
	
	//if submit button is clicked
	$('#submit').click(function () {		
		
		//Get the data from all the fields
		var name = $('input[name=name]');
		var last = $('input[name=last]');
		var company = $('input[name=company]');
		var phone = $('input[name=phone]');
		var email = $('input[name=email]');
		var af = $('select[name=af]');
		var ae = $('textarea[name=ae]');
		
		

		//Simple validation to make sure user entered something
		//If error found, add hightlight class to the text field
		if (name.val()=='') {
			name.addClass('hightlight');
			return false;
		} else name.removeClass('hightlight');
		
		if (last.val()=='') {
			last.addClass('hightlight');
			return false;
		} else last.removeClass('hightlight');
		
		if (phone.val()=='') {
			phone.addClass('hightlight');
			return false;
		} else phone.removeClass('hightlight');
		
		
		if (email.val()=='') {
			email.addClass('hightlight');
			return false;
		} else email.removeClass('hightlight');
	
		
		//organize the data properly
		var data = 
		'name=' + name.val() 
		+ '&last=' + last.val() 
		+ '&company=' + company.val() 
		+ '&phone=' + phone.val() 
		+ '&email=' + email.val()
		+ '&af=' + af.val()
		+ '&ae=' + encodeURIComponent(ae.val())

	
		//disabled all the text fields
		$('.disabled-input').attr('disabled','true');

	
				setTimeout (function(){
					$('.loading-form').show(); },300);
		
		
		//start the ajax
		$.ajax({
			//this is the php file that processes the data and send mail
			url: "contact-process.php",	
			
			//GET method is used
			type: "GET",

			//pass the data			
			data: data,		
			
			//Do not cache the page
			cache: false,
			
		//success
			success: function (html) {				
				//if process.php returned 1/true (send mail success)
				if (html==1) {	
				
						setTimeout (function(){
					$('.loading-form').hide(); },2800);	
					
					
					setTimeout (function(){
					//show the success message
					$('.done').fadeIn(1000); },2800);
					
				 
					//show the success message
					$('.myform').hide();
					
					
					
						//show the loading sign
					$('#start-now-submit-btn').hide();
					
				 
				//if process.php returned 0/false (send mail failed)
				} else alert('Sorry, unexpected error. Please try again later.');				
			}		
		});
		
		//cancel the submit button default behaviours
		return false;
	});	
 

	
	//text rotator script for about us page
	$('#contact-us-fader').cycle({
		fx:      'fade',
		timeout:  0,
		prev:    '#prev',
		next:    '#next'
	});
	
	//pop up for services icons
	$("a[rel]").overlay({
 	top: 20,
	expose: '#000000',
	opacity: 5
	 
});

	var CatalogSubCatID

	$('.bannerRotator').cycle({
	    fx:     'fade', 
	    speed:  590, 
	    timeout: 5000, 
	    pause: 1
	});

	
});	