$(document).ready( function(){ 
	initJQuery();
});

/*
var mycarousel_itemList = [];
var mycarousel_itemHTML = [];
$('#mycarousel li').each(function(i){
  var thisimg = $(this).find('img');
  mycarousel_itemList[i] = {
    url: thisimg.attr('src'),
    title: thisimg.attr('title')
  };
  mycarousel_itemHTML.push($(this).html());
});

mycarousel_itemVisibleInCallback = function (carousel, item, i, state, evt) {
  var idx = carousel.index(i, mycarousel_itemList.length);
  carousel.add(i, mycarousel_itemHTML[idx - 1]);
};

mycarousel_itemVisibleOutCallback = function (carousel, item, i, state, evt) {
  carousel.remove(i);
};

		itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
		itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback},
*/

function initJQuery(){
	

	
jQuery('#site-content').show();

			if($.cookie("zeigen") == null) 
			{
			$("#slider").css('visibility', 'visible');
			$("#top").css('height', '308px');
			$("#clickMe").removeClass("zeigen");
			$("#clickMe").removeClass("verstecken");
			$("#clickMe").addClass("zeigen");
				}
			//ELSE - WELCHES COOKIE IST GESETZT?
			else{
				if($.cookie("zeigen") == 'nein') {
					$("#slider").css('visibility', 'hidden');
					$(".top_strich").removeClass("str_verstecken");
					$(".top_strich").removeClass("str_zeigen");
					$(".top_strich").addClass("str_zeigen");
					$("#top").css('height', '170px');
					$("#clickMe").removeClass("normal");
					$("#clickMe").removeClass("zeigen");
					$("#clickMe").removeClass("verstecken");
					$("#clickMe").addClass("verstecken");
				}
				if($.cookie("zeigen") == 'ja') {
					$("#slider").css('visibility', 'visible');
					$(".top_strich").removeClass("str_zeigen");
					$(".top_strich").removeClass("str_verstecken");
					$(".top_strich").addClass("str_verstecken");
					$("#top").css('height', '308px');
					$("#clickMe").removeClass("normal");
					$("#clickMe").removeClass("verstecken");
					$("#clickMe").removeClass("zeigen");
					$("#clickMe").addClass("zeigen");
				}
			}
		
/*
			$("#clickMe").removeClass("normal");
			$("#clickMe").removeClass("zeigen");
			$("#clickMe").removeClass("verstecken");
			$("#clickMe").addClass("verstecken");
*/

$("#clickMe").click(function() {
	if($("#top").height() == 308)
	{
		$.cookie("zeigen", 'nein');
		$("#top").animate({ height: "170px" }, 800 );
		$("#slider").css('visibility', 'hidden');
		$(".top_strich").removeClass("str_verstecken");
		$(".top_strich").removeClass("str_zeigen");
		$(".top_strich").addClass("str_zeigen");
		$("#clickMe").removeClass("normal");
		$("#clickMe").removeClass("verstecken");
		$("#clickMe").addClass("verstecken");
		$("#clickMe").removeClass("zeigen");
	}
	else
	{
		$.cookie("zeigen", 'ja');
		$("#top").animate({ height: "308px" }, 800 );
		$("#slider").css('visibility', 'visible');
		$(".top_strich").removeClass("str_zeigen");
		$(".top_strich").removeClass("str_verstecken");
		$(".top_strich").addClass("str_verstecken");
		$("#clickMe").removeClass("normal");
		$("#clickMe").removeClass("zeigen");
		$("#clickMe").addClass("zeigen");
		$("#clickMe").removeClass("verstecken");
	}
});

$('#navi li table td').hover(function() {
       $(this).addClass('tover');
      }, function() {
        $(this).removeClass('tover');
});

$('#navi li li table td').hover(function() {
       $(this).addClass('tover');
      }, function() {
        $(this).removeClass('tover');
});

/*
if($.cookie("play") == null) carousel.startAuto();
	else{
		if($.cookie("play") == 1) carousel.startAuto();
		if($.cookie("play") == 0) carousel.stopAuto();
	}
*/

var mycarousel_itemList = [
    {url: 'files/GU-banner01.jpg', title: ''},
	{url: 'files/GU-banner02.jpg', title: ''},
	{url: 'files/GU-banner03.jpg', title: ''},
	{url: 'files/GU-banner04.jpg', title: ''},
	{url: 'files/GU-banner05.jpg', title: ''},
	{url: 'files/GU-banner06.jpg', title: ''},
	{url: 'files/GU-banner07.jpg', title: ''},
	{url: 'files/GU-banner08.jpg', title: ''},
	{url: 'files/GU-banner09.jpg', title: ''},
	{url: 'files/GU-banner10.jpg', title: ''},
	{url: 'files/GU-banner11.jpg', title: ''},
	{url: 'files/GU-banner12.jpg', title: ''},
	{url: 'files/GU-banner13.jpg', title: ''},
	{url: 'files/GU-banner14.jpg', title: ''},
	{url: 'files/GU-banner15.jpg', title: ''},
	{url: 'files/GU-banner16.jpg', title: ''}
]; 

function mycarousel_itemVisibleInCallback(carousel, item, i, state, evt)
{
// The index() method calculates the index from a
// given index who is out of the actual item range.
var idx = carousel.index(i, mycarousel_itemList.length);
carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[idx - 1]));
};

