$(document).ready(function() {
	
	
	$(".fancybox").fancybox({
		'autoScale'           : false
	});
	
	$(".iframefancybox").fancybox({
		'width'				: '95%',
		'height'			: '95%',
        'autoScale'     	: false,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
	
	
});

/* For downloading broucher */

$.fn.broucher_req = function() {

	user_info=[];

	if($("#name").val().length){
		user_info._userName=$("#name").val();
	}else{
		$(".error_name").html("Please type your name.");
		$(".error_name").show();
		return false;
	}
	
	if($("#email").val().length){
		user_info._userEmail=$("#email").val();
	}else{
		$(".error_email").html("Please Type your email address.");
		$(".error_email").show();
		return false;
	}
	
	user_info._contact_no = $("#contact_no").val();
	

	$.fn.sendMail_req(user_info);

};

$.fn.sendMail_req = function(user_info) {
	//_notificationBox=$('<div class="broucher_link"><a href="files/ebroucher.pdf" target="_blank"class="btn"> Download Broucher</a></div>');
	//_notificationBox.css({ borderWidth:"1px", borderColor:"#123456", borderStyle:"solid", backgroundColor:"#37719E", color:"white", padding:"5px",fontSize:"15px", fontFamily:"tahoma", fontWeight:"bold", margin:"0 0 5px", display:"none"   });
	
	/*alert("user: "+ user_info._userName + "emails :"+ user_info._userEmail + "Contact :" + user_info._contact_no);
	return false;*/
	
	$.ajax({
	  type: 'POST',
	  url:'common/mail.php',
		data: ({type:'broucher_req', name:user_info._userName, email:user_info._userEmail, contact_no:user_info._contact_no }),
		success:function(response){ 	alert(response); //return;
			if(response==true){
				$('.form').fadeOut(200);
				//_notificationBox.text('<a href="files/ebroucher.pdf" target="_blank"class="btn"> Download Broucher</a>').prependTo(".form").fadeIn(200);
				$('.broucher_link').fadeIn(300);
			}
			
	   }
	});
	
};
