	
	// id's of menu divs
	var menuDivs = new Array();
	var contentDivs = new Array();
	
	var currOpen = "";
	
	// images
	imgs = new Array();
	
	window.onload = initialize;
	
	
	function initialize() {
        // initialize the DHTML History
        // framework
        dhtmlHistory.initialize();
        
        // subscribe to DHTML history change
        // events
        dhtmlHistory.addListener(historyChange);

        if(dhtmlHistory.isInternetExplorer()){
        	var n = document.location.href.indexOf("#");
        	if (n != -1){
	        	var doLoad = document.location.href.substr(n);
	        	historyChange(doLoad);
        	} else {
        		historyChange("");
        	}
        }
        
        if (dhtmlHistory.isFirstLoad()) {
        }
    }
    
	function historyChange(newLocation, historyData) {
		if (newLocation != ""){
			var nuUid = newLocation.substring(1);
			
	        openPage(nuUid + ".1.html", historyData, nuUid, true);
        } else {
        	openPage(uid + ".1.html", historyData, uid, true);
        }
      }

	registerImg = function (theURL, theCap, theUid, theIndex){
		if(imgs[theUid+""] == undefined){
			imgs[theUid+""] = new Array();
		}
		if (imgs[theUid+""][theIndex] == undefined){
			imgs[theUid+""][theIndex] = new Array(theURL, theCap);
		}
	}
	
	function addContentDiv(id){
		contentDivs.push(id);
	}
	
	function hideContentDivs(id){
	var str = id + "\n\n";
		for(var i = 0; i < contentDivs.length; i++){

			if (contentDivs[i] != id){
				$(contentDivs[i]).innerHTML = "";
				str +=  contentDivs[i] + " " + $(id) + " \n";				
			}
		}
//		alert(str);
	}
	
	function addMenuDiv(id,pid,cid){
		menuDivs[id] = new Array();
		menuDivs[id]["pid"] = pid;
		menuDivs[id]["cid"] = cid;
	}
	
	function closeMenuDivs(){
		for (var key in menuDivs){
			if (document.getElementById(key) == undefined) continue;
			if(menuDivs[key]["pid"] != ""){
				$(key).removeClassName("mOpen");
				$(key).removeClassName("mHilight");
				document.getElementById(key).style.display = "none";
			} else {
				$(key).removeClassName("mOpen");
				$(key).removeClassName("mHilight");
				document.getElementById(key).style.display = "block";
			}
		}
	}
	
	function openChildDivs(id){
		for (var key in menuDivs){
			if (document.getElementById(key) == undefined) continue;
			if(menuDivs[key]["pid"] == id){
				document.getElementById(key).style.display = "block";
				$(key).addClassName("mOpen");
			}
		}
	}
	
	function openMenuDiv(id){
	return;
		closeMenuDivs();
		openParentMenuDiv(id);
		openChildDivs(id);
//		alert(id);
		$(id).addClassName("mHilight");
	}
	
	function openParentMenuDiv(id){
		if (document.getElementById(id) == undefined) return;
		document.getElementById(id).style.display = "block";
		$(id).addClassName("mOpen");
		openChildDivs(id);
		if(menuDivs[id]["pid"] != ""){
			openParentMenuDiv(menuDivs[id]["pid"]);
		}
	}
	
	function openPage(url, title, id, historyMode){	
		if(id == currOpen) {
			closePage(id);
			return false;
		}
		currOpen = id;
		openMenuDiv(url);
		hidePicNoRestore();
		document.getElementById("loading").style.display= "block";
		var page_request = false
		if (window.XMLHttpRequest){ // if Mozilla, Safari etc
			page_request = new XMLHttpRequest();
			if (page_request.overrideMimeType) {
                page_request.overrideMimeType('text/xml');
            }
		} else if (window.ActiveXObject){ // if IE
			try {
				page_request = new ActiveXObject("Msxml2.XMLHTTP")
			} catch (e){
				try{
					page_request = new ActiveXObject("Microsoft.XMLHTTP")
				} catch (e){}
			}
		} else return false;
		
		page_request.onreadystatechange=function(){
			loadpage(page_request, url, title, id, historyMode);
		}
		
		page_request.open('GET', url, true);
		page_request.send(null);

		return false;
	}
	
	function closePage(id){
		var cid = "content"+id;
		var elem = document.getElementById(cid);
		elem.innerHTML= ""; 
		currOpen = null;
	}
	
	function loadpage(page_request, url, title, id, historyMode){
		if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){
			var cid = "content"+id;
			var elem = document.getElementById(cid);
			elem.style.display="none";
			elem.innerHTML=page_request.responseText + "<div class='bottomSpc'></div>"; 
			elem.style.display="block";
			
			//htmlStore = document.getElementById("content").innerHTML;
			var execs = document.getElementsByName("execMe");
			var s = document.getElementsByTagName("script");
			
			if (historyMode != true){
				dhtmlHistory.add("_"+id, title);
			}
			
			// execute scripts
			for(var i = 0; i < s.length;i++){
				if(s[i].getAttribute("name") == "execMe"){
					eval(s[i].innerHTML);
				}
			}
			
			document.getElementById("loading").style.display= "none";
			elem.style.display="block";
			hideContentDivs(cid);
		}
	}
	
	function popDiv(theURL, theCap, theUid, theIndex, t){
		  	//document.getElementById("content").style.visibility = "hidden";
		  	popD.innerHTML = "<div class='spacer'></div>";
		  	if(t != undefined && t != ""){
	  		  	popD.innerHTML +="<div class='popHeader'>" + t + "</div>";
	  		}
		  	popD.innerHTML += "<a href='javascript:hidePic();'><img border='0' src='" + theURL + "'/></a>";

		  	popD.style.display = "block";
//		  	scrollD.style.display = "block";
		  	document.getElementById("menu").style.visibility = "hidden";
		  }
		  
		  
		  function hidePic(){
			  hidePicNoRestore();
			document.getElementById("menu").style.visibility = "visible";
		  	
		  }
		  
		  function hidePicNoRestore(){
		    popD.innerHTML = "";
			popD.style.display = "none";
//		    scrollD.style.display = "none";
    		//document.getElementById("content").style.visibility = "visible";
			//document.getElementById("scroll").style.display = "block";

		  }

