// US utilities.js

function goInternational(sURL)
{
if (sURL != "")
	document.location.href = sURL;
}
// change to false if no confirmation message desired
confirm_click=false;

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// Function to check for null in search criteria. 
// Added - LBS 09/19/00
function validateCriteria(sCriteria){
        if ("" == sCriteria.value)
	{
		alert('Please enter text in the search field before clicking on search.');
		return false;
	}
	else
		return true;
}

// Function for javascript pop ups
// Added - AC 03/01/02
function popup(theURL, winName, attrbList) {
 window.open(theURL, winName, attrbList);
}
// Function for small pop up window for graphics
// Added - AE 05/14/02
function popOpen(url, width, height) {
        var Win = window.open(url,'popOpen','width=' + width + ',height=' + height + ',resizable=yes,scrollbars=yes,menubar=yes,status=yes' );
}

// Function to validate an email address
// Added - AE 07/17/03
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					
}
