﻿jQuery(document).ready(function(){

	$('.post img').imghover();
	$('.item img').imghover();

	var animateSpeed = 500;	
	// init and stop the inner slideshows
	$('#block1').cycle({
		fx: 'scrollUp',
		timeout: 12000,
		delay: -12000,
		before: function() {
			removeHighlight('#link2');
			removeHighlight('#link3');
			addHighlight('#link1');
		}
	});
	
	$('#block2').cycle({
		fx: 'scrollUp',
		timeout: 12000,
		delay: -8000,
		before: function() {
			removeHighlight('#link1');
			removeHighlight('#link3');
			addHighlight('#link2');
		}
	});
	
	$('#block3').cycle({
		fx: 'scrollUp',
		timeout: 12000,
		delay: -4000,
		before: function() {
			removeHighlight('#link2');
			removeHighlight('#link1');
			addHighlight('#link3');
		}
	});
	
	$('.elementrotater').cycle({
		fx: 'scrollHorz',
		timeout: 0
	});
	
	$('.rotater').cycle({
		fx: 'scrollHorz',
		timeout: 4000
	});
	
	$('.rotaterItems').cycle({
		fx: 'fade',
		timeout: 6000
	});
	
	/*
	$("#buttonvimeo").click(function(){
		$( "#vimeo" ).animate({
			height: "410px", opacity: 1
		}, { duration: 500, queue: false });
		$( "#facebook" ).animate({
			height: "0px", opacity: 1
		}, { duration: 500, queue: false });
	});
	*/
	
	$("#buttonfacebook").click(function(){
		$( "#facebook" ).animate({
			height: "460px", opacity: 1
		}, { duration: 500, queue: false });
		/*$( "#vimeo" ).animate({
			height: "0px", opacity: 1
		}, { duration: 500, queue: false });*/
	});
	
	/*
	$("#closevimeo").click(function(){
		$( "#vimeo" ).animate({
			height: "0px", opacity: 1
		}, { duration: 500, queue: false });
	});
	*/
	
	$("#closefacebook").click(function(){
		$( "#facebook" ).animate({
			height: "0px", opacity: 1
		}, { duration: 500, queue: false });		
	});	
	
	$(".back").click(function(){
		window.history.back();
	});
});			

function addHighlight(element) {
	var animateSpeed = 500;	
	var curClass = 'element';
	var newClass = 'highlight';
		jQuery(element).removeClass(curClass);
		jQuery(element).addClass(newClass);
	return false;
}

function removeHighlight(element) {
	var animateSpeed = 600;	
	var curClass = 'highlight';
	var newClass = 'element';
		jQuery(element).removeClass(curClass);
		jQuery(element).addClass(newClass);			
	return false;
}
