// JavaScript Document

//slider variables
var items_per_page;
var nr_of_items;
var total_width;
var nr_of_pages;
var width_per_page;
var timer;
var current_page;

//lc-menu variables
var lcmenu_active = false;

$(document).ready(function() 
{
	//setup lc submenu
	setupLCSubmenu();
	
	setupFieldHints(".set-field-hint");
	
	//setup the slider
	setupSlider();
	
	//activate the accordion
	$(".accordion").reversed_accordion({ header: "h3" });
	
	mkflickr_setup();
	
	//mklogoslider_setup();
	
	submenuSameHeight();
	
	iconizeExternalLinks();
	
	//setup lc menu
	setupLCMenu();
});

//cufon
Cufon.replace('.aller', { hover: true });
Cufon.replace('h1:not(".plaintext"), h2:not(".plaintext"), h3, h4, #slider .title');


	
/**
 *
 */
function setupLCSubmenu()
{
	jQuery(".sub").each(function()
	{
		//jQuery(this).css("display", "none");
		jQuery(this).find("ul").css("width", jQuery(this).width());
	});
	
	//submenu
	jQuery("li.has_subsub a").each(function()
	{
		//jQuery(this).bind("mouseout", function()
		//{
			jQuery(this).next().css("display", "none");
			jQuery(this).next().css("width", "0%");
		//});
	});
	
	jQuery("li.has_subsub a").each(function()
	{
		jQuery(this).bind("mouseover", function()
		{
			jQuery(this).next().css("display", "block");
			jQuery(this).next().css("width", "100%");
		});
	});
	
	jQuery("li.has_subsub a").each(function()
	{
		jQuery(this).bind("mouseout", function()
		{
			jQuery(this).next().css("display", "none");
			jQuery(this).next().css("width", "0%");
		});
	});
	
	//subsubmenu
	jQuery("li.has_subsub a").next().each(function()
	{
		jQuery(this).bind("mouseover", function()
		{
			jQuery(this).css("display", "block");
			jQuery(this).css("width", "100%");
		});
	});
	
	jQuery("li.has_subsub a").next().each(function()
	{
		jQuery(this).bind("mouseout", function()
		{
			jQuery(this).css("display", "none");
			jQuery(this).css("width", "0%");
		});
	});
}
