window.addEvent('domready', function() {
	
//book online
var myPages = $$('.bookLink');	var myBubbles = $$('.bubble');	var toggle = 'true';
//offers
var myOffer = $$('.offerLink');	var myPanel = $$('.offersSlide');	var open = 'true';
//offer flyout
var offersPullout = $$('.offerPullout'); var flyoutOffer = $$('.bubble-flyout'); var flyout = 'true';

//promo flyout
var promoPullout = $$('.promoLink'); var myPromo = $$('.promoSlide'); var mouseOn = 'true';

//search open
//var searchOpen = $$('.input_search'); var searchBtn = $$('.submit_search'); var slide = 'true';

//content open
var contentOpen = $$('.slidePanel'); var showContent = $$('.showContent'); var display = 'true';		

	myPanel.setStyle('opacity', 0);
	myBubbles.setStyle('opacity', 0);
	flyoutOffer.setStyle('opacity', 0);
	//searchOpen.setStyle('opacity', 0);	searchOpen.setStyle('width', 2);
	contentOpen.setStyle('height', '0px');
	
	/* book online */
	myPages.each(function(el, i) { el.set('morph', {link : 'cancel' });
	//try { Custom.init(); }	catch(e) {}
	el.addEvents({
	'click': function() {
		if (toggle == 'true') {toggle = 'false'; myBubbles[i].morph({'opacity' : 1, 'margin-top' : '-25px'}); }
		else { toggle = 'true'; myBubbles[i].morph({'opacity' : 0,'margin-top' : '0'}); }
		}
	});
	});
	
	/* Offers slide */
	myOffer.each(function(el, i) { el.set('morph', {link : 'cancel' });
		
	el.addEvents({
	'click': function() {
		if (open == 'true') { 
		open = 'false';  //close promo first
		myPromo[0].morph({'opacity' : 0, 'height' : '0'});
		mouseOn = 'true';
		myPanel[i].morph({'opacity' : 1, 'height' : '105px'}); }
		else {open = 'true'; myPanel[i].morph({'opacity' : 0, 'height' : '0'}); }
		}
	});
    });
    
    /* Promo slide */
	promoPullout.each(function(el, i) { el.set('morph', {link : 'cancel' });
		
	el.addEvents({
	'click': function() {
		if (mouseOn == 'true') { 
		mouseOn = 'false';  //close offers first
		myPanel[0].morph({'opacity' : 0, 'height' : '0'});
		open = 'true';
		myPromo[i].morph({'opacity' : 1, 'height' : '105px'}); }
		else {mouseOn = 'true'; myPromo[i].morph({'opacity' : 0, 'height' : '0'}); }
		}
	});
    });
    
    /* Individual offer flyout */
	offersPullout.each(function(el, i) { el.set('morph', {link : 'cancel' });
	el.addEvents({
     'mouseenter': function() {
        flyoutOffer[i].morph({ 'opacity' : 1, 'margin-left' : '35px' }); 
        },
    'mouseleave' : function() {
        flyoutOffer[i].morph({ 'opacity' : 0, 'margin-left' : 0 }); }
    });
    });
	
	/* Searchbar slide */
/*	searchBtn.each(function(el, i) { el.set('morph', {link : 'cancel' });
	el.addEvents({
     'mouseenter': function() {
        searchOpen[i].morph({ 'opacity' : 1, 'width' : '130px' }); 
        },
    'mouseleave' : function() {
        searchOpen[i].morph({ 'opacity' : 0, 'width' : '2px' }); }
    });
    });*/

	/* Home content slide */
	showContent.each(function(el, i) { el.set('morph', {link : 'cancel' });
	el.addEvents({
	'click': function() {
		if (open == 'true') { open = 'false'; contentOpen[i].morph({'opacity' : 1, 'height' : '349px'}); $('showContent').style.cssText+="background-position:0px -25px;"; showContent.setStyle('bottom', '50px');}
		else { open = 'true'; contentOpen[i].morph({ 'opacity': 0, 'height': '0' }); showContent.setStyle('height', '20px'); showContent.setStyle('bottom', '51px'); $('showContent').style.cssText += "background-position:0px 0px;"; $('showContent').innerHTML = 'MORE INFO +'; }
		}
	});
    });
});