function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt)
{
carousel.remove(i+1);
};

function mycarousel_getItemHTML(item)
{
    return '<img src="' + item.url + '" width="894" height="201" alt="" />';
};


jQuery('#mycarousel').jcarousel({
        scroll: 1,
        visible: 6,
        animation: 2100,
        easing: 'swing',
        auto: 3,
        wrap: 'circular',
		//itemVisibleInCallback: itemVisibleIn,
		itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
        itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback},
		initCallback: function(jc, state) {
		if (state == 'init') {
		$(".jcarousel-container").prepend('<div class="jcarousel-toggle-vertical"></div>');
		
		jc.startAutoOrig = jc.startAuto;
			jc.startAuto = function() {
			if (!jc.paused) {
				jc.startAutoOrig();
				}
			}
			
			jc.pause = function() {
				$('div.jcarousel-toggle-vertical')
				.removeClass('jcarousel-play-vertical')
				.addClass('jcarousel-pause-vertical');
				jc.paused = true;
				jc.stopAuto();
				$.cookie("play", 0);
			};
			
			jc.play = function() {
				$('div.jcarousel-toggle-vertical')
				.removeClass('jcarousel-pause-vertical')
				.addClass('jcarousel-play-vertical');
				jc.paused = false;
				jc.startAuto();
				$.cookie("play", 1);
			};
			
			$('div.jcarousel-toggle-vertical').click(function(){
				if (jc.timer === null) {
					jc.play();
				} else {
					jc.pause();
				}
			});
			
			//COOKIES-  NOCH KEIN COOKIE?
			if($.cookie("play") == null) jc.play();
			//ELSE - WELCHES COOKIE IST GESETZT?
			else{
				if($.cookie("play") == 1) {
					jc.play();
					$('div.jcarousel-toggle-vertical')
					.addClass('jcarousel-play-vertical')
					.removeClass('jcarousel-pause-vertical');
				}
				if($.cookie("play") == 0) {
					jc.pause();
					$('div.jcarousel-toggle-vertical')
					.removeClass('jcarousel-play-vertical')
					.addClass('jcarousel-pause-vertical');
				}
			}
		}
		}
    });

$("a[href^='http://']").attr('target', '_blank');

var li = $('li.toppi');
  li.mouseover(function () {
    $(this).addClass('hover');
  });
  li.mouseout(function () {
    $(this).removeClass('hover');
  });
  /*
 var li = $('#navi li.noakt');
  li.mouseover(function () {
    $(this).addClass('hover');
  });
  li.mouseout(function () {
    $(this).removeClass('hover');
  });

  var lino = $('#navi li.noakt');
  lino.mouseover(function () {
    $('#navi ul li.akt ul').css('visibility', 'hidden');
  });
  lino.mouseout(function () {
	$('#navi ul li.akt ul').css('visibility', 'visible');
  });
*/


//initJQueryNetwork() END   
}
