<!--
var mikExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\=\|]/;
var da = 0;
var divsArray = new Array();
divsArray[da++]='mainDiv';
divsArray[da++]='addSchoolDiv';
divsArray[da++]='addYearsDiv';
divsArray[da++]='selectBtnDiv';
divsArray[da++]='selectBtnDiv1';
divsArray[da++]='searchResultsDiv';
divsArray[da++]='searchResultsLoadingDiv';
divsArray[da++]='displayErrors';

function resizeDiv(id, newHeight)
{
  $(id).style.height = newHeight;
  makeShadow(id);
}

function closeDivs(){
  for(var i=0; i<da; i++){
    toggleDiv(divsArray[i],0);
    hideShadow();
  }
}

function birthdateCheck(){
  var errorIcon    = '<div style="float: left"><img alt="" border="0" src="' + imagePrefix + '/reg/icons/icon_caution.gif"></div>';
  var errorMsg     = '<b style="color: #cc0000">Please provide the following information:</b><br /> Year I was born';
  if ($('birthYear').value==null||$('birthYear').value==''){
    $('errorMsg').innerHTML = errorIcon + errorMsg;
    $('errorMsg').style.display = 'block';
    return false;
  }else{
    $('errorMsg').style.display = 'none';
    return true;
  }
  
}

function showDiv(url,pars)
{
 if(birthdateCheck()){
  var myAjax = new Ajax.Updater( 'mainDiv', url, { method: 'get', parameters: pars, onSuccess:showResults, evalScripts:true });
 }
}

function showResults(){
  $('mainDiv').style.height=200;
  toggleDiv('mainDiv',1);
  makeShadow('mainDiv');
  window.scrollTo(0,0);
}

function addPipeLine(pagename,process,include,uri){
  var url = 'includes/session/pagepipeline.jsp';
  var pars = 'pagename=' + pagename + '&process=' + process + '&includedPage=' + include + '&requestUri=' + uri;
  top.frames['omnitureFrame'].location = url + '?' + pars; return true; 
//var myAjax = new Ajax.Updater( 'omnitureDiv', url, { method: 'get', parameters: pars, onSuccess:createOmnitureDiv, evalScripts:true   });
}

function addOmniture(pagename,events,prop2,prop3){
  var url = 'includes/session/omniture.jsp';
  var pars = 'pagename=' + pagename + '&events=' + events + '&prop2=' + prop2 + '&prop3=' + prop3;
  top.frames['omnitureFrame'].location = url + '?' + pars; return true; 
//var myAjax = new Ajax.Updater( 'omnitureDiv', url, { method: 'get', parameters: pars, onSuccess:createOmnitureDiv, evalScripts:true   });
}

function addTermsDiv(){
  var url = contextPath + '/includes/terms.jsp';
  var pars = "ms=" + new Date().getTime();
  var myAjax = new Ajax.Updater( 'policy', url, { method: 'get', parameters: pars, onComplete:createTermsDiv, evalScripts:true });
}

function createTermsDiv(){
  closeDivs();
  hideShadow();
  toggleDiv('policy', 1);
  makeShadow('policy');
  addOmniture('Terms Of Service','','Terms Of Service','Terms Of Service');
}

function addPrivacyDiv(){
	var url = contextPath + '/includes/privacy.jsp';
  var pars = "ms=" + new Date().getTime();
  var myAjax = new Ajax.Updater( 'policy', url, { method: 'get', parameters: pars, onComplete:createPrivacyDiv, evalScripts:true });
}

function createPrivacyDiv(){
  closeDivs();
  hideShadow();
  toggleDiv('policy', 1);
  makeShadow('policy');
  addOmniture('Privacy','','Privacy','Privacy');
}

function showCaliPrivacyDiv(){
	var url = contextPath + '/includes/cali-privacy.jsp';
  var pars = "ms=" + new Date().getTime();
  var myAjax = new Ajax.Updater( 'policy', url, { method: 'get', parameters: pars, onComplete:createCaliPrivacyDiv, evalScripts:true });
}

function createCaliPrivacyDiv(){
  closeDivs();
  hideShadow();
  $('drag').style.top=64;
  $('drag').style.visibility = 'visible';
  $('drag').style.display = 'block';
  toggleDiv('policy', 1);
  makeShadow('policy');
}

function getDashboard(){ 
  var url = 'includes/dashboard.jsp';
  var pars = 'action=get';
  var myAjax = new Ajax.Updater( 'dashboardCounts', url, { method: 'get', parameters: pars, onSuccess:showDashboard, onError:errorDiv });
}

function showDashboard(){
  toggleDiv('affiliationsDiv',1);
  toggleDiv('continueBtn', 1);
}

function errorDiv(){
  Log.error("An Error occured");
}

