/**
* @author rap
* Date: 27/julio/2009
* Description: Carga todas las funciones necesaria por cada sitio para el frontend, ya sea jquery o prototype 
*/

$jQ = jQuery.noConflict();
$jQ(function(){
	if ($jQ("#featured > ul")) {
		$jQ("#featured > ul").tabs({
			fx: {
				opacity: "toggle"
			}
		}).tabs("rotate", 7000, true);
	}
	
	if($jQ(".set-gallery a").length >0){
		$jQ('.set-gallery a').lightBox();
	}
});

function onAnimate(show) {
	//$jQ(this).fadeIn('slow').show();
	if (show) {
		//$jQ(this).parent().addClass('current');
		$jQ(this)
			.css('visibility', 'hidden').show()
				.css('width', $jQ(this).innerWidth())
			.hide().css('visibility', 'visible')
		.fadeIn('fast');
	} else {
		$jQ(this).fadeOut('fast');
		//$jQ(this).parent().removeClass('current');
	}
}

var MENU_COUNTER = 1;
function loadMenu() {
	if (this.id == 'dynamicMenu') {
		$jQ('> ul > li', this).remove();

		var ul = $jQ('<ul></ul>');
		var t = MENU_COUNTER + 10;
		for (; MENU_COUNTER < t; MENU_COUNTER++) {
			$jQ('> ul', this).append('<li>Item ' + MENU_COUNTER + '</li>');
		}
	}
}

function unloadMenu() {
	if (MENU_COUNTER >= 30) {
		MENU_COUNTER = 1;
	}
}

// We're passed a UL
function onHideCheckMenu() {
	return !$jQ(this).parent().is('.LOCKED');
}

// We're passed a LI
function onClickMenu() {
	$jQ(this).toggleClass('LOCKED');
	return true;
}
