var ishome = false;	
window.onload = function() {

	// variable for the list status
	var listStatus = 'closed';
	var listOpen;
	var showList = function(lid) {
	
		var listId = lid.replace(/For/g,'');

		if(listStatus == "open") {
			if(listId != listOpen) {
				hideList();
			}
		} 
		
		if(listStatus == "closed") {
			listStatus = 'open';
			listOpen = listId;
			new fx.Opacity($(listOpen), {duration: 250}).custom(0, 1);
			new fx.Height($(listOpen), {duration: 150}).custom(20, 200);
			new fx.Width($(listOpen), {duration: 150}).custom(20, 138);
			(hideList).delay(15000);	
		}
	};
	
	var hideList = function() {
		if(listOpen) {
			if($(listOpen).getStyle('visibility') == "visible") {
				new fx.Opacity($(listOpen), {duration: 250}).custom(1, 0);
				new fx.Height($(listOpen), {duration: 150}).custom(200, 20);
				new fx.Width($(listOpen), {duration: 150}).custom(138,20);
			}
			listStatus = 'closed';		
			listOpen = '';
		}
	};
				 
						
	$S('a.navbutton').action({
		initialize: function(){
			if(this.hasClass('hasSubNav')){
				
				var listId = this.id.replace(/For/g,'');
				if($Element(this.firstChild, 'getTag') == 'span') {	
					var yOffset = this.firstChild.height+1;
				} else {
					var yOffset = 20; 
				}
				
				var yOffset = 178; 

				if (/MSIE/.test(navigator.userAgent)) {
					yOffset = 185; 
				}


				if (ishome == true && /MSIE/.test(navigator.userAgent)) {
						yOffset -= 7;
				}
	
				$(listId).style.top =  yOffset+'px';
				$(listId).style.left =  (this.getLeft())+'px';
			}
		
		},

		onmouseover: function() {
			if(this.hasClass('hasSubNav')){
				showList(this.id);			
			}else{
				if(listStatus == 'open'){
					hideList();
				}
			}	
		},
		onmouseout: function() {
			var a = 'x';
		}
	});
	
	

};