/*
	--------------------------------
	SITE-SPEZIFISCHE Funktionen
	--------------------------------
*/
	
$(document).ready(function(){
						   

/*------------------------------------------------------
 Allgemeine Dropdownfunktionalität
 ------------------------------------------------------*/
$(".fade").mouseenter(function(){
	clearTimeout($(this).data('ddtimeout'));
	$(".dd").slideDown(300);
	}).mouseleave(function(){
	var mn = this;
	var timeoutId = setTimeout(function(){ $(".dd").slideUp(300);}, 500);
	$(mn).data('ddtimeout', timeoutId);
}); 

/*------------------------------------------------------
 Bühnenfunktionalität
 ------------------------------------------------------*/
$('#imagebox').cycle({
	timeout: 7000,
	speed: 1000,
	fx: 'scrollHorz',
	easing: 'easeInOutCubic',
	prev: '.prev',
	next: '.next',
	pause: 1
}); 

$('.prev, .next').hide();
$("#buehne").hover(function(){$('.prev, .next, .img_descr').fadeIn(500)}, function(){$('.prev, .next, .img_descr').fadeOut(500)});

/*------------------------------------------------------
 Navigationsfunktionalität
 ------------------------------------------------------*/
	$(".nav li").mouseenter(function(){$(this).children('ul').show()});
	$(".nav li").mouseleave(function(){$(this).children('ul').hide()});
			
/*------------------------------------------------------
  Container Links
------------------------------------------------------*/ 
	$(".c_link, .blink, .teaser").bind("click", function(e){
		var hRef = $(this).find('a[href]').first().attr("href");
		if(hRef.charAt(0)=="&" || hRef.charAt(0)=="?") hRef = document.location.href + hRef;
		document.location.href = '/' + hRef; 
		// document.location.href = hRef;
    });
	
/*------------------------------------------------------
  Externe links	 
------------------------------------------------------*/ 
	$('a[href^="http://"]:not([href^="http://ah.frameless.at/"]), a[href$="pdf"]').attr({target: "_blank"});

/*------------------------------------------------------
  Rollofunktionalität	 
------------------------------------------------------*/ 
	$('.pane').hide(); 	$('.accord.active').next('.pane').show();
	
	//auf/zu bei Klick auf dasselbe Objekt
	$('.single.accord').click(function() {
		$(this).toggleClass('active').next('.pane').slideToggle(200); 
	 });
	// auf/zu bei Klick auf anderes Objekt
	$('.accordeon .accord').click(function() { 
		$(this).toggleClass('active').next('.pane').slideToggle(200); 
		/*
		if(!$(this).hasClass('active')){
			$('.accordeon .accord').removeClass('active').next('.pane').slideUp(200);
			$(this).addClass('active').next('.pane').slideDown(200);
			$.scrollTo($(this),{"duration":700,"easing":"swing"})	
		}*/
	});

/*------------------------------------------------------
  Modalboxen
------------------------------------------------------*/
	//$('a[href*=".jpg"], .nyroModal').nyroModal();
	
/*------------------------------------------------------
  Scrollfunktionalität
------------------------------------------------------*/
$.smoothAnchors(1500, "easeInOutSine", false);
	
});
