function valid_suggetion()
{
with(document.frm_product_want)
	{
		if(txt_name.value=="")
			{
			alert("Please specify the name");
			txt_name.focus();
			return false;
			}
		if(txt_email.value=="")
			{
				alert("Please specify Email address")
				txt_email.focus();
				return false;
			}
		if(!echeck(txt_email.value))
			{
				txt_email.focus();
				return false;
				}
		if(txt_sugesstion.value=="")
			{
				alert("Please specify some suggestions")
				txt_sugesstion.focus();
				return false;
			}
	}
}



function chk_pharmacist_form()
{
with(document.frm_pharmacist_form)
	{
		if(age.value=="")
			{
				alert("Please specify the age")
				age.focus();
				return false;
			}
		if(symptoms_to_treat.value=="")
			{
				alert("Please specify the symptoms to treat")
				symptoms_to_treat.focus();
				return false;
			}
		if(symptom.value=="")
			{
				alert("Please specify the symptoms")
				symptom.focus();
				return false;
			}
		if(existing_condition.value=="")
			{
				alert("Please specify the existing condition")
				existing_condition.focus();
				return false;
			}
		if(other_medicines.value=="")
			{
				alert("Please specify the other medicines")
				other_medicines.focus();
				return false;
			}
		
		
		}

}


function valid_mng_profile()
{
with(document.frm_member_update)
{
if(txt_fname.value=="")
		{
		alert("Please specify the first name")
		txt_fname.focus();
		return false;
		}
if(txt_lname.value=="")
		{
		alert("Please specify the last name")
		txt_lname.focus();
		return false;
		}
if(txt_gender.value=="")
		{
		alert("Please specify the gender")
		txt_gender.focus();
		return false;
		}
if(txt_age.value=="")
		{
		alert("Please specify the age category")
		txt_age.focus();
		return false;
		}
if(txt_hno.value=="")
		{
		alert("Please specify the house number")
		txt_hno.focus();
		return false;
		}
if(txt_street1.value=="")
		{
		alert("Please specify the street")
		txt_street1.focus();
		return false;
		}
if(txt_city.value=="")
		{
		alert("Please specify the city")
		txt_city.focus();
		return false;
		}
if(txt_pcode.value=="")
		{
		alert("Please specify the postcode")
		txt_pcode.focus();
		return false;
		}
if(txt_phone.value=="")
		{
		alert("Please specify the phone number")
		txt_phone.focus();
		return false;
		}
}
}


function chk_nhs()
{
with(document.frm_nhs)
{
if(txt_fname.value=="")
		{
		alert("Please specify the first name")
		txt_fname.focus();
		return false;
		}
if(txt_lname.value=="")
		{
		alert("Please specify the last name")
		txt_lname.focus();
		return false;
		}
if(txt_pcode.value=="")
		{
		alert("Please specify the postcode")
		txt_pcode.focus();
		return false;
		}
if(txt_address.value=="")
		{
		alert("Please specify the Address")
		txt_address.focus();
		return false;
		}
if(txt_email.value=="")
		{
		alert("Please specify Email address")
		txt_email.focus();
		return false;
		}
if(!echeck(txt_email.value))
		{
		txt_email.focus();
		return false;
		}
if(txt_phone.value=="")
		{
		alert("Please specify the phone number")
		txt_phone.focus();
		return false;
		}
if(txt_m1.value=="")
		{
		alert("Please specify the Medication Description")
		txt_m1.focus();
		return false;
		}
if(txt_unit1.value=="")
		{
		alert("Please specify the Unit")
		txt_unit1.focus();
		return false;
		}
if(txt_qty1.value=="")
		{
		alert("Please specify the Quantity")
		txt_qty1.focus();
		return false;
		}
if(!confir.checked)
		{
		alert("Please check the declaration")
		confir.focus();
		return false;
		}
		
}

}


function valid_quick_buy()
{
with(document.frm_quick)

{
if(txt_fname.value=="")
		{
		alert("Please specify the first name")
		txt_fname.focus();
		return false;
		}
if(txt_lname.value=="")
		{
		alert("Please specify the last name")
		txt_lname.focus();
		return false;
		}
if(txt_hno.value=="")
		{
		alert("Please specify the house number")
		txt_hno.focus();
		return false;
		}
if(txt_street1.value=="")
		{
		alert("Please specify the street")
		txt_street1.focus();
		return false;
		}
if(txt_city.value=="")
		{
		alert("Please specify the city")
		txt_city.focus();
		return false;
		}
if(txt_pcode.value=="")
		{
		alert("Please specify the postcode")
		txt_pcode.focus();
		return false;
		}
if(txt_phone.value=="")
		{
		alert("Please specify the phone number")
		txt_phone.focus();
		return false;
		}
if(email.value=="")
		{
		alert("Please specify Email address")
		email.focus();
		return false;
		}
if(!echeck(email.value))
		{
		email.focus();
		return false;
		}
if(txt_country.value!="United Kingdom")
		{
		alert("Sorry currently we are providing delivery facility only in United Kingdom")
		txt_country.focus();
		return false;
		}
}
}


