
/*---------------------for Cash & Credit Card  Check-------*/

function hide_credit()
{
	//alert(retail_id);
	
		document.getElementById('ccnum').style.display="none";
		document.getElementById('ptype').style.display="none";
		document.getElementById('expdate').style.display="none";
		document.getElementById('cvv').style.display="none";
	
}


function show_credit()
{
		document.getElementById('ccnum').style.display="block";
		document.getElementById('ptype').style.display="block";
		document.getElementById('expdate').style.display="block";
		document.getElementById('cvv').style.display="block";	
	
}

/*-------------------------------------------------------*/

//-----------------large pd pic view---------------------
function popupWindow(url)
			 {
  				//alert("POP UP Called");
				
				window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=550,height=400,screenX=150,screenY=150,top=150,left=150')
			}
//--------------------------------------------------------

//----------------------start reviews---------------------

function chk_review()
{

	if(document.getElementById("dishes").value=="")
	{
		alert("Please select DISH properly.");
		return false;
	}
	
	if(document.getElementById("reviewsubject").value=="")
	{
		alert("Please enter Subject properly.");
		return false;
	}
	if(document.getElementById("customer_name").value=="")
	{
		alert("Please enter Name properly.");
		return false;
	}
	
if(document.getElementById("email").value=="")
	{
		alert("Please enter email properly.");
		return false;
	}
	else
	{
		emailRe = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/	
		if(!emailRe.test(document.getElementById("email").value))
		{
			alert('Please enter a valid email address')
			return false;
		}
	}
	
	if(document.getElementById("reviewdesc").value=="")
	{
		alert("Please enter your tesimonial details .");
		return false;
	}
}
//-----------------end reviews----------------------------	

//-------------------Start Delete------------------------
function do_delete(url,name){
	//alert(url);
	$statues = confirm('Are you sure you want to delete "'+name+'" ?');
	
	if($statues)
		window.location = url;
}
//-----------------------End Delete------------------------

//-------------------Start Delete------------------------
function cancle_order(url)
{
	//alert(url);
	$statues = confirm('Are you sure you want to cancle order?');
	
	if($statues)
		window.location = url;
}
//-----------------------End Delete------------------------


//-------------------Start Change password-----------------
function change_password()
{
	emailRe = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/
	if(document.getElementById("current_password").value=="")
	{
		alert("Please enter current password.");
		document.password_frm.current_password.focus;
		return false;
	}	
	
	 if(document.getElementById("new_password").value=="")
	{
		alert("Please enter new password.");
		document.password_frm.new_password.focus;
		return false;
	}	

	 if(document.getElementById("confirm_password").value=="")
	{
		alert("Please enter confirm password.");
		document.password_frm.confirm_password.focus;
		return false;
	}
	if(document.getElementById("new_password").value!=document.getElementById("confirm_password").value)
	{
		alert("New password and Confirm password does't match.");
		return false;
		
	}
}
//----------------End Change password-----------------



/*-----------------DISH QTY CHK----------------------*/
function chk_qty()
{
	if(document.getElementById("qty").value=="")
	{
		alert("Please enter quantity properly.");
		return false;
	}
}



function keycheck(evt)
{
    evt = (evt) ?evt :window.event;
    var charCode=(evt.which) ? evt.which :evt.keyCode;
    if(charCode>47 && charCode<58) 
	 {
    	return true;
	}
	else
	{
	 alert("Please enter only integer value .");
	 return false;	
	}
	 
 }

//-----------------------------------------------------


