function genOver(button,image) {
		button.src = image;
}

function genOut(button,image) {
		button.src =  image;
}

/*************************************/

function openPrivacy(suffix, baseUrl) 
{		
	var popupwin=window.open(baseUrl + 'privacy-'+suffix,'progPop',' width=620, height=580, status=0, location=0, scrollbars=1');
}

function openWin(url, x, y) {
	var mainWin = window.open(url, 'progPop', 'width='+x+',height='+y+',resizable=12,scrollbars=1');
}

/***************************************
* FORM VALIDATION
***************************************/
function checkForm() {
    var form1 = document.forms[0];    
    var errstr = "";
    
    form1.zip.value = Trim(form1.zip.value);
    if(Trim(form1.zip.value) == ""){
        errstr += "You need to enter your zip/postal code.\n";
    } else {
        var valid = 0;
        if(/^\d{5}$/.test(form1.zip.value)){
            valid = 1;
        }
        else if(/^[AaBbCcEeGgHhJjKkLlMmNnPpRrSsTtVvXxYy]\d[A-Za-z](\s|-)?\d[A-Za-z]\d$/.test(form1.zip.value)){
            valid = 1; 
        }
        else{
            errstr += "Your zip/postal code is invalid.\n";
        }
        
        	if (form1.school.value == "") {
			var rad = 1;
			for (i = 0; i < form1.school.length; i++) {
				if (form1.school[i].checked) {
					rad = 0;
				}
			}
			if (rad == 1) {
				errstr += "Are you interested in Online or campus-based learning?\n";
			}
		}
    }     
    submitForm(errstr, form1);
}

function Trim(strValue){
    return LTrim(RTrim(strValue));
}

function LTrim(strValue){
    var LTRIMrgExp = /^\s */;
    return strValue.replace(LTRIMrgExp, "");
}

function RTrim(strValue){
    var RTRIMrgExp = /\s *$/;
    return strValue.replace(RTRIMrgExp, "");
}

function submitForm(errstr, form)
{
	if( errstr != "" )
	{
		alert(errstr);
		errstr = "";
		
	}else
	{
		form.submit();
	}
}

function getHttpRequestObj() {
  var req = false;
  if(window.XMLHttpRequest) {
      try {
         req = new XMLHttpRequest();
      } 
      catch(e) {
         req = false;
      }
  } 
  else if(window.ActiveXObject) {
      try {
         req = new ActiveXObject("Msxml2.XMLHTTP");
      } 
      catch(e) {
         try {
            req = new ActiveXObject("Microsoft.XMLHTTP");
         } 
         catch(e) {
            req = false;
         }
      }
  }
  return req;
}