
$(document).ready(function(){
$.ImageBox.init(
	{
		loaderSRC: './images/imagebox/loading.gif',
		closeHTML: '<img src="./images/imagebox/close.jpg" alt="close" />'
	}
);
});


// prepare the form when the DOM is ready 
$(document).ready(function(){
	
			var options = {
				
				beforeSubmit: validate,
				
				success:showResponse,
				clearForm: true,     
        		resetForm: true,
				timeout:5000
			};
	
		$('#contactForm').ajaxForm(options);
		
		$("#content p+p").css("margin-top","20px");
		$("li img").click(function(){
				$(this).css("cursor","hand");
				location.href="samples.php";
				
			});
		$('#htmlTarget').hide();
		$('#valName').hide();
		$('#loading').hide();
		
		
		 
		});
	function validate(formData, jqForm, options) { 
    // jqForm is a jQuery object which wraps the form DOM element 
    // 
    // To validate, we can access the DOM elements directly and return true 
    // only if the values of both the username and password fields evaluate 
    // to true 
 
    var form = jqForm[0]; 
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	mail = form.email.value;
	name = form.name.value;
	valid = emailExp.test(mail);
	
	if(valid==false && name=="")
	 	{
			
			alert('Your name and a valid email are required');
			return false; 
        }
     else if (valid==false)
	 	{ 
			
			alert('Your name and a valid email are required');
			return false; 
    	 }
	else if(valid==true && name=="")
	 	{
			
			alert('Your name and a valid email are required');
			return false; 
		}
		$('#wham').hide(); 
	$('#loading').show();
	  return true;
}

function showResponse()  { 
   $('#loading').hide();
	$('#wham').hide(); 
   	$('#htmlTarget').fadeIn('slow');

} 

	