jQuery(document).ready(

	/*
	This function gets loaded when all the HTML, not including the portlets, is
	loaded.
	*/

	function() {
	}
);

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() {
	
	
	}
);



if (typeof nebui == "undefined" || !nebui)
	nebui = {};




nebui.toggleblock = function(i){
	var $ = jQuery;
	
	var isopened = $("#toggler" + i).hasClass("opened");
	
	$("a.toggler").each(function(e){
		$(this).removeClass("opened");
	});

	$("div.toggled").each(function(e){
		$(this).removeClass("opened");
	});

	if (isopened)
	{
		$("#toggler" + i).removeClass("opened");
		$("#toggled" + i).removeClass("opened");
	}else{
		$("#toggler" + i).addClass("opened");
		$("#toggled" + i).addClass("opened");
	}

};



nebui.outmail = function(p, txt)
{
	//alert(p);
	//coded="xR6EbA.2A58RHd@SHWs.jbx";
	//key="LXnco0vFChKqORHNz14MPs3lDSjbtdJrmwkfa7p59UTIAQEGBVWZie8xY6g2uy";
	var coded = p.substr(0, p.length - 62);//alert(coded);
	var key = p.substr(p.length - 62,62);//alert(key);
	
	shift=coded.length;
	link="";
	for(i=0;i<coded.length;i++)
	{
		if (key.indexOf(coded.charAt(i))==-1)
		{
			ltr=coded.charAt(i);
			link+=ltr;
		}else
		{
			ltr=(key.indexOf(coded.charAt(i))-shift+key.length)%key.length;
			link+=(key.charAt(ltr));
		}
	}
	return "<a href='mailto:"+link+"'>"+txt+"</a>";
};

nebui.openwindow = function(url, w, h, resizable, centered){
	if (!w) w = 700;
	if (!h) h = 600;
	window.open(url, "", "width="+w+",height="+h+",resizeable=yes,scrollbars=yes");
};
