//SuckerTree Horizontal Menu (Sept 14th, 06)
//By Dynamic Drive: http://www.dynamicdrive.com/style/
var a = new Array();
var ai = 0;
var iTimerID;
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 ultags=document.getElementById(menuids[i]).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.onmouseover=function(){
    this.getElementsByTagName("ul")[0].style.visibility="visible"
    }
    ultags[t].parentNode.onmouseout=function(){
    this.getElementsByTagName("ul")[0].style.visibility="hidden"
    }
    }
  }
}

function maxpopup(thisone, maxx, maxy){	  
	  
	ai = ai+1;
	a[ai]= thisone;
	
	if(thisone.width!=0){
		if(thisone.height>maxy || thisone.width>maxx){
	      		if(thisone.height>maxy) {
	        		auxx = thisone.width;
                		auxy = thisone.height;
				thisone.height = maxy;
	        		thisone.width=auxx*maxy/auxy;
	       			//thisone.offsetParent.style.position='fixed';
	        		max(thisone, maxx, maxy);
	      		}
              		else{
                		auxx = thisone.width;
               			auxy = thisone.height;
                		thisone.width = maxx; 
               			//thisone.offsetParent.style.position='fixed';
               			thisone.height= auxy *maxx /auxx;
                		max(thisone, maxx, maxy);
             		} 
           	}else{
           		thisone.offsetParent.style.position='fixed';
           	}
           
           
         	if(thisone.height <= maxy || thisone.width <= maxx){
	 	   	window.resizeTo(thisone.width + 20, thisone.height + 45)
	 	   	thisone.offsetParent.style.position='fixed';
	 	    
	  	}
        }
        else{
          iTimerID = setTimeout("maxdelay("+ai+","+maxx+","+maxy+")", 1);
	}
}


function max(thisone, maxx, maxy){	  
	  
	  	  
	  ai = ai+1;
	  a[ai]= thisone;
	  if(thisone.width!=0){
	  
	   
	  
	    if(thisone.height> maxy || thisone.width>maxx){
	      if(thisone.height>maxy) {
	        auxx = thisone.width;
                auxy = thisone.height;
		thisone.height = maxy;
	        thisone.width=auxx*maxy/auxy;
	        //thisone.offsetParent.style.position='fixed';
	        max(thisone, maxx, maxy);
	      }
              else{
                auxx = thisone.width;
                auxy = thisone.height;
                thisone.width = maxx; 
                //thisone.offsetParent.style.position='fixed';
                thisone.height= auxy *maxx /auxx;
                max(thisone, maxx, maxy);
                
	     } 
           }else{
            // thisone.offsetParent.style.position='fixed';
           }
        }
       
        else{
          iTimerID = setTimeout("maxdelay("+ai+","+maxx+","+maxy+")", 1);
        }
       
     }
     
     function maxdelay(indice, maxx, maxy){	  
    	max(a[indice],maxx,maxy);
    
    } 	 
     
     function preview(link)
  {
     window.open(link,null,'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=650, height=490')

    // window.open(link, null, 'height=600, width=800, toolbar=no, menubar=no, resizable=yes');
  }

if (window.addEventListener)
window.addEventListener("load", buildsubmenus_horizontal, false)
else if (window.attachEvent)
window.attachEvent("onload", buildsubmenus_horizontal)


