// UA (user agen) contains detailed browser info
var UA = navigator.userAgent.toLowerCase();

// get an element with the id
function getObj(elementID) {
  if (typeof elementID == "string")
    return document.getElementById(elementID);
  else
    return elementID;
}

// Set the text color of an object
function setColor(object, color) {
  getObj(object).style.color = color;
}

// Change the cursor.
// The second argument is optional.
function setCursor(cursortype, thisobj) {
  if (UA.indexOf("msie 5")>=0 && cursortype == 'pointer')
    cursortype = 'hand';
  if (thisobj==null)
    document.body.style.cursor = cursortype;
  else
    getObj(thisObj).style.cursor = cursortype;
}

// Set the background of an object
function setBackground(object, color) {
  getObj(object).style.background = color;
}

// Set the text color of an object
function setColor(object, color) {
  getObj(object).style.color = color;
}

function setBackgroundImage(object, url) {
	getObj(object).style.backgroundImage = "url('"+url+"')";
}

function underline(object, choice) {
    if(choice)
        getObj(object).style.textDecoration = "underline";
    else
        getObj(object).style.textDecoration = "none";
}

function changeBackground(element, position, imageUrl) {
    setBackgroundImage(element, imageUrl);
    if(position == 'over') {
        underline(element, true);
        setCursor("pointer");
    } else {
        underline(element, false);
        setCursor("auto");
    }
}

function showSubmenu(id) {
    setVisibility(id, true);
    setCursor("pointer");
}

function hideSubmenu(id) {
    setVisibility(id, false);
    setCursor("auto");
}

// Setting the visibility of an object
function setVisibility(objectID, vis) {
  var object = getObj(objectID);
  if(vis == true || vis=='visible' || vis=='y')
    object.style.visibility = "visible";
  else
    object.style.visibility = "hidden";
}

function goPage(location) {
window.location.href = location;
}



