function SignupFrmFocusClass(objClass, objnum, objstatus) {
	if (objstatus=="foc") { document.getElementById(objClass+objnum).className=objClass+"foc";}
	if (objstatus=="blr") { document.getElementById(objClass+objnum).className=objClass; }	
}
function SignupFrmValidate() {	
	if (IsEmpty(document.SignupFrm.email, 'text')) { document.SignupFrm.email.focus(); return false; }
	if (IsEmpty(document.SignupFrm.email, 'text')) { document.SignupFrm.email.focus(); return false; }	
	if (!ValidateEmail(document.SignupFrm.email.value)) { document.SignupFrm.email.focus(); return false; }
	if (IsEmpty(document.SignupFrm.password, 'text')) { document.SignupFrm.password.focus(); return false; }
	if(!captcha_valid_code()){document.SignupFrm.captxt.focus();return false;}
	document.getElementById('signup_loading').style.display="block";
	return true;
}

function SigninFrmValidate() {	
	if (IsEmpty(document.SignupFrm.email, 'text')) { document.SignupFrm.email.focus(); return false; }	
	if (!ValidateEmail(document.SignupFrm.email.value)) { document.SignupFrm.email.focus(); return false; }
	if (IsEmpty(document.SignupFrm.password, 'text')) { document.SignupFrm.password.focus(); return false; }
	document.getElementById('signin_loading').style.display="block";
	return true;
}

function EditrecipeTitleValidate() {   
	if (IsEmpty(document.change_recipe_title.recipe_title, 'text')) { document.change_recipe_title.recipe_title.focus(); return false; }	
	document.getElementById('signin_loading').style.display="block";   
	return true;    
}


function captcha_valid_code(){
	var entered_data=$("#captxt").val();
	if(entered_data=='true'){
		
		 var page_url="captcha_check.php";
				$.ajax({
				 type: "post",
				 data:"clear_session=1",
				 url : page_url   
				 });
		return true; 
	}else{
		alert('Please enter correct verification code'); 
		return false;
	}
}


function signin_with_recipe_title(){    
	parent.close_forcibly_to_open_another(20);       
}
function signin_suc() {
	parent.selfCloseTimer(300);      
	document.getElementById('signin_loading').style.display="none";
}


function signin_fail() {
	document.getElementById('signin_error_msg').style.display="block";
	document.getElementById('signin_loading').style.display="none";
}

function empty_recipe_title(){
	document.getElementById('signin_error_msg').style.display="block";
	document.getElementById('signin_loading').style.display="none"; 
}
function signup_suc() {
	document.getElementById('sign_up_success').style.display="block";
	document.getElementById('signup_form').style.display="none";
	document.getElementById('signup_loading').style.display="none";
	parent.opacAdjust(350);
}

function auto_logging_register_id(register_id){
	var new_link='<a href="#"  id="auto_login_url" onclick="parent.closeEditRecipeTitle('+register_id+');">Go to your profile!</a>'; 
	$('#replace_auto_login_lnk_div').html(new_link);      
}

function closeEditRecipeTitle(member_id){
	parent.opacAdjust(350);
	parent.document.location="profile.php?id="+member_id;

}

function close_inner_upload_profile_image__page(member_id){ 
	parent.opacAdjust(350);
	parent.document.location="../profile.php?id="+member_id;
}

function close_inner_upload_recipe_image__page(recipe_id){ 
	parent.opacAdjust(350);
	parent.document.location="../viewrecipe.php?id="+recipe_id;               
}

function signup_fail(type) {
	if(type==1) {
		document.getElementById('signup_error_msg').innerHTML = "Email aready taken";
	}
	if(type==2) {
		document.getElementById('signup_error_msg').innerHTML = "Oops! Something went wrong in our Servers. Please try after some time!";
	}
	document.getElementById('signup_error_msg').style.display="block";
	document.getElementById('signup_loading').style.display="none";
}
function ForgotFrmValidate() {	
	if (IsEmpty(document.forgot_pwd.forgotpwd, 'text')) { document.getElementById('forgot_error_msg').innerHTML="Enter your valid e-mail address";document.forgot_pwd.forgotpwd.focus(); return false; }	
	if (!ValidateEmail(document.forgot_pwd.forgotpwd.value)) { document.getElementById('forgot_error_msg').innerHTML="Enter your valid e-mail address";document.forgot_pwd.forgotpwd.focus(); return false; }
	return true;
}
function openForgot() {
	document.getElementById('forgot_pwd_container').style.display="block";
	//document.forgot_pwd.forgotpwd.focus();
}
function closeForgot(opt) {
	if(opt=="1") {
		divname = "forgot_pwd_msg_container";
	} else {
		divname = 'forgot_pwd_container';
	}
	document.getElementById(divname).style.display="none";
	document.getElementById('forgot_error_msg').innerHTML="&nbsp;";
}
function forgot_suc() {
	document.getElementById('forgot_error_msg').innerHTML="&nbsp;";
	document.getElementById('forgot_pwd_container').style.display="none";
	document.getElementById('forgot_pwd_msg_container').style.display="block";
}
function forgot_fail() {
	document.getElementById('forgot_error_msg').innerHTML="Username / Email does not exists.";
}
