// jQuery
$(document).ready(function(){
	// general hover
	$(".opacity").hover(function(){
		$(this).stop().fadeTo(200,0.7);
	},function(){
		$(this).stop().fadeTo(200,1.0);
	});
	// fade in
	$(".hide-n-seek").fadeIn(500);
	// fancybox
	$("a[rel*=fb-group]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'overlayOpacity'	: 0.8,
		'overlayColor'		: '#000000',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Bild ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});
	$(".fancybox").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'none',
		'overlayOpacity'	: 0.8,
		'overlayColor'		: '#000000'
	});
	// accordion
	$(".accordion").addClass("ui-accordion ui-accordion-icons ui-widget ui-helper-reset").find("h3").addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-top ui-corner-bottom").hover(function(){
		$(this).toggleClass("ui-state-hover");
	}).prepend('<span class="ui-icon ui-icon-triangle-1-e"></span>').click(function(){
		$(this).toggleClass("ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom").find("> .ui-icon").toggleClass("ui-icon-triangle-1-e ui-icon-triangle-1-s").end().next().toggleClass("ui-accordion-content-active").slideToggle();
		return false;
	}).next().addClass("ui-accordion-content  ui-helper-reset ui-widget-content ui-corner-bottom").hide();
	//forms
	$("form[class*=list],#newsletter").click(function(){
		var divId = '#'+$(this).attr('id');
		var loader = $('<div><img src="_img/loader.gif" width="16" height="11" alt="loading..." /></div>').css({ padding : "5px 157px 5px 157px", position : "absolute", width : "16px", height : "11px", background : "#fff" }).appendTo(divId).hide();
		$(divId).ajaxStart(function(){
			loader.show();
		}).ajaxStop(function(){
			loader.hide();
		}).ajaxError(function(a, b, e){
			throw e;
		});
		var v = $(divId).validate({
			submitHandler:function(divId){
				$(divId).ajaxSubmit({
					target: $(divId)
				});
			}
		});
	});
});
$(window).load(function(){
});
$(window).resize(function(){
});
// JW Player
function createAudioPlayer(playerFile, playerId, playerStart, playerWidth){
	jwplayer(playerId).setup({
		flashplayer: "_swf/player.swf",
		skin: "_swf/esance.zip",
		file: playerFile,
		autostart: playerStart,
		width: playerWidth,
		height: 102,
		controlbar: 'top',
		playlist: 'bottom'
	});
}
function createMoviePlayer(playerFile, playerId, playerImage, playerStart, playerWidth, playerHeight){
	jwplayer(playerId).setup({
		flashplayer: "_swf/player.swf",
		skin: "_swf/esance.zip",
		file: playerFile,
		image: playerImage,
		autostart: playerStart,
		width: playerWidth,
		height: playerHeight,
		controlbar: 'over',
		playlist: 'none'
	});
}
// Form Funcs
function clickclear(thisfield,defaulttext){ if(thisfield.value == defaulttext){ thisfield.value = ""; } }
function clickrecall(thisfield,defaulttext){ if(thisfield.value == ""){ thisfield.value = defaulttext; } }

