function postData(formID)
{
 document.getElementById(formID).submit();
}
function navigate(module,action,params)
{
 location.href="?module="+module+"&action="+action+'&'+params;
}
function postSmart(module,action,params,target)
{	
 $('#'+target).html("Please wait. Loading...");
 $.ajax({
  type: "POST",
  cache: false,
  async: false,
  timeout:20000,
  url: '?module='+module+'&action='+action,
  data: params,
  success: function(data) {
  $('#'+target).html(data);
    
  }
});
}
function getSmart(module,action,params,target)
{
}
function postSerialized(form,module,action,target)
{
	$('#'+target).html("Loading...");
	var params=$("#"+form).serialize();
	
	 $.ajax({
	type: "POST",
	cache: false,
	async: false,
	timeout:10000,
	url: '?module='+module+'&action='+action,
	data: params,
	success: function(data) {
	$('#'+target).html(data);
  }
});
}

function selectMenu(obj)
{
 $(".box li").attr("id","");
jQuery(obj).attr("id", "submenu-active");

}
//Selecting Shops
function selectShop(obj)
{
  if(jQuery(obj).is(':checked'))	
	jQuery(obj).val('1');
  else
	jQuery(obj).val('0');
}
//Verify Email
function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID=document.frmSample.txtEmail
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }
 //End email verification
 //Checking Is Numeric value
 function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }

   return blnResult;
   }

//Japanese Post Code Validation
function postcode_validate(postcode)
{

var regPostcode = /^([0-9]){3}[-]([0-9]){4}$/;

obj = document.getElementById("status");

if(regPostcode.test(postcode) == false)
{

return false;

}
else
{

return true;

}

}
//Check Password
function checkPassword(pw1,pw2)
{
 
if (pw1 != pw2) {
alert ("\nYou did not enter the same new password twice. Please re-enter your password.")
return false;
}
 if(pw1.length<5)
	{alert("Password must be 5 characters long. Please try again.");return false;
	}
}
//Search product enter
function key_search_product(e)
{
	if(e.keyCode==13)
		{
			var srch_str=$("#psearch_box").val();
			if(srch_str=="keyword"|| srch_str=="")
			{
				$("#psearch_box").val("");
				alert("Enter a keyword to search"); return;
			}
			location.href="?module=shopping&action=SearchProduct&q="+srch_str;
		}
}
//search product
function search_product()
{
	var srch_str=$("#psearch_box").val();
	if(srch_str=="keyword"|| srch_str=="")
		{
		$("#psearch_box").val("");
		 alert("Enter a keyword to search"); return;
		}
 location.href="?module=shopping&action=SearchProduct&q="+srch_str;
}
//clear the search box
function srch_clear(str)
{
	if(str=="keyword")
		$("#psearch_box").val("");
}
//fill search box
function fill_srch(str)
{
	if(str=="") $("#psearch_box").val("keyword");
}
