var agent=navigator.userAgent.toLowerCase();
var isIE=(agent.indexOf('msie') != -1) ? true : false;
var isDOM=(typeof(document.getElementById) != 'undefined' && !isIE) ? true : false;
var isNav4=(agent.indexOf('mozilla') != -1 && !isDOM && !isIE) ? true : false;

// returns left position
function getLeft(daObj){
	var returnVal;
	// set left if auto-calculated (left=0) or if not specified in-line/with style sheet
	if(isDOM){
		if(typeof(daObj.style.left)=='undefined' || daObj.style.left==''){
			daObj.style.left = 
				document.defaultView.getComputedStyle(daObj, '').getPropertyValue('left');
		}
		returnVal = parseInt(daObj.style.left);
	}
	else if(isNav4){ returnVal = daObj.left; } // daObj.pageY if undef
	else{ returnVal = daObj.style.pixelLeft; } // daObj.offsetLeft if undef
	return returnVal;
}

// sets left position
function setLeft(daObj, newLeft){
	if(isDOM){ daObj.style.left = newLeft + 'px'; }
	else if(isNav4){ daObj.left = newLeft; }
	else{ daObj.style.pixelLeft = newLeft; }
}

// returns top position
function getTop(daObj){
	var returnVal;
	if(isDOM){
		if(typeof(daObj.style.top)=='undefined' || daObj.style.top==''){
			daObj.style.top = 
				document.defaultView.getComputedStyle(daObj, '').getPropertyValue('top');
		}
		returnVal = parseInt(daObj.style.top);
	}
	else if(isNav4){ returnVal = daObj.top; } // daObj.pageX if undef
	else{ returnVal = daObj.style.pixelTop; } // daObj.offsetTop if undef
	return returnVal;
}

// sets top position
function setTop(daObj, newTop){
	if(isDOM){ daObj.style.top = newTop + 'px'; }
	else if(isNav4){ daObj.top = newTop; }
	else{ daObj.style.pixelTop = newTop; }
}

// gets object height
function getObjHeight(daObj){
	var returnVal;
	if(isDOM){
		if(typeof(daObj.style.height) == 'undefined' || daObj.style.height==''){
			daObj.style.height = 
				document.defaultView.getComputedStyle(daObj, '').getPropertyValue('height');
		}
		returnVal = parseInt(daObj.style.height);
	}else if(isIE){ returnVal = daObj.clientHeight; // daObj.offsetHeight if undef
	}else{ returnVal = daObj.clip.height; } // daObj.clip.height if undef
	return returnVal;
}

// gets object width
function getObjWidth(daObj){
	var returnVal;
	if(isDOM){
		if(typeof(daObj.style.width) == 'undefined' || daObj.style.width==''){
			daObj.style.width = 
				document.defaultView.getComputedStyle(daObj, '').getPropertyValue('width');
		}
		returnVal = parseInt(daObj.style.width);
	}else if(isIE){ returnVal = daObj.clientWidth; // daObj.offsetWidth if undef
	}else{ returnVal = daObj.clip.width; } // daObj.clip.width if undef
	return returnVal;
}

// return an object for a string or an object (just in case)
function getObject(daName){
	var daObj;
	if(typeof(daName) == "string"){
		if(isDOM){
			daObj = document.getElementById(daName);
		}else if(isIE){
			daObj = eval("document.all." + daName);
		}else{
			daObj = eval("document." + daName);
		}
	}else{
		daObj = daName;
	}
	return daObj;
}

// moxes an object to a new coordinate (left, top) AKA (x, y)
function moveObjTo(daObj, newLeft, newTop){
	daObject = getObject(daObj);
	setLeft(daObject, newLeft);
	setTop(daObject, newTop);
}
function moveObjBy(daObj,left,top){
	newLeft = left + getLeft(daObj);
	currentTop = getTop(daObj);
	newTop = (top + currentTop);
	//alert(newTop);
	moveObjTo(daObj,newLeft,newTop);
}
//clips an object to the new corrdinate (top,right,bottom,left)
function clipObjTo(daObj,t,r,b,l) {
	//these properties are held so that you know where you are in your clipping
	//allowing for the clipObjBy method
	daObj.clpt = t;
	daObj.clpr = r;
	daObj.clpb = b;
	daObj.clpl = l;
	daObj.style.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)";
}
function clipObjBy(daObj,t,r,b,l){
	clipObjTo(daObj,(daObj.clpt+t),(daObj.clpr+r),(daObj.clpb+b),(daObj.clpl+l));
}
// shows an object
function show(daObj){
	var Obj = getObject(daObj);
	if(isNav4){
		Obj.visibility = 'visible';
	}else{
		Obj.style.visibility = 'visible';
	}
}

// hides an object
function hide(daObj){
	var Obj = getObject(daObj);
	if(isNav4){
		Obj.visibility = 'hidden';
	}else{
		Obj.style.visibility = 'hidden';
	}
}

