<!--

/*
Function echeck is used to verify if the given value is a possible valid email address.
This function thus simply makes sure the email address has one (@), atleast one (.).
It also makes sure that there are no spaces, extra '@'s or a (.) just before or after the @.
It also makes sure that there is atleast one (.) after the @.
*/

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 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;
}
	
function getNumOfSelBoxes(boxes){
	var nc=0;
	if (boxes  != null) {
        	for (i=0; i<boxes.length; i++) {
			if (boxes.item(i).checked)
                        	nc=nc+1;
                }
	}
	return nc;
}

function selectValue(fName, fValue)
{
	var optionElement;

	for (var index=0; index < fName.options.length; index++)
	{
		optionElement = fName.options[index];

		if (optionElement.value == fValue)
		{
			optionElement.selected =  true;
			break;
		}
	}
}

//
function clearOptns()
{
	var hFld;
	var vals = document.all("hide");

	for (var i=0; i< vals.length; i++)
	{
		hFld = vals.item(i);
		hFld.value = "";		
	}
}

//Get number of selected options and move the first 10 values to the hidden fields.
function getNumOptions()
{
	var selOptns = 0;
	var optns = document.all("optn");
	var vals = document.all("hide");
	
	clearOptns();
	
	for (var i=0; i< optns.length; i++)
	{
		if (optns.item(i).checked)
		{
			//alert(optns.item(i).value);

			if (selOptns < 10)
				vals.item(selOptns).value = optns.item(i).value;
			selOptns++;
		}

	}

	//for (var i=0; (i< 10) && (i < selOptns); i++)
	//	alert(vals.item(i).value);

	return selOptns;
}

function isEntered(field, fldNm)
{
	if (field.value == "")
	{
		
		alert("Please specify " + fldNm);
		field.focus();
		return false;
	}

	return true;
}

-->


