/* commonScripts.js - contains the common javascript functions for use with eyos */

function writeCookie() 
{
  if (screen.width >= 1024 && screen.height >= 768)
    var the_cookie = "hires=1";
  else
    var the_cookie = "hires=0";
  var the_date = new Date();
  the_date.setTime(the_date.getTime() + (24*60*60*1000));
  var expires = "; expires=" + the_date.toGMTString();

  document.cookie=the_cookie + expires + "; path=/";
}

// http://members.ozemail.com.au/~dcrombie/javascript/chap14.html
function getCookie(name) { // use: getCookie("name");
  var bikky = document.cookie;
  var index = bikky.indexOf(name + "=");
  if (index == -1) return null;
  index = bikky.indexOf("=", index) + 1;
  var endstr = bikky.indexOf(";", index);
  if (endstr == -1) endstr = bikky.length;
  return unescape(bikky.substring(index, endstr));
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

