$(function(){

	/* Menu a tendina
	-------------------------------------------------------------- */
	$("li.submenu").click(function(){
		$(this).children('ul').show();
	}).mouseout(function(){
		$(this).children('ul').hide();
	});
	$("li.submenu ul").mouseover(function(){
		$(this).show();
	}).mouseout(function(){
		$(this).hide();
	});

	/* Tooltip
	-------------------------------------------------------------- */
	$(".ttMin a").append("<em></em>");
	$(".ttMin a").hover(function() {
		$(this).find("em").animate({opacity: "show", top: "-30"}, "slow");
		var hoverText = $(this).attr("title");
	    $(this).find("em").text(hoverText);
	}, function() {
		$(this).find("em").animate({opacity: "hide", top: "-45"}, "fast");
	});

	/* Tabs - By Daniele De Nobili - www.ommilandia.com
	-------------------------------------------------------------- */
	tabs = {
		init : function(){
			// Azione iniziale
			$("ul.tabs .active a").each(function(){
				tabs.loader($(this));
			});
			// Azione al click
			$("ul.tabs a").click(function(){
				tabs.loader($(this));
				return false;
			});
		},
		loader : function(e){
			var h = e.attr("href");
			var p = e.parent().parent();
			if ( h.substr(0,1) == "#" ){
				p.nextAll(".tabPanel").hide();
				$(h).show();
			} else {
				p.next(".tabPanel").load(h);
			}
			p.find("li.active").removeClass("active");
			e.parent().addClass("active");
		}
	};
	tabs.init();

	$("ul.navbar li:not('.news, .feed') a").mouseover(function(){ // li:not esclude le classi
		$("ul.navbar li.active").removeClass("active"); // Tolgo la classe active dalla tab
		$("#submenu .active").removeClass("active"); // Tolgo la classe active dal div del submenu
		$(this).parent().addClass("active"); // Aggiungo la classe active al <li> della tab cosi' da colorarlo
		$($(this).attr("href")).addClass("active"); // Rendo attivo il div del submenu
	});
	
	$("#contactForm dd *").focus(function() {
		$(this).parent().parent().addClass("formfocus");
	}).blur(function(){
		$(this).parent().parent().removeClass("formfocus");
	});

	/* Shadowbox
	-------------------------------------------------------------- */
	Shadowbox.init();

});

/* Shadowbox 2.0 - http://www.mjijackson.com/shadowbox
-------------------------------------------------------------- */
Shadowbox.loadSkin('classic', 'http://www.communicationagents.com/mnm_files/mnm/js/shadowbox/skin');
Shadowbox.loadLanguage('en', 'http://www.communicationagents.com/mnm_files/mnm/js/shadowbox/lang');
//Shadowbox.loadPlayer(['flv', 'html', 'iframe', 'img', 'qt', 'swf', 'wmp'], 'js/shadowbox/player');
Shadowbox.loadPlayer(['html', 'iframe'], 'http://www.communicationagents.com/mnm_files/mnm/js/shadowbox/player');


/*  ADDED show/hide divs
-----------------------------------------------------------------------------*/

function ShowHide(divIDShow,divIDHide) {
	var divShow = document.getElementById(divIDShow);	
	var divHide = document.getElementById(divIDHide);	

		divShow.style.display = "block"; 		
		divHide.style.display = "none";		

}

