﻿$(document).ready(function(){

$("#mainMenu li.activePage").addClass("currentPage");
	$("#mainMenu > li").hover(
		function(){			
			if ($(this).children().is("ul")) {
				$("#mainMenu li.activePage").removeClass("activePage").addClass("hideSubmenu");
				$(this).addClass("activePage");
			}
		},function(){
			if ($(this).children().is("ul")) {
				$(this).removeClass("activePage");
				$("#mainMenu li.hideSubmenu").addClass("activePage").removeClass("hideSubmenu");
				$("#mainMenu li.currentPage").addClass("activePage");
			}
	})



$('.newsletterSubscription input.newsletterSubscriptionEmail, #ankiro_input_right').focus(function () {
         $(this).animate({  width: "185px"}, 500 );

    });

$('.newsletterSubscription input.newsletterSubscriptionEmail, #ankiro_input_right').blur(function () {
         $(this).animate({  width: "105px"}, 500 );

    });



	$("#priorityNav > li").hover(
		function(){
				$(this).addClass("hover");
		},function(){
				$(this).removeClass("hover");
	})


	var priorityNr = 0;
	$(".prioritySlide:gt(0)").hide();	
	
	$("ul#priorityNav li").click(function() { 
				
		priorityNr = $("ul#priorityNav li").index(this);
		$("#priorityNav li").removeClass("currentItem").eq(priorityNr).addClass("currentItem");		
		$("#prioritySlides .prioritySlide").fadeOut("slow").eq(priorityNr).fadeIn("slow");		
	
	})
	
	

$("table tr:odd").addClass("lightRow");


	$("#priorityNav > li").hover(
		function(){
				$(this).addClass("hover");
		},function(){
				$(this).removeClass("hover");
	})





/* BRANCH - EQUAL HIGHT */

var branchesHeight = 50;
var branchesNr = $(".branches").length;


if (branchesHeight < $(this).height()){
	$(".branches").each(function (i) {
		if (branchesHeight < $(this).height()){
			branchesHeight = $(this).height()
		}
	});
	
	$(".branches").each(function (i) {
		$(this).children(".branchesBody").css({height: branchesHeight+"px"})

	});
}


/* THEME EQUAL HEIGHT */



var themeHeight = 50;
var themeNr = $(".branches").length;


if (branchesHeight < $(this).height()){
	$("#themePage .brancheOverview").each(function (i) {
		if (branchesHeight < $(this).height()){
			branchesHeight = $(this).height()
		}
	});
	
	$("#themePage .brancheOverview").each(function (i) {
		$(this).children(".brancheOverviewContent").css({height: branchesHeight-70+"px"}) 

	});
}




/* STYLE SWITCHER */

	$('.styleswitch').click(function()
	{
		switchStylestyle(this.getAttribute("rel"));
		return false;
	});
	
	var c = readCookie('style');	
	if (c) switchStylestyle(c);





function switchStylestyle(styleName)
{
	$('link[@rel*=style][@title]').each(function(i) 
	{
		this.disabled = true;
		if (this.getAttribute('title') == styleName) this.disabled = false;
	});
	createCookie('style', styleName, 365);
}

// cookie functions http://www.quirksmode.org/js/cookies.html
function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); 
	}
	return null;
}
function eraseCookie(name)
{
	createCookie(name,"",-1);
}



make_image_onclick();


});



