
function doEnterKey(objectId) {

    var eventObj = window.event || e;
    if ((eventObj.which && eventObj.which == 13) || (eventObj.keyCode && eventObj.keyCode == 13))
	{
	    eventObj.returnValue = false;
	    eventObj.cancel = true;
		var anObject = jQuery('#' + objectId);
		if (anObject){
			anObject.click();
			return true;
		}
		else
		{
			return false;
		}
	}
	else
	{
		return true;
	}
}

function getStyleObject(objectId) {
	// checkW3C DOM, then MSIE 4, then NN 4
	if(document.getElementById && document.getElementById(objectId)) {
	return document.getElementById(objectId).style;
	}
	else if (document.all && document.all[objectId]) {  
	return document.all[objectId].style;
	} 
	else if (document.layers && eval('document.'+objectId)) { 
	return eval('document.'+objectId);
	} else {
	return false;
	}
}

function getObject(objectId) {
	// checkW3C DOM, then MSIE 4, then NN 4
	if(document.getElementById && document.getElementById(objectId)) {
	return document.getElementById(objectId);
	}
	else if (document.all && document.all[objectId]) {  
	return document.all[objectId];
	} 
	else if (document.layers && eval('document.'+objectId)) { 
	return eval('document.'+objectId);
	} else {
	return false;
	}
}

function changeObjectVisibility(objectId) {
	// first get the object
	var styleObject = getStyleObject(objectId);

	// then if we find the object, set its display
	if (styleObject) {
		if (styleObject.display == "none")
			styleObject.display = "block";
		else
			styleObject.display = "none";
		return true;
	} 
	else {
		return false;
	}
}

function changeObjectVisibility2(objectId, mode) {
	// first get the object
	var styleObject = getStyleObject(objectId);

	// then if we find the object, set its display
	if (styleObject) {
		styleObject.display = mode;
		return true;
	} 
	else {
		return false;
	}
}

function focusIt(objectId) {
	var anObject = jQuery('#' + objectId);
	
	if (anObject)
	{
		anObject.focus();
		return true;
	}
}

function focusIt(objectId, divID) {
	var anObject = jQuery('#' + objectId);
	var styleObject = getStyleObject(divID);
	
	if ((anObject) && (styleObject.display != "none"))
	{
		anObject.focus();
		return true;
	}
}

function anchorTime(objectId){
	window.location = objectId;
	return true;
}

function changeGridLine(objectId, lineStyle){
	var anObject = jQuery('#' + objectId);
	if (anObject){
		if (anObject.className == lineStyle)
		{
			//gridLine2 is white so no gridlines
			anObject.className = 'gridLine2';
		}
		else
		{
			anObject.className = lineStyle;
		}
		return true;
	}
}

function changeStyleClass(objectId, newStyle){
    var anObject = jQuery('#' + objectId);
	if (anObject){
		anObject.className = newStyle;
		return true;
	}
}

function userConfirmation(sMessage){
	if (window.confirm(sMessage))
	{
		return true;
	}
	else
	{
		return false;
	}	
}

function resizeMenuFrame(FrameSetName,ColSizesA,ColSizesB){
	var _frame = getObject(FrameSetName);
	if (_frame)
	{
		if (ColSizesA != _frame.cols)
			_frame.cols = ColSizesA;
		else
			_frame.cols = ColSizesB;
	}
}

// Window PopUp
// all parameters after height are yes/no values
function cmsPopUp(url, title, width, height, scroll, menubar, resizeable, toolbar, location, status) {
	var winl = (screen.width - width) / 2;
	var wint = (screen.height - height) / 2;
	var winproperties = 'scrollbars='+scroll+',menubar='+menubar+',height='+height+',width='+width+',resizable='+resizeable+',toolbar='+toolbar+',location='+location+',status='+status+',top='+wint+',left='+winl;
	var win = window.open(url,title,winproperties);
	
	if (parseInt(navigator.appVersion) >= 4) { 
		win.window.focus();
	}
	 
	if (win.opener == null) win.opener = self;
}

//clear text
function clearText(obj)
{
	if (obj.value == "item# or keyword")
	{
		obj.value = "";
	}
}
