// Common function- used for JS in webpages thruout the site
// @author--Nikhil Subramanian-NetworkATS


function jmpMS(category) { 
switch (category) { 
case 0: return
break 
case 1: window.location.href = "/Instructional/Resources/BRINews/Headline_Categories/TheFounders.htm" 
break 
case 2: window.location.href = "/Instructional/Resources/BRINews/Headline_Categories/Religion.htm" 
break 
case 3: window.location.href = "/Instructional/Resources/BRINews/Headline_Categories/Expression.htm" 
break 
case 4: window.location.href = "/Instructional/Resources/BRINews/Headline_Categories/Guns.htm" 
break 
case 5: window.location.href = "/Instructional/Resources/BRINews/Headline_Categories/Property.htm" 
break 
case 6: window.location.href = "/Instructional/Resources/BRINews/Headline_Categories/Criminal_Procedure.htm" 
break 
case 7: window.location.href = "/Instructional/Resources/BRINews/Headline_Categories/CitizenJuries.htm" 
break 
case 8: window.location.href = "/Instructional/Resources/BRINews/Headline_Categories/PersonalLiberty.htm" 
break 
case 9: window.location.href = "/Instructional/Resources/BRINews/Headline_Categories/Federalism.htm" 
break 
case 10: window.location.href = "/Instructional/Resources/BRINews/Headline_Categories/SupremeCourt.htm" 
break 
} 
} 

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=400,left = 490,top = 312');");
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}



function isEmailAddr(fromEmail)
{
  var result = false
  var theStr = new String(fromEmail)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}


function Validate(theForm)
{

  if (theForm.Email.value == "")
  {
    alert("Please enter your email address");
    theForm.Email.focus();
    return (false);
  }

  if (!isEmailAddr(theForm.Email.value))
  {
    alert("Please enter a valid email address of the form: yourname@yourdomain.com");
    theForm.Email.focus();
    return (false);
  }
   
  if (theForm.Email.value.length < 3)
  {
    alert("Please enter at least 3 characters in the \"email\" field.");
    theForm.Email.focus();
    return (false);
  }

  if (theForm.Email.value.length < 3)
  {
    alert("Please enter at least 3 characters in the \"email\" field.");
    theForm.Email.focus();
    return (false);
  }

		  	return (true);
}