// JavaScript for bergbahnen-fieberbrunn.at

function initialize_slidemenu() {
	
	var switches = $$('ul.mainmenu li.menu-expand');
	if(!switches.length)
		return false;
	switches.each(function(element) {
		//window.alert("found element: "+element.getTag());
		slider = element.getChildren();
		slider.each(function(slider_element) {
			if(slider_element.get('tag') == 'ul' && slider_element.hasClass('mainmenu_sub')) {
				theSlide = new Fx.Slide(slider_element, { wait: false, fps: 25, onCancel: function() {this.slideOut();} });
				if(!element.hasClass('menu-parent')) { // keep the active subemnu showing, all others get the events
						theSlide.hide();
					// add mouseover-toggle
					element.addEvent('mouseenter', function(e){
						e = new Event(e);
						this.slideIn.delay(250,this);
						e.stop();
					}.bindWithEvent(theSlide));
					// add mouseout toggle
					element.addEvent('mouseleave', function(e){
						e = new Event(e);
						this.slideOut.delay(250,this);
						e.stop();
					}.bindWithEvent(theSlide));
				} // end if hasClass('menu-active')
			}

		});
	});
} 


function init_bbfVideo() {
	if(!$('wb_section_3'))
		return false;
	// we are on the startseite
	head = $('maincontainer').getElement('h1');
	adlink = new Element('a',{'class': 'news_ad_link', 'href':'/pages/de/schigebiet/rundflug.php'});
	adlink.set('text','Neuer 3D Rundflug online');
	/*adlink.addEvent('click', function() {
		video = new Element('div',{'class': 'news_ad_container'});
		video.set('html','<object width="570" height="321"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=9714849&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=6FBAE4&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=9714849&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=6FBAE4&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="570" height="321"></embed></object>');
		video.inject(head);
		this.removeEvents();
		return false;
	});
	*/
	head.adopt(adlink);
}

window.addEvent('domready', function(){ initialize_slidemenu(); init_bbfVideo(); });


