
function isChildNode(elt, parentid)
{
	var o = elt;
	
	if (o == null) return(false);

	// Go through all parents until you hit the "body" element or there's an ID match.
	while (o.id != parentid && o.nodeName != 'BODY')	
		o = o.parentNode					

	if (!o.id) return(false);
	if (o.id == parentid) return(true);
	
	return(false);	
}

function GetTarget()
{
	if (!e) var e = window.event;		
	var target = (e.relatedTarget) ? e.relatedTarget : e.toElement;			
	return(target);
}

function HideMenu(e) 
{								
    var target = GetTarget();	
	var child = isChildNode(target, 'menu');				
	if (child) return;		
		
	// Hide the menu.	
	var obj = GetMenuObject(e);
	obj.style.visibility = 'hidden';											
}

function HideThemeMenu(e) 
{								
	var target = GetTarget();	
	var child = isChildNode(target, 'menu-theme');			
	
	if (child) return;		
		
	// Hide the menu.	
	var obj = GetThemeMenuObject();
	obj.style.visibility = 'hidden';											
}

function GetMenuObject(h)
{
	var obj = document.getElementById(h);																							
	return(obj);
}

function GetThemeMenuObject()
{
	var obj = document.getElementById("menu-theme");
	return(obj);
}

function GetThemeMenuFrameObject()
{
	var obj = document.getElementById("menu-theme-frame");
	return(obj);
}

function CloseOpenMainMenu()
{			
	var obj = GetMenuObject();	
	if (obj == null) return;
	
	obj.style.visibility = 'hidden';		
}

function CloseOpenThemeMenu()
{			
	var obj = GetThemeMenuObject();	
	if (obj == null) return;
	
	obj.style.visibility = 'hidden';
	
	var oFrame = GetThemeMenuFrameObject();		
	if (oFrame == null) return;				
	
	oFrame.visibility = 'hidden';
}



function ToggleVisibility(obj)
{
	if (obj.style.visibility == 'visible')
		obj.style.visibility = 'hidden';
	else	
		obj.style.visibility = 'visible';
}

function ShowThemeMenu()
{		
	var obj = GetThemeMenuObject();
		
	ToggleVisibility(obj);		
						
	var oFrame = GetThemeMenuFrameObject();			
	
	if (oFrame == null) return;
	
	oFrame.visibility = obj.visibility;				
}

function StartPage()
{		
	var menu = GetMenuObject();		
	document.body.onclick = CloseAllMenus;			    	
}

function ThemeStartPage()
{    
    StartPage();
    var menu = GetThemeMenuObject();	
    document.body.onclick = CloseAllMenus;
}

function CloseAllMenus()
{        
    return;
    
    var target = GetTarget();        

    CloseOpenThemeMenu();            
    
    var menu = GetMenuObject();    
    HideMenu(menu);    
}


function dakai(k)
{
	var obj = GetMenuObject(k);
	obj.style.visibility = 'visible';	
}


function close(k)
{
	var obj = GetMenuObject(k);
	obj.style.visibility = 'hidden';
}

function ShowMenu(k)
{	
 closeall();
 dakai(k);
		
}

function closeall() 
{
var haystack=new Array("menu","menu-research","menu-achiwment","menu-selution")//  
for(var i in haystack) 

if($(haystack[i]))
{    
close(haystack[i])
}

}


var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;
offsetX = 0;
offsetY = 12;
var toolTipSTYLE="";
function initToolTips() {
if(ns4||ns6||ie4) {
if(ns4) toolTipSTYLE = document.toolTipLayer;
else if(ns6) toolTipSTYLE = document.getElementById("toolTipLayer").style;
else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style;
if(ns4) document.captureEvents(Event.MOUSEMOVE);
else {
toolTipSTYLE.visibility = "visible";
toolTipSTYLE.display = "none";
}
document.onmousemove = moveToMouseLoc;
}
}
function toolTip(msg, fg, bg) {
if(toolTip.arguments.length < 1) {// hide 
if(ns4) toolTipSTYLE.visibility = "hidden";
else toolTipSTYLE.display = "none";
}
else {// show
if(!fg) fg = "#336699";
if(!bg) bg = "#E1EFFA";
var content =
'<table border="0" cellspacing="0" cellpadding="1" bgcolor="' + fg + '"><td style="padding: 1px">' +
'<table border="0" cellspacing="0" cellpadding="1" bgcolor="' + bg + 
'"><td align="center" style="padding: 2px; color: ' + fg +
';">&nbsp\;' + msg +
'&nbsp\;</td></table></td></table>';
if(ns4) {
toolTipSTYLE.document.write(content);
toolTipSTYLE.document.close();
toolTipSTYLE.visibility = "visible";
}
if(ns6) {
document.getElementById("toolTipLayer").innerHTML = content;
toolTipSTYLE.display='block'
}
if(ie4) {
document.all("toolTipLayer").innerHTML=content;
toolTipSTYLE.display='block'
}
}
}
function moveToMouseLoc(e) {
if(ns4||ns6) {
x = e.pageX;
y = e.pageY;
}
else {
x = event.x + document.body.scrollLeft;
y = event.y + document.body.scrollTop;
}
toolTipSTYLE.left = x + offsetX;
toolTipSTYLE.top = y + offsetY;
return true;
}
