var menuids=["treemenu1"]

function buildsubmenus_horizontal(){
	for (var i=0; i<menuids.length; i++){
		var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
	    for (var t=0; t<ultags.length; t++){
	    var strCnames = "";
			var cFound = false;
			if (ultags[t].parentNode.parentNode.id==menuids[i]){
				ultags[t].style.top=ultags[t].parentNode.offsetHeight+"px"
				var firstEl = ultags[t].parentNode.getElementsByTagName("a")[0];
				var elCnames = firstEl.className.split(' ');
				if(elCnames.length>0)
				{
					for(var ecn = 0; ecn < elCnames.length; ecn++)
					{
						if(elCnames[ecn]=="menu_item") cFound = true;
					}
				}
				if(!cFound) elCnames.push("menu_item");
				firstEl.className = elCnames.join(' ');

			}
			else{
				ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px"
				ultags[t].parentNode.getElementsByTagName("a")[0].className="submenu_item"
			}
			ultags[t].parentNode.onmouseover=function(){
				this.getElementsByTagName("ul")[0].style.visibility="visible"
				Element.addClassName(this, "hovered")
			}
			ultags[t].parentNode.onmouseout=function(){
				this.getElementsByTagName("ul")[0].style.visibility="hidden"
				Element.removeClassName(this, "hovered")
			}
		}
	}
}

if (window.addEventListener)
window.addEventListener("load", buildsubmenus_horizontal, false);
else if (window.attachEvent)
window.attachEvent("onload", buildsubmenus_horizontal);





var popupStatus = 0;

//loading popup with jQuery magic!
function loadPopup(){
	//loads popup only if it is disabled
	if(popupStatus==0){
		jQuery("#backgroundPopup").css({
			"opacity": "0.7"
		});
		jQuery("#backgroundPopup").fadeIn("slow");
		jQuery("#popupContact").fadeIn("slow");
		popupStatus = 1;
	}
}

//disabling popup with jQuery magic!
function disablePopup(){
	//disables popup only if it is enabled
	if(popupStatus==1){
		jQuery("#backgroundPopup").fadeOut("slow");
		jQuery("#popupContact").fadeOut("slow");
		popupStatus = 0;
	}
}

//centering popup
function centerPopup(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = jQuery("#popupContact").height();
	var popupWidth = jQuery("#popupContact").width();
	//centering
	jQuery("#popupContact").css({
		"position": "absolute",
		"top": 300,
		"left": windowWidth/2-popupWidth/2
	});
	//only need force for IE6
	jQuery("#backgroundPopup").css({
		"height": windowHeight
	});
}


/*
function openNewsletterPopup(){
	centerPopup();
	loadPopup();
	
	if (document.getElementById('popupContact')){
		var today = new Date();
		today.setTime( today.getTime() );
		var expires_date = new Date( today.getTime() + (1000*60*60*24) );
		//var expires_date = new Date( today.getTime() + (1000*60) );
		document.cookie = "newsletterPopup=Y;expires=" + expires_date.toGMTString()+";path=/";
	}	
	
				
	//CLOSING POPUP
	//Click the x event!
	jQuery("#popupContactClose").click(function(){
		disablePopup();
	});
	//Click out event!
	jQuery("#backgroundPopup").click(function(){
		disablePopup();
	});
	//Press Escape event!
	jQuery(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus==1){
			disablePopup();
		}
	});

}


//CONTROLLING EVENTS IN jQuery
jQuery(document).ready(function(){
	window.setTimeout('openNewsletterPopup()',1000);
});
*/












