/*************************************
* Loads the tooltips
**************************************/

function initializeToolTips() {
	/* Tips 1 */
	var Tips1 = new Tips($$('.Tips1'));
	 
	/* Tips 2 */
	var Tips2 = new Tips($$('.Tips2'), {
		initialize:function(){
			this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 500, wait: false}).set(0);
		},
		onShow: function(toolTip) {
			this.fx.start(1);
		},
		onHide: function(toolTip) {
			this.fx.start(0);
		}
	});
}

/*************************************
* Loads horizontal sliding menu
**************************************/
function initializeHorzMenu() {
	var szNormal = 90, szSmall  = 70, szFull   = 200;
	
	// Preload the hover images
	var preload = new Image(100,25); 
	preload.src="Img/news2.png"; 
	preload.src="Img/shows2.png"; 
	preload.src="Img/store2.png"; 
	preload.src="Img/contact2.png"; 

	// Hover images
	var normal = new Array("url('img/news1.png')", "url('img/shows1.png')","url('img/store1.png')","url('img/contact1.png')");
	var hover = new Array("url('img/news2.png')", "url('img/shows2.png')","url('img/store2.png')","url('img/contact2.png')");
	var links = new Array('news.php','shows.php','store.php','contact.php');
	
	var MenuItems = $$("#HorzMenu .MenuItem");
	
	MenuItems.each(function(menuitem, i) {
			menuitem.setStyle("background-image", normal[i]);

	});
		
	var fx = new Fx.Elements(MenuItems, {wait: false, duration: 300, transition: Fx.Transitions.Back.easeOut});
	MenuItems.each(function(menuitem, i) {
		menuitem.addEvent("mouseenter", function(event) {
			var o = {};
			o[i] = {width: [menuitem.getStyle("width").toInt(), szFull]}
			//alert(hover[i]);
			menuitem.setStyle("background-image", hover[i]);
			MenuItems.each(function(other, j) {
				if(i != j) {
					var w = other.getStyle("width").toInt();
					if(w != szSmall) o[j] = {width: [w, szSmall]};
					//kwick.setStyle("background-image", normal[i]);
				}
			});
			fx.start(o);
		});
		
		menuitem.addEvent("click", function(event) {
			$("display").setProperty('src', links[i]);
		});

	});
	
	$("HorzMenu").addEvent("mouseleave", function(event) {
		var o = {};
		MenuItems.each(function(menuitem, i) {
			o[i] = {width: [menuitem.getStyle("width").toInt(), szNormal]};
			menuitem.setStyle("background-image", normal[i]);

		});
		fx.start(o);
	});
}



window.addEvent('domready', function(){
	initializeHorzMenu();
	initializeToolTips();		
}); 