var appVer = navigator.appVersion.toLowerCase();
var win = (appVer.indexOf("win") != -1);
var nn = (navigator.appName == "Netscape");
var ie = (navigator.appName == "Microsoft Internet Explorer");
var ver = (ie) ? parseFloat(appVer.substring((appVer.indexOf('msie') + 5), appVer.length)) : parseFloat(appVer);
var v4 = (parseInt(appVer) == 4);
var docload = false;

function blurLinks() {
  for(var i=0; i < document.links.length; i++) {
  document.links[i].onfocus =  document.links[i].blur;
  }
}

var onloadHandlers = new Array(0);
function loadEvents() {
if(ie && win && v4) blurLinks();
  for(var i=0; i<onloadHandlers.length;i++) {
  eval(onloadHandlers[i]);
  }
}
window.onload = loadEvents;

var onresizeHandlers = new Array(0);
function resizeEvents() { 
 for(var i=0; i<onresizeHandlers.length;i++) {
  eval(onresizeHandlers[i]);
  }
}
window.onresize = resizeEvents;

function imgCollection(name,glen,slen,path,ext){
if(!document.images) return;
this.name = name;
this.groups = new Array(glen);
this.filepath = path;
this.filetype = (ext) ? ext : ".gif";
  for(var i = 0; i < glen; i++){
  this.groups[i] = new Image();
  this.groups[i].src = path + name + "_" + i + this.filetype;
  this.groups[i].states = new Array(slen);
    for(var j = 0; j < slen; j++){
    this.groups[i].states[j] = new Image();
    this.groups[i].states[j].src = path + name + "_" + i + "_" + j + this.filetype;
    }
  }
}

function getObjByName(name,doc) {
if(!doc) doc = document;
if(doc[name]) return doc[name]; 
  for(var i=0;i < doc.layers.length;i++){
  var lyrdoc = doc.layers[i].document;
  if(lyrdoc[name]) return lyrdoc[name]; 
    if(lyrdoc.layers.length > 0) {
    var obj = getObjByName(name, lyrdoc);
    if(obj) return obj;
    }
  }
return 0;
} 

function swapImg() { 
if(!document.images) return;
var args = swapImg.arguments; 
  for(var i = 0; i < args.length; i+=2) {
  var imgSrc = (args[i + 1].indexOf('[') != -1) ? eval(args[i + 1] + '.src') : args[i + 1]; 
  if(getObjByName(args[i])) getObjByName(args[i]).src = imgSrc; 
  }
}

function handleResize(init) {
if(!(nn && v4)) return;	
  if(init==true) with (navigator) {
  document.pgW=innerWidth; 
  document.pgH=innerHeight; 
  onresizeHandlers[onresizeHandlers.length] = 'handleResize()';
  }
  else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();
}
handleResize(true);

/*
function reDraw() {
var ie5fix = (!window.MENUS_imgpath && !reDraw.init && win && ie && ver == 5 && ie5fix) ? 17 : 0;
var globalBkgW = (window.innerWidth) ? window.innerWidth : document.body.clientWidth - ie5fix;
  if(globalBkgW < reDraw.maxwidth) {globalBkgW = reDraw.maxwidth}
   for(var i=0;i < reDraw.layers.length;i++) {
    if(document.layers) document.layers[reDraw.layers[i]].clip.width = globalBkgW;
    else {
	csspObj(reDraw.layers[i]).setProperty('width',globalBkgW);
    csspObj(reDraw.layers[i]).clipTo(0,globalBkgW,reDraw.clipBottoms[i],0);
    }
  }
reDraw.init = true;
}
reDraw.maxwidth = 720;
reDraw.layers = new Array(0);
reDraw.clipBottoms = new Array(0);
*/

window.offscreenBuffering = true;
var cssp = (document.getElementById || document.layers || document.all);

function csspObj(id) { 
 if(document.getElementById) {
  var obj = document.getElementById(id);
  }
  else if(document.all) {
  var obj =  eval('document.all.' + id);
  }
  else if(document.layers) {
  var obj = getLayer(id, document);
  obj.style = obj;
  }
if(!obj) return 0;   
obj.getProperty = CSSP_getProperty;
obj.setProperty = CSSP_setProperty;
obj.resizeTo = (obj.resizeTo) ? obj.resizeTo : CSSP_resizeTo;
obj.resizeBy = (obj.resizeBy) ? obj.resizeBy : CSSP_resizeBy;
obj.moveTo = (obj.moveTo) ? obj.moveTo : CSSP_moveTo;
obj.moveBy = (obj.moveBy) ? obj.moveBy : CSSP_moveBy;
obj.getClipValue = CSSP_getClipValue;
obj.clipTo = CSSP_clipTo;
obj.clipBy = CSSP_clipBy;
obj.scrollBy = CSSP_scrollBy;
  if(obj.captureEvents) {
  obj.captureEvents(Event.MOUSEDOWN);
  obj.onmousedown = eventRoute;
  }
return eval(obj);
}

function eventRoute(e){this.routeEvent(e)}

function CSSP_resizeTo(w,h) {
this.style.width = w;
this.style.height = h;
}

function CSSP_resizeBy(w,h) {
this.style.width = parseInt(this.style.width) + w;
this.style.height =  parseInt(this.style.height) + h;
}

