
$(document).ready(function() {

$("li.login").hover(
  function () {
    $('div.tooltip').stop(true, true).fadeIn("fast");
    
  },
  function () {
   $('div.tooltip').stop(true, true).delay(200).fadeOut("slow");
  }
);


	$("a.fancy").fancybox();
	$("a.fancydiv").fancybox({
	'autoDimensions':false,
	'width'			: 680,
	'height'		: 250}
			);
	$('div.lottery-latest').cycle({ fx:'fade',delay: 50, speed:1000,timeout:5000});
	$('div.headerslider').cycle({ fx:'scrollLeft',delay: 100,pager:  '#headnav',pause: true,speed:1000,timeout:5000});
	$('.slider').jcarousel( {
		initCallback: slider_initCallback,
		itemFirstInCallback: slider_firstInCallback,
		scroll: 1,
		auto: 5,
		wrap: 'both',
		// This tells jCarousel NOT to autobuild prev/next buttons
		buttonNextHTML: null,
		buttonPrevHTML: null
	});

    $("div.smallpanes div.ov").mouseenter(function () {
    $(this).parent("div").find("div.training-over").filter(':not(:animated)').fadeIn();
  });
    $("div.smallpanes div.ovsmall").mouseenter(function () {
    $(this).parent("div").find("div.training-over").filter(':not(:animated)').fadeIn();
  });
	 $("div.training-over").mouseleave(function () {
     $(this).fadeOut();
  });
  
  $(".touchbuch").click(function(){
    $.fancybox({
  		'width'				    : 900,
  		'height'			    : '75%',
      'autoScale'       : false,
      'transitionIn'		: 'none',
  		'transitionOut'		: 'none',
  		'type'				    : 'iframe',
  		'href'            : 'http://www.touchbuch.com/touchbuch_connect.php?page='+this.title
  	});  
  	return false;
  });

  $(".marke").click(function(){
    $.fancybox({
  		'width'				    : 900,
  		'height'			    : '75%',
      'autoScale'       : false,
      'transitionIn'		: 'none',
  		'transitionOut'		: 'none',
  		'type'				    : 'iframe',
  		'href'            : 'http://www.touchbuch.com/touchbuch_connect.php?marke='+this.title
  	});  
  	return false;
  });
	
	//$('.question').fancybox();
	
	$('a.ask').fancybox();
  
  $('a.no').click(function() {
    $('.fancy').hide();
    return false;
  });
	
});

function slider_initCallback (carousel) {
	
	$('.slider-nav a').bind('click', function() {
		carousel.scroll($.jcarousel.intval($(this).text()));
		return false;
	});
}

function slider_firstInCallback(carousel, item, idx, state) {
	$('.slider-nav a').removeClass('active');
	$('.slider-nav a').eq(idx-1).addClass('active');
}

$(function() {
	// setup ul.tabs to work as tabs for each div directly under div.panes
	$("ul.tabs").tabs("div.panes > div");
	$("ul.smalltabs").tabs("div.smallpanes > div");
});

// $("ul.smalltabs").tabs("div.smallpanes > div", {event:'mouseover'});
//  $("div.ever").mouseenter(function () {
//    $(this).find("div.training-over").filter(':not(:animated)').fadeIn();
//  }).mouseleave(function () {
//    $(this).find("div.training-over").fadeOut();
//  });
