/**
 * Cross-browser code modifed from:
 * Visual Quicstart Guide: DHTML for the World Wide Web
 * by Jason Cranford Teague
 * Peachpit Press
 * copyright 1998
 *
 * Webmaster:  C.K. Bales
 *
 * Code for centerIt and it's supporting fuctions were modified from:
 *
 * Dynamic HTML: The Definitive Reference
 * by Danny Goodman
 * O'Reilly
 * copyright 1998
 */

//declaring variables
var dom;
var isNS6 = 0,
	isIE4 = 0,
	isOpera = 0,
	isSupported = 0;
	
//Determines the browser name and browser version
var brow = ((navigator.appName) + (parseInt(navigator.appVersion)));

//Reassign variable depending on the browser
if (brow == "Netscape5") {
	isNS6 = 1;
	isSupported = 1;
} else if (brow == "Microsoft Internet Explorer4") {
	isIE4 = 1;
	isSupported = 1;
} else if (navigator.appName == 'Opera') {
	isOpera = 1;
	isSupported = 1;
} //end if

//Setup genereic dom
if (isIE4 || isOpera) {
	docObj = "document.all";
	styleObj = ".style";
} else if (isNS6) {
	docObj = "document.getElementById";
	styleObj = ".style";
} //end if

//start getObjHeight function
function getObjHeight(obj) {
	if (isNS6) {
		return obj.clip.height;
	} else {
		return obj.clientHeight;
	} //end if
} //end getObjHeight function

//start getObjWidth function
function getObjWidth(obj) {
	if (isNS6) {
		return obj.offsetWidth;
	} else {
		return obj.clientWidth;
	} //end if
} //end getObjWidth function

//start getInsideWindowWidth function
function getInsideWindowWidth() {
	if (isNS6) {
		return window.innerWidth;
	} else {
		return document.body.clientWidth;
	} //end if
} //end getInsideWindowWidth function

//start getParentWindowWidth function
function getParentWindowWidth() {
	if (isNS6) {
		return parent.window.innerWidth;
	} else {
		return parent.document.body.clientWidth;
	} //end if
} //end getParentWindowWidth function

//start getInsideWindowHeight function
function getInsideWindowHeight() {
	if (isNS6) {
		return window.innerHeight;
	} else {
		return document.body.clientHeight;
	} //end if
} //end getInsideWindowHeight function

//start shiftTo function
function shiftTo(obj, x, y) {
	if (isNS6) {
		obj.moveTo(x,y);
	} else {
		obj.pixelLeft = x;
		obj.PixelTop = y;
	} //end if
} //end shiftTo function

//start centerIt function
function centerIt() {
	//obj is the positional object
	var obj = eval(dom + "intro" + styleObj);
	//contentObj is the element content, necessary for IE4 to return the true current width
	var contentObj = eval(dom + "banner");
	var x = Math.round((getInsideWindowWidth()/2)-(getObjWidth(contentObj)/2));
	var y = Math.round((getInsideWindowWidth()/2)-(getObjWidth(contentObj)/2));
	shiftTo(obj, x, y);
	obj.visibility = "visible";
} //end centerIt function

//special handling for CSS=P redraw bug in NS 4
//start handleResize function
function handleResize() {
	if (isNS4) {
		//causes extra re-draw, but must do it to get banner object color drawn
		location.reload();
	} else {
		//centerIt();
		var sText=eval(dom + "scroll" + styleObj),
			pTop=eval(dom + "scroller" + top),
			pLeft=eval(dom + "scroller" + left);
			alert("top:" + pTop + " left: " + pLeft);
		shiftTo(sText, pTop, pLeft);
	} //end if
} //end handleResize function