function saveInput(name,val){
  var mikExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\=\|]/;
  var expError = "Sorry, but the following characters\n\r\n\r@ $ % ^ & * # ( ) [ ] \\ { + } ` ~ =  | \n\r\n\rare not allowed!<br>";
  var value = Trim(val);
  if (name.toLowerCase()=='birthyear'){
    if (value==""||value==null){value=$F('birthYearSave');}
  }
  if (value!=""&&value!=null){
    if (name.toLowerCase()=='birthyear'){
      if(value.search(mikExp) == -1) {
        value=parseInt( value );
        if(value.toString()=='NaN'||value<1900)
        {// this would obviously be wrong
          var errorIcon    = '<div style="float: left"><img alt="" border="0" src="' + imagePrefix + '/reg/icons/icon_caution.gif"></div>';
          var errorMsg     = '<b style="color: #cc0000">Please provide the following information:</b><br /> Year I was born';
          $('errorMsg').innerHTML = errorIcon + errorMsg;
          $('errorMsg').style.display = 'block';
          $(name).value = "";
          return false;
        }
      } else {
        var errorIcon    = '<div style="float: left"><img alt="" border="0" src="' + imagePrefix + '/reg/icons/icon_caution.gif"></div>';
        var errorMsg     = '<b style="color: #cc0000">Please provide the following information:</b><br />'+expError;
        $('errorMsg').innerHTML = errorIcon + errorMsg;
        $('errorMsg').style.display = 'block';
        $(name).value = value;
        return false;
      }
      $('errorMsg').style.display = 'none';
    }else if (name=="zip") {
      if(value.search(mikExp) == -1) {
        if(value.toString()=='NaN'){ 
          var errorIcon    = '<div style="float: left"><img alt="" border="0" src="' + imagePrefix + '/reg/icons/icon_caution.gif"></div>';
          var errorMsg     = '<b style="color: #cc0000">Please provide the following information:</b><br /> Zip Code';
          $('errorMsg').innerHTML = errorIcon + errorMsg;
          $('errorMsg').style.display = 'block';
          $(name).value = "";
          return false;
        }
        len   = value.toString().length;
        // only 3 possibilities: US zip (5), US zip with extended attributes, or Canadian zip (6)
        if( len == 5 ) { // valid US zip
          $('errorMsg').style.display = 'none';
        }else if ( len == 6 ){ // valid Candian zip
          $('errorMsg').style.display = 'none';
        }else if ( value == "Intl" ){ // valid Candian zip
          $('errorMsg').style.display = 'none';
        }else{ // not a valid zip
          var errorIcon    = '<div style="float: left"><img alt="" border="0" src="' + imagePrefix + '/reg/icons/icon_caution.gif"></div>';
          var errorMsg     = '<b style="color: #cc0000">Please provide the following information:</b><br /> Zip Code';
          $('errorMsg').innerHTML = errorIcon + errorMsg;
          $('errorMsg').style.display = 'block';
          $(name).value = value;
          return false;
        }
      } else {
        var errorIcon    = '<div style="float: left"><img alt="" border="0" src="' + imagePrefix + '/reg/icons/icon_caution.gif"></div>';
        var errorMsg     = '<b style="color: #cc0000">Please provide the following information:</b><br />'+expError;
        $('errorMsg').innerHTML = errorIcon + errorMsg;
        $('errorMsg').style.display = 'block';
        if (name=="zip"||name=="birthYear"){ $(name).value = value; }
        return false;
      }
    }
    var url = '/registration/services/user/profileInformation?successUrl=/blank.jsp';
    var pars = name + '=' + value; 
    var myAjax = new Ajax.Updater( 'emptyDiv', url, { method: 'get', parameters: pars, onComplete:checkCoppa  });
    $(name + 'Div').style.display='none';
    if (name=="zip"||name=="birthYear"){ $(name).value=value; }
    $(name + 'Span').innerHTML="<a href='#' onclick=\"editInput('" + name + "','" + value + "');return false\">" + value + "</a>";
    $(name + 'Span').style.display='block';
  }else{
    $(name + 'Div').style.display='none';
    $(name + 'Div').style.display='block';
  }
}

function checkCoppa(originalRequest){
  var responseText = trim(originalRequest.responseText);
  if (responseText.indexOf("redirect*")!= -1){
      var params = responseText;
      var sp = params.split("*");
      var aId = trim(sp[0]);
      var redUrl = trim(sp[1]);
      window.location=redUrl; 
      return false;
  }
  if (responseText=="COPPA"){
    location.href='age_redirect.jsp';
  }
}

function editInput(name,value){
  $(name + 'Span').style.display='none';
  $(name + 'Div').style.display='block';
}

function swapImg(img, type){
  src = img.src;

  switch(type)
  {
    case 'hi':
      if (src.indexOf('_hi.') != -1)
        img.src = src.replace('_hi.', '_on.');
      else if (src.indexOf('_on.') != -1)
        img.src = src.replace('_on.', '_hi.');
    break
    default:
      if (src.indexOf('_off.') != -1)
        img.src = src.replace('_off.', '_on.');
      else if (src.indexOf('_on.') != -1)
        img.src = src.replace('_on.', '_off.');
    break
  }
}

function preloadImg(img, type){
  src = img.src;
  document.onImg = new Image();

  switch(type)
  {
  case 'hi':
    document.onImg.src = src.replace('_hi.', '_on.');
  break
  default:
    document.onImg.src = src.replace('_off.', '_on.');
  break
  }
}