function CSSP_moveBy(dx,dy) {
this.style.left = parseInt(this.style.left) + dx;
this.style.top =  parseInt(this.style.top) + dy;
}

function CSSP_moveTo(x,y) {
this.style.left = parseInt(x);
this.style.top =  parseInt(y);
}

function CSSP_getClipValue(which) {
  if(this.clip) {
  return eval('this.clip.' + which)
  }
  else {
  var clip =  this.style.clip.split('(')[1].split(')')[0].split(' ');
  if(which == 'top') return parseInt(clip[0]);
  if(which == 'right') return parseInt(clip[1]);
  if(which == 'bottom') return parseInt(clip[2]);
  if(which == 'left') return parseInt(clip[3]);
  }
}

function CSSP_clipTo(t,r,b,l) {
if(this.clip) { this.clip.top = t; this.clip.right = r; this.clip.bottom = b; this.clip.left = l; }
else this.style.clip = 'rect(' +t+ ' ' +r+ ' ' +b+ ' ' +l+ ')';
}

function CSSP_clipBy(t,r,b,l) {
var ct = (this.currenStyle) ? parseInt(this.currentStyle.clipTop) : this.getClipValue('top');
var cr = (this.currenStyle) ? parseInt(this.currentStyle.clipRight) : this.getClipValue('right');
var cb = (this.currenStyle) ? parseInt(this.currentStyle.clipBottom) : this.getClipValue('bottom');
var cl = (this.currenStyle) ? parseInt(this.currentStyle.clipLeft) : this.getClipValue('left');  
this.clipTo((ct + t),(cr + r),(cb + b),(cl + l)); 
}

function CSSP_scrollBy(dx,dy) {
this.moveBy(-dx,-dy);
this.clipBy(dy,dx,dy,dx);
}

function CSSP_getProperty(property) {
if(property == 'top') var top = parseInt(this.style.top);
if(property == 'left') var left = parseInt(this.style.left);
if(property == 'width') var width = (this.style.width) ? parseInt(this.style.width)  : parseInt(this.style.clip.width);
if(property == 'height') var height = (this.style.height) ? parseInt(this.style.height)  : parseInt(this.style.clip.height);
if(property == 'offsetWidth') var offsetWidth = (this.offsetWidth) ? this.offsetWidth  : parseInt(this.style.clip.width);
if(property == 'offsetHeight') var offsetHeight = (this.offsetHeight) ?  this.offsetHeight  : this.document.height;
if(property == 'zIndex') var zIndex = this.style.zIndex;
if(property == 'visibility') var visibility = (this.style.visibility == 'show' || this.style.visibility == 'visible') ? 'visible' : 'hidden'; 
if(property == 'bgColor') var bgColor = (this.bgColor) ? rgbToHex(this.bgColor) : (this.style.backgroundColor.indexOf('rgb') != -1) ? rgbToHex(this.style.backgroundColor.split('rgb(')[1].split(')')[0]) : this.style.backgroundColor.toUpperCase(); 
if(property == 'bgImage') var bgImage = (typeof(this.style.background) == 'object') ? this.style.background.src : (this.style.backgroundImage) ? this.style.backgroundImage.split('url(')[1].split(')')[0] : 'undefined';
return eval(property);
}

function CSSP_setProperty(property,value) {
 if(property == 'bgImage') {
 if(document.layers) return this.style.background.src = value;
 else return this.style.backgroundImage =  'url(' +value+ ')';
 }
 if(property == 'bgColor') {
 property =  (document.layers) ? 'document.bgColor' : 'backgroundColor';
 if(value == 'transparent' && document.layers) return this.document.bgColor = null;
 value = (value.indexOf('rgb(') != -1) ? rgbToHex(value.split('rgb(')[1].split(')')[0]) : value;
 }
 if(property == 'innerHTML') {
   if(this.innerHTML != null) {
   this.innerHTML = '';
   return this.innerHTML = value;
   }
   else {
   this.document.open();
   this.document.write(value);
   this.document.close();
   return true; 
   } 
 }
return eval('this.style.' + property + '= value');
}

function getLayer(name,doc) {
var i, layer;
if(!doc) doc = document;
  for(var i=0;i < doc.layers.length;i++) {
  layer = doc.layers[i];
  if(layer.name == name) return layer;
    if(layer.document.layers.length > 0) {
    layer = getLayer(name, layer.document);
    if(layer.name == name) return layer;
    }
  }
return 0;
}

function rgbToHex() {
var hexChar = new Array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
var hexVal = '';
var rgb = (arguments.length > 1) ? arguments : arguments[0].toString().split(',');
  for(var i = 0; i < rgb.length; i++) {
  var decVal = parseInt(rgb[i],10);
  var Hex1 = Math.floor(decVal / 16);
  var Hex2 = Math.floor(decVal - (Hex1 * 16));
    if(Hex1 >= 16) return hexVal = rgbToHex(Hex1) + hexChar[Hex2]; 
    else {
    var h1 = (rgb.length == 1 && Hex1 <= 9) ? (hexChar[0] + hexChar[Hex1]) : hexChar[Hex1];
    hexVal += h1 + hexChar[Hex2]; 
    }
  }
return '#' + hexVal;
}

function SHLayer(layername,state) {
 	csspObj(layername).setProperty('visibility',state);
}

