// JavaScripts for soth.co.uk, by G.H. Ferrari

// Global variables
var isCSS, isW3C, isIE4, isNN4, isIE6CSS;


// initialize on load to suit scripts to different browsers
function initDHTMLAPI() {
	if(document.images){
		isCSS=(document.body && document.body.style) ? true:false;
		isW3C=(isCSS && document.getElementById) ? true:false;
		isIE4=(isCSS && document.all) ? true: false;
		isNN4=(isCSS && document.layers) ? true:false;
		isIE6CSS = (document.compatMode && document.compatMode.indexOf("CSS1") >=0) ? true:false;
	}
}
// set browser to initialize scripts on load
window.onload = initDHTMLAPI;

// general function scripts

function getObject(obj) {
	var theObj;
	if (typeof obj == "string") {
		if (isW3C) {
			theObj=document.getElementById(obj);
		} else if (isIE4) {
			theObj=document.all(obj);
		} else if (isNN4) {
			theObj=seekLayer(document, obj);
		}
	} else {
		theObj=obj;
	}
	return theObj;
}

function seekLayer(document, name) {
	var theObj;
	for (var i=0; i<doc.layers.length; i++) {
		if (doc.layers[i].name == name) {
			theObj=doc.layers[i];
			break;
		}
		if (doc.layers[i].document.layers.length>0) {
			theObj=seekLayer(document.layers[i].document, name);
		}
	}
	return theObj;
}

		
// Navigation menu scripts

function changeMenuState(elemID) {
	var element =getObject(elemID);
	if(element && element.className) {
		element.className = (element.className =="contents_normal") ? "contents_over": "contents_normal";
	} else if (element.style && element.style.bgColor) {
		alert("Element has bgColor");
		element.style.bgColor=(getBGColor(element)=="rgb(0, 51, 255)") ? "rgb(0,0,153)": "rgb(0,51,255)";
	}
		}


function setSubMenu(submenu_suffix){
	var submenu="topmenu_"+submenu_suffix+".html";
	parent.submenu.location=submenu;
}

function setTalkSelections(isAll, isChecked) {
// script to incorpate "Select All" feature in online registration form
	var theChkBox;
	theChkBox=getObject("chkTalkAll");
	if(isAll && isChecked) {
		for(var i=1; i<7; i++) {
			theChkBox=getObject("chkTalk" + i);
			theChkBox.checked=true;
		}
	}
	if(!isAll && !isChecked){ 
		theChkBox=getObject("chkTalkAll");
		theChkBox.checked=false;
	}
		
}