function valid_shipping_details()
{
with(document.frm_shopping)

{
if(txt_fname.value=="")
		{
		alert("Please specify the first name")
		txt_fname.focus();
		return false;
		}
if(txt_lname.value=="")
		{
		alert("Please specify the last name")
		txt_lname.focus();
		return false;
		}
if(txt_hno.value=="")
		{
		alert("Please specify the house number")
		txt_hno.focus();
		return false;
		}
if(txt_street1.value=="")
		{
		alert("Please specify the street")
		txt_street1.focus();
		return false;
		}
if(txt_city.value=="")
		{
		alert("Please specify the city")
		txt_city.focus();
		return false;
		}
if(txt_pcode.value=="")
		{
		alert("Please specify the postcode")
		txt_pcode.focus();
		return false;
		}
if(txt_phone.value=="")
		{
		alert("Please specify the phone number")
		txt_phone.focus();
		return false;
		}
if(txt_email.value=="")
		{
		alert("Please specify Email address")
		txt_email.focus();
		return false;
		}
if(!echeck(txt_email.value))
		{
		txt_email.focus();
		return false;
		}
if(txt_country.value!="United Kingdom")
		{
		alert("Sorry currently we are providing delivery facality only in United Kingdom")
		txt_country.focus();
		return false;
		}
}
}








function valid_forgot()
{
with (document.frm_forgot)
	{
	if(email.value=="")
		{
		alert("Please specify Email address")
		email.focus();
		return false;
		}
	if(!echeck(email.value))
		{
		email.focus();
		return false;
		}
}
}

function chk_blank_email(a)
{
with(document.frm_email_form)
{
if(!echeck(txt_email.value))
		{
		txt_email.focus();
		}
else if(a==1)
		{				
			var props = "toolbar=no,location=no,status=no,scrollbars=no,resizable=no,titlebar=no,menubar=no,left=150,top=100,width=410,height=300";
			url="email_subscribe.aspx?sub=1&email="+document.frm_email_form.txt_email.value;
			w=window.open(url,"Newsletter",props)
		}
else if(a==2)
		{				
			var props = "toolbar=no,location=no,status=no,scrollbars=no,resizable=no,titlebar=no,menubar=no,left=150,top=100,width=410,height=300";
			url="email_subscribe.aspx?un=1&email="+document.frm_email_form.txt_email.value;
			w=window.open(url,"Newsletter",props)
		}
}
}
function chk_blank1()
{
with(document.frm_etp)
	{
	if(txt_etp.value=="")
		{
		alert("Please enter some ETP code")
		txt_etp.focus();
		return false;
		}
	}

}

function chk_blank_quick()
{
with(document.frmquick)
	{
	if(keyword.value=="")
		{
		alert("Please enter some text to search product");
		keyword.focus();
		return false;
		}
	}

}

function ValidateFullDecimal(myfield,e)
{
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;
	if (((keycode>=46) && (keycode<58) )  || (keycode==8)) { return true; }
	else return false;
}

function ValidateNumeric(myfield,e)
{
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;
	if ((keycode==32) || ((keycode>43) && (keycode<58) )  || (keycode==8)) { return true; }
	else return false;
}

function ValidateAlphaNumeric(myfield,e)
{
    var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;
	if ((keycode==32) || ((keycode>43) && (keycode<58) ) || ((keycode>=64) && (keycode<=90) )  || (keycode==8) || (keycode==95) || ((keycode>=97) && (keycode<=122) )) 
	{ 
	return true; 
	}
	else 
	return false;
}

/*=======================================================================*/
/* Validation function for alphabatic data (available for all the form) */

function ValidateAlpha(myfield,e)
{
    var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;
	if ((keycode==32) || ((keycode>43) && (keycode<48)) || ((keycode>=65) && (keycode<=90) )  || (keycode==8) || ((keycode>=97) && (keycode<=122) )) { return true; }
	else return false;
}

function LTrim(str)
	{
		if (str==null){return null;}
		for(var i=0;str.charAt(i)==" ";i++);
		return str.substring(i,str.length);
	}
