﻿$(document).ready(function(){
	$(".sp img").each(function() { $(this).css("position", "absolute"); } );
	$(".sp img.out").each(function() {$(this).css({"z-index" : "0"}); } );
	$(".sp img.over").each(function() {$(this).css({"z-index" : "1"}); } );
	//$(".sp img.out").each(function() {$(this).animate({ opacity: 1.0}, 1000 ); } );
	$(".sp img.over").hover(
	function(){
		$(this).animate({ opacity: 0.0}, 500 );
	},
	function () {
		$(this).animate({ opacity: 1.0}, 1000 );
	});
	
	$("#apart img").each(
	function(){
		$(this).animate({ opacity: 0.0}, 0 );
		$(this).animate({ opacity: 0.0}, 300 );
		$(this).animate({ opacity: 1.0}, 1000 );
	});
	
	$(".gallery img").each(
	function(){
		$(this).animate({ opacity: 0.5}, 0 );
	});
	
	$(".gallery img").hover(
	function(){
		$(this).animate({ opacity: 1.0}, 500 );
	},
	function () {
		$(this).animate({ opacity: 0.5}, 1000 );
	});
	
	/*
	$(".gallery img").each(function() { $(this).css("position", "absolute"); } );
	$(".gallery img.out").each(function() {$(this).css({"z-index" : "0"}); } );
	$(".gallery img.over").each(function() {$(this).css({"z-index" : "1"}); } );
	//$(".sp img.out").each(function() {$(this).animate({ opacity: 1.0}, 1000 ); } );
	$(".gallery img.over").hover(
	function(){
		$(this).animate({ opacity: 0.0}, 500 );
	},
	function () {
		$(this).animate({ opacity: 1.0}, 1000 );
	});
	*/
	
	$(".galleryx img").each(function() { $(this).css("position", "absolute"); } );
	$(".galleryx img.out").each(function() {$(this).css({"z-index" : "1"}); } );
	$(".galleryx img.over").each(function() {$(this).css({"z-index" : "0"}); } );
	$(".galleryx img.out").each(function() {$(this).animate({ opacity: 0.0}, 1000 ); } );
	$(".galleryx img.out").hover(
	function(){
		$(this).animate({ opacity: 1.0}, 300 );
	},
	function () {
		$(this).animate({ opacity: 0.0}, 500 );
	});
	
	$("#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 ); } );
		
	$("#news-id").each(function() {$(this).animate({ opacity: 0.0}, 0 ); } );
	$("#news-id").each(function() {$(this).animate({ opacity: 0.1}, 400 ); } );
	$("#news-id").each(function() {$(this).animate({ opacity: 1.0}, 1200 ); } );
		
	$("#o_nas_logo").each(function() {$(this).animate({ opacity: 0.0}, 0 ); } );
	$("#o_nas_logo").each(function() {$(this).animate({ opacity: 1.0}, 600 ); } );
	
	$("#klienci-logo").each(function() {$(this).animate({ opacity: 0.0}, 0 ); } );
	$("#klienci-logo").each(function() {$(this).animate({ opacity: 1.0}, 600 ); } );
	
	$("#kontakt-mapa").each(function() {$(this).animate({ opacity: 0.0}, 0 ); } );
	$("#kontakt-mapa").each(function() {$(this).animate({ opacity: 1.0}, 600 ); } );
	
	$("#kontakt-right").each(function() {$(this).animate({ opacity: 0.0}, 0 ); } );
	$("#kontakt-right").each(function() {$(this).animate({ opacity: 1.0}, 600 ); } );

	
	//$("#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
}
