$(document).ready(function(){ 	
	/**
	MENU
	**/
	$("ul.sf-menu").superfish({ 
            delay:      200,                            // one second delay on mouseout
            speed: 1, 
            dropShadows: true                            // disable drop shadows 
        });
      
	$("ul.sf-menu ul li").bind("mouseover", function(){
		$(this).css('background-color','#CE1C1A');
		$(this).children("a").css('color','#fff');		
	}); 

	$("ul.sf-menu ul li").bind("mouseout", function(){
		$(this).children("a").css('color','#CE1C1A');       		
		$(this).css('background-color','#fff');	
	});         
	
	$("ul.sf-menu ul").children("li:last").css('border-bottom','0');
	$('#top-menu li ul').bgiframe(); 


	/**
	EVENTS 
	**/      
    // set id of first element in list as default id
    var active_teaser = $("#event-teaser-list li img")[0].id.substring(7);            
    $("#event-teaser-list li img").bind("click", function(){
		if (this.id.substring(7) != active_teaser) {
			$("#teaser_"+active_teaser).removeClass('active');
			$("#teaser_"+active_teaser).css('border','2px solid white');
			$(this).addClass('active');
			bindEventAnim();
        }	
		// extract id from id attribute of img
	  	id = this.id.substring(7);
	  		
		$("#content_"+active_teaser).css('display','none');
			
		$("#content_"+id).css('display','block');
  		active_teaser = id;
	});
	bindEventAnim();
	$("#event-teaser-list li img").css('cursor','pointer');	
      		
	/**
	GASTRO
	**/
	// set id of first element in list as default id
    var active_gastro_teaser = $("#gastro-teaser-list li img")[0].id.substring(7);
        
    $("#gastro-teaser-list li img").bind("click", function(){
		// extract id from id attribute of img
  		var gid = this.id.substring(7);
		if (gid != active_gastro_teaser) {
			$("#teaser_"+active_gastro_teaser).removeClass('active');
			$("#teaser_"+active_gastro_teaser).css('border','2px solid white');
			$(this).addClass('active');
        	bindGastroAnim();
        }	
		// hide content  		
		$("#content_"+active_gastro_teaser).css('display','none');
		// display content
		$("#content_"+gid).css('display','block');
		// set active teaser id
		active_gastro_teaser = gid;
	});
	
	bindGastroAnim();
	$("#gastro-teaser-list li img").css('cursor','pointer');
	
	
	/**
	Shopping Tipp
	**/
	// set id of first element in list as default id
    var active_shops_teaser = $("#shops-teaser-list li img")[0].id.substring(7);       
    $("#shops-teaser-list li img").bind("click", function(){
		// extract id from id attribute of img
  		var gid = this.id.substring(7);  		
		if (gid != active_shops_teaser) {
			$("#teaser_"+active_shops_teaser).removeClass('active');
			$("#teaser_"+active_shops_teaser).css('border','2px solid white');
			$(this).addClass('active');
        	bindShopsAnim();
        }	
		// hide content  		
		$("#content_"+active_shops_teaser).css('display','none');
		// display content
		$("#content_"+gid).css('display','block');
		// set active teaser id
		active_shops_teaser = gid;
	});
	
	bindShopsAnim();
	$("#shops-teaser-list li img").css('cursor','pointer');	
	
		
}); 


function bindGastroAnim()
{
	$("#gastro-teaser-list li img").jFade({
		trigger: "mouseover",
		property: 'border-color',
		start: 'ffffff',
		end: 'C90202',
		steps: 25,
		duration: 15
	}).jFade({
		trigger: "mouseout",
		property: 'border-color',
		start: 'C90202',
		end: 'ffffff',
		steps: 25,
		duration: 15
	});
		
	$("#gastro-teaser-list li img.active").jFade({
		trigger: "mouseover",
		property: 'border-color',
		start: 'C90202',
		end: 'C90202',
		steps: 25,
		duration: 15
	}).jFade({
		trigger: "mouseout",
		property: 'border-color',
		start: 'C90202',
		end: 'C90202',
		steps: 25,
		duration: 20
	});	
}

function bindEventAnim()
{
	$("#event-teaser-list li img").jFade({
		trigger: "mouseover",
		property: 'border-color',
		start: 'ffffff',
		end: 'C90202',
		steps: 25,
		duration: 15
	}).jFade({
		trigger: "mouseout",
		property: 'border-color',
		start: 'C90202',
		end: 'ffffff',
		steps: 25,
		duration: 15
	});
	
	$("#event-teaser-list li img.active").jFade({
		trigger: "mouseover",
		property: 'border-color',
		start: 'C90202',
		end: 'C90202',
		steps: 25,
		duration: 15
	}).jFade({
		trigger: "mouseout",
		property: 'border-color',
		start: 'C90202',
		end: 'C90202',
		steps: 25,
		duration: 20
	});
}

function bindShopsAnim()
{
	$("#shops-teaser-list li img").jFade({
		trigger: "mouseover",
		property: 'border-color',
		start: 'ffffff',
		end: 'C90202',
		steps: 25,
		duration: 15
	}).jFade({
		trigger: "mouseout",
		property: 'border-color',
		start: 'C90202',
		end: 'ffffff',
		steps: 25,
		duration: 15
	});
		
	$("#shops-teaser-list li img.active").jFade({
		trigger: "mouseover",
		property: 'border-color',
		start: 'C90202',
		end: 'C90202',
		steps: 25,
		duration: 15
	}).jFade({
		trigger: "mouseout",
		property: 'border-color',
		start: 'C90202',
		end: 'C90202',
		steps: 25,
		duration: 20
	});	
}


