$(document).ready(function() {

	/*** Cycle Posts ***/
	$('#slideshow').cycle({
		fx:			'scrollHorz',
		timeout:	4000,
		prev:		'#prev',
		next:		'#next',
		pause:		1,
		easing:		'easeInOutQuart',
		speed:		1500,
		pager:		'#nav'
	});


	/*** lavaLamp Slider ***/
	// Footer
	$(function() { $(".lavaLamp").lavaLamp({ fx: "easeOutQuart", speed: 2000 })});

	// Header
	// $(function() { $("#access ul.menu").lavaLamp({ fx: "easeOutQuart", speed: 500 })});


	/*** TAB-Content ***/
	//When page loads...
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content

	//On Click Event
	$("ul.tabs li").click(function() {

		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});


	/*** AJAX Conact Form ***/
	// SUCCESS AJAX CALL, replace "success: false," by:     success : function() { callSuccessFunction() },
	$("#form").validationEngine({
		ajaxSubmit: true,
			ajaxSubmitFile: "/wp-content/themes/falkimmo/ajaxSubmit.php",
			ajaxSubmitMessage: "Vielen Dank, wir werden uns bei Ihnen melden!",
		success : false,
		failure : function() {}
	})


	/*** GALLERY ***/
	//Larger thumbnail preview 
	$("ul.thumb li").hover(function() {
		$(this).css({'z-index' : '100'});
		$(this).find('img').addClass("hover").stop()
			.animate({
				/*'easeInQuart'	: 'elastic',
				'easeOutQuart'	: 'elastic',*/
				marginTop: '-90px', 
				marginLeft: '-90px', 
				top: '50%', 
				left: '50%', 
				width: '180px', 
				height: '180px'/*,
				padding: '3px'*/
			}, 200);

		} , function() {
		$(this).css({'z-index' : '0'});
		$(this).find('img').removeClass("hover").stop()
			.animate({
				marginTop: '0', 
				marginLeft: '0',
				top: '0', 
				left: '0', 
				width: '100px', 
				height: '100px'/*, 
				padding: '2px'*/
			}, 400);
	});


	/*** FANCYBOX ***/
	$("a[rel=group]").fancybox({
		'overlayShow'	: true,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'titlePosition' 	: 'inside',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Bild ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});


	/*** Smooth Scroll ***/
	// Alle internen Links auswŠhlen
	$("div.top a[href*=#],").bind("click", function(event) {
		// Standard Verhalten unterdrŸcken
		event.preventDefault();
		// Linkziel in Variable schreiben
		var ziel = $(this).attr("href");
		//Scrollen der Seite animieren, body benštigt fŸr Safari
		$('body,html').animate({
			//Zum Ziel scrollen (Variable)
			scrollTop: $(ziel).offset().top
		// Dauer der Animation und Callbackfunktion die nach der Animation aufgerufen wird, sie stellt das Standardverhalten wieder her und ergŠnzt die URL
		}, 500 , function (){location.hash = ziel;});
	});


	/*** Zoom Header Font-Size ***/
	var oldSize = parseFloat($("#menu-main li a").css('font-size'));
	var newSize = oldSize * 1.2;
	$("#menu-main li:not(.current-menu-item,.current-post-ancestor) a").hover(
		function() {
			$("#menu-main li a:hover").animate({ fontSize: newSize}, 200);
		},
		function() {
			$("#menu-main li a").animate({ fontSize: oldSize}, 200);
		}
	);


	/*** AddThis ***/
	var addthis_config = {"data_track_clickback":true};


});
