﻿$(document).ready(function(){
	$(".index_img img").each(function() { $(this).css("position", "absolute"); } );
	$(".index_img img.out").each(function() {$(this).css({"z-index" : "0"}); } );
	$(".index_img img.over").each(function() {$(this).css({"z-index" : "-1"}); } );
	$(".index_img img.out").each(function() {$(this).animate({ opacity: 0.0}, 1000 ); } );
	$(".index_img img.out").hover(
	function(){
		$(this).animate({ opacity: 1.0}, 200 );
	},
	function () {
		$(this).animate({ opacity: 0.0}, 1000 );
	});
/*	
	$("#portfolio img").each(function() {$(this).css({"z-index" : "0"}); } );
	$("#portfolio img").each(function() {$(this).animate({ opacity: 0.0}, 0 ); } );
	$("#portfolio img").each(function() {$(this).animate({ opacity: 0.1}, 400 ); } );
	$("#portfolio img").each(function() {$(this).animate({ opacity: 1.0}, 1200 ); } );
*/		

	$("#main").each(function() {
		//$(this).animate({ opacity: 0.0 }, 0 ); 
		//$(this).animate({ opacity: 1.0 }, 2000 ); 
		//$(this).animate({ height: "-=500" }, 0 ); 
		//$(this).animate({ height: "+=500" }, 2000 ); 
		$(this).hide();
		$(this).slideDown(2000);
	} );
	
	$(".expl").each(function() {
		$(this).animate({ opacity: 0.0 }, 0 ); 
		$(this).animate({ opacity: 0.0 }, 1500 ); 
		$(this).animate({ opacity: 1.0 }, 2000 ); 
	});
	
	$(".logo-kontakt img").each(function() {
		$(this).animate({ opacity: 1.0 }, 14000 );
		$(this).animate({ opacity: 0.0 }, 1000 ); 
		$(this).animate({ opacity: 1.0 }, 1000 ); 
	});
	
	$("#loading").each(function() {
	        $("#all").hide(0);
	        $("#all").hide(6000);
	        $("#all").slideDown(6000);
		$("img").animate({ opacity: 0.0 }, 0 ); 
		$(".photo").animate({ opacity: 1.0 }, 2000 );
		$("img").animate({ opacity: 0.0 }, 10000 );
		$("img").animate({ opacity: 1.0 }, 2000 );
		$(this).animate({ opacity: 1.0 }, 3000 ); 
		$(this).animate({ opacity: 0.9 }, 3000 ); 
		$(this).animate({ opacity: 0.0 }, 3000 );		
		$(this).hide(0);		
	} );
	
	//$("#main").each(function() {$(this).animate({ width: '100%', height: '100%', opacity: 0.0}, 0 ); } );
	//$("#main").each(function() {$(this).animate({ width: '100%', height: '100%', opacity: 1.0}, 500 ); } );
	
	
	$('.gallery_demo_unstyled').addClass('gallery_demo'); // adds new class name to maintain degradability
	$('ul.gallery_demo').galleria({
		history   : true, // activates the history object for bookmarking, back-button etc.
		clickNext : true, // helper for making the image clickable
		insert    : '#main_image', // the containing selector for our main image
		onImage   : function(caption,image,thumb) { // let's add some image effects for demonstration purposes
				// fade in the image & caption
			image.css('display','none').fadeIn(1000);
			caption.css('display','none').fadeIn(1000);
				// fetch the thumbnail container
			var _li = thumb.parents('li');
				// fade out inactive thumbnail
			_li.siblings().children('img.selected').fadeTo(500,0.3);
				// fade in active thumbnail
			thumb.fadeTo('fast',1).addClass('selected');
				// add a title for the clickable image
			image.attr('title','');
		},
		onThumb : function(thumb) { // thumbnail effects goes here
				// fetch the thumbnail container
			var _li = thumb.parents('li');
				// if thumbnail is active, fade all the way.
			var _fadeTo = _li.is('.active') ? '1' : '0.3';
				// fade in the thumbnail when finnished loading
			thumb.css({display:'none',opacity:_fadeTo}).fadeIn(1500);
				// hover effects
			thumb.hover(
				function() { thumb.fadeTo('fast',1); },
				function() { _li.not('.active').children('img').fadeTo('fast',0.3); } // don't fade out if the parent is active
			)
		}
	});
	
		$("#jaxform").FormValidate({
			ajax:true,
			validCheck: false,
			phpFile:"/assets/js/send.php"
		});
		
		$("#twitter").hover(
			function()
			{
				$("#twittertt").fadeIn("slow");
			},
			function()
			{
				$("#twittertt").fadeOut("slow");
			});	

});

function move_in(img_name,img_nazwa) {
$(document[img_name]).each(function() {$(this).animate({ opacity: 0.1}, 0 ); } );
document[img_name].src=img_nazwa;
//$("#duzefoto").animate({left: '+=150px'},300);

	//$(document[img_name]).each(function() {$(this).animate({ opacity: 0.1}, 0 ); } );
	//$(document[img_name]).fadeOut(0);
	//$(document[img_name]).attr("src",img_nazwa);
	//$(document[img_name]).fadeIn(1200);
	$(document[img_name]).each(function() {$(this).animate({ opacity: 1.0}, 1000 ); } );
}
function move_out(img_name,img_nazwa) {
document[img_name].src=img_nazwa;
}



featuredcontentglider.init({
	gliderid: "suqoon_project_portfolio", //ID of main glider container
	contentclass: "glidecontent2", //Shared CSS class name of each glider content
	togglerid: "p-select", //ID of toggler container
	remotecontent: "", //Get gliding contents from external file on server? "filename" or "" to disable
	selected: 0, //Default selected content index (0=1st)
	persiststate: true, //Remember last content shown within browser session (true/false)?
	speed: 250, //Glide animation duration (in milliseconds)
	direction: "rightleft", //set direction of glide: "updown", "downup", "leftright", or "rightleft"
	autorotate: false, //Auto rotate contents (true/false)?
	autorotateconfig: [3000, 2] //if auto rotate enabled, set [milliseconds_btw_rotations, cycles_before_stopping]
})

function clearText(input){
	if (input.defaultValue==input.value)
	input.value = ''
}
function restoreText(input){
	if (input.value=='')
	input.value = input.defaultValue
}

