function open_login(){
		var main_obj = document.getElementById('loginPop');
		var log_obj = document.getElementById('loginBox');
		if(main_obj.style.display=='none'){
			main_obj.style.display='block';
			if(log_obj.style.display=='none'){
				log_obj.style.display='block';
			}
		}
	}
	
	function open_fp(){
		var fp_obj = document.getElementById('fpBox');
		if(fp_obj.style.display=='none'){
			fp_obj.style.display='block';
		}
		
		var fp_a_obj = document.getElementById('fp_a_text');
		if(fp_a_obj.style.display==''){
			fp_a_obj.style.display='none';
		}
		
	}
	
	function open_fp_all(){
		var main_obj = document.getElementById('loginPop');
		var log_obj = document.getElementById('loginBox');
		if(main_obj.style.display=='none'){
			main_obj.style.display='block';
			if(log_obj.style.display=='none'){
				log_obj.style.display='block';
			}
		}
		/*******************/
		var fp_obj = document.getElementById('fpBox');
		if(fp_obj.style.display=='none'){
			fp_obj.style.display='block';
		}
		
		var fp_a_obj = document.getElementById('fp_a_text');
		if(fp_a_obj.style.display==''){
			fp_a_obj.style.display='none';
		}
	}
	
	function validate_for_got() {
		var all_ok = true;
		var err_msg = "";
		
		if(isblank(document.f_g_frm.cust_uname_forgot.value))	{
				all_ok = false;
				err_msg += "\n -Email cannot be left blank.";
		} else if (!validEmail(document.f_g_frm.cust_uname_forgot.value)) {
				all_ok = false;
				err_msg += "\n -Please enter a valid email.";
		}
		
		
		if (all_ok == false){
			alert("The following error have occured -" + err_msg);
	
		} 
		
		return all_ok
}

function validate_log() {
	var all_ok = true;
	var err_msg = "";
	
	if(isblank(document.login_frm.cust_uname.value))	{
			all_ok = false;
			err_msg += "\n -Email cannot be left blank.";
	} else if (!validEmail(document.login_frm.cust_uname.value)) {
			all_ok = false;
			err_msg += "\n -Please enter a valid email.";
	}
	if (isblank(document.login_frm.cust_password.value)) {
		all_ok = false;
		err_msg += "\n -Password cannot be left blank.";
	}
	
	if (all_ok == false){
		alert("The following error have occured -" + err_msg);

	} 
	
	return all_ok
}

function remove_val_h(id){
	var val = document.getElementById(id).value;
	//alert(document.getElementById(id).type);
	if(val=='username' || val=='password' || val=='your email'){
		document.getElementById(id).value="";
		if(val=="password"){
			//document.getElementById(id).type = 'password';
			var p_obj = document.getElementById('pass_hmtl');
			p_obj.innerHTML = "<input name=\"cust_password\" type=\"password\" id=\"cust_password\" value=\"\"  onfocus=\"remove_val_h('cust_password');\" onblur=\"set_val_h('cust_password');\" class=\"loginPopInput\"/>"; 
			document.login_frm.cust_password.focus();
			document.login_frm.cust_password.select();
		}
	}
}

function set_val_h(id){
	var val = document.getElementById(id).value;
	if(val==''){
		if(id=='cust_uname'){
			document.getElementById(id).value="username";
		}

		if(id=='cust_password'){
			//document.getElementById(id).type = "text";
			//document.getElementById(id).value="password";
			var p_obj = document.getElementById('pass_hmtl');
			p_obj.innerHTML = "<input name=\"cust_password\" type=\"text\" id=\"cust_password\" value=\"password\"  onfocus=\"remove_val_h('cust_password');\" onblur=\"set_val_h('cust_password');\" class=\"loginPopInput\"/>"; 

		}
		
		if(id=='fp_tx_box'){
			document.getElementById(id).value="your email";
		}
	}
}

function close_fp(){
	//alert("hi");
	var main_obj = document.getElementById('loginPopConfirm');
	main_obj.style.display = "none";
}

function fp_ok(){
	var main_obj = document.getElementById('loginPopConfirm');
	main_obj.style.display = "block";
}
/************************/
function hide_login(){
	var main_obj = document.getElementById('loginPop');
	if(main_obj.style.display=='block'){
		main_obj.style.display='none';
	}
}

document.onclick = chk_div_id;
function chk_div_id(e){
	var targ;
	if (!e) var e = window.event;
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	//if (targ.nodeType == 3) // defeat Safari bug
	targ = targ.parentNode;
	theId=targ.id
	if(theId==""){
		targ = targ.parentNode;
		theId=targ.id
	}
	//alert(theId);
	if(theId!="loginPop" && theId!="loginPopTop" && theId!="loginPopMid" && theId!="loginBox" && theId!="fpBox" && theId!="loginPopBorder" && theId!="pass_hmtl"){
		hide_login();
	}
}