// JavaScript KLEIDARIA


$(function(){	
	
	//Configure jquery plugin supersized integration
	$.fn.supersized.options = {  
			startwidth: 1024,  
			startheight: 768,
			vertical_center: 1,
			slideshow: 1,
			navigation: 0,
			transition: 1, //0-None, 1-Fade, 2-slide top, 3-slide right, 4-slide bottom, 5-slide left
			pause_hover: 1,
			slide_counter: 1,
			slide_captions: 1,
			slide_interval: 10000
		};
     $('#supersize').supersized();
	 
	 $("#supersize_layer").css("height", $("#supersize").height()+"px");
	 $("#supersize_layer").css("width", $("#supersize").width()+"px");
	 
	 
	 
	 //Configure tipTip
	 $(".tiptip").tipTip({
        maxWidth: "auto",
        edgeOffset: 5,
        defaultPosition: "top",
        fadeIn: 200,
        fadeOut: 300,
        delay: 50
    });
	 
	 //Cufon setup
	 Cufon.set('fontStretch', '95%');
     Cufon.replace('.cufon, .window-title', { fontFamily: 'Ch Freeset', hover: true });
	 
		
});

//Window animation slide left
function windowAnimationLeft(){
	$("#window").css("left", $("#window").width() * (-1));
	$("#window").css("top", ($(window).height()-$("#window").height())/2+20 + "px");
	$("#window").stop().animate({ left: "0px" }, 500);
}
//Window animation slide right
function windowAnimationRight(){
	$("#window").css("right", $("#window").width() * (-1));
	$("#window").css("top", ($(window).height()-$("#window").height())/2+20 + "px");
	$("#window").stop().animate({ right: "0px" }, 500);
}
//Window animation fade in center
function windowAnimationCenter(){
	$("#window").css("opacity", 0);
	$("#window").css("left", ($(window).width()-$("#window").width())/2 + "px");
	$("#window").css("top", ($(window).height()-$("#window").height())/2+20 + "px");
	$("#window").stop().animate({ opacity: "1" }, 1000);
}

function reloadScrollEvent(){
	 //content container scroll button up
	$(" a#icon_up").click(function () {
		 setPositionContent(1);
	 });
	 $("a#icon_up").mouseover(function () {
		 setPositionContent(1);
	 });
	 
	 //content container scroll button down
	 $("a#icon_down").click(function () {
		 setPositionContent(-1);
	 });
	 $("a#icon_down").mouseover(function () {
		 setPositionContent(-1);
	 });
	 
	 //content container bind mousewheel
	 $('div#content_container').mousewheel(function(event, delta) {
			setPositionContent(delta);
			event.stopPropagation();				
			event.preventDefault();		 
	 });
	 
	 //JCAPTION
	 /*$('#content_container img').jcaption({
		copyStyle: true,
		animate: true,
		show: {height: "show"},
		hide: {height: "hide"}
	});*/

}


function setPositionContent(delta) {
	sym = "+";
	if (delta > 0) {
		sym = "-";
	}
	$('#content_container').stop().animate({ scrollTop: sym + "=200" }, 1000);
}
