/**
* home.js
* This file is used to load the javascript content for homepage
* @Author: Andrew Chan
* Created @ 2008-08-02
*/

window.url_location = "/boi/home";
window.animation = 0;

function switchPanel(status)
{
	if(status == 'open') {
		$("#expand_panel").slideToggle();
		$("#panelSwitcher").hide();
		}
	else if(status == 'close') {
		$("#expand_panel").slideUp();
		$("#panelSwitcher").show();
	}
}
	
function reloadPage()
{
	window.location.href = window.url_location;
	}	
	
function clickDetector(evt)
{	
	clearTimeout(window.ttt);
	evt=evt?evt:window.event;
	var srcElem=(evt.target)?evt.target:evt.srcElement;
	while(srcElem.tagName.toUpperCase()=="A" && srcElem.parentNode.tagName.toUpperCase()=="LI")
	{
		//exchange the srcElement's href
		if(srcElem.getAttribute("lang")!=null) src_href = srcElem.getAttribute("lang");
		else{
			src_href = srcElem.href;
			srcElem.setAttribute("lang",src_href);
			srcElem.lang = src_href;
			srcElem.href="#";
		}
		if(srcElem.parentNode.getAttribute("lang")!=null && srcElem.parentNode.className!="firstMenu")
		{
				//window.url_location = src_href;
				//window.ttt = setTimeout(imageFadeOut,"3000");
				imageFadeOut();
				window.url_location = src_href;
			}
		else if(srcElem.parentNode.className!="firstMenu"){
			imageFadeOut();
			window.url_location = src_href;
				}		
		break;
		}
		
	}
	

//if(document.attachEvent) document.attachEvent("onclick", clickDetector);
//Else document.addEventListener("click", clickDetector, false);