// start: methods from deprecated cmo/fragments/js/scripts.js
function buttonHover(source, obj){
  obj.src = source;
  return true;
}

function openPopupWindow(url, width, height, scrolling) {
  if (!width) width = 350;
  if (!height) height = 350;
  if (!scrolling) scrolling = "no"; 
  features = "width="+width+","
           + "height="+height+","
           + "toolbar=no,"
           + "location=no,"
           + "status=no,"
           + "menubar=no,"
           + "scrollbars="+scrolling+","
           + "top="+(window.screen.height-height)/2+","
           + "left="+(window.screen.width-width)/2;
  window.open(url,"win"+Math.round(Math.random()*1000),features);
}
// end: methods from deprecated cmo/fragments/js/scripts.js

function doOver(el) {
  if(el != selectedEl){
    el.style.backgroundColor = '#C8D8E6';
    el.style.color = '#000000';
 }
  el.style.cursor = "pointer";
 }

function doOut(el,bg) {
  if(el != selectedEl){
    el.style.backgroundColor = bg;
    el.style.color = '#000000';
  }
  el.style.cursor = "auto";
}

function toggleDiv(szDivID, iState) // 1 visible, 0 hidden
{
  var obj = null;
  if($(szDivID)) {
    obj = $(szDivID).style;
  } else if(document.all) {
    if(document.all[szDivID]) {
      obj = document.all[szDivID].style;
    }
  } else if(document.layers) {
     obj = document.layers[szDivID];
  }

  //Fail if object has no properties
  if(obj == null) {
    return false;
  }

  obj.visibility = document.layers ? (iState ? "show" : "hide") : (iState ? "visible" : "hidden");
  obj.display = document.layers ? (iState ? "block" : "none") : (iState ? "block" : "none");
}
function displayObj(id)
{
  var obj = document.getElementById(id);
  obj.style.visibility = (obj.style.visibility == 'hidden') ? 'visible' : 'hidden';

  if (obj.style.visibility == 'visible')
    makeShadow(id);
  else
    hideShadow();
}

function Set_Cookie( name, value, expires, path, domain, secure ) 
{
  // set time, it's in milliseconds
  var today = new Date();
  today.setTime( today.getTime() );

  /*
     if the expires variable is set, make the correct 
     expires time, the current script below will set 
     it for x number of days, to make it for hours, 
     delete * 24, for minutes, delete * 60 * 24
     */
  if ( expires )
  {
    expires = expires * 1000 * 60 * 60 * 24;
  }
  var expires_date = new Date( today.getTime() + (expires) );

  document.cookie = name + "=" +escape( value ) +
    ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
      ( ( path ) ? ";path=" + path : "" ) + 
        ( ( domain ) ? ";domain=" + domain : "" ) +
        ( ( secure ) ? ";secure" : "" );
}

// this function gets the cookie, if it exists
function Get_Cookie( name ) {
  var start = document.cookie.indexOf( name + "=" );
  var len = start + name.length + 1;
  if ( ( !start ) &&
      ( name != document.cookie.substring( 0, name.length ) ) )
  {
    return null;
  }
  if ( start == -1 ) return null;
  var end = document.cookie.indexOf( ";", len );
  if ( end == -1 ) end = document.cookie.length;
  return unescape( document.cookie.substring( len, end ) );
}


// this deletes the cookie when called
function Delete_Cookie( name, path, domain ) {
  if ( Get_Cookie( name ) ) document.cookie = name + "=" +
    ( ( path ) ? ";path=" + path : "") +
      ( ( domain ) ? ";domain=" + domain : "" ) +
      ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function Trim(string) {
  var tstring = "";
  string = '' + string;
  splitstring = string.split(" ");
  for(i = 0; i < splitstring.length; i++)
    tstring += splitstring[i];
  return tstring;
}
/*function Trim(TRIM_VALUE){
if(TRIM_VALUE.length < 1){
    return"";
  }
  TRIM_VALUE = RTrim(TRIM_VALUE);
  TRIM_VALUE = LTrim(TRIM_VALUE);
  if(TRIM_VALUE==""){
    return "";
  }
  else{
    return TRIM_VALUE;
  }
} //End Function
*/
function RTrim(VALUE){
  var w_space = String.fromCharCode(32);
  var v_length = VALUE.length;
  var strTemp = "";
  if(v_length < 0){
    return"";
  }
  var iTemp = v_length -1;

  while(iTemp > -1){
    if(VALUE.charAt(iTemp) == w_space){
    }
    else{
      strTemp = VALUE.substring(0,iTemp +1);
      break;
    }
    iTemp = iTemp-1;

  } //End While
  return strTemp;

} //End Function

function LTrim(VALUE){
  var w_space = String.fromCharCode(32);
  if(v_length < 1){
    return"";
  }
  var v_length = VALUE.length;
  var strTemp = "";

  var iTemp = 0;

  while(iTemp < v_length){
    if(VALUE.charAt(iTemp) == w_space){
    }
    else{
      strTemp = VALUE.substring(iTemp,v_length);
      break;
    }
    iTemp = iTemp + 1;
  } //End While
  return strTemp;
} //End Function


// -->

