function openWindow(url, name) {
  popupWin = window.open(url, name, 'width=440,height=400,left=100,top=100,scrollbars=yes,menubar=yes')
}
function openWindowLG(url, name) {
  popupWin = window.open(url, name, 'width=650,height=400,left=100,top=100,scrollbars=yes,menubar=yes')
}
function openWindowLong(url, name) {
  popupWin = window.open(url, name, 'width=650,height=600,left=100,top=100,scrollbars=yes,menubar=yes')
}
function openWindowW(url, name) {
  popupWin = window.open(url, name, 'width=620,height=300,left=100,top=100,scrollbars=yes,menubar=yes')
}
function openWindowFrames(url, name) {
  popupWin = window.open(url, name, 'width=490,height=650,left=100,top=100,scrollbars=no,menubar=no')
}
function openWindowMichWear(url, name) {
  popupWin = window.open(url, name, 'width=490,height=455,left=100,top=100,scrollbars=no,menubar=no')
}
function openWindowVidH(url, name) {
  popupWin = window.open(url, name, 'width=720,height=480,left=100,top=100,scrollbars=no,menubar=no')
}
function openWindowVidL(url, name) {
  popupWin = window.open(url, name, 'width=320,height=240,left=100,top=100,scrollbars=no,menubar=no')
}
function openWindowThumbpop(url){
newWindow=window.open('url','newWin','width=640,height=480,scrollbars=no,menubar=no')
newWindow.document.write('<html><head><\/head><body topmargin="0" leftmargin="0"><img src="'+url+'"><\/body><\/html>')
newWindow.focus()
}
function openWindowMsg(url, name) {
  popupWin = window.open(url, name, 'width=400,height=200,left=100,top=100,scrollbars=no,menubar=no')
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function img_act(imgName)	{
	document.images[imgName].src = "/images/" + imgName + "_on.gif";
}

function img_inact(imgName)	{
	document.images[imgName].src = "/images/" + imgName + "_off.gif";
}

//preload images
image1 = new Image();
image1.src = "/images/bg_content.gif";

image2 = new Image();
image2.src = "/images/bg_diagonal.gif";

image3 = new Image();
image3.src = "/images/bg_divider_print.gif";

image4 = new Image();
image4.src = "/images/bg_footer.gif";

image5 = new Image();
image5.src = "/images/bg_header.gif";

image6 = new Image();
image6.src = "/images/menu.gif";

image7 = new Image();
image7.src = "/images/btn_intranet_off.gif";
image8 = new Image();
image8.src = "/images/btn_intranet_on.gif";

image9 = new Image();
image9.src = "/images/btn_sitemap_off.gif";
image10 = new Image();
image10.src = "/images/btn_sitemap_on.gif";

image11 = new Image();
image11.src = "/images/btn_print_off.gif";
image12 = new Image();
image12.src = "/images/btn_print_on.gif";

image13 = new Image();
image13.src = "/images/home.jpg";

//for the time & date

dayName = new Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");

monName = new Array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

now = new Date()
function leadingZero(inValue) {
	if(inValue > 9) {
		return ":"+inValue
	}
	return ":0"+inValue
}
var Hours = now.getHours();
var Minutes = now.getMinutes();
var ampm = "am";
if (Hours == 0) Hours = 12;
if (Hours > 11)
	ampm = "pm";
if (Hours > 12)
	Hours -= 12;
var Minutes = leadingZero(now.getMinutes());

//set cookie for main choice

expireDate = new Date;
expireDate.setMonth(expireDate.getTime()+1);

function setCookie(name, value, path, domain, secure)
{
    document.cookie= name + "=" + escape(value) +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

//delete cookie

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 ) );
}

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";
}

// for print page  
  function printpage() {
	window.print();  
	}
	
//font adjust
function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  return ('A--');
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
if (title == 'null') {
  title = getPreferredStyleSheet();
}

setActiveStyleSheet(title);

function changeclass_sm() {
var small = document.getElementById("small");
var big = document.getElementById("big");
small.className="selected";
big.className="";
}

function changeclass_big() {
var small = document.getElementById("small");
var big = document.getElementById("big");
small.className="";
big.className="selected";
}
//font adjust end

//google map

// function onLoad() {
// Create a base icon for all of our markers that specifies the shadow, icon
// dimensions, etc.
// var baseIcon = new GIcon();
// baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
// baseIcon.iconSize = new GSize(20, 34);
// baseIcon.shadowSize = new GSize(37, 34);
// baseIcon.iconAnchor = new GPoint(9, 34);
// baseIcon.infoWindowAnchor = new GPoint(9, 2);
// baseIcon.infoShadowAnchor = new GPoint(18, 25);

// The Basics
//
// Creates a map and centers it on Palo Alto.
// var map = new GMap(document.getElementById("map"));
// map.addControl(new GLargeMapControl());
// map.centerAndZoom(new GPoint(-79.3909, 43.6559), 2);
//map.openInfoWindowHtml(map.getCenterLatLng(), 
// var html = "<b>The Michener Institute<br> for Applied Health Sciences</b><br>222 St. Patrick Street<br>Toronto, Ontario Canada M5T 1V4";
// GEvent.addListener(marker, "click", function() {
//           marker.openInfoWindowHtml(html);
//   });
//       
//         return marker;
//       }
// var marker = createMarker((-79.3909, 43.6559), i);
//         map.addOverlay(marker);
// }

//show - hide trick
function show( id )
  {
    document.getElementById(id).style.display = 'block';
  }

  function hide( id )
  {
    document.getElementById(id).style.display = 'none';
  }

// for resolution survey
var resolution = +screen.width+'x'+screen.height;