var appVer = navigator.appVersion.toLowerCase();
var userAgt = navigator.userAgent.toLowerCase();
var mac = (appVer.indexOf("mac") != -1);
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 aol = (userAgt.indexOf("aol") != -1);
var opera = (userAgt.indexOf("opera") != -1);
var v4 = (parseInt(appVer) == 4);
var docload = false;


	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  : parseInt(this.style.clip.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) ? '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) {
   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;
if(doc.all) return doc.all[name];
  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 errReport(msg,url,line) {
var errurl = 'http://trinity.criticalmass.ab.ca:7077/brand/script/jserror.html?'+msg+'&'+url+'&'+line;
var errwin = window.open(errurl,'','width=600,height=600,scrollbars=1,resizable=1');
return true;
}
if(document.domain.indexOf('x39')+1) window.onerror = errReport;
else if(document.domain.indexOf('trinity') == -1) window.onerror = Function("return true");
*/
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 showHide(d){
	var obj = csspObj(d);
	var getVis = obj.getProperty('visibility');
	if (getVis == 'visible' || getVis == 'show') obj.setProperty('visibility', 'hidden');
	else obj.setProperty('visibility','visible');
}


//Function for Random messages
function makeArray(len) {
	    for (var i = 0; i < len; i++) this[i] = null;
	this.length = len;
	}

	// This is where the array of text/images/sounds is created.
	
	ideas = new makeArray(7);
	ideas[0] = "The road to a friend's house is never long.<br>  -Danish proverb ";
	ideas[1] = "If you can't return a favor, pass it on.<br> -Louise Brown" ;
	ideas[2] = "When one door of happiness closes, another opens; but often we look so long at the closed door that we do not see the one which has opened for us.<br> -Helen Keller ";
	ideas[3] = "Wisdom begins in wonder.<br> -Socrates ";
	ideas[4] = "Laughter is the shortest distance between two people.<br> -Victor Borge ";
	ideas[5] = "The best way to cheer yourself up is to try to cheer somebody else up.<br> -Mark Twain ";
	ideas[6] = "Genius is one percent inspiration and ninety-nine percent perspiration.<br> -Thomas Alva Edison ";


	// The random number generator.
	
	function rand(n) {
	seed = (0x015a4e35 * seed) % 0x7fffffff;
	return (seed >> 16) % n;
	}
        
	var now = new Date()
	var seed = now.getTime() % 0xffffffff