// ----- DETECT STANDARDS-COMPLIANT BROWSERS -----
var W3CDOM = (document.createElement && document.getElementsByTagName);
// IDENTIFY BROWSER, VERSION AND OS
// FROM: http://www.quirksmode.org/js/detect.html
// I don't like browser detection, but some browsers cannot be reliably excluded by object detection, and need to be (eg - Mac IE)
// this script may look like overkill, but is quite ingenious (see url above) and reliable
var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;
if (checkIt('konqueror')) {
	browser = "Konqueror";
	OS = "Linux";
} 
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) browser = "Internet Explorer"
else if (!checkIt('compatible')) {
	browser = "Netscape Navigator"
	version = detect.charAt(8);
} 
else browser = "An unknown browser";
if (!version) version = detect.charAt(place + thestring.length);
if (!OS) {
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac"
	else if (checkIt('win')) OS = "Windows"
	else OS = "an unknown operating system";
}
function checkIt(string) {
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}
// prevent Mac IE from running scripts
if((browser == 'Internet Explorer') && (OS == 'Mac'))  W3CDOM = false;

// ----- END DETECT STANDARDS-COMPLIANT BROWSERS -----



// ----- GET ELEMENTS BY CLASS NAME -----
// FROM: http://www.dynamicdrive.com/dynamicindex17/switchcontent_dev.htm
function getElementsByClassName(classname) {
	ccollect=new Array();
	var inc=0;
	var alltags=document.all? document.all : document.getElementsByTagName("*");
	for (i=0; i<alltags.length; i++){
		//if (alltags[i].className==classname) ccollect[inc++]=alltags[i];		// this only handles single classes, not space-seperated
		if (alltags[i].className.indexOf(classname) > -1) ccollect[inc++]=alltags[i];	// but this works - miks
	}
	return ccollect;
}

// ADD ONLOAD HANDERS - allows attachment of multiple function calls to window.onload
// FROM: http://www.tek-tips.com/gfaqs.cfm/pid/216/fid/4862 "Code courtesy of jemminger"
// USEAGE:
//	- window.addOnload( foo );
//	- window.addOnload( function() { foo(arg); } );
//	- window.addOnload( function() { bar(a, b, c); } );
window.addOnload = function (fn) {
    if (!window.OnloadCache) window.OnloadCache = [];
    var ol = window.OnloadCache;
    //ol.push(fn);			// push method not supported in IE5...
    ol[ol.length] = fn;		// but this works fine - miks
}
window.onload = function () {
    var ol = window.OnloadCache;
    if (ol)
        for (var x = 0; x < ol.length; x++)
            ol[x]();
}