$(document).ready(function(){ 
	
	// Course booking
	if($('table.course_booking').length) { 
		$('table.course_booking.toggle').hide();
		$('h2.booking_toggle').click(function() { 
			$(this).toggleClass('auf');
			$(this).next('.toggle').slideToggle(500);
		});
	};

	if($('body.startseite').hasClass('tbox') == true) { 
		var tboxAdress = $('a.tbox').attr('href');
		var tboxTitle = $('a.tbox').attr('title');
		tb_show(tboxTitle, tboxAdress, false); 
	};
	
	// Ohne Cycle-Plugin
	if($("#gallery").length) { 
		$.getScript("js_is/gallerie.js");
	};
	
	/* Loginbox */
	$('.loginbox').addClass('slide').parent().before('<a class="loginlink" title="Loginbereich &ouml;ffnen" href="#">Login&nbsp;&raquo;</a>');
	$(".loginlink").click().toggle(function(){
		$('#rechte_spalte:not(:animated), #head form').animate({ marginTop: '125px' }, 'slow', function() { 
			$('.loginbox:not(:animated)').animate({ height: 'show' }, 'slow');
		});
	  }, function() { 
		$('.loginbox:not(:animated)').animate({ height: 'hide' }, 'slow', function() { 
			$('#rechte_spalte:not(:animated), #head form').animate({ marginTop: '0' }, 'slow');
		});
	});
	
	/* Navigation */
 	$('#nav li:last a').addClass('last'); 
	$('body.startseite #nav li:has(>ul) ul li:first-child').addClass('first');
	$('body.startseite #nav li:has(>ul) li:last-child').addClass('last');
	function auf(){ $(this).children('ul').show(); }
	function zu(){ $(this).children('ul').hide(); }
	$('body.startseite #nav li:has(>ul)').hoverIntent({
	   sensitivity: 1, 
	   interval: 30, 
	   over: auf, 
	   timeout: 400, 
	   out: zu 
	});
	
	/* Allgemeines */
	$('table.kurstabelle tr:odd').addClass('wechsel');
	$('table.kurstabelle th:first').addClass('first');
	$('table.kurstabelle').before('<a class="jhw1" title="See January - June" href="#">&laquo;&nbsp;See January - June</a>&nbsp;&nbsp;&nbsp;&nbsp;<a class="jhw2" title="See July - December" href="#">See July - December&nbsp;&raquo;</a>');
	
	$('table.kurstabelle tr').find('td:gt(7), th:gt(7)').css({ display: 'none' });
	$('table.kurstabelle td.title a').attr({ target: '_parent' });	
	$('a.jhw2').click(function() { 
		$('table.kurstabelle tr, table.kurstabelle tr').each(function() { 
			$(this).find('td:gt(1), th:gt(1)').hide();
			$(this).find('td:gt(7), th:gt(7)').show();
		});
		return false;
	});
	
	$('a.jhw1').click(function() { 
		$('table.kurstabelle tr, table.kurstabelle tr').each(function() { 
			$(this).find('td:gt(1), th:gt(1)').hide();
			$(this).find('td:lt(8), th:lt(8)').show();
		});
		return false;
	});
	
	$('table.kurstabelle tr').hover(function() {
		$(this).find('td').addClass('hover');
	  }, function() {
		$(this).find('td').removeClass('hover');
	});
	
	$('select option:odd').addClass('wechsel'); 
	$('#linke_spalte select option:odd').addClass('wechsel'); 
	$('body.startseite #inhalt h2').wrap('<span class="h2wrap"></span>'); 
	$('#inhalt .box:even').addClass('box2');
	
	/* sIFR - Headlines */	
	if(typeof sIFR == "function"){
		sIFR.replaceElement(named({sSelector:"h1.bildueberschrift", sFlashSrc:"sifr/univers.swf", sColor:"#ffffff", sFlashVars:"textalign=right", sCase:"upper", sWmode:"transparent"}));
		sIFR.replaceElement(named({sSelector:"#linke_spalte h3, #rechte_spalte h3", sFlashSrc:"sifr/univers.swf", sColor:"#999999", nPaddingTop:4, nPaddingBottom:2, sFlashVars:"textalign=left", sCase:"upper", sWmode:"transparent"}));
		sIFR.replaceElement(named({sSelector:"h3.bereichheadline", sFlashSrc:"sifr/univers.swf", sColor:"#0035AD", nPaddingTop:5, nPaddingBottom:5, sFlashVars:"textalign=left", sCase:"upper", sWmode:"transparent"}));
		sIFR.replaceElement(named({sSelector:"#inhalt h1", sFlashSrc:"sifr/univers.swf", sColor:"#565656", sFlashVars:"textalign=left", sWmode:"transparent"}));
		//sIFR.replaceElement(named({sSelector:"body.startseite #inhalt h2", sFlashSrc:"sifr/univers.swf", sColor:"#565656", sFlashVars:"textalign=left&offsetTop=2", sCase:"upper",sWmode:"transparent"}));
	};	
});