/*-----------------Address Book----------------------*/
function chk_addbook()
{

   for (var i=0; i < document.addbook_frm.payment_rad.length; i++)
   {
	  if (document.addbook_frm.payment_rad[i].checked)
	  {
		  var rad_val = document.addbook_frm.payment_rad[i].value;
		  //alert(rad_val);
	  }
   }
	
	
	if(document.getElementById("title").value=="")
	{
		alert("Please select title properly.");
		return false;
	}
	
	if(document.getElementById("fname").value=="")
	{
		alert("Please enter first name properly.");
		return false;
	}
	
	if(document.getElementById("lname").value=="")
	{
		alert("Please enter last name properly.");
		return false;
	}
	
	
	/*-----------------------------------------*/
	
	if(rad_val=="credit")
	{
			
			if(document.getElementById("criditcard_no").value=="")
			{
				alert("Please enter cridit card number properly.");
				return false;
			}
			if(document.getElementById("criditcard_no").value!="")
			{
				var cardnum = document.getElementById("criditcard_no").value;
				
				if(cardnum.length<16)
				{
					alert("Please enter cridit card number properly as it should consist of 16-digits.");
					return false;
				}
			}
			
			if(document.getElementById("card_exp_month").value=="")
			{
				alert("Please enter card expiry month properly.");
				return false;
			}
			
			if(document.getElementById("card_exp_year").value=="")
			{
				alert("Please enter card expiry year properly.");
				return false;
			}
			
			if(document.getElementById("csc_num").value=="")
			{
				alert("Please enter csc number properly.");
				return false;
			}
			
			if(document.getElementById("csc_num").value!="")
			{
				var csc = document.getElementById("csc_num").value;
				
				if(csc.length<2)
				{
					alert("Please enter csc number properly.");
					return false;
				}
			}
	}
	
	if(document.getElementById("bill_address1").value=="")
	{
		alert("Please enter bill_address properly.");
		return false;
	}
	
	/*----------------------------------------*/
	
	
	if(document.getElementById("email").value=="")
	{
		alert("Please enter email properly.");
		return false;
	}
	else
	{
		emailRe = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/	
		if(!emailRe.test(document.addbook_frm.email.value))
		{
			alert('Please enter a valid email address')
			document.addbook_frm.email.focus();
			return false;
		}
	}
	
	if(document.getElementById("pri_phone_num").value=="")
	{
		alert("Please enter Primary Phone Number properly.");
		return false;
	}
	
	if(document.getElementById("address1").value=="")
	{
		alert("Please enter adress properly.");
		return false;
	}
	
	if(document.getElementById("fax").value=="")
	{
		alert("Please enter fax number properly.");
		return false;
	}
	
	if(document.getElementById("postcode").value=="")
	{
		alert("Please enter post code properly.");
		return false;
	}
	
	if(document.getElementById("Country").value=="")
	{
		alert("Please select Country properly.");
		return false;
	}

 return true;
}

/*---------------------------------------*/


/*--------cehcing forget pass-------------*/

function chk_flogin()
{
	if(document.forgetpass_frm.login.value=="")
	{
		alert('Please enter email address')
		document.forgetpass_frm.login.focus();
		return false;
	}
	else
	{
		emailRe = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/	
		if(!emailRe.test(document.forgetpass_frm.login.value))
		{
			alert('Please enter a valid email address')
			document.forgetpass_frm.login.focus();
			return false;
		}
	}
	
}
/*---------------------------------------*/


//------------------------------------Start Regidter-------------------------------------------
function chk()
{
	
	//alert("function called");
	emailRe = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/

	if(document.getElementById("fname").value=="")
	{
		alert("Please enter first  name.");
		document.signup_frm.fname.focus();
		return false;
	}
	else if(document.getElementById("lname").value=="")
	{
		alert("Please enter last name.");
		document.signup_frm.lname.focus;
		return false;
	}
	else if(!emailRe.test(document.signup_frm.email.value))
	{
		alert('Please enter a valid email address')
		document.signup_frm.email.focus();
		return false;
	}
	else if(!emailRe.test(document.signup_frm.re_email.value))
	{
		alert('Please enter a valid email address')
		document.signup_frm.email.focus();
		return false;
	}
	else if(document.signup_frm.re_email.value!=document.signup_frm.email.value)
	{
		alert('email addresses does not match.')
		document.signup_frm.re_email.focus();
		return false;
	}
	else if(document.getElementById("password").value == "")
	{
			alert("Password field is empty!");
			document.getElementById("password").focus();
			return false;
	}
	/*else if(document.getElementById("password").value.length<6)
	{
		
		alert document.getElementById("password").value.length;
		alert("Password must consist of atleast 6 words, digits or combination.");
		document.getElementById("password").focus();
		return false;
	}*/
	else if(document.getElementById("password").value != document.getElementById("re_password").value)
	{
			alert("Password did not match!");
			document.getElementById("password").value = "";
			document.getElementById("re_password").value = "";
			document.getElementById("password").focus();
			return false;
	}


	return true;

}

//------------------------------------End Register -------------------------------------------

//------------------------------------Start Contact us-------------------------------------------
function contact_us()
{
	emailRe = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/
	if(document.getElementById("f_name").value=="")
	{
		alert("Please enter first name.");
		document.frm_contact.f_name.focus();
		return false;
	}	
	
	 if(document.getElementById("l_name").value=="")
	{
		alert("Please enter last name.");
		document.frm_contact.l_name.focus();
		return false;
	}	

	if(!emailRe.test(document.frm_contact.email.value))
	{
		alert('Please enter a valid email address')
		document.frm_contact.email.focus();
		return false;
	}
	if(document.getElementById("subject").value=="")
	{
		alert("Please enter subject.");
		document.frm_contact.subject.focus();
		return false;
	}	

}

//------------------------------------Start Contact us-------------------------------------------


//------------------------------------Start EMAIL-------------------------------------------
function check_email()
{
	emailRe = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/	
	if(!emailRe.test(document.signin_frm.login.value))
	{
		alert('Please enter a valid email address')
		document.signin_frm.login.focus();
		return false;
	}
	
	return true;
}

//------------------------------------End EMAIL-------------------------------------------