/***********************************************
* Switch Menu script- by Martial B of http://getElementById.com/
* Modified by Dynamic Drive for format & NS4/IE4 compatibility
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var item_name = "";

function SwitchMenu(obj){
	if(document.getElementById){
		var el = document.getElementById(obj);
		var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
		if(el) {
			if(el.style.display != "block"){ //DynamicDrive.com change
				for (var i=0; i<ar.length; i++){
					if (ar[i].className=="submenu") //DynamicDrive.com change
					ar[i].style.display = "none";
				}
				el.style.display = "block";
			}else {
				el.style.display = "none";
			}
		}
	}
}

function get_current_item_name() {
	var _GET_Keys;
	var _GET_Values;
	var _GET_Count = 0;

	item_name = "";
	//Parsed link and fetch Get array from it.
	get = new String(window.location);
	x = get.indexOf('?');
	if(x!=-1) {
		l = get.length;
	    get = get.substr(x+1, l-x);
	    l = get.split('&');
	    _GET_Count  = l.length;
	    _GET_Keys   = new Array(_GET_Count);
	    _GET_Values = new Array(_GET_Count);
		x = 0;
	    for(i in l) {
			get = l[i].split('=');
			_GET_Keys[x] = get[0];
			_GET_Values[x] = get[1];
			if(_GET_Keys[x] == "parent_item") {				item_name = _GET_Values[x];
			}
			x++;
		}
	 };
}


function onloadfunction(){	get_current_item_name();
	if(item_name != "") {
		document.getElementById(item_name).style.display="block";
	};
}
window.onload=onloadfunction;

