// Solitaire Master Vegas High Score script copyright 2000 Zoomgo.com  written by Tim Chung Dec 18, 2000
//======================================================================================================

// FS COMMAND HOOK FOR INTERNET EXPLORER
// -------------------------------------
  text  = '<SCRIPT LANGUAGE=VBScript\> \n';
  text += 'on error resume next \n';
  text += 'Sub vhisc_FSCommand(ByVal command, ByVal args)\n';
  text += '  call vhisc_DoFSCommand(command, args)\n';
  text += 'end sub\n';
  text += '</SCRIPT\> \n';
  document.write(text);


// FS COMMAND HOOK FOR NETSCAPE
// ----------------------------
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;

// GlOBALS
var nextyear = new Date();

// these are treated like constants:
var cookiepath = "/games/soli";
var cookiedomain = "www.zoomgo.com";

function LoadHighScore(seed) {
// this function loads the high score according to a cookie then calls the function
// SetHighScore to write it to the screen
  var zggameObj = InternetExplorer ? zggame : document.zggame;
  var allcookies = document.cookie;
  var hspos = allcookies.indexOf("vegashighscore=");
  
  if (hspos != -1) {
    var hsstart = hspos + 15;
    var hsend = allcookies.indexOf(";", hsstart);
    if (hsend == -1) hsend = allcookies.length;
    var hsvalue = allcookies.substring(hsstart, hsend);
    hsvalue = unescape(hsvalue);
    vegashighscore = hsvalue;
    zggameObj.setvariable("_root.vegashighscore", vegashighscore);
    SetHighScore(vegashighscore,seed);
  }
}

function SetHighScore(vegashighscore,seed) {
  // save the high score in a cookie
  nextyear.setFullYear(nextyear.getFullYear() + 1);
  document.cookie = "vegashighscore=" + vegashighscore + "; expires=" + nextyear.toGMTString() + "; path=" + cookiepath + "; domain= " + cookiedomain;
}

