function validPhone(field,val)
{
	string =val
	values =""
	n=string.length

	for (i=0;i<n;i++)
		{
			if(string.charCodeAt(i)!=32)
				{
					
				    if (string.charCodeAt(i)<45 || string.charCodeAt(i)>57 || string.charCodeAt(i)==46 || string.charCodeAt(i)==47 )
						{
				    		alert(string.charAt(i)+"  Invalid character")
							window.document.getElementById(field).value=values
							window.document.getElementById(field).focus();
							return false;
						}
					
			values=values+string.charAt(i)
		}
	}
}

function validEntry(field,val)
{
	string =val
	values =""
	n=string.length

	for (i=0;i<n;i++)
		{
			if(string.charCodeAt(i)!=32)
				{
	
				    if(string.charCodeAt(i)<=47 || (string.charCodeAt(i)>57 && string.charCodeAt(i)<65))
						{
				    		alert(string.charAt(i)+"  Invalid character")
							window.document.all.item(field).value=values
							window.document.all.item(field).focus();
							return false;
						}
					for(x=91;x<97;x++) 
						{
							if((string.charCodeAt(i)==x))
							{
								alert(string.charAt(i)+"  Invalid character")
								window.document.all.item(field).value=values
								window.document.all.item(field).focus();
								return false;
							}
						}
						

					if(string.charCodeAt(i)>122)
						{
							alert(string.charAt(i)+"  Invalid character")
							window.document.all.item(field).value=values
							window.document.all.item(field).focus();
							return false;
						}
			values=values+string.charAt(i)
		}
	}
}

function validCity(field,val)
{
	string =val
	values =""
	n=string.length

	for (i=0;i<n;i++)
		{
			if(string.charCodeAt(i)!=32)
				{
				    //if(string.charCodeAt(i)<=47 || (string.charCodeAt(i)>57 && string.charCodeAt(i)<65))
					if((string.charCodeAt(i)<44) || (string.charCodeAt(i)==45) || (string.charCodeAt(i)==46) || (string.charCodeAt(i)==47) || (string.charCodeAt(i)>57 && string.charCodeAt(i)<65))
						{
				    		alert(string.charAt(i)+"  Invalid character")
							window.document.getElementById(field).value=values
							window.document.getElementById(field).focus();
							return false;
						}
					for(x=91;x<97;x++) 
						{
							if((string.charCodeAt(i)==x))
							{
								alert(string.charAt(i)+"  Invalid character")
								window.document.getElementById(field).value=values
								window.document.getElementById(field).focus();
								return false;
							}
						}
						

					if(string.charCodeAt(i)>122)
						{
							alert(string.charAt(i)+"  Invalid character")
							window.document.getElementById(field).value=values
							window.document.getElementById(field).focus();
							return false;
						}
			values=values+string.charAt(i)
		}
	}
}
function validData(field,val)
{
	string =val
	values =""
	n=string.length

	for (i=0;i<n;i++)
		{
			if(string.charCodeAt(i)!=32)
				{
	
				    if(string.charCodeAt(i)<=47 || (string.charCodeAt(i)>57 && string.charCodeAt(i)<65))
						{
				    		alert(string.charAt(i)+"  Invalid character")
							window.document.getElementById(field).value=values
							window.document.getElementById(field).focus();
							return false;
						}
					for(x=91;x<97;x++) 
						{
							if((string.charCodeAt(i)==x))
							{
								alert(string.charAt(i)+"  Invalid character")
								window.document.getElementById(field).value=values
								window.document.getElementById(field).focus();
								return false;
							}
						}
						

					if(string.charCodeAt(i)>122)
						{
							alert(string.charAt(i)+"  Invalid character")
							window.document.getElementById(field).value=values
							window.document.getElementById(field).focus();
							return false;
						}
			values=values+string.charAt(i)
		}
	}
}
function validEntryText(field,val)
{
	string =val
	values =""
	n=string.length
	

	for (i=0;i<n;i++)
		{
			if(string.charCodeAt(i)!=32)
				{
	
				   if(string.charCodeAt(i)<65)
						{
				    		window.alert(string.charAt(i)+"  Invalid character");
							window.document.getElementById(field).value=values
							window.document.getElementById(field).focus();
							return false;
						}
					for(x=91;x<97;x++) 
						{
							if((string.charCodeAt(i)==x))
							{
								alert(string.charAt(i)+"  Invalid character")
								window.document.getElementById(field).value=values
								window.document.getElementById(field).focus();
								return false;
							}
						}

					if(string.charCodeAt(i)>122)
						{
							alert(string.charAt(i)+"  Invalid character")
							window.document.getElementById(field).value=values
							window.document.getElementById(field).focus();
							return false;
						}
			values=values+string.charAt(i)
		}
	}
}
function validNumber(field,val)
{
	string =val
	values =""
	n=string.length

	for (i=0;i<n;i++)
		{
			if(string.charCodeAt(i)!=32)
				{
	
				   //if(string.charCodeAt(i)<=57 || (string.charCodeAt(i)>57 && string.charCodeAt(i)<65))
				  
				    if (string.charCodeAt(i)<47 || string.charCodeAt(i)>57)
						{
				    		alert(string.charAt(i)+"  Invalid character")
							window.document.getElementById(field).value=values
							window.document.getElementById(field).focus();
							return false;
						}
					
			values=values+string.charAt(i)
		}
	}
}

