var currentSec = {};
var currentExpert = {};
//var caller={};
//var itemClicked={};

window.addEvent('load', function(){
	
	var topItem = $$('#menu .drop');
	
	topItem.each(function(el){
		el.addEvents({
			"mouseover":function() {
				el.getElement("ul").setStyle("visibility","visible")
			},
			"mouseleave":function() {
				el.getElement("ul").setStyle("visibility","hidden")
			}
		})
	})
	
	var stepAccordion = new Accordion($$('.toggler'),$$('.toggled'),{
		opacity: false,
		//alwaysHide: true,
		//display:0,
		//show: function(){
			
		//},		
		onActive: function(toggler){
			toggler.setStyles({'background-position':'left -40px'});

			try { currentSec.setStyle('display','none'); } catch(e){}
			currentSec = $(toggler.id+"Sec")
			currentSec.setStyle('display','block')
	        			
			
		},
		onBackground: function(toggler) {
			toggler.setStyles({
				'background-position':'top left'
			});
			
			//caller={};
			
			//alert(toggler.id);	        					

		}
		
	},$('accordion'));



	var found = 0;
	$$('.toggler').each(function(link,i){
		if (window.location.hash.substr(1) == link.id){
		found = i;	
		//alert(i);	
		}
	});
	stepAccordion.display(found);
	
    
	if (window.location.href.contains("steps")) { 
	    var subItems = $$('ul.subNav li');

	    subItems.each(function(el,i) {
	        el.addEvents({
	            'click':function(){
	                stepAccordion.display(i);
	                
	            }
	        });
	    });
	
	};
	
	
	
	
	
	
			//////////////

            //alert(toggler.id);
            //alert('0');
//			if(currentSec.id !=null)
//		    {
//		        var tempToggler=itemClicked;
//		        if(currentSec.style.display=='block')
//		        {
//		            
//		            alert('1');
//		            alert(tempToggler.id);
//		            tempToggler.addEvents(
//		            {
//                        'click':function()
//                            {   
//                                if(currentSec.id.contains('secure'))
//                                {                                                                   
//                                    caller='secure';                                    
//                                    stepAccordion.display(0);
//                                    return;
//                                    //alert(CurrentSec.id);
//                                }
//                                else if(tempToggler.id.contains('dispose') && caller !='secure')
//                                {                              
//                                    caller='dispose';
//                                    stepAccordion.display(1);
//                                    return;	                            
//                                }
//                                             
//	            
//                            }
//                    });
//            
//                }
//            }
			
			
			//////////////		
	
	
	
	


   
});

