	window.addEvent('domready', function(){
		var divs = new Array(); 
		var counter = 0; 
		var i=1;
		
		var location = window.location.toString();		    
		var splitUrl = location.split('#');
		var currentTab = splitUrl[1];			
		var activePanel = '';
		
		while ($$(['panel'+i]) != '') {
			divs.push($('panel'+i));
			// check url anchor name for current active panel
			
			var link = $('panel'+i+'_button');
			 
			if (currentTab == link.innerHTML.replace(" ","_")) {
			    activePanel = 'panel'+i;
			} 
			i++;			 
	 	}
	 	
	 	if (activePanel == '') {	 		
	 		activePanel = 'panel1';
	 	}
	 	 
		divs.each(
		
		function(div){
		
			var link = $(div.id + '_button'); 
			 
			if (div.id != activePanel) {				 
				 div.setStyle('display', 'none');				 
				 link.setStyle('background-color','#E6E6E6');				 
			} else  
			 {
				 div.setStyle('display','block');
				 link.setStyle('font-weight','bold');
				 link.setStyle('background-color','#FFFFFF')
			}
			  
			link.addEvent('click',  
				function(e){
					e = new Event(e);
					   
					divs.each(
					function(other){
						if (other != div) {
							 var otherlink = $(other.id + '_button');
							 otherlink.setStyle('background-color', '#E6E6E6');
							 otherlink.setStyle('font-weight','normal');
							 other.setStyle('display', 'none');	 
						}  							
					});	
					this.setStyle('background-color', '#FFFFFF');
					this.setStyle('font-weight','bold');
					div.setStyle('display', 'block');    
					
					window.location.hash = link.innerHTML.replace(" ","_");
					
					e.stop();
					//return false;
			});
			counter++;
		});
	});