//razor javascript library
//identify browser and version

var useID = 0, useLayers = 0, useAll = 0, N6 = 0, MSIE = 0;

if (document.getElementById){
	useID = 1;
	}
if (document.layers){
	useLayers = 1;
	}
if (document.all){
	useAll = 1;
	}
	
var MSIE = (useID && useAll);
var N6 = (useID && (!useAll));

function getObj(obj)
{
	//tool for proper cross platform DOM formating
	var myObj;
	if (useID){
		myObj = window.document.getElementById(obj).style;
		}
	else if (useAll){
		myObj = window.document.all[obj].style;
		}
	else if (useLayers){
		myObj = window.document.layers[obj];
		}
	return myObj;
}

function getObjCore(obj)
{
	//same as getObj() but with access to core object
	var myObj;
	if (useID){
		myObj = window.document.getElementById(obj);
		}
	else if (useAll){
		myObj = window.document.all[obj];
		}
	else if (useLayers){
		myObj = window.document.layers[obj];
		}
	return myObj;
}
	

function changeVis(obj, the_change)
{
	//change visibility based on value of the_change
	var myObj = getObj(obj);
	myObj.visibility = the_change;
}

function moveObj(obj, x, y)
{
	//move object to specific x, y based window origin coordinates
	var myObj = getObj(obj);
	
	if (document.moveTo){
		myObj.moveTo(x,y);
		}
	else {
		myObj.left = x;
		myObj.top = y;
		}
}

function nudgeObj(obj, x, y)
{
	//move object to specific x, y coordinates based on current location
	var myObj = getObj(obj);
	
	if (myObj.moveBy){
		myObj.moveBy(x,y);
		}
	else if (MSIE){
		myObj.pixelLeft += x;
		myObj.pixelTop += y;
		}
	else {
		myObj.left = parseInt(myObj.left) + x;
		myObj.top = parseInt(myObj.top) + y;
		}
}

function getX(obj)
{
	//get the x location of the upper left corner of current object
	var myObj = getObj(obj);
	
	if (MSIE){
		x = myObj.pixelLeft;
		}
	else {
		x = myObj.left;
		}
	return(parseInt(x));
}

function getY(obj)
{
	//get the y location of the upper left corner of current object
	var myObj = getObj(obj);
	
	if (MSIE){
		y = myObj.pixelTop;
		}
	else {
		y = myObj.top;
		}
	return(parseInt(y));
}

function closeMenus(objarray)
{
	//closes called visible dropdown menus
	for (var loop=0; loop < objarray.length; loop++)
		{
			changeVis(objarray[loop], "hidden");
		}
}
		

//alert("newrazorlib is loaded");
