// Original JavaScript code by Duncan Crombie: dcrombie@chirp.com.au
// revised by Bradford Mar: bradfordmar@hotmail.com
// Please acknowledge use of this code by including this header.

//var bites = (document.cookie) ? document.cookie.split("; ") : null; // break cookie into array of bites

  function getCookie(name) { // use: getCookie("name");
    bites = (document.cookie) ? document.cookie.split("; ") : null; // break cookie into array of bites
    if (bites != null) {
      for (var i=0; i < bites.length; i++) {
        nextbite = bites[i].split("="); // break into name and value
        if (nextbite[0] == name) {// if name matches
          return unescape(nextbite[1]); // return value
        }
      }
    } else {
      return null;
    }
    return null;
  }

  function setCookie(name, value, expDate) {
    var today = new Date();
    var yearFromNow = new Date(today.getTime() + 31536000000); // plus 365 days
    var expiry = (expDate) ? expDate.toGMTString() : null;
    if (value != null && value != "") {
      newCookie = name + "=" + escape(value) + "; path=/";
      newCookie += (expiry) ? ";expires=" + expiry : "";
      document.cookie = newCookie;
      bites = document.cookie.split("; "); // update cookie bites
    }
  }

var session = (getCookie('JSESSIONID')) ? true : false;
//var loggedin = (jsession && jsession != null && jsession !="loggedout") ? true : false;
var firstname = (session) ? getCookie('firstname') : ' ';
var lastname = (session) ? getCookie('lastname') : ' ';
if(firstname == null || firstname == "") firstname = ' ';
if(lastname == null || lastname == "" || firstname == lastname) lastname = "";
var educatorid = (firstname != ' ') ? getCookie('educatorid') : 'none';
var reqLoc = document.location.href.substring(document.location.href.indexOf('/educators/')+11);
var members = (firstname != ' ') ? 'Welcome, ' + firstname + ' ' + lastname + '<br /><a href="/educators/forms/logout_meta.html"><img src="/educators/common/images/pref_focus_logout.jpg" width="64" height="18" border="0" /></a><a href="/educators/forms/profile_meta.html"><img src="/educators/common/images/pref_focus_profile.jpg" width="55" height="18" border="0" /></a><a href="/educators/forms/password_meta.html"><img src="/educators/common/images/pref_focus_password.jpg" width="78" height="18" border="0" /></a>' : 'Register for full access. It\'s free!<br /><a href="/educators/forms/register_meta.html"><img src="/educators/common/images/pref_focus_register.jpg" width="64" height="18" border="0" /></a><a href="/educators/forms/login_meta.html"><img src="/educators/common/images/pref_focus_login.jpg" width="55" height="18" border="0" /></a>'

var aoproi="<script language=\"javascript\" src=\"http://track.roiservice.com/track/track.aspx?ROIID=935467107000023\"></s"+"cript><script language=\"javascript\">if (typeof(ROIID) + '' != 'undefined') TrackEvent('LandingPage', 0);</s"+"cript>";
/*function finishPage() {
  docLoc = document.location.href;
  if ((cut = docLoc.indexOf(".html"))!=-1) {
	docLoc = docLoc.substring(0,cut+5);
  } else if ((cut = docLoc.indexOf(".jsp"))!=-1) {
	docLoc = docLoc.substring(0,cut+4);
  }
  //$("div#sidenav li ul").css("display", "none");
  $("div#sidenav li a").each(function(i) {
	if (this.href == docLoc || this.href == docLoc + "index.html" || this.href == docLoc + "/index.html" ) {
	  $(this).addClass("current");
	  $("ul:eq(0)", $(this).parent("li")).css("display", "block");
	  $(this).parents("ul").css("display", "block");
	}
  })
  if ($("div#sidenav li a.current").length==0) {
	compareLoc = ((cut=docLoc.indexOf("index"))!=-1) ? docLoc.substring(0,cut+5) + ".html" : docLoc;
	publicHref = compareLoc.replace(/members[\\|\/]/g,'');
    $("div#sidenav li a").each(function(i) {
	  if (this.href == compareLoc || this.href == publicHref) {
		$(this).addClass("current");
		$("ul:eq(0)", $(this).parent("li")).css("display", "block");
		$(this).parents("ul").css("display", "block");
      }
	})
  }*/
/*  $("div#aop").html(aoproi);*/
/*}
if ( jQuery.browser.safari ) {
  (function(){if(document.body)finishPage();else setTimeout(arguments.callee,0);})();
} else {
  $(document).ready(finishPage);
}*/