// JavaScript Document

function sendEmail(_val)
{
	$.facebox("Requesting...");
	$.get('forgot.php',_val,function(data){ 
									 if(data=='y'){
										 $.facebox("<b>The Password Changing link has been successfully sent</b>");
									 }else if(data=='ns'){
										 $.facebox("<b><font color=red>Email couldnot be sent. Please try again.</font></b>");
										
									 }else{
										 $.facebox("<b><font color=red>The Provided Email Address is not registered.</font></b>");
									 }
									 
									 });
}

function showForgot()
{
	$("#forgot-form").attr("style","display: block");
	$("#_email").focus();
	return false;
}
function hideForgot()
{
	$("#forgot-form").attr("style","display: none");
	return false;
}

$(function(){
		   $("#forgot").submit(function(){
										if($("#_email").val()==''){
											$.facebox('Please provide email to send password !');
											$("#_email").focus();
											return false;
										}
										sendEmail($(this).serialize());
										return false;
										});
		  $("#signup").submit(function(){
									   if($("#email").val()==''){
										   $.facebox('Please Enter Email Address !');
										   $("#email").focus();
										   return false;
									   }
									   $.post('newsletter/user/process.php',$(this).serialize(),function(data){ $.facebox(data); });
									   return false;
									   });
		  
		   });