// Menu
$(document).ready(function() {
	var menu = $("ul.menu");
	
	menu.find("li").each(function() {
		if($(this).find("ul.sub-menu").length > 0) {
			$(this).mouseenter(function() {
				$("ul.sub-menu").hide();
				$(this).find("ul.sub-menu").stop(true, true).show();
			});
			
			$(this).mouseleave(function() {
				$(this).find("ul.sub-menu").stop(true, true).hide();
			});
		} else {
			if ($(this).parent().get(0).className != "sub-menu") {
				$(this).mouseenter(function() {
					$("ul.sub-menu").hide();
				});
			}
		}
	});
	
	$("#navigator").mouseleave(function() {
		$("#navigator ul.menu li.current-menu-parent ul.sub-menu").show();
		$("#navigator ul.menu li.current-page-ancestor ul.sub-menu").show();
	});
});

// Slider
$(window).load(function() {
    $('#slider').nivoSlider({
    	effect: 'fade',
    	animSpeed: 400,
    	pauseTime: 6000,
    	directionNav: false,
    	keyboardNav: false,
    	pauseOnHover: true
    });
});

// galerias
$(function() {
	var uri = 'http://www.opentech.com.py/wp-content/themes/opentech-2011/images/';
	$('.galeria a').lightBox({
		overlayBgColor: '#333',
		overlayOpacity: 0.75,
		imageLoading: uri + 'lightbox-ico-loading.gif',
		imageBtnClose: uri + 'lightbox-btn-close.gif',
		imageBtnPrev: uri + 'lightbox-btn-prev.gif',
		imageBtnNext: uri + 'lightbox-btn-next.gif',
		containerResizeSpeed: 350,
		txtImage: 'Imagen',
		txtOf: 'de'
	});
});

// mapa
// Create the tooltips only when document ready
$(document).ready(function()
{
   // We'll target all AREA elements with alt tags (Don't target the map element!!!)
   $('area[alt]').qtip(
   {
      content: {
         attr: 'alt' // Use the ALT attribute of the area map for the content
      },
      style: {
         classes: 'ui-tooltip-tipsy ui-tooltip-shadow'
      }
   });
});
