//Logic determines version and brand of browser

var isNav, isIE
var coll = ""
var styleObj = ""
if (parseInt(navigator.appVersion) >=4) {
	if (navigator.appName=="Netscape"){
		isNav = true
	}	
	else {
		isIE = true
		coll = "all."
		styleObj = ".style"
	}
}

//Method returns refference to an image by name
function getImage(img) {
	var theImg
	theImg = document.images.item(img);
	return theImg
}

//Method takes positionable element and returns refference to it
function getObject(obj) {
	var theObj
	if (typeof obj == "string") 
		{theObj = eval("document." + coll + obj + styleObj)}
	else
		{theObj = obj}
	return theObj
}

//Property returns rendered hight of object in pixels
function getObjHeight(obj) {
	if (isNav) 
		{return obj.clip.height}
	else 
		{return obj.clientHeight}
}

//Property returns rendered width of an object in pixels
function getObjWidth(obj) {
	if (isNav) 
		{return obj.clip.width}
	else 
		{return obj.clientWidth}
}

//Property returns the available content width space in browser window
function getInsideWindowWidth() {
	if (isNav)
		{return window.innerWidth}
	else
		{return document.body.clientWidth}
}

//Property returns the available content width space in browser window
function getWindowWidth(obj) {
var win = obj;
	if (isNav)
		{return win.innerWidth}
	else
		{return win.document.body.clientWidth}
}

//Property returns the available content hight space in browser window
function getInsideWindowHeight() {
	if (isNav)
		{return window.innerHeight}
	else
		{return document.body.clientHeight}
}

//Property returns the available content hight space in browser window
function getWindowHeight(obj) {
var win = obj;
	if (isNav)
		{return win.innerHeight}
	else
		{return win.document.body.clientHeight}
}


//Method positions element at specific x,y location
function shiftTo(obj, x, y) {
	if (isNav) 
		{obj.moveTo(x,y)}
	else
		{obj.pixelLeft = x
		 obj.pixelTop = y}
}

//Method moves element by x and/or y
function shiftBy(obj, deltaX, deltaY) {
	if (isNav)
		{obj.moveBy(deltaX, deltaY)}
	else
		{obj.pixelLeft += deltaX
		 obj.pixelTop += deltaY}
}

//Method sets visibility property to true
function show(obj) {
var theObj = getObject(obj)
	theObj.visibility = "visible"
}

//Method sets visibility property to false
function hide(obj) {
var theObj = getObject(obj)
	theObj.visibility = "hidden"
}

//Method sets Z-INDEX of an element
function setZIndex(obj, zOrder) {
	var theObj = getObject(obj)
	theObj.zIndex = zOrder
}

//Method sets background color
function setBGColor(obj, color) {
	var theObj = getObject(obj)
	if (isNav)
		{theObj.bgColor = color}
	else
		{theObj.backgroundColor = color}
}

//Mathod sets status bar message
function setMsg(msg) {
	window.status = msg
	return true
}

//Centers Window
function centerWindow(obj) {
	var sWidth = parseInt(window.screen.availWidth);
	var sHeight = parseInt(window.screen.availHeight);
	if(obj != null && !obj.closed) {
		var oWidth = parseInt(getWindowWidth(obj));
		var oHeight = parseInt(getWindowHeight(obj));
			obj.moveTo(Math.round((sWidth / 2) - (oWidth / 2)), Math.round((sHeight / 2) - (oHeight / 2)));	
	}
}



function printit(){
    if (window.print) {
        window.print() ;
    } else {
        var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
        document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
        WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";
    }
}

function version() {
	var vers = "";
	var agent = new String(navigator.userAgent);
	var pos, len;
	if(isNav) {
		pos = parseInt(agent.indexOf("Netscape6"));
		len = 10; // Netscape6 + "/"
		if(pos != -1) {
			vers = parseFloat(agent.substr(pos + len, 4));
		}	
	} else {
		pos = parseInt(agent.indexOf("MSIE"));
		len = 5; // MSIE + " "
		if(pos != -1) {
			vers = parseFloat(agent.substr(pos + len, 3));
		}
	}
    return vers;
}
