//<![CDATA[

/////////////////////////////////////////////////////////////////
// JS Object: IE_computedStyle
// Returns the computed style, expressed in pixels or as auto, for the given element
//
// Usage:
// IE_computedStyle.get(elementNode, CSS-Style);
//
// Examples:
// IE_computedStyle.get(el, "width");
// IE_computedStyle.get(el, "margin-top");
/////////////////////////////////////////////////////////////////
var IE_computedStyle = function() {
	var isIE = /*@cc_on true || @*/false;
	var borderRegex = /thin|medium|thick/i; // regex for css border width keywords
	var styleEl;

	// GET POS /////////////////////////////////////////////////////////////////
	var getPos = function(which) {
		if(/auto/i.test(styleEl.currentStyle[which])) {
			return "auto";
		} else {
			return grabLength(styleEl.currentStyle[which]) + "px";
		}
	}

	// GET MARGIN /////////////////////////////////////////////////////////////////
	var getMargin = function(which) {
		if(/auto/i.test(styleEl.currentStyle["margin" + which])) {
			return "0px";
		} else {
			return grabLength(styleEl.currentStyle["margin" + which]) + "px";
		}
	}

	// GET BORDER WIDTH /////////////////////////////////////////////////////////////////
	var getBorderWidth = function(which) {
		var borderWidth = styleEl.currentStyle["border" + which + "Width"];
		if(styleEl.currentStyle["border" + which + "Style"] != "none" &&
		((/Top|Bottom/i.test(which) && styleEl.offsetHeight > styleEl.clientHeight) ||
		(/Right|Left/i.test(which) && styleEl.offsetWidth > styleEl.clientWidth))) {
			if(!borderRegex.test(borderWidth)) {
				return grabLength(borderWidth) + "px";
			} else if(borderRegex.test(borderWidth)) {
				var temp = document.createElement("DIV");
				temp.style.width = "10px";
				temp.style.border = borderWidth + " " + styleEl.currentStyle["border" + which + "Style"] + " #000000";
				styleEl.parentNode.appendChild(temp);
				borderWidth = Math.round((temp.offsetWidth-10)/2);
				styleEl.parentNode.removeChild(temp);
				return borderWidth + "px";
			}
		} else {
			return "0px";
		}
	}

	// GET PADDING /////////////////////////////////////////////////////////////////
	var getPadding = function(which) {
		return grabLength(styleEl.currentStyle["padding" + which]) + "px";
	}

	// GET WIDTH /////////////////////////////////////////////////////////////////
	var getWidth = function() {
		var width = styleEl.offsetWidth; // currently the width including padding + border
		width -= parseInt(getPadding("Right"));
		width -= parseInt(getPadding("Left"));
		width -= parseInt(getBorderWidth("Right"));
		width -= parseInt(getBorderWidth("Left"));
		return width + "px";
	}

	// GET HEIGHT /////////////////////////////////////////////////////////////////
	var getHeight = function() {
		var height = styleEl.offsetHeight; // currently the height including padding + border
		height -= parseInt(getPadding("Top"));
		height -= parseInt(getPadding("Bottom"));
		height -= parseInt(getBorderWidth("Top"));
		height -= parseInt(getBorderWidth("Bottom"));
		return height + "px";
	}

	// GRAB LENGTH /////////////////////////////////////////////////////////////////
	var grabLength = function(length) {
		var temp = document.createElement("DIV");
		temp.style.width = length;
		styleEl.parentNode.appendChild(temp);
		length = Math.round(temp.offsetWidth);
		styleEl.parentNode.removeChild(temp);
		return length;
	}

	return {
		// GET /////////////////////////////////////////////////////////////////
		get : function(el, styleProp) {
			var rValue;
			styleEl = (typeof(el) == "string") ? document.getElementById(el) : el;
			var styleProp = (typeof(styleProp) == "string") ? styleProp.toLowerCase() : "";
			styleProp = styleProp.replace(/\-/g, "");

			if(!isIE || !/block/i.test(styleEl.currentStyle["display"]))
			return;

			switch(styleProp) { // run through the valid css properties, return undefined if none match
				case "top": rValue = getPos("top"); break;
				case "right": rValue = getPos("right"); break;
				case "bottom": rValue = getPos("bottom"); break;
				case "left": rValue = getPos("left"); break;
				case "margintop": rValue = getMargin("Top"); break;
				case "marginright": rValue = getMargin("Right"); break;
				case "marginbottom": rValue = getMargin("Bottom"); break;
				case "marginleft": rValue = getMargin("Left"); break;
				case "bordertopwidth": rValue = getBorderWidth("Top"); break;
				case "borderrightwidth": rValue = getBorderWidth("Right"); break;
				case "borderbottomwidth": rValue = getBorderWidth("Bottom"); break;
				case "borderleftwidth": rValue = getBorderWidth("Left"); break;
				case "paddingtop": rValue = getPadding("Top"); break;
				case "paddingright": rValue = getPadding("Right"); break;
				case "paddingbottom": rValue = getPadding("Bottom"); break;
				case "paddingleft": rValue = getPadding("Left"); break;
				case "width": rValue = getWidth(); break;
				case "height": rValue = getHeight(); break;
			}

			return rValue;
		}
	}
}();

