var timeout    = 10000;

var closetimer = 0;

var item = 0;



function dropdown_open()

{  dropdown_canceltimer();

   dropdown_close();

   item = $(this).find('ul').css('visibility', 'visible');}



function dropdown_close()

{  if(item) item.css('visibility', 'hidden');}



function dropdown_timer()

{  closetimer = window.setTimeout(dropdown_close, timeout);}



function dropdown_canceltimer()

{  if(closetimer)

   {  window.clearTimeout(closetimer);

      closetimer = null;}}



$(document).ready(function()

{  $('#navi > li').bind('mouseover', dropdown_open)

   $('#navi > li').bind('mouseout',  dropdown_timer)});



document.onclick = dropdown_close;





$(document).ready(function(){

	$('ul.tabNav a').click(function() {

		var curChildIndex = $(this).parent().prevAll().length + 1;

		$(this).parent().parent().children('.active').removeClass('active');

		$(this).parent().addClass('active');

		$(this).parent().parent().next('.tabContainer').children('.active').slideUp('fast',function() {

			$(this).removeClass('active');

			$(this).parent().children('div:nth-child('+curChildIndex+')').slideDown('normal',function() {

				$(this).addClass('active');

			});

		});

		return false;

	});

});


