$(document).ready(function () {
				$("#login").click(function () {
					$("#fadeBlock").fadeIn(500, function (){
						$("#loginBox").fadeIn(200);								  
						  })
				});
				$("#hide").click(function () {
					$("#fadeBlock").fadeOut("slow");
					$("#loginBox").fadeOut("slow");
					//window.location = 'http://www.badadeal.com';
				});
				$(".forLavel").click(function () {
					$(".forLavel").fadeOut(300, function (){
						$(".lookin").fadeIn(300);									  
					 })						   
				});
				$("#txtMail").keyup(function(event){
					regEmail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{1,4})$/;
					mail = $(this).val();
					if(regEmail.test(mail) == false) {
						$(".emailError").html('Please enter valid email address.');
					}
					else{
						$(".emailError").html('');
					}
				});
				$("#mailTxt").keyup(function(event){
					regEmail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{1,4})$/;
					mail = $(this).val();
					if(regEmail.test(mail) == false) {
						$(".emailError").html('Enter valid email address.');
					}
					else{
						$(".emailError").html('');
					}
				});
				$(".inputa").keyup(function(event){
					regEmail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{1,4})$/;
					mail = $(this).val();
					if(regEmail.test(mail) == false) {
						$(".forgetError").html('Please enter valid email address.');
					}
					else{
						$(".forgetError").html('');
					}
				});
				$("#logSubmit").click(function(){
					regEmail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{1,4})$/;
					pass = $("#txtPass").val();	
					mail = $("#txtMail").val();
					if(mail == ''){
						$(".emailError").html('Email can not be empty.');
					}
					else if(regEmail.test(mail) == false){
						$(".emailError").html('Invalid Email Address.');
					}
					else if(pass == ''){
							$(".passError").html('Password can not be empty.');
						}
					else{
						$.ajax({
							url: 'ajxLogin.php?mail='+mail+'&pass='+pass,
							success: function(bipul){
								if(bipul == 'bipul'){
									location.reload();	
								}
								else if(bipul == 'usererror'){
									$(".logError").html('Either e-mail ID is incorrect or you have not signed up');
								}
								else if(bipul == 'passerror'){
									$(".passError").html('Check your password.');
									$(".logError").html('');
								}
							}
						});	
					}
				});
				$("#submitLogin1").click(function(){
					regEmail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{1,4})$/;
					pass = $("#passTxt").val();	
					mail = $("#mailTxt").val();
					if(mail == ''){
						$(".emailError").html('Email can not be empty.');
					}
					else if(regEmail.test(mail) == false){
						$(".emailError").html('Invalid Email Address.');
					}
					else if(pass == ''){
							$(".passError").html('Password can not be empty.');
						}
					else{
						
						$.ajax({
							url: 'ajxLogin.php?mail='+mail+'&pass='+pass,
							success: function(bipul){
								if(bipul == 'bipul'){
									window.location = 'download.php';	
								}
								else if(bipul == 'usererror'){
									$(".logError").html('Either e-mail ID is incorrect or you have not signed up');
								}
								else if(bipul == 'passerror'){
									$(".passError").html('Check your password.');
									$(".logError").html('');
								}
							}
						});	
					}
				});
				
				
				
				
				
				
				
				
				$("#submitLogin").click(function(){
					regEmail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{1,4})$/;
					pass = $("#passTxt").val();	
					mail = $("#mailTxt").val();
					if(mail == ''){
						$(".emailError").html('Email can not be empty.');
					}
					else if(regEmail.test(mail) == false){
						$(".emailError").html('Invalid Email Address.');
					}
					else if(pass == ''){
							$(".passError").html('Password can not be empty.');
						}
					else{
						
						$.ajax({
							url: 'ajxLogin.php?mail='+mail+'&pass='+pass,
							success: function(bipul){
								if(bipul == 'bipul'){
									window.location = 'submission.php';	
								}
								else if(bipul == 'usererror'){
									$(".logError").html('Either e-mail ID is incorrect or you have not signed up');
								}
								else if(bipul == 'passerror'){
									$(".passError").html('Check your password.');
									$(".logError").html('');
								}
							}
						});	
					}
				});
				
				
				
				
				
				
				
				
				
				
				
				
				
				
				
				
				
				$("#fogeta").click(function(){
					regEmail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{1,4})$/;
					mail = $(".inputa").val();
					if(mail == ''){
						$(".forgetError").html('Email can not be empty.');
					}
					else if(regEmail.test(mail) == false){
						$(".forgetError").html('Invalid Email Address.');
					}
					else{
						$.ajax({
							url: 'ajxForget.php?mail='+mail,
							success: function(upen){
								$(".forgetError").html(upen);
							}
						});	
					}
				});
				$("#txtSearch").click(function(){
					document.getElementById('txtSearch').value = '';
				 });
				$("#fogetm").click(function(){
					regEmail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{1,4})$/;
					mail = $(".inputar").val();
					if(mail == ''){
						$(".forgetError").html('Email can not be empty.');
					}
					else if(regEmail.test(mail) == false){
						$(".forgetError").html('Invalid Email Address.');
					}
					else{
						$.ajax({
							url: 'ajxForget.php?mail='+mail,
							success: function(upen){
								$(".forgetError").html(upen);
							}
						});	
					}
				});
				
				$("#fogetm34").click(function(){
					regEmail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{1,4})$/;
					mail = $(".inputar").val();
					if(mail == ''){
						$(".forgetError").html('Email can not be empty.');
					}
					else if(regEmail.test(mail) == false){
						$(".forgetError").html('Invalid Email Address.');
					}
					else{
						$.ajax({
							url: 'ajxForget34.php?mail='+mail,
							success: function(upen){
								$(".forgetError").html(upen);
							}
						});	
					}
				});
				
				
		  });
function chkResponse(){
		var regEmail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
		var title = document.getElementById('txtName').value;
		var regQuery = /^([A-Za-z0-9_\-\.,? ]{2,250})$/;
		var contact = document.getElementById('txtQuery').value;
		var abstract = document.getElementById('txteMail').value;
		var error = '';
		
		if(abstract == ''){
			error += ('Email can not be empty\n');
		}
		else if(regEmail.test(abstract) == false) {
      	error += ('Invalid Email Address\n');
   		}
		else if(contact == ''){
			error += ('Query can not be empty\n');
		}
		else if(regQuery.test(contact) == false) {
      	error += ('Query can not be more than 250 characters.\n');
   		}
		
		if(error){
			$('#erroDet').html(error);
			$("#fadelock").fadeIn(200);
			$("#errors").fadeIn(200);
		}else{
			document.frmQuery.submit();
		}	
	}
	$(document).ready(function () {
		$(".closeAlert").click(function(event){
			$("#fadelock").fadeOut(200);
			$("#errors").fadeOut(200);							
		});
	$(".closeError").click(function(event){
			$("#fadelook").fadeOut(200);
			$("#alert").fadeOut(200);
			$("#txteMail").focus();
		});
	$("#botRight").hover(function closeall(){
			
		});
	});