//]]>


function getStyle(oElm, strCssRule){
	var strValue = "";
	if(document.defaultView && document.defaultView.getComputedStyle){
		strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
	}
	else if(oElm.currentStyle){
		strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
			return p1.toUpperCase();
		});
		strValue = oElm.currentStyle[strCssRule];
	}
	return strValue;
}


function getElementWidth(elem) {
	function _Convert(val) {
		if (!val) {return;}
		val = val.replace("px","");
		if (isNaN(val)) {return 0;}
		return parseInt(val);
	}
	var currentStyle;
	if (elem.currentStyle) { currentStyle = elem.currentStyle; }
	else if (window.getComputedStyle) {	currentStyle = document.defaultView.getComputedStyle(elem, null); }
	else { currentStyle = elem.style; }
	return (elem.offsetWidth -
	_Convert(currentStyle.marginLeft) -
	_Convert(currentStyle.marginRight) -
	_Convert(currentStyle.borderLeftWidth) -
	_Convert(currentStyle.borderRightWidth))
}


// Browser Detection Javascript
// copyright 1 February 2003, by Stephen Chapman, Felgall Pty Ltd

// You have permission to copy and use this javascript provided that
// the content of the script is not changed in any way.

function whichBrs() {
	var agt=navigator.userAgent.toLowerCase();
	if (agt.indexOf("opera") != -1) return 'Opera';
	if (agt.indexOf("staroffice") != -1) return 'Star Office';
	if (agt.indexOf("webtv") != -1) return 'WebTV';
	if (agt.indexOf("beonex") != -1) return 'Beonex';
	if (agt.indexOf("chimera") != -1) return 'Chimera';
	if (agt.indexOf("netpositive") != -1) return 'NetPositive';
	if (agt.indexOf("phoenix") != -1) return 'Phoenix';
	if (agt.indexOf("firefox") != -1) return 'Firefox';
	if (agt.indexOf("safari") != -1) return 'Safari';
	if (agt.indexOf("skipstone") != -1) return 'SkipStone';
	if (agt.indexOf("msie") != -1) return 'Internet Explorer';
	if (agt.indexOf("netscape") != -1) return 'Netscape';
	if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
	if (agt.indexOf('\/') != -1) {
		if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') {
			return navigator.userAgent.substr(0,agt.indexOf('\/'));}
			else return 'Netscape';} else if (agt.indexOf(' ') != -1)
			return navigator.userAgent.substr(0,agt.indexOf(' '));
			else return navigator.userAgent;
}



function initMLMenu(className) {

	arrayOfElementsWitThisClassName = getElementsByClassName(className);

	for( i=0; i<arrayOfElementsWitThisClassName.length; i++ )
	{
		currentRoot = arrayOfElementsWitThisClassName[i];

		var lis = currentRoot.getElementsByTagName("LI");
		for (j=0; j<lis.length; j++) {
			if(lis[j].lastChild.tagName=="UL"){
				lis[j].onmouseover=function() {
					/* display the inner menu */
					this.lastChild.style.visibility="visible";
				}
				lis[j].onmouseout=function() {
					this.lastChild.style.visibility="hidden";
				}
				assignEvents(lis[j].lastChild,0, 0);
			}
		}


	}

}


