<!--
var alphabet = "abcdefghijklmnopqrstuvwxyz";
var numeric  = "0123456789";

function isValidwithBag(name,Bag)
{
	var i;
	name = name.toLowerCase();
	for(i=0;i<name.length;++i)
		if (Bag.indexOf(name.charAt(i)) == -1) 
			return false;
	return true;
}		

function isEmpty(s)
{
	// if the string is null or having the length of zero
	// the function will return true
	return((s==null) || (s.length==0));
}

function isWhitespace(s)
{
	// 	Check if s is empty

	if (isEmpty(s)) return true;	

	// Checks for whitespace. If there is atleast a non-whitespace character
	// the function will return false.

	var spaces = " \n\t\r"
	var i;
	for(i=0;i<s.length;++i)
		if (spaces.indexOf(s.charAt(i)) == -1) 
			return false;
	return true;
}

function isLogin(s)
{
	if (s.length < 5)
	{
		alert("Min. length of login id is 5.");
		return false;
	}

	if (!isValidwithBag(s,alphabet + numeric + "-._"))

	{
		alert("Login id should contain only the characters from alphabet, numbers and '-._'");
		return false;
	}
	if (!isValidwithBag(s.charAt(s.length-1),alphabet + numeric))
	{
		alert("Login id should end with an alphanumeric characters.");
		return false;
	}
	if (!isValidwithBag(s.charAt(0),alphabet + numeric))
	{
		alert("Login id should start with an alphanumeric characters.");
		return false;
	}
	return true;
}

function isPassword(s)
{
	if (s.length < 5)
	{
		alert("Min. length of password is 5.");
		return false;
	}

	if (isWhitespace(s))
	{
		alert("Please enter the password without spaces.");
		return false;
	}
	return true;
}


function isEmail(s)
{
	var i = 1,Length = s.length,result;

	while((i<Length) && (s.charAt(i) != '@')) i++;
	
	if ((i == Length) || (s.charAt(i) != '@'))
	{
		alert("Email address don\'t have the character @ after the login name.");
		return false;
	}
	
	i+=2;
	
	while((i<Length) && (s.charAt(i) != '.')) i++;

	if ((i == Length) || (s.charAt(i) != '.'))
	{
		alert("Email address don\'t have the character . after the domain name.");
		return false;
	}

	if (i+1 >= Length)
	{
		alert("Email address should have atleast one character after . ");
		return false;
	}
	
	return true;
}

function validateDB(objForm)
{
	var i,j;
	with(objForm)
	{	
		for(i=0;i < elements.length;i++)
		{
			if(elements[i].name.substr(0,2) == "_1" || (elements[i].name.substr(0,2) == "_0" && elements[i].value != ""))
			{
				j = elements[i].name.charAt(2);
				
				switch(j)
				{
					case "1" :
							if (isWhitespace(elements[i].value))
							{
								alert("Please enter value for " + elements[i].name.substr(4) + ".")
								elements[i].focus();
								return false;
							}
							break;

					case "2" :
							if (isNaN(elements[i].value) || isWhitespace(elements[i].value))
							{
								alert("Please enter numeric value for " + elements[i].name.substr(4) + ".")
								elements[i].focus();
								return false;
							}
							break;

					case "3" :
							if (isNaN(elements[i].value))
							{
								alert("Please select yes/no for " + elements[i].name.substr(4) + ".")
								elements[i].focus();
								return false;
							}
							break;

					case "4" :
							if (!isDate(elements[i].value,elements[i].name.substr(4)))
							{

								alert("Please enter a valid date value for " + elements[i].name.substr(4) + ".")
								return false;
							}
							break;
					case "5" :
						if(!IsaCardno(elements[i]))
						{
							return false;	
						}
						break;	
					case "9" :
							if (isWhitespace(elements[i].value))
							{
								alert("Please select a file for " +  elements[i].name.substr(4) + ".")
								elements[i].focus();
								return false;
							}	
							elements[elements[i].name.substr(4)].value = elements[i].value;
				}
				
			}
			else if(elements[i].name.substr(0,3) == "_09")
				elements[elements[i].name.substr(4)].value = elements[i].value;
			
		}
	}
	return true;
}


