
$(document).ready(function() {
    $('#news').cycle({
		fx:     'turnDown', 
    	timeout: 8000,  
		speed: 800
	});
	//----------------------------
	
	 $('#banner').cycle({
		fx: 'cover', 
    	timeout: 4000,  
		speed: 800
	});
	//----------------------------
	
	jQuery('.course_menu').accordion({
		autoheight: false,
		header: ".acc_tab"			
	});
	
	//-------------------------
	
	$('.corner_t_10').cornerz({
		radius: 8,
		corners: "tl tr"
	})
	
	//--------------------------
	
	$("#ceo_message").colorbox({width:"600", inline:true, href:"#ceo_message_txt", opacity : 0.65});
	
	//-------------------------
	
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;


	$('.mustFields2').click(function() { 
		if($(this).val() == 'Please enter...')
		{
			$(this).val('');
		}
	});
	$('.submit_2').click(function() { 
		var valid = true;
		$('.mustFields2').each(function() { 		
			if($(this).val() == '' || $(this).val() == 'Please enter...')
			{
				$(this).val('Please enter...');
				valid = false;
			}
			else if($(this).attr('id') == 'formContEmail'){
				if (!filter.test($(this).val())) {
					valid = false;
					alert('Please enter a valid email address...');
				}
			}
		});
		
		if(valid)
		{
			var msgbody = 'Name: ' + $('#formContName').val() + '\n\n' + 
						'Company Name: ' + $('#formContCompany').val() + '\n\n' + 
						'Address:\n ' + $('#formContAddress').val().replace(/\r|\n|\r\n/g, '\n ') + '\n\n' +
						'Telephone Number: ' + 	$('#formContTel').val() + '\n\n' + 
						'Email: ' + 	$('#formContEmail').val() + '\n\n' +
						'Message:\n ' +  $('#formContMessage').val().replace(/\r|\n|\r\n/g, '\n ') + '\n\n' ; 	
			$.post("contact.php", { emailFrom: $('#formContEmail').val(), subject: 'Message From syscoms.edu.qa', message: msgbody },
				function(data){
					$('.contact').hide().html("<div class=\"thank_you\"><p>Thank you. Your message has been sent. <br/> We will get back to you as soon as possible.</p></div>").fadeIn('fast');		
				}
			);	
					
		}
		
		return false;
	});
	
});







	
