// JavaScript Document
var videoPos = 0;
var fotoPos = 0;

$(function (){
	if (extendAllowed) {
		$('#content').append('<span id="extendPage">+</span>');
		$('#extendPage').click(changeContent);	
	}
	
	ddsmoothmenu.init({
	 mainmenuid: "mainMenu", //menu DIV id
	 orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
	 classname: 'ddsmoothmenu', //class added to menu's outer DIV
	 //customtheme: ["#1c5a80", "#18374a"],
	 contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
	});
	
	$('#showPhoto').click(showThePhoto);
	
	$('#videoCarousel #videoRight').click(function(){
		videoPos = videoPos-130;
		if (videoPos < -3075) {
			videoPos = -3075;
		}
		$('#videoCarousel #videoCarouselItems').animate({left: videoPos + 'px'});
	});
	
	$('#videoCarousel #videoLeft').click(function(){
		videoPos = videoPos+130;
		
		if (videoPos > 0) {
			videoPos = 0;
		}
		$('#videoCarousel #videoCarouselItems').animate({left: videoPos + 'px'});
	});
	
	
	$('#fotoCarousel #videoRight').click(function(){
		fotoPos = fotoPos-130;
		if (fotoPos < -3075) {
			fotoPos = -3075;
		}
		$('#fotoCarousel #videoCarouselItems').animate({left: fotoPos + 'px'});
	});
	
	$('#fotoCarousel #videoLeft').click(function(){
		fotoPos = fotoPos+130;
		
		if (fotoPos > 0) {
			fotoPos = 0;
		}
		$('#fotoCarousel #videoCarouselItems').animate({left: fotoPos + 'px'});
	});
});

var contentIsSmall = true;

function changeContent(){
	if (contentIsSmall) {
		extendContent();
	} else {
		smallerContent();
	}
	
	contentIsSmall = !contentIsSmall;
}

function extendContent() {
//	$('#siteLayer').fadeOut(1000);
	$('#rightColumn').fadeOut(1000);
	setTimeout(function(){
		$('#content').animate({width:'984px'});
		$('h1').animate({width:'995px'});
//		$('#content').css({overflow: 'hidden'}).animate({height:'20px'});
	}, 1000);
	$('#extendPage').html('-');
	//$('#extendPage').click(smallerContent);
}

function smallerContent() {
	$('#content').animate({width:'640px'}, 1000);
	$('h1').animate({width:'651px'}, 1000);
	setTimeout(function(){
		$('#rightColumn').fadeIn(1000);
	}, 1000);
	$('#extendPage').html('+');
	//$('#extendPage').click(extendContent);
}


function activeLogin(){
	$('#loginBox form').show().animate({height: '100px',width: '400px'});
}

var largePhoto = false;

function showThePhoto(){
	if (!largePhoto ) {
		pos = $('#siteLayer').css('height');
		$('#siteLayer').animate({top:'-'+pos}, 2000);
		largePhoto = true;
	} else {
		$('#siteLayer').animate({top:'0px'}, 2000);
		largePhoto = false;
	}
}
