// JavaScript Document

$(document).ready(function (){
	/** comments starts here**/							
	$("#dividclosecomm").click(function (e){
		$("#dividcomments").show();	
		$("#dividaddcomments").hide();
	});
	/** comments ends here**/	
	/** news jquery starts here..**/
	$("#aidupcoming").click(function (e){
		e.preventDefault();
		$("#dividupcoming").show();
		$("#dividpast").hide();	
		$(this).attr('class', 'active');	
		$("#aidpast").attr('class', '');			
	});
	$("#aidpast").click(function (e){
	 	e.preventDefault();
		$("#dividupcoming").hide();
		$("#dividpast").show();	
		$("#aidupcoming").attr('class', '');	
		$(this).attr('class', 'active');		
	});
	/** news jquery ends here..**/
	/** request a song jquery starts here..**/
	$("#prayer_name").focus(function (e){
		if(trimAll($(this).val()) == 'Name' || trimAll($(this).val()).toLowerCase() == 'name'){
			$(this).val('');
		}
		$(this).attr('class', '');
	});	
	$("#prayer_name").blur(function (e){
		if(trimAll($(this).val()) == ''){
			$(this).val('Name');
			$(this).attr('class', 'hint');			
		}
	});
	$("#prayer_email").focus(function (e){
		if(trimAll($(this).val()) == 'Email' || trimAll($(this).val()).toLowerCase() == 'email'){
			$(this).val('');
		}
		$(this).attr('class', '');
	});	
	$("#prayer_email").blur(function (e){
		if(trimAll($(this).val()) == ''){
			$(this).val('Email');
			$(this).attr('class', 'hint');
		}
	});
	$("#prayer_country").change(function (e){
		if(trimAll($(this).val()) == 0 ){
			$(this).attr('class', 'hint');
		}else{
			$(this).attr('class', '');
		}
	});
	$("#prayer_country").click(function (e){		
		$(this).attr('class', '');
	});
	$("#prayer_country").blur(function (e){
		if(trimAll($(this).val()) == 0 ){
			$(this).attr('class', 'hint');
		}else{
			$(this).attr('class', '');
		}
	});
	/*$("#prayer_country").focus(function (e){
		if(trimAll($(this).val()) == 'Phone' || trimAll($(this).val()).toLowerCase() == 'phone'){
			$(this).val('');
		}
	});	
	$("#prayer_country").blur(function (e){
		if(trimAll($(this).val()) == ''){
			$(this).val('Phone');
		}
	});*/
	$("#prayer_song").focus(function (e){
		if(trimAll($(this).val()) == 'Song & Album' || trimAll($(this).val()).toLowerCase() == 'song & album'){
			$(this).val('');
		}
		$(this).attr('class', '');
	});	
	$("#prayer_song").blur(function (e){
		if(trimAll($(this).val()) == '' ){
			$(this).val('Song & Album');
			$(this).attr('class', 'hint');
		}
	});
	$("#aidcomments").click(function (e){
		e.preventDefault();
		if(trimAll($("#prayer_name").val()).toLowerCase() == 'name' || trimAll($("#prayer_name").val()) == ''){
			alert('Please enter Name');
			$("#prayer_name").focus();
			return false;
		}
		if(trimAll($("#prayer_email").val()).toLowerCase() == 'email' || trimAll($("#prayer_email").val()) == ''){
			alert('Please enter Email');
			$("#prayer_email").focus();
			return false;
		}else{
			if(EmailValidate(document.getElementById('prayer_email'), 'Email') == false){
				$("#prayer_email").focus();
				return false;
			}
		}
		if(trimAll($("#prayer_country").val()) == 0){
			alert('Please select Country');
			$("#prayer_country").focus();
			return false;
		}
		if(trimAll($("#prayer_song").val()).toLowerCase() == 'song & album' || trimAll($("#prayer_song").val()) == ''){
			alert('Please enter Song & Album');
			$("#prayer_song").focus();
			return false;
		}
		if($("#prayer_security").val() == ''){
			alert('Please enter Security Code');
			$("#prayer_security").focus();
			return false;
		}else{
			$.ajax({
			  url: 'captcheck.php?code='+$("#prayer_security").val(),
			  async: false,
			  success: function(data) {
				if(data == "N") { 
					alert('The entered Security Code is not correct. Please try again'); 
					$("#prayer_security").val(''); 
					$("#prayer_security").focus();
					return false;
				}else if(data == "Y"){
					var d = new Date();
					$.ajax({
					  url: 'ajax_func.php?action=prayer_request&prayer_name='+trimAll($("#prayer_name").val())+'&prayer_email='+trimAll($("#prayer_email").val())+'&prayer_song='+trimAll($("#prayer_song").val())+'&prayer_country='+trimAll($("#prayer_country").val()),
					  async: false,
					  success: function(respoane) {
					  	if(respoane == 'sent'){
							alert('Request a song detail has been sent successfully.');
							$("#prayer_name").val('Name');
							$("#prayer_email").val('Email');
							$("#prayer_country").val(0);
							$("#prayer_song").val('Song & Album');
							$("#prayer_security").val('');
							$("#prayercaptcha").attr('src', '');
							$("#prayercaptcha").attr('src', 'CaptchaSecurityImages.php?width=103&height=23&characters=6&time='+d.getTime());
							return false;
						}else{
							alert('Request a song detail is not sent successfully. Please try again later');
							$("#prayer_name").val('Name');
							$("#prayer_email").val('Email');
							$("#prayer_country").val(0);
							$("#prayer_song").val('Song & Album');
							$("#prayer_security").val('');
							$("#prayercaptcha").attr('src', '');
							$("#prayercaptcha").attr('src', 'CaptchaSecurityImages.php?width=103&height=23&characters=6&time='+d.getTime());
							return false;
						}
					  }
					});			
				}else if(data == "SE"){
					alert('Your session has expired.Please enter Security Code again');
					window.location.reload();			
				}
			  }
			});
		}		
		return false;
	});	
	/** request a song jquery ends here..**/
	
	/** prayer request jquery starts here..**/
	$("#request_name").focus(function (e){
		if(trimAll($(this).val()) == 'Name' || trimAll($(this).val()).toLowerCase() == 'name'){
			$(this).val('');
		}
		$(this).attr('class', '');	
	});	
	$("#request_name").blur(function (e){
		if(trimAll($(this).val()) == ''){
			$(this).val('Name');
			$(this).attr('class', 'hint');	
		}
	});
	$("#request_email").focus(function (e){
		if(trimAll($(this).val()) == 'Email' || trimAll($(this).val()).toLowerCase() == 'email'){
			$(this).val('');
		}
		$(this).attr('class', '');	
	});	
	$("#request_email").blur(function (e){
		if(trimAll($(this).val()) == ''){
			$(this).val('Email');
			$(this).attr('class', 'hint');	
		}
	});
	$("#request_phone").focus(function (e){
		if(trimAll($(this).val()) == 'Phone' || trimAll($(this).val()).toLowerCase() == 'phone'){
			$(this).val('');
		}
		$(this).attr('class', '');	
	});	
	$("#request_phone").blur(function (e){
		if(trimAll($(this).val()) == ''){
			$(this).val('Phone');
			$(this).attr('class', 'hint');	
		}
	});
	$("#request_state").focus(function (e){
		if(trimAll($(this).val()) == 'State' || trimAll($(this).val()).toLowerCase() == 'state'){
			$(this).val('');
		}
		$(this).attr('class', '');	
	});	
	$("#request_state").blur(function (e){
		if(trimAll($(this).val()) == '' ){
			$(this).val('State');
			$(this).attr('class', 'hint');	
		}
	});
	$("#request_address").focus(function (e){
		if(trimAll($(this).val()) == 'Address' || trimAll($(this).val()).toLowerCase() == 'address'){
			$(this).val('');
		}
		$(this).attr('class', '');	
	});	
	$("#request_address").blur(function (e){
		if(trimAll($(this).val()) == '' ){
			$(this).val('Address');
			$(this).attr('class', 'hint');	
		}
	});
	$("#request_country").change(function (e){
		if(trimAll($(this).val()) == 0 ){
			$(this).attr('class', 'hint');
		}else{
			$(this).attr('class', '');
		}
	});
	$("#request_country").click(function (e){		
		$(this).attr('class', '');
	});
	$("#request_country").blur(function (e){
		if(trimAll($(this).val()) == 0 ){
			$(this).attr('class', 'hint');
		}else{
			$(this).attr('class', '');
		}
	});
	$("#request_city").focus(function (e){
		if(trimAll($(this).val()) == 'City' || trimAll($(this).val()).toLowerCase() == 'city'){
			$(this).val('');
		}
		$(this).attr('class', '');	
	});	
	$("#request_city").blur(function (e){
		if(trimAll($(this).val()) == '' ){
			$(this).val('City');
			$(this).attr('class', 'hint');	
		}
	});
	$("#request_comment").focus(function (e){
		if(trimAll($(this).val()) == 'Request' || trimAll($(this).val()).toLowerCase() == 'request'){
			$(this).val('');
		}
		$(this).attr('class', '');	
	});	
	$("#request_comment").blur(function (e){
		if(trimAll($(this).val()) == '' ){
			$(this).val('Request');
			$(this).attr('class', 'hint');	
		}
	});
	$("#request_postcode").focus(function (e){
		if(trimAll($(this).val()) == 'Postal code' || trimAll($(this).val()).toLowerCase() == 'postal code'){
			$(this).val('');
		}
		$(this).attr('class', '');	
	});	
	$("#request_postcode").blur(function (e){
		if(trimAll($(this).val()) == '' ){
			$(this).val('Postal code');
			$(this).attr('class', 'hint');	
		}
	});
	$("#aidprayer").click(function (e){
		e.preventDefault();
		if(trimAll($("#request_name").val()).toLowerCase() == 'name' || trimAll($("#request_name").val()) == ''){
			alert('Please enter Name');
			$("#request_name").focus();
			return false;
		}
		if(trimAll($("#request_email").val()).toLowerCase() == 'email' || trimAll($("#request_email").val()) == ''){
			alert('Please enter Email');
			$("#request_email").focus();
			return false;
		}else{
			if(EmailValidate(document.getElementById('request_email'), 'Email') == false){
				$("#request_email").focus();
				return false;
			}
		}
		if(trimAll($("#request_phone").val()).toLowerCase() == 'phone' || trimAll($("#request_phone").val()) == ''){
			alert('Please enter Phone');
			$("#request_phone").focus();
			return false;
		}
		if(SelectValidate(document.getElementById('request_country'), 'Country') == false){
			$("#request_country").focus();
			return false;
		}
		if(trimAll($("#request_comment").val()).toLowerCase() == 'request' || trimAll($("#request_comment").val()) == ''){
			alert('Please enter Request');
			$("#request_comment").focus();
			return false;
		}
		if($("#request_security").val() == ''){
			alert('Please enter Security Code');
			$("#request_security").focus();
			return false;
		}else{
			var d = new Date();
			$.ajax({
			  url: 'captcheck.php?for=prayer&code='+$("#request_security").val(),
			  async: false,
			  success: function(data) {
				if(data == "N") { 
					alert('The entered Security Code is not correct. Please try again'); 
					$("#request_security").val(''); 
					$("#request_security").focus();
					return false;
				}else if(data == "Y"){
					$.ajax({
					  url: 'ajax_func.php?action=request_request&request_name='+trimAll($("#request_name").val())+'&request_email='+trimAll($("#request_email").val())+'&request_country='+trimAll($("#request_country").val())+'&request_phone='+trimAll($("#request_phone").val())+'&request_state='+trimAll($("#request_state").val())+'&request_city='+trimAll($("#request_city").val())+'&request_postcode='+trimAll($("#request_postcode").val())+'&request_comment='+trimAll($("#request_comment").val())+'&request_address='+trimAll($("#request_address").val()),
					  async: false,
					  success: function(respoane) {
					  	if(respoane == 'sent'){
							alert('Prayer request has been sent successfully.');
							$("#request_name").val('Name');
							$("#request_email").val('Email');
							$("#request_phone").val('Phone');
							$("#request_country").val(0);
							$("#request_state").val('State');
							$("#request_city").val('City');
							$("#request_postcode").val('Postal code');
							$("#request_state").val('State');
							$("#request_comment").val('Request');
							$("#request_address").val('Address');
							$("#request_security").val('');
							$("#requestcaptcha").attr('src', 'CaptchaSecurityImagesPrayer.php?width=103&height=23&characters=6&time='+d.getTime());
							return false;
						}else{
							alert('Prayer Request is not sent successfully. Please try again later');
							$("#request_name").val('Name');
							$("#request_email").val('Email');
							$("#request_phone").val('Phone');
							$("#request_country").val(0);
							$("#request_state").val('State');
							$("#request_city").val('City');
							$("#request_postcode").val('Postal code');
							$("#request_state").val('State');
							$("#request_comment").val('Request');
							$("#request_address").val('Address');
							$("#request_security").val('');
							$("#requestcaptcha").attr('src', 'CaptchaSecurityImagesPrayer.php?width=103&height=23&characters=6&time='+d.getTime());
							return false;
						}
					  }
					});			
				}else if(data == "SE"){
					alert('Your session has expired.Please enter Security Code again');
					window.location.reload();			
				}
			  }
			});
		}		
		return false;
	});	
	/** prayer request jquery ends here..**/
	
	/** contact us detail jquery starts here..**/
	$("#contact_name").focus(function (e){
		if(trimAll($(this).val()) == 'Name' || trimAll($(this).val()).toLowerCase() == 'name'){
			$(this).val('');			
		}
		$(this).attr('class', '');
	});	
	$("#contact_name").blur(function (e){
		if(trimAll($(this).val()) == ''){
			$(this).val('Name');
			$(this).attr('class', 'hint');
		}
	});
	$("#contact_email").focus(function (e){
		if(trimAll($(this).val()) == 'Email' || trimAll($(this).val()).toLowerCase() == 'email'){
			$(this).val('');
		}
		$(this).attr('class', '');
	});	
	$("#contact_email").blur(function (e){
		if(trimAll($(this).val()) == ''){
			$(this).val('Email');
			$(this).attr('class', 'hint');
		}
	});
	$("#contact_phone").focus(function (e){
		if(trimAll($(this).val()) == 'Phone' || trimAll($(this).val()).toLowerCase() == 'phone'){
			$(this).val('');
		}
		$(this).attr('class', '');
	});	
	$("#contact_phone").blur(function (e){
		if(trimAll($(this).val()) == ''){
			$(this).val('Phone');
			$(this).attr('class', 'hint');
		}		
	});
	$("#contact_state").focus(function (e){
		if(trimAll($(this).val()) == 'State' || trimAll($(this).val()).toLowerCase() == 'state'){
			$(this).val('');
		}
		$(this).attr('class', '');
	});	
	$("#contact_state").blur(function (e){
		if(trimAll($(this).val()) == '' ){
			$(this).val('State');
			$(this).attr('class', 'hint');
		}
	});
	$("#contact_address").focus(function (e){
		if(trimAll($(this).val()) == 'Address' || trimAll($(this).val()).toLowerCase() == 'address'){
			$(this).val('');
		}
		$(this).attr('class', '');
	});	
	$("#contact_address").blur(function (e){
		if(trimAll($(this).val()) == '' ){
			$(this).val('Address');
			$(this).attr('class', 'hint');
		}
	});
	$("#contact_country").change(function (e){
		if(trimAll($(this).val()) == 0 ){
			$(this).attr('class', 'hint');
		}else{
			$(this).attr('class', '');
		}
	});
	$("#contact_country").click(function (e){		
		$(this).attr('class', '');
	});
	$("#contact_country").blur(function (e){
		if(trimAll($(this).val()) == 0 ){
			$(this).attr('class', 'hint');
		}else{
			$(this).attr('class', '');
		}
	});
	$("#contact_city").focus(function (e){
		if(trimAll($(this).val()) == 'City' || trimAll($(this).val()).toLowerCase() == 'city'){
			$(this).val('');
		}
		$(this).attr('class', '');
	});	
	$("#contact_city").blur(function (e){
		if(trimAll($(this).val()) == '' ){
			$(this).val('City');
			$(this).attr('class', 'hint');
		}
	});
	$("#contact_comment").focus(function (e){
		if(trimAll($(this).val()) == 'Comments' || trimAll($(this).val()).toLowerCase() == 'comments'){
			$(this).val('');
		}
		$(this).attr('class', '');
	});	
	$("#contact_comment").blur(function (e){
		if(trimAll($(this).val()) == '' ){
			$(this).val('Comments');
			$(this).attr('class', 'hint');
		}
	});
	$("#contact_postcode").focus(function (e){
		if(trimAll($(this).val()) == 'Postal code' || trimAll($(this).val()).toLowerCase() == 'postal code'){
			$(this).val('');
		}
		$(this).attr('class', '');
	});	
	$("#contact_postcode").blur(function (e){
		if(trimAll($(this).val()) == '' ){
			$(this).val('Postal code');
			$(this).attr('class', 'hint');
		}
	});
	$("#aidcontact").click(function (e){
		e.preventDefault();
		if(trimAll($("#contact_name").val()).toLowerCase() == 'name' || trimAll($("#contact_name").val()) == ''){
			alert('Please enter Name');
			$("#contact_name").focus();
			return false;
		}
		if(trimAll($("#contact_email").val()).toLowerCase() == 'email' || trimAll($("#contact_email").val()) == ''){
			alert('Please enter Email');
			$("#contact_email").focus();
			return false;
		}else{
			if(EmailValidate(document.getElementById('contact_email'), 'Email') == false){
				$("#contact_email").focus();
				return false;
			}
		}
		if(trimAll($("#contact_phone").val()).toLowerCase() == 'phone' || trimAll($("#contact_phone").val()) == ''){
			alert('Please enter Phone');
			$("#contact_phone").focus();
			return false;
		}
		if(SelectValidate(document.getElementById('contact_country'), 'Country') == false){
			$("#contact_country").focus();
			return false;
		}
		if(trimAll($("#contact_comment").val()).toLowerCase() == 'contact' || trimAll($("#contact_comment").val()) == ''){
			alert('Please enter Comments');
			$("#contact_comment").focus();
			return false;
		}
		if($("#contact_security").val() == ''){
			alert('Please enter Security Code');
			$("#contact_security").focus();
			return false;
		}else{
			var d = new Date();
			$.ajax({
			  url: 'captcheck.php?for=prayer&code='+$("#contact_security").val(),
			  async: false,
			  success: function(data) {
				if(data == "N") { 
					alert('The entered Security Code is not correct. Please try again'); 
					$("#contact_security").val(''); 
					$("#contact_security").focus();
					return false;
				}else if(data == "Y"){
					$.ajax({
					  url: 'ajax_func.php?action=request_contact&contact_name='+trimAll($("#contact_name").val())+'&contact_email='+trimAll($("#contact_email").val())+'&contact_country='+trimAll($("#contact_country").val())+'&contact_phone='+trimAll($("#contact_phone").val())+'&contact_state='+trimAll($("#contact_state").val())+'&contact_city='+trimAll($("#contact_city").val())+'&contact_postcode='+trimAll($("#contact_postcode").val())+'&contact_comment='+trimAll($("#contact_comment").val())+'&contact_address='+trimAll($("#contact_address").val()),
					  async: false,
					  success: function(respoane) {
					  	if(respoane == 'sent'){
							alert('Contact us detail has been sent successfully.');
							$("#contact_name").val('Name');
							$("#contact_email").val('Email');
							$("#contact_phone").val('Phone');
							$("#contact_country").val(0);
							$("#contact_state").val('State');
							$("#contact_city").val('City');
							$("#contact_postcode").val('Postal code');
							$("#contact_state").val('State');
							$("#contact_comment").val('Comments');
							$("#contact_address").val('Address');
							$("#contact_security").val('');
							$("#contactcaptcha").attr('src', 'CaptchaSecurityImagesPrayer.php?width=103&height=23&characters=6&time='+d.getTime());
							return false;
						}else{
							alert('Contact us detail is not sent successfully. Please try again later');
							$("#contact_name").val('Name');
							$("#contact_email").val('Email');
							$("#contact_phone").val('Phone');
							$("#contact_country").val(0);
							$("#contact_state").val('State');
							$("#contact_city").val('City');
							$("#contact_postcode").val('Postal code');
							$("#contact_state").val('State');
							$("#contact_comment").val('Comments');
							$("#contact_address").val('Address');
							$("#contact_security").val('');
							$("#contactcaptcha").attr('src', 'CaptchaSecurityImagesPrayer.php?width=103&height=23&characters=6&time='+d.getTime());
							return false;
						}
					  }
					});			
				}else if(data == "SE"){
					alert('Your session has expired.Please enter Security Code again');
					window.location.reload();			
				}
			  }
			});
		}		
		return false;
	});	
	/** contact us detail jquery ends here..**/
	
	$('#uidgallery > li > a').click(function(e){
		e.preventDefault();		
		$('#galleryCon').hide();
		$('#imageLoader').show();
		$.ajax({
		  url: 'ajax_gallery.php?ref='+$(this).attr('value'),
		  async: false,
		  success: function(data) {
				$('#galleryCon').html(data); 
				$('#galleryCon a').lightBox();
				$('#galleryCon').show();
				$('#imageLoader').hide();
		  }
		});
					
	});	
	$("#newsletter_email").focus(function (e){
		if(trimAll($(this).val()) == 'Email Address' || trimAll($(this).val()).toLowerCase() == 'email address'){
			$(this).val('');
		}
		$(this).attr('class', '');
	});	
	$("#newsletter_email").blur(function (e){
		if(trimAll($(this).val()) == ''){
			$(this).val('Email Address');
			$(this).attr('class', 'hint');
		}
	});
	$('#aidnewsletter').click(function(e){
		e.preventDefault();		
		if(trimAll($("#newsletter_email").val()) == '' || trimAll($("#newsletter_email").val()).toLowerCase() == 'email address'){
			alert('Please enter Email Address');
			$("#newsletter_email").focus();
			return false;
		}else{
			if(EmailValidate(document.getElementById('newsletter_email'), 'Email') == false){
				$("#newsletter_email").focus();
				return false;
			}
		}
		$.ajax({
		  url: 'ajax_func.php?action=newsletter&newsletter_email='+$('#newsletter_email').val(),
		  async: false,
		  success: function(data) {
				if(data == 'sent'){
					$('#newsletter_email').val('');	
					alert('Newsletter signup has been completed successfully.');
				}else{
					alert('Email address you have entered already exist!');
					$('#newsletter_email').val('');	
				}
		  }
		});					
	});	
	
	$('#ulidpagination a').live('click', function(e){
		e.preventDefault();	
		if($(this).attr('value') != '' && $(this).attr('value') != 0){
			$('#dividcomments').fadeOut();		
			$('#dividcommentsfloat').fadeIn(500);			
			$.ajax({
			  url: 'ajax_func.php?action=comments&page='+$(this).attr('value'),
			  async: false,
			  success: function(data) {
					$('#dividcomments').html(data);
					$('#dividcommentsfloat').fadeOut();					
					$('#dividcomments').fadeIn(500);		
			  }
			});
		}
	});	
	$('#aiddefaultcooments').live('click', function(e){
		e.preventDefault();	
		$('#dividaddcomments').show();
		$('#dividcomments').hide();
	});
	$("#comments_name").focus(function (e){
		if(trimAll($(this).val()) == 'Name' || trimAll($(this).val()).toLowerCase() == 'name'){
			$(this).val('');
		}
		$(this).attr('class', '');
	});	
	$("#comments_name").blur(function (e){
		if(trimAll($(this).val()) == ''){
			$(this).val('Name');
			$(this).attr('class', 'hint');
		}
	});
	$("#comments_email").focus(function (e){
		if(trimAll($(this).val()) == 'Email' || trimAll($(this).val()).toLowerCase() == 'email'){
			$(this).val('');
		}
		$(this).attr('class', '');
	});	
	$("#comments_email").blur(function (e){
		if(trimAll($(this).val()) == ''){
			$(this).val('Email');
			$(this).attr('class', 'hint');
		}
	});
	$("#comments_text").focus(function (e){
		if(trimAll($(this).val()) == 'Comments' || trimAll($(this).val()).toLowerCase() == 'comments'){
			$(this).val('');
		}
		$(this).attr('class', '');
	});	
	$("#comments_text").blur(function (e){
		if(trimAll($(this).val()) == ''){
			$(this).val('Comments');
			$(this).attr('class', 'hint');
		}
	});
	$("#aidaddcomments").click(function (e){
		e.preventDefault();
		if(trimAll($("#comments_name").val()).toLowerCase() == 'name' || trimAll($("#comments_name").val()) == ''){
			alert('Please enter Name');
			$("#comments_name").focus();
			return false;
		}
		if(trimAll($("#comments_email").val()).toLowerCase() == 'email' || trimAll($("#comments_email").val()) == ''){
			alert('Please enter Email');
			$("#comments_email").focus();
			return false;
		}else{
			if(EmailValidate(document.getElementById('comments_email'), 'Email') == false){
				$("#comments_email").focus();
				return false;
			}
		}
		if(trimAll($("#comments_text").val()).toLowerCase() == 'comments' || trimAll($("#comments_text").val()) == ''){
			alert('Please enter Comments');
			$("#comments_text").focus();
			return false;
		}
		$.ajax({
		  url: 'ajax_func.php?action=addcomments&comments_name='+$('#comments_name').val()+'&comments_email='+$('#comments_email').val()+'&comments_text='+$('#comments_text').val(),
		  async: false,
		  success: function(data) {
				if(data == 'sent'){
					$('#comments_name').val('Name');
					$('#comments_email').val('Email');
					$('#comments_text').val('Comments');
					alert('Your comment has been sent successfully.');
				}else{
					$('#comments_name').val('Name');
					$('#comments_email').val('Email');
					$('#comments_text').val('Comments');
					alert('Your comment is not sent successfully.');
					$('#newsletter_email').val('');	
				}
				$('#dividaddcomments').hide();
				$('#dividcomments').show();
		  }
		});	
	});
});