function  restvalues()
{
adminlog.reset();

}

 function check()
{
	if (document.adminlog.username.value =="")
	{
		window.alert("You missed  Name ");
		document.adminlog.username.focus();
		return false;
	}
	 
	 if (document.adminlog.password.value =="")
	{
		window.alert("You missed Password");
		document.adminlog.password.focus();
		return false;
	}
	
	return true;

}

function validQty(field,val,id)
{
	string =val
	values =""
	n=string.length

	for (i=0;i<n;i++)
		{
			if(string.charCodeAt(i)!=32)
				{
	
				   //if(string.charCodeAt(i)<=57 || (string.charCodeAt(i)>57 && string.charCodeAt(i)<65))
				   // alert(string.charCodeAt(i));
				    if (string.charCodeAt(i)<46 || string.charCodeAt(i)>57)
						{
				    		alert(string.charAt(i)+"  Invalid character")
							window.document.getElementById(field).value=values
							window.document.getElementById(field).focus();
							if (id==1)
							{
							window.document.getElementById("txtcarton").value='';
							}
							else
							{
							window.document.getElementById("txtquantity").value='';
							}
							
							return false;
						}
					
			values=values+string.charAt(i)
		}
	}
}

function  restvalues1()
{
	chpass.reset();

}
function check1()
{
	
	if (document.chpass.oldpassword.value =="")
	{
		window.alert("You missed Old Password");
		document.chpass.oldpassword.focus();
		return false;
	}
	if (document.chpass.newpassword.value =="")
	{
		window.alert("You missed New Password");
		document.chpass.newpassword.focus();
		return false;
	}
	else
	{
		h = document.chpass.newpassword.value.length;
		x = document.chpass.newpassword.value;

		for( i=0;i<h;i++)
		{
		 
			if (  h < 6 )
			{
							alert(" Password can't be less than 6" + " characters");
							document.chpass.newpassword.focus();
							document.chpass.newpassword.select();
							return false;
			}
			var valid = "0123456789"
			var okn = "yes";
			var temp;
			for (var i=0; i<document.chpass.newpassword.value.length; i++) 
			{
				temp = "" + document.chpass.newpassword.value.substring(i, i+1);
				if (valid.indexOf(temp) == "-1") 
					okn = "no";
			}
			var valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
			var oka = "num";
			var temp;
			for (var i=0; i<document.chpass.newpassword.value.length; i++) 
			{
				temp = "" + document.chpass.newpassword.value.substring(i, i+1);
				if (valid.indexOf(temp) == "-1") 
					oka = "alp";
			}
		}
		if(okn=="yes" || oka == "num")
		{
			alert("Password should be Aplphanumeric");
			document.chpass.newpassword.focus();
			document.chpass.newpassword.select();
			return false;
		}
	}
	if (document.chpass.confirmpassword.value =="")
	{
		window.alert("You missed Confirm Password");
		document.chpass.confirmpassword.focus();
		return false;
	}
	if (document.chpass.confirmpassword.value != document.chpass.newpassword.value)
	{
		window.alert("New Password and Confirm Password should be same");
		document.chpass.confirmpassword.value =""
		document.chpass.newpassword.value =""
		document.chpass.newpassword.focus();
		return false;
	}
	return true;

}

function validPrice(field,val)
{
	string =val;
	values ="";
	n=string.length;

	for (i=0;i<n;i++)
		{
			if(string.charCodeAt(i)!=32)
				{
	
				   //if(string.charCodeAt(i)<=57 || (string.charCodeAt(i)>57 && string.charCodeAt(i)<65))
				  
				     if (string.charCodeAt(i)<46 || string.charCodeAt(i)>57)
						{
				    		alert(string.charAt(i)+"  Invalid character");
							window.document.getElementById(field).value=values;
							window.document.getElementById(field).focus();
							return false;
						}
					
			values=values+string.charAt(i);
		}
	}
}

function  restvalues()
{
adminlog.reset();

}
