// JavaScript Document
AC_FL_RunContent = 0;
var b = new BrowserInfo();
var sMusicOn = eatCookie("music");

//function fnMnuClick(sMnu){
//  document.location="/" + sMnu + "/index.html";
//}

//function fnRiport(sTxt){
//  alert(sTxt);
//}

function fnMusic(sTxt){
  expDate=new Date();
  OneMonth=31*24*60*60*1000; //in millisec
  expDate.setTime(expDate.getTime() + OneMonth);
  if(sTxt=="Start"){
    bakeCookie("music","on",expDate,"/");
    }
  else{
    bakeCookie("music","off",expDate,"/");
    }
}

function BrowserInfo(){
  this.name = navigator.appName;
  this.codename = navigator.appCodeName;
  this.version = navigator.appVersion.substring(0,4);
  this.platform = navigator.platform;
  this.javaEnabled = navigator.javaEnabled();
  this.screenWidth = screen.width;
  this.screenHeight = screen.height;
}

function bakeCookie(name,value) {
//Parameters
   //Name: Used as the identifier as many cookies could be used for different purposes by the same site. Names can't contain semicolon, comma or space. Well behaved calls will verify that the name does not have any of these characters. 
   //Value: The data that is to be saved. 
   //Expires: Last date that the 'value' is valid for. Format is DD-Mon-YY HH:MM:SS UTC 
   //NOTE: MSIE expires after the date, gecko expires on the date. The data is not necessarily removed from the file but it is inaccessable using JavaScript. 
   //Path: Restricts cookie to specific level of a site. Defaults to the level that made the cookie. 
   //Domain : Site specification to restrict access to cookies. Defaults to open. 
   //Secure: If set to 'true', the cookie responds only to a 'secure' server. Defaults to 'false' 
//Usage
   //expDate=new Date();
   //ThreeDays=3*24*60*60*1000; //in millisec
   //expDate.setTime(expDate.getTime() + ThreeDays);
   //bakeCookie("colorSet",entry,expDate);

   argv=arguments;
   argc=arguments.length;
   expires=(argc>2) ? argv[2] : null;
   path=(argc>3) ? argv[3] : null;
   domain=(argc>4) ? argv[4] : null;
   secure=(argc>5) ? argv[5] : false;
   document.cookie=name+"="+escape(value) +
     ((expires === null) ? "" : ("; expires="+expires.toUTCString())) +
     ((path === null) ? "" : ("; path="+path)) +
     ((domain === null) ? "" : ("; domain="+domain)) +
     ((secure === true) ? "; secure" : "");
}

function eatCookie(name) {
   arg=name+"=";
   alen=arg.length;
   clen=document.cookie.length;
   i=0;
   while (i<clen) {
      j=i+alen;
      if (document.cookie.substring(i,j) == arg) {
          return eatCookieVal(j);
          }
      i=document.cookie.indexOf(" ",i) + 1;
      if (i === 0) {break;}
   }
}

function eatCookieVal(offset) {
   endstr=document.cookie.indexOf(";",offset);
   if (endstr == -1) {endstr=document.cookie.length;}
   return unescape(document.cookie.substring(offset,endstr));
}

function tossCookie(name) {
   threeDays=3*24*60*60*1000; //in millisecounds
   expDate=new Date();
   expDate.setTime(expDate.getTime()-threeDays);
   document.cookie=name+"=; expires="+expDate.toGMTString();
}
