//admin

function doc_setup() {
	
setTimeout('run_js()', 200)	


}




function run_js() {

	
var main_anchor = document.getElementById('drop_menu').getElementsByTagName('UL')[0];


var li_arr = main_anchor.getElementsByTagName('LI'); 


for (var j = 0; j < li_arr.length; j ++) {  

				if (li_arr[j].className == "lev1") {
					
					
								
				 li_arr[j].startMe = startMe_but
				
			     li_arr[j].startMe()
			
				}

}

function startMe_but(){

		var counter = 0
		var mOverStat = false
		var s
		var isSelected
		isSelected = false
		
		
		this.sub_ul = this.getElementsByTagName("UL")[0] 
		this.childObjs = this.getElementsByTagName("LI")
		if(this.childObjs.length){
			this.lastChil = this.childObjs[this.childObjs.length -1]  
			var openHeightTo = this.lastChil.offsetTop + this.lastChil.offsetHeight + 3
			
			
			this.openDwn = function(){
				
				if(counter>3 && mOverStat){  
					
					if(this.sub_ul.offsetHeight < openHeightTo ){
						this.sub_ul.style.height = this.sub_ul.offsetHeight+10
					
						clearTimeout(s)                                             
					
					s=setTimeout('window.document.getElementById("'+this.id+'").openDwn()',30) 
					}
				
				}else if(mOverStat){
					counter++
					clearTimeout(s)
					s=setTimeout('window.document.getElementById("'+this.id+'").openDwn()',60)
				}
				if(this.sub_ul.offsetHeight > openHeightTo && mOverStat ){
						this.sub_ul.style.height  = openHeightTo
					}
			}
			
			this.closeUp = function(){
				if(this.sub_ul.offsetHeight < 80 && counter>4) 
					this.sub_ul.style.height  = 1
				if(counter>4 && !mOverStat){
					if(this.sub_ul.offsetHeight > 70 ){
						this.sub_ul.style.height = this.sub_ul.offsetHeight-20
						clearTimeout(s)
						s=setTimeout('window.document.getElementById("'+this.id+'").closeUp()',10)
					}
				
				}else if(!mOverStat){
					counter++
					clearTimeout(s)
					s=setTimeout('window.document.getElementById("'+this.id+'").closeUp()',60)
				}
			}
			

		for(i=0; i<	this.childObjs.length;	i++ ){
			
					if(this.childObjs[i].className=="selected"){
						isSelected = true
						break;
					}
			}
			if(!isSelected){
				this.onmouseover = function(){
					counter = 0
					mOverStat = true
					this.openDwn()
					
				}
				this.onmouseout = function(){
					counter = 0
					mOverStat = false
					this.closeUp()
				}
			}else{
				//this.style.backgroundImage = 'url(images/left_but_menu_s.gif)'
				this.style.color = '#ffffff'
				this.subObj.style.height = openHeightTo
			}
	
}

}
}



