$(document).ready(initStripes);


/******************************************************************************
 * Stripes related
 ******************************************************************************/
var numRandomstripes = 5;
function initStripes() 
{
  /* highlight Navi */
  $("#navi .active, .subMenu .active").addClass("stripe" + getRandomStripe());
  $("#navi a, .subMenu a").hover(
    function () {
      if (!$(this).hasClass("active")) {
        $(this).addClass("stripe" + getRandomStripe());
      }
    }
  );
  
  /* highlight Subnavi */
  $(".sub_2ndLevel .active").addClass("subStripe" + getRandomStripe());   
  $(".sub_2ndLevel a").hover(
    function () {
      if (!$(this).hasClass("active")) {
        $(this).addClass("subStripe" + getRandomStripe());
      }
    }
  );   
  
  /* remove Navistripes */    
  $("#navi a, .subMenu a").mouseout(
    function () {
      for (var i=1; i<=numRandomstripes; i++)
      {
        if (!$(this).hasClass("active")) {        
          $(this).removeClass("stripe" + i);
        }
      }
    }
  );

  /* remove Subnavistripes */     
  $(".sub_2ndLevel a").mouseout(
    function () {    
      for (var i=1; i<=numRandomstripes; i++)
      {
        if (!$(this).hasClass("active")) {        
          $(this).removeClass("subStripe" + i);
        }
      }
    }
  );   
} 

function getRandomStripe() {
  var number = 0;
  number = 1+(Math.round(Math.random()* (numRandomstripes - 1)));
  return number;
  /*return "stripe" + number;*/
}


/******************************************************************************
 * Datebox related
 ******************************************************************************/
var dateboxOpen = true;
function toggleDates()
{
  if (dateboxOpen) {
    hideDates();
  }
  else {
    showDates();
  }  
}
function hideDates()
{
  $("#dates").hide("slow");
  $("#ocButton").removeClass("closeIcon");
  $("#ocButton").addClass("openIcon");       
  dateboxOpen = false;
}
function showDates()
{
  $("#dates").show("slow");
  $("#ocButton").removeClass("openIcon");
  $("#ocButton").addClass("closeIcon");
  dateboxOpen = true;
}
