var TechnisysBROUTheme = function () {
	var $ = jQuery;
	return {
		init: function() {
			var instance = this;

			//instance.handleSearchForm();
			//instance.dropDownMenu();
			//instance.handleLastChild();
		},

		handleSearchForm: function() {
			var searchForm = $('#banner .search');

			var searchInput = searchForm.find('input[@type=image]');
			var searchLink = $('<a class="search-input-link" href="javascript:;"></a>');

			searchLink.click(
				function() {
					$(this).parents('form')[0].submit();
				}
			);

			searchInput.hide();
			searchInput.before(searchLink);
		},

		handleLastChild: function () {
			var instance = this;

			$('#footer ul li:last').addClass('last-child');
		},

		dropDownMenu: function() {
			$("#navigation ul .dropDown-menu").hoverIntent(
				{
					interval: 25,
					timeout: 100,
					over: function () {
						var instance = $(this);
						var child = $('.child-menu', this);

						instance.addClass("init");
						child.slideDown(100);
					},
					out: function () {
						var instance = $(this);
						var child = $('.child-menu', this);
						child.slideUp(50);
						instance.removeClass("init");
					}
				}
			);
		}
	};
}();


jQuery(document).ready(

	/*
	This function gets loaded when all the HTML, not including the portlets, is
	loaded.
	*/

	function() {
		TechnisysBROUTheme.init();
		
		/* GAL: Agrego clases a las filas de las tablas <table class="zebra"...> */
		jQuery("table.zebra tr:even").addClass("even");
   		jQuery("table.zebra tr:odd").addClass("odd");
		
   		
   		/* GAL: Agrega class="modalwindow" (lightbox) a todos los <a.. dentro del <div class=gallery">..</div> */
   		//jQuery('div.gallery a').addClass("modalwindow"); 
   		
   		/* GAL: Seleccion de Links "modalwindow" (lightbox) */
   		jQuery('a.modalwindow').lightbox(); 		// Select all links with modalwindow class
   		//jQuery('#gallery a').lightbox(); 			// Select all links in object with gallery ID
  		//jQuery('a[@rel*=modalwindow]').lightbox();// Select all links that contains modalwindow in the attribute rel
   		//jQuery('a').lightbox(); 					// Select all links in the page (NO RECOMENDADO)
	}
);

Liferay.Portlet.ready(

	/*
	This function gets loaded after each and every portlet on the page.

	portletId: the current portlet's id
	jQueryObj: the jQuery wrapped object of the current portlet
	*/

	function(portletId, jQueryObj) {
	}
);

jQuery(document).last(

	/*
	This function gets loaded when everything, including the portlets, is on
	the page.
	*/

	function() {
	}
);