function Check_Code(code_value)
{
	
		var chk = xmlHttp_send_post("xmlHTTP_BE.php", "action=check_code&code_value=" + code_value);
	
	if(chk == "")
	{
	
		document.getElementById('error_msg').innerHTML="Please enter a valid promotional code."
	}
	else
	{
		
		document.getElementById("show_discount").style.display='block';
		document.getElementById("show_discount").style.visibility='visible';
		document.getElementById("code_value").value="valid";
		document.getElementById('error_msg').innerHTML="";
	}


}

function Check_Username(username)
{


		var chk = xmlHttp_send_post("xmlHTTP_BE.php", "action=check_user&username=" + username);
		
	if(chk != "")
	{
	
		document.getElementById('error_msg1').innerHTML="Username already exists."
		return chk;
	}
	else
	{
		
		document.getElementById('error_msg1').innerHTML="";
		return "false";
	}

}
function insert_transaction(page_name)
{

	var chk = xmlHttp_send_post("xmlHTTP_BE.php", "action=insert_tracking&page_name=" + page_name);

	return;
}
function check_login(flag)
{
	var store_no=document.getElementById("store_no").value;
	//alert(store_no);
	var group_type=document.getElementById("group_type").value;
	if(store_no== "")
	{
		alert("Please Enter Store Number!");
		return false;
	}
	var chk = xmlHttp_send_post("xmlHTTP_BE.php", "action=check_login&store_no=" + store_no+"&group_type=" + group_type);

	if(chk)
	{
		if(flag=='enterKey')
			alert('Sorry, You have entered invalid login information. Please try again...');
		else
			document.getElementById("warn_msg").innerHTML='Sorry, You have entered invalid login information. Please try again...';
	}
	else
		document.check_login_form.submit();

	return;
}
function checkForLogin(event){
		if (event.keyCode == 13)
		{
			check_login('enterKey');
		}	
	}
