/* Content Loader (common): Standard Menu Script
Title: JavaScript Menus
File: [com]/scripts/menus.js
File Ver.:0.1
Date Created: 09-03-07
Updated: 18-Mar-2007

Description:
	Standard CL menus
*/
var IS_MOZILA;

// firstClick
var firstClick = "";

// -== Functions ==-
// event_overRootItem(obj)
// event_outRootItem(obj)
// event_overItem(obj)
// event_outItem(obj)

// -== Definitions ==-

function event_overItem(obj, style, isRoot)
{
	// save old style
	obj.o_className = obj.className;
	
	// apply new style
	obj.className = style;

	// show the floating table
	var objFloat;
	if ((objFloat = (MM_findObj(obj.id + "-float"))) != null)
	{
	    // make visible
		objFloat.style.visibility = "visible";
	}
}

function event_outItem(obj)
{
    obj.className = obj.o_className;

	// hide the floating table
	var objFloat;
	if ((objFloat = (MM_findObj(obj.id + "-float"))) != null)
	{
	    // make hidden
		objFloat.style.visibility = "hidden";
	}
}

function event_clickItem(loc_id, ref_loc, ref_sub)
{
	// first click is first!!
	if (firstClick == "")
	{
		if (ref_loc != "")
		{
			location.href = "?loc=" + loc_id + "&referrer_loc=" + ref_loc
		}
		else
		{
			location.href = "?loc=" + loc_id;
		}
		firstClick = loc_id;
	}
}

// returns a CSS "style" object's style text from a class name
function getCSS_text(className)
{
	var str = "", style_str;
	var ss_x, r_x, style_x;

	if (IS_MOZILA)
	{
		// Mozilla / Netscape
		for (ss_x in document.styleSheets)
		{
			for (r_x in document.styleSheets[ss_x].cssRules)
			{
				if (document.styleSheets[ss_x].cssRules[r_x].selectorText == className)
					return(document.styleSheets[ss_x].cssRules[r_x].style.cssText);
			}
		}
	}
	else
	{
		// MS-IE 5+
		for (ss_x in document.styleSheets)
		{
			for (r_x in document.styleSheets[ss_x].rules)
			{
				if (document.styleSheets[ss_x].rules[r_x].selectorText == className)
					return(document.styleSheets[ss_x].rules[r_x].style.cssText);
			}
		}
	}

	return(0);
}

// fondObj
function MM_findObj(n, d)
{
	var p,i, x;
	if (!d)
		d=document;
	if((p=n.indexOf("?")) > 0 && parent.frames.length)
	{
		d=parent.frames[n.substring(p+1)].document;
		n=n.substring(0,p);
	}
	if (!(x = d[n]) && d.all)
		x=d.all[n];
	if (d.forms)
	{
		for (i=0; !x && i < d.forms.length; i++)
			x = d.forms[i][n];
	}
	for (i=0; !x && d.layers && i < d.layers.length; i++)
		x=MM_findObj(n,d.layers[i].document);
	if (!x && d.getElementById)
		x = d.getElementById(n);
	return x;
}

// Get browser type.
function getBrowser()
{
	var agt=navigator.userAgent.toLowerCase();
	var nav	= ((agt.indexOf('mozilla')!=-1) && ((agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1)));
	IS_MOZILA = nav;
}

// init
getBrowser();
