var imagesArray = Array();

debug = function(msg) {
	console.log(msg);	
}

Browser = {
    IE:     !!(window.attachEvent && !window.opera),
    Opera:  !!window.opera,
    WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
    Gecko:  navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
    MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
 }

$ = function(id) {
	return document.getElementById(id);
}


var displayTextBox = null;
menuTextBox = function(displayId, anchor) {
	if (displayId != null) {
		if (displayTextBox != null) {
			$(displayTextBox).style.display = 'none';
		}
		$(displayId).style.display = 'block';
		displayTextBox = displayId;
	}
	
	if (anchor != null) {
		var anchors = $('subbox').getElementsByTagName('a');
		for (var i=0, len=anchors.length; i<len; i++) {
			anchors[i].className = '';
			if (anchors[i] == anchor) {
				anchors[i].className = 'selected';										
			}
		}
	}
}

hitFirstTextBox = function() {
	if ($('subbox') != null) {
		var anchors = $('subbox').getElementsByTagName('a');
		if (anchors.length > 0) {
			anchors[0].onclick();
		}
	}
}

title = function(container, str, bgcolor) {
	SWF.insert({
		container: container,
		src: '../flash/page_title.swf',
		name: (container + 'Object'),
		width: 296, height: 24,
		bgcolor: bgcolor || '#BDDAEA',
		parameters: { wmode: 'transparent', allowScriptAccess: 'sameDomain' },
		variables: { labelTxt: str }
	});
}

title2 = function(container, str) {
	SWF.insert({
		container: container,
		src: '../flash/menu_box_title.swf',
		name: (container + 'Object'),
		width: 230, height: 24,
		bgcolor: '#BE8142',
		parameters: { wmode: 'transparent', allowScriptAccess: 'sameDomain' },
		variables: { labelTxt: str }
	});
}

selectMenu = function() {
	var page = window.location.toString();
	page = page.substring(page.lastIndexOf("/") + 1);
	
	var anchors = $('menu-row').getElementsByTagName('a');
	for (var i=0, len=anchors.length; i<len; i++) {
		var href = anchors[i].href;
		if (page == href.substring(href.lastIndexOf("/") + 1)) {
			anchors[i].className = 'selected';										
		}
	}
}

startPageBox = function() {
	fadeIt1.start();
	fadeIt2.start();
	if (!Browser.IE) {
		$('iframeA').style.display = 'block';
	}
}

addOnLoad = function(handler) {
	if (typeof window.addEventListener != "undefined")
		window.addEventListener("load", handler, false);
	else if (typeof window.attachEvent != "undefined") {
		window.attachEvent("onload", handler);
	}
	else {
		if (window.onload != null) {
			var oldOnload = window.onload;
			window.onload = function (e) {
				oldOnload(e);
				handler();
			};
		}
		else window.onload = handler;
	}
}

loadHandler = function() {
	if (!Browser.IE) {
		$('iframeA').style.display = 'block';
	}
	selectMenu();
	hitFirstTextBox();
}
