// JavaScript Document
// VARIABLES
var elms = new Array();
var openMenu=null;
var timerRunning=false;
var timerId=null;
////////////////////////////////////////
// swap an element's src
// BEWARE: no error checking
////////////////////////////////////////
function swapImage(imgToSwap, newSrc)
{
	document[imgToSwap].src=newSrc;
}
////////////////////////////////////////
// elements are defaulted as being invisible, and are initially toggled to visible.
////////////////////////////////////////
function toggleElementDisplay(elname)
{
	if (elms[elname]=="block")
	{
		elms[elname]="none";
	}else{
		elms[elname]="block";
	}
	setElementStyle(elname, "display", elms[elname]);
}

////////////////////////////////////////
// set any style property of any element
////////////////////////////////////////
function setElementStyle(elname, styleName, val)
{

	var theel = document.getElementById( elname );
	theel.style[styleName] = val;
}

////////////////////////////////////////
//
////////////////////////////////////////
/*
function externallinks()
{
    var c=document.getElementById('mainContent');
    if(c)
    {
        var ls=c.getElementsByTagName('a');
        for(var i=0;i<ls.length;i++){
            if(ls[i].getAttribute('rel')=='external')
            {
                ls[i].className+=ls[i].className?' extlink':'extlink';
                ls[i].title+='(Opens in new window)';
                ls[i].onclick=function()
				{
					window.open(this.href);
					return false
				}
            }
        }
    }
}*/
////////////////////////////////////////
//
////////////////////////////////////////
function openURLinWindow(url)
{
	window.open(url);
}
/************************************************************* HOVER MENU */
////////////////////////////////////////
// 
////////////////////////////////////////
function jyd_openMenu(menuId)
{	
	if (openMenu != null)
		jyd_closeMenuNow();
	
	openMenu = menuId; // store open menu id
	setElementStyle(menuId, "display", "block"); //make menu visible
	// kill any timers that are present.
}
////////////////////////////////////////
// 
////////////////////////////////////////
function jyd_closeMenuNow()
{
	setElementStyle(openMenu, "display", "none"); //make menu invisible
}
////////////////////////////////////////
// 
////////////////////////////////////////
function jyd_closeMenu()
{
	jyd_closeMenuNow(); // this is a hack cause i dont know timers
	// setup timer to close menu in halfsecond.
}
/************************************************************* SUB MENU */
function openSubMenu(menu)
{
	if (menu=="music.php")
	{
		setElementStyle("subMenu_About", "display", "none");
		setElementStyle("subMenu_Music", "display", "block");
	}else if (menu=="about.php"){
		setElementStyle("subMenu_About", "display", "block");
		setElementStyle("subMenu_Music", "display", "none");
	}else{
		//setElementStyle("subMenu_About", "display", "none");
		//setElementStyle("subMenu_Music", "display", "none");
		window.open(menu);
		return;
	}
	
	timerRunning = true;
    timerID = self.setTimeout("closeSubMenu()", 5000);
}
/////////////////////////////////////////////////
//
////////////////////////////////////////////
function closeSubMenu()
{
	setElementStyle("subMenu_About", "display", "none");
	setElementStyle("subMenu_Music", "display", "none");
	
	if (timerId)
	{
		clearTimeout(timerId);
		timerId=null;
		timerRunning=false;
	}
}