function get_li_width_in_IE(element)
{
	initial_width = 0;
	initial_width = parseInt(IE_computedStyle.get(element,"width").replace("px",""));
	initial_width -= parseInt(IE_computedStyle.get(element,"padding-left").replace("px",""));
	initial_width -= parseInt(IE_computedStyle.get(element,"padding-right").replace("px",""));
	for(i=0;i<element.childNodes.length-1;i++)
	{
		initial_width -= parseInt(IE_computedStyle.get(element.childNodes[i],"padding-right").replace("px",""));
	}

	return initial_width;
}

function assignEvents(element){


	/* Get all the list items within the menu */

	var lis = element.getElementsByTagName("LI");
	for (i=0; i<lis.length; i++) {

		/* If the LI has another menu level */
		if(lis[i].lastChild.tagName=="UL"){

			if( whichBrs() == "Internet Explorer" )
			lis[i].lastChild.style.left = get_li_width_in_IE(lis[i]) + "px";
			else
			lis[i].lastChild.style.left = lis[i].offsetWidth + "px";

			/* assign the function to the LI */
			lis[i].onmouseover=function() {
				/* display the inner menu */
				this.lastChild.style.visibility="visible";
			}
			lis[i].onmouseout=function() {
				this.lastChild.style.visibility="hidden";
			}
			
			assignEvents( lis[i].lastChild);

		}

	}
}


// get elements by class name
function getElementsByClassName(className, tag, elm){
	if (document.getElementsByClassName) {
		getElementsByClassName = function (className, tag, elm) {
			elm = elm || document;
			var elements = elm.getElementsByClassName(className),
			nodeName = (tag)? new RegExp("\\b" + tag + "\\b", "i") : null,
			returnElements = [],
			current;
			for(var i=0, il=elements.length; i<il; i+=1){
				current = elements[i];
				if(!nodeName || nodeName.test(current.nodeName)) {
					returnElements.push(current);
				}
			}
			return returnElements;
		};
	}
	else if (document.evaluate) {
		getElementsByClassName = function (className, tag, elm) {
			tag = tag || "*";
			elm = elm || document;
			var classes = className.split(" "),
			classesToCheck = "",
			xhtmlNamespace = "http://www.w3.org/1999/xhtml",
			namespaceResolver = (document.documentElement.namespaceURI === xhtmlNamespace)? xhtmlNamespace : null,
			returnElements = [],
			elements,
			node;
			for(var j=0, jl=classes.length; j<jl; j+=1){
				classesToCheck += "[contains(concat(' ', @class, ' '), ' " + classes[j] + " ')]";
			}
			try	{
				elements = document.evaluate(".//" + tag + classesToCheck, elm, namespaceResolver, 0, null);
			}
			catch (e) {
				elements = document.evaluate(".//" + tag + classesToCheck, elm, null, 0, null);
			}
			while ((node = elements.iterateNext())) {
				returnElements.push(node);
			}
			return returnElements;
		};
	}
	else {
		getElementsByClassName = function (className, tag, elm) {
			tag = tag || "*";
			elm = elm || document;
			var classes = className.split(" "),
			classesToCheck = [],
			elements = (tag === "*" && elm.all)? elm.all : elm.getElementsByTagName(tag),
			current,
			returnElements = [],
			match;
			for(var k=0, kl=classes.length; k<kl; k+=1){
				classesToCheck.push(new RegExp("(^|\\s)" + classes[k] + "(\\s|$)"));
			}
			for(var l=0, ll=elements.length; l<ll; l+=1){
				current = elements[l];
				match = false;
				for(var m=0, ml=classesToCheck.length; m<ml; m+=1){
					match = classesToCheck[m].test(current.className);
					if (!match) {
						break;
					}
				}
				if (match) {
					returnElements.push(current);
				}
			}
			return returnElements;
		};
	}
	return getElementsByClassName(className, tag, elm);
};
