//Define global variables
var timerID = null;
var timerOn = false;
var timecount = 1000;
// Change this to the time delay that you desire
var what = null;
var newbrowser = true;
var check = false;
var remix;

function highlightOn(p) {
	hideAll();
	p.style.backgroundImage = 'url(/images/menu_left_on.jpg)';
	p.firstChild.style.backgroundImage = 'url(/images/menu_right_on.jpg)';
}
function highlightOff(p) {
	p.style.backgroundImage = 'url(/images/menu_left_off.jpg)';
	p.firstChild.style.backgroundImage = 'url(/images/menu_right_off.jpg)';
}

function init() {
	if(document.getElementById) {
		layerRef="document.getElementByID";
		what="dom1";
	}
	else if (document.layers) {
		layerRef="document.layers";
		what ="ns4";
	}
	else if(document.all) {
		layerRef="document.all";
		styleSwitch=".style";
		what ="ie4";
	}
	else {
		what="none";
		newbrowser = false;
	}
	check = true;
}

// Toggles the layer visibility on
function showLayer(layerName,titleName) {
	if(check) {
		if (what =="none") {
			return;
		}
		else if (what == "dom1") {
			document.getElementById(layerName).style.display="block";
		}
		else {
			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.display="block"');
		}
	}
	else {
		return;
	}
}

// Toggles the layer visibility off
function hideLayer(layerName) {
	if(check) {
		if (what =="none") {
			return;
		}
		else if (what == "dom1") {
			document.getElementById(layerName).style.display="none";
		}
		else {
			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.display="none"');
		}
	}
	else {
		return;
	}
}

function hideAll() {
	hideLayer('sub_about_us');
	hideLayer('sub_programs');
	hideLayer('sub_contact_us');
	hideLayer('women_in_prayer');
	resetLayer();
}


function resetLayer() {
	if(check) {
		if (what =="none") {
			return;
		}
		else  {
			//document.getElementById('sub_menu_off').style.display="none";
			//document.getElementById('sub_menu_off').style.display="block";
		}
	}
	else {
		return;
	}
}

function startTime() {
	if (timerOn == false) {
		timerID=setTimeout( "hideAll()" , timecount);  timerOn = true;
	}
}

function stopTime() {
	if (timerOn) {
		clearTimeout(timerID);
		timerID = null;
		timerOn = false;
	}
}