var DropdownMenu = Class.create();

/*DropdownMenu.prototype = {
    
    initialize: function (menu) {
		this.menu = menu;
		this.tabs = $$(menu + ' ul li');
		this.tabs.each(this.setuphover.bind(this));
    },
	setuphover: function (k,v){
		Event.observe($(k),'mouseover', this.hoveron.bindAsEventListener(this));
		Event.observe($(k),'mouseout', this.hoveroff.bindAsEventListener(this));
	},
	hoveroff: function (e){
		var tab = Event.findElement(e, "li");
		console.log(tab);
		tab.removeClassName('over');	
	},
	hoveron: function(e) {
		var tab = Event.findElement(e, "li");
		tab.addClassName('over');
	}
};/**/



Event.observe(window, 'load', function() {  
	$$('ul#level1 li').each(function(e) {
		Event.observe(e, 'mouseover', function() { 
				Element.addClassName(e, 'over');  
		});  
		Event.observe(e, 'mouseout', function() {  
				Element.removeClassName(e, 'over');  
		});  
	});  
	
	$$('ul.level2 li').each( function(e) {  

		Event.observe(e, 'mouseover', function() { 
				Element.addClassName(e, 'over');  
		});  
		Event.observe(e, 'mouseout', function() {  
				Element.removeClassName(e, 'over');  
		});  
	});  
	
	$$('ul.level3 li').each( function(e) {  
		Event.observe(e, 'mouseover', function() { 
				Element.addClassName(e, 'over');  
		});  
		Event.observe(e, 'mouseout', function() {  
				Element.removeClassName(e, 'over');  
		});  
	});  
	
	$$('ul.level4 li').each( function(e) {  
		Event.observe(e, 'mouseover', function() { 
				Element.addClassName(e, 'over');  
		});  
		Event.observe(e, 'mouseout', function() {  
				Element.removeClassName(e, 'over');  
		});  
	});  
	
	$$('.quick-links h3').each( function(e) {
		Event.observe(e, 'click', function() {	
			linkHeight = $('links').getStyle('height');
			if(linkHeight == '544px') {
				$('links').morph('height:63px;');
			} else {
				$('links').morph('height:544px;');
			}
		});
	});
	
	$$('#twelve-specific-pagination a').each(function(e, index) {
		Event.observe(e, 'click', function(ev) {
			ev.stop();
			if(this.hasClassName('current')) {
				return false;
			}
			
			$$('#twelve-specific-pagination a').each(function(l) { l.removeClassName('current')});
			//$('twelve-left-container-list').setStyle({'top': ((188 * index)*-1) + 'px'});
			
			document.stored_button_num = (document.stored_button_num == 'undefined') ? 0 : document.stored_button_num;
			// Get the x_pos we need to be at
			button_id = this.identify();
			button_num = button_id.substring( (button_id.length - 1), button_id.length);
			desired_x_pos = parseInt($(this.identify()).getAttribute('rel'));
			
			// Get the position the ul is currently
			current_position = ( $('twelve-left-container-list').getStyle('top') == null ) ? 0 : $('twelve-left-container-list').getStyle('top');
		
			moveto = "-"+parseInt(desired_x_pos);

			new Effect.Move($('twelve-left-container-list'), { y:moveto, mode:'absolute' });
			this.addClassName('current');
			
			document.stored_button_num = button_num;
			
		});
	});
		

	
});/**/