function validateDB1(objForm)
{
	var i,j;
	with(objForm)
	{	
		for(i=0;i < elements.length;i++)
		{
			if(elements[i].name.substr(0,2) == "_1")
			{
				j = elements[i].name.charAt(2);
				
				switch(j)
				{
					case "1" :
							if (isWhitespace(elements[i].value))
							{
								alert("Please enter value for " + elements[i].name.substr(4) + ".")
								return false;
							}
							break;
					case "2" :
							if (isNaN(elements[i].value) || isWhitespace(elements[i].value))
							{
								alert("Please enter numeric value for " + elements[i].name.substr(4) + ".")
								return false;
							}
							break;
					case "3" :
							if (isWhitespace(elements[i].value))
							{
								alert("Please enter date value for " + elements[i].name.substr(4) + ".")
								return false;
							}
							break;
					case "9" :
							if (isWhitespace(elements[i].value))
							{
								alert("Please select a file for " +  elements[i].name.substr(4) + ".")
								return false;
							}	
							elements[elements[i].name.substr(4)].value = elements[i].value;
				}
				
			}
			
			else if(elements[i].name.substr(0,3) == "_09")
			{
					elements[elements[i].name.substr(4)].value = elements[i].value;
			}
			
		}
	}
	return true;
}

function win_open(location, width, height)
{
	//determine browser type
	var ns4up = (document.layers) ? 1 : 0;  
	var ie4up = (document.all) ? 1 : 0;
	
	//if compatable browser
	if (ns4up || (ie4up))
	{
		//if netscape 4 or up
		if (ns4up)
		{
			//width & height X% of client's current brower
			if (width.indexOf("%") > -1)
			{
				var win_width = Math.round(self.innerWidth * (parseFloat(width)*.01));
			}
			else
			{
				var win_width = parseFloat(width)
			}
			if (height.indexOf("%")  > -1)
			{
				var win_height = Math.round(self.innerHeight * (parseFloat(height)*.01));
			}
			else
			{
				var win_height = parseFloat(height)
			}
			
		}
		//if internet explorer 4 or up
		else if (ie4up)
		{
			//width & height X% of client's current brower
			if (width.indexOf("%")  > -1)
			{ 
				var win_width = Math.round(document.body.clientWidth * (parseFloat(width) *.01))
			}
			else
			{
				var win_width = parseFloat(width)
			}
			if (height.indexOf("%")  > -1)
			{
				var win_height = Math.round(document.body.clientHeight * (parseFloat(height)*.01))
			}
			else
			{
				var win_height = parseFloat(height)
			}
		}
			//parm string
			var win_size = "scrollbars=no,width=" + win_width + ",height=" + win_height +",top=100,left=400,resizable=1"
			//open window
			window.open(location,"", win_size)
	}
	//else incompatable broswer, open window to default size
	else
	{
		//open window with default settings
		window.open(location, "", "scrollbars=Yes,menubar=yes,top=100,left=400",resizable=1)
	}
}

function showSubItems(MyForm,intIndex,intMaxIndex,intParent)
{
//this handles Javascript Array built in ASP
//useful only when all the levels of categories are stored in the same table
//cannot be used along with the DATABASE.INC functions InsetDB and UpdateDB

	for(i=intIndex;i<=intMaxIndex;i++)
	{
		var objOptions = MyForm._11_Step[i].options;
		var objXLength = objOptions.length;
		for(j=1;j<objXLength;j++)
		{
			objOptions[1] = null;
		}
	}
	
	var objOptions = MyForm._11_Step[intIndex].options;
	var j = 1;
	for(i=0;i<CatArray.length;i++)
	{
		if(CatArray[i][2] == intParent)		
		{
			var myNewOption = new Option(CatArray[i][1],CatArray[i][0]);
			objOptions[j] = myNewOption;
			j++;
		}
	}
}

function showSubItemsOpt(MyForm,intIndex,intMaxIndex,intParent)
{
//this handles Javascript Array built in ASP
//useful only when all the levels of categories are stored in the same table
//cannot be used along with the DATABASE.INC functions InsetDB and UpdateDB
	for(i=intIndex;i<=intMaxIndex;i++)
	{
		var objOptions = MyForm._01_Step[i].options;
		var objXLength = objOptions.length;
		for(j=1;j<objXLength;j++)
		{
			objOptions[1] = null;
		}
	}
	
	var objOptions = MyForm._01_Step[intIndex].options;
	var j = 1;
	
	for(i=0;i<CatArray.length;i++)
	{
		if(CatArray[i][2] == intParent)		
		{
			var myNewOption = new Option(CatArray[i][1],CatArray[i][0]);
			objOptions[j] = myNewOption;
			j++;
		}
	}
}

//-->
