
function setCookie(name, value, expiredays) {
  // Three variables are used to set the new cookie.
  // The name of the cookie, the value to be stored,
  // and finally the number of days until the cookie expires.
  // The first lines in the function convert
  // the number of days to a valid date.

  var ExpireDate = new Date ();
  ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));

  // The next line stores the cookie, simply by assigning
  // the values to the "document.cookie" object.
  // Note the date is converted to Greenwich Mean time using
  // the "toGMTstring()" function.

  document.cookie = name + "=" + escape(value) +
  ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}

function getCookie(name) {
  // First we check to see if there is a cookie stored.
  // Otherwise the length of document.cookie would be zero.

  if (document.cookie.length > 0) 
  {

    // Second we check to see if the cookie's name is stored in the
    // "document.cookie" object for the page.

    // Since more than one cookie can be set on a
    // single page it is possible that our cookie
    // is not present, even though the "document.cookie" object
    // is not just an empty text.
    // If our cookie name is not present the value -1 is stored
    // in the variable called "begin".

    begin = document.cookie.indexOf(name+"=");
    if (begin != -1) // Note: != means "is not equal to"
      {

      // Our cookie was set.
      // The value stored in the cookie is returned from the function.

      begin += name.length+1;
      end = document.cookie.indexOf(";", begin);
      if (end == -1) end = document.cookie.length;
        return unescape(document.cookie.substring(begin, end));
    } 
  }
  return null;
// Our cookie was not set.
// The value "null" is returned from the function.
}

function checkTabCookie() {
  tab = getCookie('tabValue');
  if (tab != null) {
    //call set tab function
    makeactive(tab);
  }	
}

function printSpecial() {
      if (document.getElementById != null) {
        var html = '<HTML>\n<HEAD>\n';

	if (document.getElementsByTagName != null) {
	  var headTags = document.getElementsByTagName("head");
	  if (headTags.length > 0)
	    html += headTags[0].innerHTML;
        }
		
        html += '\n</HE' + 'AD>\n<BODY>\n';
		
	var printReadyElem = document.getElementById("content");
		
	if (printReadyElem != null) {
          html += '<div class="printSection">';
	  html += printReadyElem.innerHTML;
          html += '</div>';
	}
	else {
          alert("Could not find the printReady section in the HTML");
	  return;
        }
			
	html += '\n</BO' + 'DY>\n</HT' + 'ML>';
		
	var printWin = window.open("","printSpecial");
	printWin.document.open();
	printWin.document.write(html);
	printWin.document.close();
	if (gAutoPrint)
	  printWin.print();
      }
      else {
        alert("Sorry, the print ready feature is only available in modern browsers.");
      }
}