//Determine browser
var ie = (navigator.appName.indexOf('Microsoft') != -1) ? true : false;
var ns = (navigator.appName.indexOf('Netscape') != -1) ? true : false;
var ns4 = (ns && document.layers) ? true : false;
var ns6 = (ns && document.getElementById) ? true : false;
var dom = (document.getElementById) ? true : false;
var mac = ((navigator.appVersion.indexOf("PPC") >0) || (navigator.appVersion.indexOf("Mac") >0)) ? true : false;

var highRes = false;

if (screen!=null && (screen.width>800)){
	highRes = true;
	
}

// Array and function necessary for ads to show up in netscape
var ads = new Array();
	function ad(site, page, position, size){
		this.site = site;
		this.page = page;
		this.pos = position;
		this.sz = size;
}

//Variables needed for email a photo
var currentEPhoto = 0;
var imageLoc = new Array();
var imageCap = new Array();
var imageCre = new Array();
var imageAmex = new Array();

//needed for e-card
var imageNameArray = new Array();
var thumbNailLoc = new Array();

//Random Number generator
function Random(N) 
	{ return Math.floor( N*Math.random() );	} 
	
//Blank onLoad,init functions
function onLoad() {}
function init(bool) {}
var popupPath = '/popups/';

//----------------------------------
// allows a positioned element be shown
//----------------------------------

function showDiv(divID_as_a_string) {
    var myReference = getRefToDiv(divID_as_a_string);
    if( !myReference ) { window.alert('Your Browser version does not support this feature'); return; }
    if( myReference.style ) { myReference.style.visibility = 'visible'; } else {
        if( myReference.visibility ) { myReference.visibility = 'show'; } else {
            window.alert('Your Browser version does not support this feature'); return; } }
}

//----------------------------------
// allows a positioned element be hidden
//----------------------------------

function hideDiv(divID_as_a_string) {
    var myReference = getRefToDiv(divID_as_a_string);
    if( !myReference ) { window.alert('Your Browser version does not support this feature');return; }
    if( myReference.style ) { myReference.style.visibility = 'hidden'; } else {
        if( myReference.visibility ) { myReference.visibility = 'hide'; } else {
            window.alert('Your Browser version does not support this feature'); return; } }
}

// team schedules dropdown links
function goHere(formName, selectName) {
	var dLink = eval('document.' + formName + '.' + selectName + '.options[document.' + formName + '.' + selectName + '.selectedIndex].value');
	if (dLink != '') window.location.href = '' + dLink;
}

// RSS on HomePage
function getMinutesSince(pDate){
	if(curTime) {
	var delay = 120000 //two minutes;
	postTime = new Date (pDate);
	curTime = new Date(curTime);

	postTime = Date.parse(postTime);
	curTime = Date.parse(curTime);

	minSince = curTime - postTime;
	minSince = minSince + delay;
	minSince = minSince / 60000;
	minSince = Math.round(minSince);

	var minStr = "min.";
	showMin = minSince;
	if(minSince >= 1 && minSince <= 60){minStr = "min.";}
	if(minSince >= 60 && minSince <= 90){minStr = "hr"; showMin = minSince / 60;}
	if(minSince >= 90 && minSince <= 1440){minStr = "hrs"; showMin = minSince / 60;}
	if(minSince >= 1440 && minSince <= 2880){minStr = "day"; showMin = minSince / 1440;}
	if(minSince >= 2880){minStr = "days"; showMin = minSince / 1440;}

	return document.write("<span class=minAgo> - " + Math.round(showMin) + " " + minStr + "</span>");
	}
}

//new global drop down functions
function ddOpen(ddID){
	document.getElementById(ddID).style.visibility = "visible";
}
function ddClose(ddID){
	document.getElementById(ddID).style.visibility = "hidden";
}

function addOnLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

function printPage(){
window.print();
}

Function.prototype.bg = function(ms){
	this.PID = setInterval(this,ms);
	return this;
}
Function.prototype.kill = function(){
	clearInterval(this.PID)
}
String.prototype.onReady = function(func){
	var str = this;
	return function(){
		try{
			eval("var res=("+str+")");
			if(res){
				arguments.callee.kill();
				func()
			}
		}catch(e){
		}
	}.bg(10)
}

function initOmniture() {
	s.pageName="generic"
	s.server=""
	s.channel=""
	s.prop11=s.getNewRepeat();

	/* E-commerce Variables */
	s.events=""
	var e=new Date(),y=e.getYear(),m=e.getMonth()+1;
	s.eVar1=(y<1000?y+=1900:y)+"/"+(m<10?'0'+m:m);
	var s_code=s.t();if(s_code)document.write(s_code);
}

function endOmniture(){
	var s_code=s.t();if(s_code)document.write(s_code)	
}	
