var ieX = (navigator.appName.indexOf("Microsoft") != -1);

var ns4 = (document.layers);
var ie4 = (document.all && !document.getElementById);
var ie5 = (document.all && document.getElementById);
var ns6 = (!document.all && document.getElementById);

/* workaround for netscape 4 resize bug: http://www.webreference.com/dhtml/diner/resize/ */
if(ns4){origWidth=innerWidth;origHeight=innerHeight;onresize=function(){if(innerWidth!=origWidth||innerHeight!=origHeight)location.reload()}}

function pageload() {
	loaded = true;
}

function getElement(id,doc) {
	if (!doc) { doc = document; }
	if (ie5||ns6)
		return(doc.getElementById(id));
	else if (ie4)
		return(doc.all[id]);
	else if (ns4)
		return(doc.layers[id]);
	else
		return null;
}

function getDivDocument(d) {
	if (ns6)
		return d.ownerDocument;
	else
		return d.document;
}

function styleObject(e) {
	return (ns4 ? e : e.style);
}

function showElement(e,force) {
	so = styleObject(e);
	so.visibility = "visible";
	if (force) { so.zIndex = 999; }
}

function hideElement(e,force) {
	so = styleObject(e);
	so.visibility = "hidden";
	if (force) { so.zIndex = -999; }
}

function w(t) { document.write(t); }

function changeContent(e,t) {
	if (!ns4) {
		if (e.innerHTML != t) {
			e.innerHTML = t;
		}
	}
	else if (document.layers) {
		e.document.open();
		e.document.write(t);
		e.document.close();
	}
}

// flash stuff
function flashGetMovie(movieName) {
	return (ieX ? window[movieName] : window.document[movieName]);
}
function flashIsLoaded(flashMovie) { return (typeof flashMovie == "undefined" ? false : flashMovie.PercentLoaded() == 100); }


// content scroller stuff
maxy=0;
miny=0;
contentTimer=false;
contentDirection=0;

function contentUp() {
	contentDirection = 1;
	contentTimer = setInterval("contentLogic()",50);
}

function contentDown() {
	contentDirection = -1;
	contentTimer = setInterval("contentLogic()",50);
}

function contentStop() {
	clearInterval(contentTimer);
}

function contentLogic() {
	slideContent(0,10*contentDirection);
}

function slideContent(x,y) {
	if (!loaded)
		return;

	if (ns4) {
		eContainer = getElement('contentContainer');
		e = getElement('contentText',eContainer)
	}
	else
		e = getElement('contentText');
	
	if (miny==0) {
		if (ns4) {
			miny = (e.clip.height*-1)+270;
		}
		else {
			miny = (e.offsetHeight*-1)+270;
		}
	}
			
	s = styleObject(e);
	if (!s.top)
		s.top = 0;

	//alert(parseInt(s.top) +" "+ miny +" "+ maxy);

	if (!(miny > maxy)) {
		s.top = parseInt(s.top) + y;
		if (parseInt(s.top) < miny)
			s.top = miny;
		else if (parseInt(s.top) > maxy)
			s.top = maxy;
	}
	
	//alert(parseInt(s.top) +" "+ miny +" "+ maxy);
}