function RTrim(str)
	{
		if (str==null){return null;}
		for(var i=str.length-1;str.charAt(i)==" ";i--);
		return str.substring(0,i+1);
	}
function Trim(str){return LTrim(RTrim(str));}

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("Sorry invalid E-mail ID");
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
		{
		    alert("Sorry invalid E-mail ID")
		    return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
			alert("Sorry invalid E-mail ID")
		    return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Sorry invalid E-mail ID")
		    return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Sorry invalid E-mail ID")
		    return false;
		 }

		 if (str.indexOf(" ")!=-1){
		    alert("Sorry invalid E-mail ID")
		    return false;
		 }

 		 return true;
}			


function chk_contact()
{
with(document.frm_contact)
	{
	if(txt_fname.value=="")
		{
		alert("Please specify the first name")
		txt_fname.focus();
		return false;
		}
	if(txt_email.value=="")
		{
		alert("Please specify Email address")
		txt_email.focus();
		return false;
		}
	if(!echeck(txt_email.value))
		{
		txt_email.focus();
		return false;
		}
	if(txt_phone.value=="")
		{
		alert("Please specify the phone number")
		txt_phone.focus();
		return false;
		}
	}
return true;

}



function valid_reg()
{
with (document.frm_cust)
	{
	if(txt_email.value=="")
		{
		alert("Please specify Email address")
		txt_email.focus();
		return false;
		}
	if(!echeck(txt_email.value))
		{
		txt_email.focus();
		return false;
		}
	if(txt_pass.value=="")
		{
		alert("Please specify password")
		txt_pass.focus();
		return false; 
		}
	if(txt_pass.value.length<6)
		{
		alert("Password has minimum 6 character")
		txt_pass.focus();
		return false; 
		}
	if(txt_pass.value!=txt_conf_pass.value)
		{
		alert("Confirm password does not matched")
		txt_conf_pass.focus();
		return false;
		}
	if(txt_fname.value=="")
		{
		alert("Please specify the first name")
		txt_fname.focus();
		return false;
		}
	if(txt_lname.value=="")
		{
		alert("Please specify the last name")
		txt_lname.focus();
		return false;
		}
	if(txt_gender.value=="")
		{
		alert("Please specify the gender")
		txt_gender.focus();
		return false;
		}
	if(txt_age.value=="")
		{
		alert("Please specify the age category")
		txt_age.focus();
		return false;
		}
	if(txt_house_no.value=="")
		{
		alert("Please specify the house number")
		txt_house_no.focus();
		return false;
		}
	if(txt_s1.value=="")
		{
		alert("Please specify the street number")
		txt_s1.focus();
		return false;
		}
	if(txt_city.value=="")
		{
		alert("Please specify the city")
		txt_city.focus();
		return false;
		}
	if(txt_pcode.value=="")
		{
		alert("Please specify the post code")
		txt_pcode.focus();
		return false;
		}
	if(txt_phone.value=="")
		{
		alert("Please specify the phone number")
		txt_phone.focus();
		return false;
		}
	}
return true;
}

function valid_pharma()
{
with(document.frm_p_reg)
{

if(txt_pname.value=="")
		{
		alert("Please specify the Pharmacist name")
		txt_pname.focus();
		return false;
		}
if(txt_p_reg_no.value=="")
		{
		alert("Please specify the registration number")
		txt_p_reg_no.focus();
		return false;
		}
if(txt_pass.value=="")
		{
		alert("Please specify password")
		txt_pass.focus();
		return false; 
		}
	if(txt_pass.value.length<6)
		{
		alert("Password has minimum 6 character")
		txt_pass.focus();
		return false; 
		}
	if(txt_pass.value!=txt_conf_pass.value)
		{
		alert("Confirm password does not matched")
		txt_conf_pass.focus();
		return false;
		}
		if(txt_pname.value=="")
		{
		alert("Please specify the Pharmacist name")
		txt_pname.focus();
		return false;
		}
  if(txt_fname.value=="")
		{
		alert("Please specify the first name")
		txt_fname.focus();
		return false;
		}
	if(txt_lname.value=="")
		{
		alert("Please specify the last name")
		txt_lname.focus();
		return false;
		}
	if(txt_quali.value=="")
		{
		alert("Please specify the Qualification")
		txt_quali.focus();
		return false;
		}
		
	if(txt_house_no.value=="")
		{
		alert("Please specify the house number")
		txt_house_no.focus();
		return false;
		}
	if(txt_s1.value=="")
		{
		alert("Please specify the street number")
		txt_s1.focus();
		return false;
		}
	if(txt_city.value=="")
		{
		alert("Please specify the city")
		txt_city.focus();
		return false;
		}
	if(txt_pcode.value=="")
		{
		alert("Please specify the post code")
		txt_pcode.focus();
		return false;
		}
	if(txt_phone.value=="")
		{
		alert("Please specify the phone number")
		txt_phone.focus();
		return false;
		}
 if(txt_email.value=="")
		{
		alert("Please specify Email address")
		txt_email.focus();
		return false;
		}
	if(!echeck(txt_email.value))
		{
		txt_email.focus();
		return false;
		}
}
return true;
}

 
 function valid_password()
 {
 with(document.frm_up_password)
 {
  if(txt_pass.value=="")
		{
		alert("Please specify password")
		txt_pass.focus();
		return false; 
		}
	if(txt_pass.value.length<6)
		{
		alert("Password has minimum 6 character")
		txt_pass.focus();
		return false; 
		}
	if(txt_pass.value!=txt_conf_pass.value)
		{
		alert("Confirm password does not matched")
		txt_conf_pass.focus();
		return false;
		}
 
 
 }
 
 
 }
 
 function ValidateFullNumeric(myfield,e)
{
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;
	if (((keycode>46) && (keycode<58) )  || (keycode==8)) { return true; }
	else return false;
}

