/* == PROTECT NAMESPACE == */

jQuery.noConflict();



/* == FUNCTION: TOGGLE NAVIGATION == */

function toggleNavigation()
{
	jQuery("div#navigation ul#navigation_menu li ul").hide();
	jQuery("div#navigation ul#navigation_menu li a.toggle").click(function()
	{
		jQuery(this).next().toggle();
		return false;
	});
}



/* == FUNCTION: TOGGLE NEWS == */

function toggleNews()
{
	if (jQuery("div#content div#news_home").length > 0 && jQuery("div#content div#news_home p").text().length > 0)
	{
		jQuery("div#content div#news_home p").hide();
		jQuery("div#content div#news_home").append("<p class=\"read_more\"><a href=\"#\">" + text_open + "</a></p>");
		jQuery("div#content div#news_home p.read_more a").click(function()
		{
			jQuery(this).parent().prev().slideToggle("fast");
			jQuery(this).toggleClass("active");
			
			if (jQuery(this).text() == text_open)
			{
				jQuery(this).text(text_close);
			}
			else
			{
				jQuery(this).text(text_open);
			}
			
			return false;
		});
	}
}



/* == FUNCTION: COLLAPSE DIV'S == */

function collapseDivs()
{
	if (jQuery("div#content h2 span").length > 1)
	{
		jQuery("div#content div.detail").hide();
		jQuery("div#content h2").append("<a href=\"#\" class=\"collapse\">" + text_open + "</a>");
		jQuery("div#content h2 a").click(function()
		{
			jQuery(this).parent().toggleClass("active");
			jQuery(this).parent().next("div.detail").slideToggle("normal");
			
			if (jQuery(this).text() == text_open)
			{
				jQuery(this).text(text_close);
			}
			else
			{
				jQuery(this).text(text_open);
			}
			
			return false;
		});
	}
}



/* == EVENTS == */

jQuery(document).ready(function()
{
	toggleNavigation();
	toggleNews();
	collapseDivs();
});
