$(document).ready(function() {
	
	$("#slider").easySlider({
			auto: true,
			continuous: true,
			vertical: true,
			controlsShow: false
		});
	
	$('#panels').equalHeights(true);
	
	
	// rules for main menu submenu items
	// drop-down menu
	$('#menu ul > li > ul').each(function() { 
		this.initHeight = $(this).height();
		$(this).height(0);
	});
	
	$('#menu ul > li').bind('mouseover', function() {
		var $ul = $(this).find('> ul');
		if ($ul.length) {
			$ul.stop(true).animate({height: $ul.get(0).initHeight}, {
				duration: ($ul.get(0).initHeight - $ul.height()) * 3
			});
		}
	});
 
	$('#menu ul > li').bind('mouseout', function() {
		var $ul = $(this).find('> ul');
		if ($ul.length) {
			$ul.stop(true).animate({height: 0}, {
				duration: $ul.height() * 3,
				complete: function () {
					$ul.hide();
				}
			});
		}
	});
	
	// prettyPhoto init
	$("#mid a[rel^='prettyPhoto']").prettyPhoto({
	    animationSpeed:'fast',
	    theme:'facebook',
	    overlay_gallery: false,
	    slideshow:3000
	});
	
	// banini trade map tooltip
	var tt_conf = { 
		effect: 'slide',
		position: 'top center',
		relative: true,
		opacity: 0.9
	};
	
	$.each(["ki","ns","bg","ca","ni"], function(idx, loc){
		$("#bt"+loc).tooltip($.extend(tt_conf, {tip: "#bt"+loc+"_c"}));
		$("#bt"+loc+"_li").hover(
			function(){$("#bt"+loc).data("tooltip").show()},
			function(){$("#bt"+loc).data("tooltip").hide()}
		);
	});
	
});

