/**
 * /assets/js/init.js
 * @author Philipp Maas <maas@medienfabrik.de>
 * @date 2010-11-02
 * @version 0.1
 */
 
$(document).ready(function () {

	jQuery.each(jQuery.browser, function(i, val) {
	   if(i=="mozilla" && jQuery.browser.version.substr(0,5) < "1.9.1")
	      $("span.arrow").css("margin-top","-13px");
	 });


	/* ... social bookmarks ...... */

		$("li.social>a").click(function() { return false; });
		
		$("li.social").hover(function() {
			$(this).find("ul").fadeIn();
		}, function() {
			$(this).find("ul").fadeOut();
		});

	/* ... !social bookmarks ...... */

	
	/* ... service_tvspot ....... */

		var service_tvspot_flashvars = {};
		var service_tvspot_params = {
			menu: "false",
			scale: "Scale",
			allowFullscreen: "true",
			allowScriptAccess: "always",
			bgcolor: "#ffffff",
			wmode: "transparent"
		};
		var service_tvspot_attributes = {
			id:"service_tvspot_flash"
		};
		swfobject.embedSWF("./assets/swf/tvspot_"+current_lang+".swf", "service_tvspot_flash_alt", "880", "528", "10.0.0", "./assets/swf/expressInstall.swf", service_tvspot_flashvars, service_tvspot_params, service_tvspot_attributes);

	/* ... !service_tvspot ....... */


	/* ... Menu Flyout ...... */
		
		if($('#oe_menu').length > 0) {
			$(function() {
				var $oe_menu    = $('#oe_menu');
				var $oe_menu_items  = $oe_menu.children('li');
				var $oe_overlay   = $('#oe_overlay');
				
				$oe_menu_items.bind('mouseenter',function(){
					var $this = $(this);
									
					var liPos = $this.position().left;
					var divPos = liPos + 12;
					$this.children('div').css('left','-'+divPos+'px')
					
					$this.addClass('slided selected');
					$this.children('div').css('z-index','9900').stop(true,true).slideDown(200,function(){
						$oe_menu_items.not('.slided').children('div').hide();
						$this.removeClass('slided');
					});
				}).bind('mouseleave',function(){
					var $this = $(this);
					$this.removeClass('selected').children('div').css('display','none');
				});
				
				$oe_menu.bind('mouseenter',function(){
					var $this = $(this);
					// $oe_overlay.stop(true,true).fadeTo(200, 0.4);
					$this.addClass('hovered');
				}).bind('mouseleave',function(){
					var $this = $(this);
					$this.removeClass('hovered');
					// $oe_overlay.stop(true,true).fadeTo(200, 0);
			
					$oe_menu_items.children('.div').hide();
				})
			});
		}

	/* ... !Menu Flyout ...... */



}); // end: document ready
