
if(!window.WWWROOT) window.WWWROOT = "/";
if(!window.RESOURCES) window.RESOURCES = "/mskcc_resources/";
if(!window.DarkColor) var DarkColor = "#333333";
if(!window.MediumColor)	var MediumColor = "#999999";
if(!window.LightColor) var LightColor = "#CCCCCC";

var imageCache = new Object()
function cacheImage(ID, onSrc, offSrc){
	//alert (onSrc);
	imageCache[ID] = new Object()
	imageCache[ID].on = new Image()	
	imageCache[ID].on.src = onSrc
	imageCache[ID].off = new Image()	
	imageCache[ID].off.src = offSrc
}

// i = image
var _staging = false
function createNavigationImageCache(){
	for(var i=0;i<arguments.length;i++){
		var ID = arguments[i]
		cacheImage("i" + ID, 
			"http://www.rostlab.org/newwebsite/images/on/" + ID + ".gif", 
			"http://www.rostlab.org/newwebsite/images/off/" + ID + ".gif"
		)
	}
}

function imageOn(ID, statusMessage){
	if(!imageCache[ID]){
		if(ID.indexOf("i") == 0)
			createNavigationImageCache(ID.substring(1))
		if(ID.indexOf("u") == 0)
			createHeaderImageCache(ID.substring(1))
	}

	document.images[ID].src = imageCache[ID].on.src
	if(statusMessage) window.status = statusMessage
	return true
}

function imageOff(ID){
	document.images[ID].src = imageCache[ID].off.src
	window.status = ''
	return true
}

function getElement(id){
	
	if(document.all) return document.all[id]
	if(document.getElementById)	return document.getElementById(id)
	return null
}

function setTextColor(element, color){
	if(typeof element == "string")
		element = getElement(element)

	if(element) if(element.style) element.style.color = color
}

function setBgColor(element, color){
	if(element) if(element.style) element.style.backgroundColor = color
}

function openHref(ID){
	location = getElement("a" + ID).href
}