function chk_blank()
{
	if (document.frm_detail.txt_qty.value=="")
		{
		alert("Please input some quantity");
		document.frm_detail.txt_qty.focus();
		return false;		
		}
}
  function price_format1(v)
  {
  i = indexof(v, ".")
        if(i!=0)
        {
         tmp = Left(v, i - 1) & Right(v, Len(tmp) - i)
        return( Left(v, Len(v) - 3) & "." & Right(v, 2))
        }
   }
function chk_pharma_login()
{
with(document.login_pharma)
 {
 if (txt_reg_no.value=="")
	{
		alert("Please input registration number");
		txt_reg_no.focus();
		return false;		
	}
}
}

function modi_pharma()
{
with(document.frm_modi_pharma)
{
	if(txt_pname.value=="")
		{
		alert("Please specify the Pharmacist name")
		txt_pname.focus();
		return false;
		}
  if(txt_fname.value=="")
		{
		alert("Please specify the first name")
		txt_fname.focus();
		return false;
		}
	if(txt_lname.value=="")
		{
		alert("Please specify the last name")
		txt_lname.focus();
		return false;
		}
	if(txt_house_no.value=="")
		{
		alert("Please specify the house number")
		txt_house_no.focus();
		return false;
		}
	if(txt_s1.value=="")
		{
		alert("Please specify the street number")
		txt_s1.focus();
		return false;
		}
	if(txt_city.value=="")
		{
		alert("Please specify the city")
		txt_city.focus();
		return false;
		}
	if(txt_pcode.value=="")
		{
		alert("Please specify the post code")
		txt_pcode.focus();
		return false;
		}
	if(txt_phone.value=="")
		{
		alert("Please specify the phone number")
		txt_phone.focus();
		return false;
		}
 if(txt_email.value=="")
		{
		alert("Please specify Email address")
		txt_email.focus();
		return false;
		}
	if(!echeck(txt_email.value))
		{
		txt_email.focus();
		return false;
		}
}
return true;
}


function chk_valid_etp()
{
with (document.frm_etp)
	{
	if(txt_etp.value=="")
		{
		alert("Please specify ETP")
		txt_etp.focus();
		return false;
		}
	if(txt_email.value=="")
		{
		alert("Please specify Email address")
		txt_email.focus();
		return false;
		}
	if(!echeck(txt_email.value))
		{
		txt_email.focus();
		return false;
		}
	if(txt_fname.value=="")
		{
		alert("Please specify the first name")
		txt_fname.focus();
		return false;
		}
	if(txt_lname.value=="")
		{
		alert("Please specify the last name")
		txt_lname.focus();
		return false;
		}
	if(txt_house_no.value=="")
		{
		alert("Please specify the house number")
		txt_house_no.focus();
		return false;
		}
	if(txt_s1.value=="")
		{
		alert("Please specify the street number")
		txt_s1.focus();
		return false;
		}
	if(txt_city.value=="")
		{
		alert("Please specify the city")
		txt_city.focus();
		return false;
		}
	if(txt_pcode.value=="")
		{
		alert("Please specify the post code")
		txt_pcode.focus();
		return false;
		}
	if(txt_phone.value=="")
		{
		alert("Please specify the phone number")
		txt_phone.focus();
		return false;
		}
	}
return true;
}
