//SuckerTree Horizontal Menu (Sept 14th, 06)
//By Dynamic Drive: http://www.dynamicdrive.com/style/
var menuids=["treemenu1"] //Enter id(s) of SuckerTree UL menus, separated by commas

function buildsubmenus_horizontal(){
for (var i=0; i<menuids.length; i++){
	var anElement = document.getElementById( menuids[i] );
	if( anElement )
	{ 
	    var ultags=anElement.getElementsByTagName( "ul" )
	    for (var t=0; t<ultags.length; t++){
			if (ultags[t].parentNode.parentNode.id==menuids[i]){ //if this is a first level submenu
				ultags[t].style.top=ultags[t].parentNode.offsetHeight+"px" //dynamically position first level submenus to be height of main menu item
				ultags[t].parentNode.getElementsByTagName("a")[0].className="mainfoldericon"
			}
			else{ //else if this is a sub level menu (ul)
			  ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" //position menu to the right of menu item that activated it
	    	ultags[t].parentNode.getElementsByTagName("a")[0].className="subfoldericon"
			}
	    
	    ultags[t].parentNode.onclick=function(){
	    	if( this.getElementsByTagName("ul")[0].style.visibility == "visible" )
	    	{
	    		this.getElementsByTagName("ul")[0].style.visibility="hidden";
	    		
				swapMenuImage( this );    		
			} 
			else
			{
				this.getElementsByTagName("ul")[0].style.visibility="visible";						    		
		
				swapMenuImage( this );
			}
	    }
	}		    
    
    }
  }
}

function confirm_form()
{
	return confirm( "Are you sure?" );
}

function swapMenuImage( element )
{
	var imageElement = element.getElementsByTagName( "img" )[0];
	if( imageElement.src.match( "_on.gif" ) )
	{
		imageElement.src = imageElement.src.replace( "_on.gif", ".gif" );
	}
	else
	{
		imageElement.src = imageElement.src.replace( ".gif", "_on.gif" );
	}	    		
}

function startup()
{
	buildsubmenus_horizontal();
}

function openPopup( url ) 
{
 window.open(url, "popup_id", "scrollbars,resizable,width=580,height=490" );
 return false;
}

function resize( iframe )
{
    iframe.height = iframe.contentWindow.document.body.scrollHeight + 30;
}

function resizef( height )
{
	// http://www.permadi.com/tutorial/flashGetObject/
	fo = window.document["menunew"];
	fo.height = height;
	fo.width = 1000;
}


