var hold_img = "";

  function activateTile(sId, sSeed, vPath){

     var eSrc = document.getElementById(sId);
     var sName = sId.replace("link_", "");

     eSrc.onmouseover = new Function("ANI_" + eSrc.id + ".stop()");
     eSrc.onmouseout  = new Function("ANI_" + eSrc.id + ".restart()");
     
     var objLink = new ani(11, sId, "ANI_" + sId, sSeed);

     with(objLink){
       load(0, "/misc/classic/" + sName + ".gif");
       load(1, "/misc/classic/" + sName + ".gif");
       load(2, "/misc/classic/" + sName + ".gif");
       load(3, "/misc/classic/big_smile_093.gif");
       load(4, "/misc/classic/big_smile_094.gif");
       load(5, "/misc/classic/big_smile_095.gif");
       load(6, "/misc/classic/big_smile_096.gif");
       load(7, "/misc/classic/big_smile_097.gif");
       load(8, "/misc/classic/big_smile_098.gif");
       load(9, "/misc/classic/big_smile_099b.gif");
       load(10,"/misc/classic/big_smile_100.gif");

       startup();
      }
    return objLink;
  }

function bs(){
    
      var agt = navigator.userAgent.toLowerCase();
      var w = window;
      
      w.css = "sp";
      w.is_dom = (document.getElementById)?true:false;

      if(agt.indexOf("mac")!=-1){                                    /* Mac */

		var is_ns4mac = (document.layers) ? true : false;
		var is_ns6mac = (!document.all && document.getElementById)  ? true : false;
		var is_ie4mac = (document.all  && !document.getElementById) ? true : false;
		var is_ie5mac = (document.all  && document.getElementById)  ? true : false;

		if(is_ns4mac){w.css = "ns_mac4";}
		if(is_ns6mac){w.css = "ns_mac6";}
		if(is_ie4mac){w.css = "ie_mac4";}
		if(is_ie5mac){w.css = "ie_mac5";}
      }

      if ((agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1)){  /* Windows */

		var is_ns4win = (document.layers) ? true : false;
		var is_ns6win = (!document.all && document.getElementById)  ? true : false;
		var is_ie4win = (document.all  && !document.getElementById) ? true : false;
		var is_ie5win = (document.all  && document.getElementById)  ? true : false;
                var is_safari = (document.childNodes)&&(!document.all)&&(!navigator.taintEnabled)&&(!navigator.accentColorName) ? true : false;

		if(is_ns4win){w.css = "ns_win4";}
		if(is_ns6win){w.css = "ns_win6";}
		if(is_ie4win){w.css = "ie_win";}
		if(is_ie5win){w.css = "ie_win";}
	  }
	  
	  window.style_key = w.css;
	  
}
    
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;
	 }
	 
	 
   }
   
   // alert(a);
   
   // alert( title);
}

function cf(){window.status="";}

function preload(){

  var imgs = document.images;

  if(imgs.length == 0) {return;}

  var holdImg = new Array();
  var strSrc = "";
  var strArray;


  for(var i=0; i < imgs.length; i++) {

    if(imgs[i].src.indexOf("dot.gif")==-1){

      holdImg[i] = new Image;

      if(imgs[i].rollover != ""){
        strSrc = "../images/box/" + imgs[i].rollover + ".gif"
        holdImg[i].src = strSrc;
      }

      else{
        holdImg[i] = new Image;
        holdImg[i].src = image_reassign(imgs[i].src);
      }
    }
  }

}

function image_reassign(strSrc){
  var strArray = strSrc.split("/");
  strSrc = "../images/640/" + strArray[strArray.length -1].replace(".gif", ".jpg");
  return strSrc;
}

function image_switch(strSrc){
   var eBigImage = document.getElementById("big_image");
   strSrc = image_reassign(strSrc);
   eBigImage.src = image_reassign(strSrc);
}

function grid_rollover(eSrc){
  var s_rollover = eSrc.getAttribute("rollover");
  if(!s_rollover) return;
  hold_img = eSrc.getAttribute("src");
  eSrc.setAttribute("src", "../images/box/" + s_rollover + ".gif");
}

function grid_rollout(eSrc){
   if(hold_img != "") eSrc.setAttribute("src", hold_img);
   hold_img = "";
}

function random_blink(){


  if (iBlinkSpeed==-1) return;

  var iIndex = Math.round(100 * Math.random());

  if(hold_img != ""){return;}

  if (document.images[iIndex]){

   if(document.images[iIndex].src.indexOf("dot.gif")!= -1){return;}

   var eSrc =document.images[iIndex];
   eSrc.src= document.images[iIndex].src;
  }
}

function back_from_blink(){}

function send_message(){
  frmMain.submit();
}

function button_rollover(eSrc){
  eSrc.className = "form_button_over";
}

function button_rollout(eSrc){
  eSrc.className = "form_button";
}

function click_box(eSrc){
 // alert("!!");
}


  
  function ani(intFrames, sId, sName, sSeed, bLoop){
    this.eSrc = document.getElementById(sId);
    this.name = sName;
    this.seed = sSeed;
    this.loop = bLoop;
    this.setFrames(intFrames);
    this.start();
  }

  ani.prototype.load = function (i, src){
    this.aniframes[i].src  = src;
  }

  ani.prototype.setFrames = function(intFrames){

    this.frames = intFrames;
    this.aniframes = new Array(intFrames);
    this.frame = 0;
    this.timeout_id = null;

    for (var i=0; i < this.frames; i++){this.aniframes[i] = new Image();}
  }

  ani.prototype.blinker = function(){
    if(Math.round(this.seed * Math.random())==1){
      this.frame=0; this.start();
    }

    this.timeout_random = setTimeout(this.name + ".blinker()", 100);
  }

  ani.prototype.restart = function(){
    this.frame=2; this.start();
    this.timeout_random = setTimeout(this.name + ".blinker()", 100);
  }

  ani.prototype.startup = function(){
    this.start();
    this.timeout_random = setTimeout(this.name + ".blinker()", 100);
  }

  ani.prototype.start = function(){

    if(!this.loop){
      if(this.frames==this.frame){
        clearTimeout(this.timeout_id);
        this.timeout_id=null;
        return;
      }
    }

    this.eSrc.src = this.aniframes[this.frame].src;

    if(this.loop){this.frame = (this.frame + 1)%this.frames;}  // user this for continuous;
    else{ this.frame += 1;}

    this.timeout_id = setTimeout(this.name + ".start()", 100);
  }

  ani.prototype.stop = function(){

    if(this.timeout_id){
      clearTimeout(this.timeout_id);
      this.timeout_id=null;
    }

   if(this.timeout_random){
     clearTimeout(this.timeout_random);
     this.timeout_random=null;
   }

    this.eSrc.src = this.aniframes[0].src;
  }

