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 = $$('.test-flyout'); var flyout = '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' });
		
	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'; myPanel[i].morph({'opacity' : 1, 'height' : '105px'}); }
		else {open = 'true'; myPanel[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' : '396px'}); g('showContent').innerHTML='CLOSE'; showContent.setStyle('bottom', '35px');}
		//else {open = 'true'; contentOpen[i].morph({'opacity' : 0, 'height' : '0'}); showContent.setStyle('height', '14px'); showContent.setStyle('bottom', '35px'); g('showContent').innerHTML='MORE INFO +'; }

		if (open == 'true') { open = 'false'; contentOpen[i].morph({ 'opacity': 1, 'height': '368px' }); $('showContent').style.cssText += "background-position:0px -29px;"; showContent.setStyle('bottom', '35px'); }
		else { open = 'true'; contentOpen[i].morph({ 'opacity': 0, 'height': '0' }); showContent.setStyle('height', '24px'); showContent.setStyle('bottom', '51px'); $('showContent').style.cssText += "background-position:0px 0px;"; $('showContent').innerHTML = 'MORE INFO +'; }

		
		}
	});
    });
});

