/*
 * jQuery (TY) Drop Down Mega Menu 
 * http://tumharyyaaden.site50.net/
 *
 * Copyright (c) 2009 Ronak Patel 
 * Desisaswat@gmail.com
 * Dual licensed under the MIT and GPL licenses.
 *
 * Date: 2010-05-19 00:00:01 -0500 (Wed, 19 May 2010)
 * Version: 0.1
 * Further modified by Juhani Hyvärinen to better meet the requirements of Sivutoimi's i_parser content management system and file parser
 */

$(document).ready(function(){

    $(".tiptip").tipTip(); //Initiate tipTip Tooltip, Titles to Tooltip
	

		
	$('#top_navi .menuboth div a') //Top Navigation, Drop down Links Background Animation, inlcude bgpos.js!
		.css( {backgroundPosition: "-550px -10px"} )
		.mouseover(function(){
			$(this).stop().animate({paddingLeft:"40"}, {duration:600});
		})
		.mouseout(function(){
			$(this).stop().animate({paddingLeft:"12"}, {duration:600});
		});
	
	//Näytä menu	
	$('.menuboth').mouseover(function(){
													  
		var containerID = '#'+$('a:first-child', this).attr('menudata'); //Get Menu container ID
		$(containerID).css( {visibility:"visible"});
		var tall = $('a:first-child', this).attr('menuheight'); //Get Menu container Height
		var wide = $('a:first-child', this).attr('menuwidth'); //Get Menu container Width
		$(containerID).css( {width:wide+"px"});
		$(containerID).stop().animate({height:tall},250);
	});
	
	//Piilota menu
	$('.menuboth').mouseout(function(){
							  
		var containerID = '#'+$('a:first-child', this).attr('menudata');
		//$(containerID).stop().animate({height:0},300,function(){$(containerID).css( {visibility:"hidden"});});
		$(containerID).stop().animate({height:1+"px"},250,function(){$(containerID).css( {visibility:"hidden"});});

	});


	
});
