/*
Version 1.2
Automized Menu Item Selection routines by Justin Deltener
Copyright 1999 Mind Tremors Corp.  Any duplication in part or in full of this page is strictly prohibited
without the expressed permission of Mind Tremors.

DSS = Default Status String
Tag = Is used for loading the glow version of menu items. This way, we only have to pass the Load function one file name and the routines
      will automatically add on the Tag to load it. Ex: 2 Files (Links, Links-g) we would call SetTag("-g");

*/
window.onerror=null;
var netscape = 0;
var goodIE = 0;

browserName = navigator.appName.substring(0,8);
browserVer = parseFloat(navigator.appVersion);
if (browserName == "Netscape" && browserVer >= 3)   {netscape = 1;}
if (browserName == "Microsof" && browserVer >= 3.01){goodIE = 1;}


var Count=0,NumberOfObjects,Items,Path,DSS="",Tag;
var Over_errors,Over_error_count=0;


function Over_error_history(nametag)  //check Over_errors to see if tag has a error history
	{ for(var z=0;z < Over_errors.length;z++)
		{if(nametag == Over_errors[z]){return 1;}
		}
	 return -1;
	}

function Setup(NOO) //NOO number of objects
{ Items = new Array(NOO);
  Over_errors = new Array();
  NumberOfObjects=NOO;
}

function SetPath(path)
{ Path=path;
}

function SetTag(tag)
{this.Tag=tag;
}

function SetDefaultStatus(string)
{DSS=string;
 SetStatus(DSS);
}

function Load(img1,w,h,alt,nametag)
{ if(netscape || goodIE)
  {Items[Count] = new xLoad(img1,w,h,alt,nametag);
   Count++;
  }
}

function xLoad(img,w,h,alt,nametag)
{ if(netscape || goodIE)
  {this.StatusString=alt;
   this.PicRegular = new Image(w,h);
   this.PicRegular.src=Path+img;
   this.PicGlow = new Image(w,h);
    var front,file;
   front= newsplit(img,'.');
   file=front[0];
   file+=Tag+'.'+front[1];
   this.PicGlow.src=Path+file;
   this.NameTag=nametag; 
   this.Width=w;
   this.Height=h;
  }
}

function Flip(nametag,onoff)
{if(netscape || goodIE)
  {var pick = Locate(nametag);
 
   if(pick == -1)
	{var error_history = Over_error_history(nametag);
	 if(error_history == -1)
		{Over_errors[Over_error_count]=nametag;Over_error_count++;
              errorhandle('Tags Not Pressent! ['+Over_errors+']',window.location,"Flip()");
		} 
	 }
   else
   { var temp= new Image();
     if(onoff==1)
        {temp=Items[pick].PicGlow.src;SetStatus(Items[pick].StatusString);}
    else{temp=Items[pick].PicRegular.src;
     SetStatus(DSS);}
    document.images[nametag].src=temp;
   }
 }

}

function SetStatus(string)
{ if(netscape || goodIE)
   {window.status=string;
    return true;
   }
}

function Locate(name)
{ for(c=0;c<NumberOfObjects;c++)
   { if(Items[c].NameTag == name){return c;}
   }
  return -1;
}

function OpenWindow(url,title,width,height)
{dimension='width='+width+','+'height='+height;
 if(netscape || goodIE)
   {window.open(url,title,dimension);
   }
}

function newsplit(string,spliter)
{ // getting how many entries there are
   var allocate=1;
   for(var l=0;l<=string.length;l++)
    {if(string.charAt(l) == spliter) {allocate++;}}

   var newstring = new Array(allocate);
   var segment ="";
   var counter = 0;

for(var c=0;c<=string.length;c++)
  { if(string.charAt(c) !=spliter && (c+1)<=string.length)
        {segment+=string.charAt(c);} else 
        {newstring[counter] = segment; segment = "";counter++;} 
    
  } 
return newstring;
}

function Footer()
{
}

