//This function returns the value of the selected radio button
	function Radio (form){
	var company = -1;
	val=form.value;
	if (val==0)
	{company=0;
	return company;}
	var len = form.length;
			for (Count = 0; Count < len; Count++) {
			if (form[Count].checked){
				company = Count;
				break;	}
		}
	return company;
}

	


//this function will make sure a check box is picked
function check(check)
{ 
	
	var len = check.length;
	var value = -1;

	
	if (len>=0)
	{
	}
	else
	{value=0;
	return value;}

	for (Count = 0; Count <len; Count++) {
	
		if (document.myForm.accts[Count].checked)
	{
			value =0;
			break;
		}
	}

	return value;
}



//This function takes that name of an email address field and validates it
//This function is all you need to validate sh_mlgsem.asp
//This function will return a -1 if the address is not valid
function validmail(email)
{

Temp = email;
var AtSym    = Temp.value.indexOf('@')
var Period   = Temp.value.lastIndexOf('.')
var Space    = Temp.value.indexOf(' ')
var Length   = Temp.value.length - 1   // Array is from 0 to length-1

if ((AtSym < 1) ||                     // '@' cannot be in first position
    (Period <= AtSym+1) ||             // Must be atleast one valid char btwn '@' and '.'
    (Period == Length ) ||             // Must be atleast one valid char after '.'
    (Space  != -1))                    // No empty spaces permitted
   {  
      return -1;
      
   }
}


//these functions are used on the Buy Additional Shares pages
function FilterData(e) {
	if (e.target == document.myForm.MonthlyDep)
		return FilterNumNN(e)
	if (e.target == document.myForm.OneDep)
		return FilterNumNN(e)
	if (e.target == document.myForm.InitDep)
		return FilterNumNN(e)

}

function FilterNum(txtcntrl) 
{
	var kc = event.keyCode;
	if (kc >= 48 && kc <= 57)
	{		return true;}
	return false;
}

function FilterNumNN(e) 
{
	var kc = e.which;
	if (kc >= 48 && kc <= 57)
		{		return true;}
	return false;
}
			
			if (navigator.appVersion.indexOf("Nav")> 0) {
		document.captureEvents(Event.KEYPRESS)
		document.onKeyPress = FilterData
	}
function setcheck(tform)
{
	tform.check.value="check";
}
