//MODIFICATIONS
//02-Sep-2010 no changes


//---------------------------------------------------------------------------------
// MS 22.02.10
// validates an email address
// checks form element value to ensure that it has a @ and .
function IsValidEmail(el){
	var el;
	if (el.value != ""){
		if (el.value.indexOf('@') == -1 || el.value.indexOf('.') == -1)
	    {
	    	alert("This does not appear to be a valid email address.");
	    	el.focus();
	    	return false;
	    }
    }
}


//---------------------------------------------------------------------------------
// MS 22.02.10
// validates a comment field
// checks form element value to ensure that it doesn't include links to other websites
function IsValidCommentNoHttp(el){
	var el;

	if (el.value.toLowerCase().indexOf('http') != -1){
		alert("Please do not include links (http) to other websites.");
    	el.focus();
    	return false;
    }
}


//---------------------------------------------------------------------------------
// MS 22.02.10
// checks to see if form element has some info in it
function IsAnswered(el){
	var el;

	//alert(el.value);	
	if (el.value == ""){
    	return false;
    }
	else if (el.value != ""){
    	return true;
    }
}

//---------------------------------------------------------------------------------
// MS 22.02.10
// checks to see if (for a group of radio buttons of the same name) an option has been selected
function IsAnsweredRadio(el,elUpperBound){
	var el, elUpperBound;
	var i;
	var count = 0;
	//alert("checking IsAnsweredRadio");
    
    for(i=0;i<=elUpperBound;i++){
        //if an array of elements exist
        if (el[i]){
			//alert("checking if "+i+" is checked");	        
	        if(el[i].checked == true){
				//alert(i+" is checked");		        
		        count=count+1;
		        return true;
	        }
        }

	}
}

//---------------------------------------------------------------------------------
// MS 22.02.10
// checks to see if (for a group of radio buttons of the same name) an option has been selected
function IsAnsweredSelect(el,elUpperBound){
	var el, elUpperBound;
	var i;
	var count = 0;
	//alert("checking IsAnsweredSelect");

	var selObj = el;	
	var selIndex = selObj.selectedIndex;
	//alert("selected index: "+selObj.options[selIndex].value); 
	
	//if the index is not 0 (the first option in the list is not valid)
	if(selObj.options[selIndex].value > 0){
        return true;
	}
}


//---------------------------------------------------------------------------------
// MS 22.02.10
// highlights form fields 

function highlightOn(el){
	el.style.backgroundColor  = "yellow"
}

//---------------------------------------------------------------------------------
// MS 22.02.10
// clears highlights from form fields 

function highlightOff(el){
	el.style.backgroundColor  = "white"
}

