﻿/***************************/
$(document).ready(function() { $('.backtotop').click(function(){ $('html, body').animate({scrollTop:0}, 'fast'); return false; }); });				
/***************************/
$(function($) {
	   
    $('.jclock').jclock();
	$('#poll').jqTransform();
	$('#register').jqTransform();
	$('#profile_action').jqTransform();
	$('#profile_action_logout').jqTransform();
	$('#_action_gallery').jqTransform();
	$('#_action_gallery2').jqTransform();
	$('#karpikForm').jqTransform();
	$('#commentForm').jqTransform();
	$('#form').jqTransform();
	$('#edit-profil').jqTransform();
	$('#edit-gallery').jqTransform();
	$('#send-mail').jqTransform();
	$('#send-reply').jqTransform();
});
/***************************/
function checkscript(fObj) {
	for (i=0;i<fObj.elements.length;i++) {
		box = fObj.elements[i];
		if (!box.value) {
			alert('Nie wypełniłeś pola ' + box.id + '!');
			box.focus()
			return false;
		}
	}
	return true;
}
/***************************/
$(document).ready(
				function(){
					$('div#profil-gallery-slide').innerfade({
						animationtype: 'slide',
						speed: 1000,
						timeout: 3000,
						type: 'sequence',
						containerheight: '110px'
					});				
});
/***************************/
function msg_usun () {
 return confirm("Informacja!\n\nCzy na pewno chcesz usunąć?");
}
/***************************/
function div_visibility(name)
{	
		if(document.getElementById(name).style.display == 'block')
		{
			document.getElementById(name).style.display = 'none';
		}
		else
		{
			document.getElementById(name).style.display = 'block';
		}	
}
/***************************/
$(document).ready(function() {
			$("a[rel=group]").fancybox({
				'transitionIn':'elastic',
				'transitionOut':'elastic',
				'titlePosition':'over',
				'easingIn':'easeOutBack',
				'easingOut':'easeInBack',
				'zoomSpeedIn':300,
				'zoomSpeedOut':300,
				'overlayShow':false,
				'hideOnContentClick': true
			});
			$("#addButton").fancybox({
				'transitionIn':'fade',
				'transitionOut':'fade',
				'easingIn':'easeOutBack',
				'easingOut':'easeInBack',
				'zoomSpeedIn':300,
				'zoomSpeedOut':300,
				'overlayShow':false,
				'autoScale':true
			});
			$(".view").fancybox({
				'transitionIn':'elastic',
				'transitionOut':'elastic',
				'easingIn':'easeOutBack',
				'easingOut':'easeInBack',
				'showNavArrows':false,
				'zoomSpeedIn':200,
				'zoomSpeedOut':300,
				'overlayShow':false,
				'autoScale':true,
				'scrolling': 'no'
			});
			$(".zoom").fancybox({
				'titlePosition'  : 'over',
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic',
				'easingIn'      : 'easeOutBack',
				'easingOut'     : 'easeInBack',
				'overlayShow':false,
				'hideOnContentClick': true
			});
			$("a[href$=.jpg],a[href$=.JPG],a[href$=.png],a[href$=.gif]").attr('rel', 'gallery').fancybox({'titlePosition':'over','transitionIn':'elastic','transitionOut':'elastic','easingIn':'easeOutBack','easingOut':'easeInBack','overlayShow':false,'hideOnContentClick':true});
});
/***************************/
function zliczaj_znaki(){
	if(document.dodawanie.tresc.value.length<501)	{
		a=document.dodawanie.tresc.value.length;
		b=500;
		limit = document.getElementById("limit");
		c=b-a;
		var d=c;
		limit.innerHTML = "Pozostało " + d + " znaków.";
	}
	else{
		alert('Przekroczono dozwoloną ilość znaków !');
	}
}
/***************************/
$(document).ready(function(){	
	$('.serviceFlip').bind("click",function(){		
		var elem = $(this);		
		if(elem.data('flipped'))
		{			
			elem.revertFlip();
			elem.data('flipped',false)
		}
		else
		{			
			elem.flip({
				direction:'lr',
				speed: 350,
				onBefore: function(){					
				elem.html(elem.siblings('.serviceData').html());
				}
			});
			elem.data('flipped',true);
		}
	});
	$('.shopFlip').bind("click",function(){		
		var elem = $(this);		
		if(elem.data('flipped'))
		{			
			elem.revertFlip();
			elem.data('flipped',false)
		}
		else
		{			
			elem.flip({
				direction:'tb',
				speed: 350,
				onBefore: function(){					
				elem.html(elem.siblings('.shopData').html());
				}
			});
			elem.data('flipped',true);
		}
	});
});
/***************************/
function box(name){
	var box = $("#"+name);
	box.fadeIn(2000);
}
