	$.ajaxSetup({
		cache: false
	});
	$(document).ready(function()
	{
	
		loadingzor=[
			/* NIE ZMIENIAC LINIJEK PONIZEJ */
			"OH NOES!",
			"Combusken matko boska!",
			"Kliknij tu szybko!!",
			"A dasz mi pokemoncia?"
		]
		$("div.signature div.sig, div.profileWiecej div.wiecej").hide();
		$("input#signatureEdit").parent().hide(); 

		$("div.profileWiecej img.rozwijacz").click(function(){
			$(this).parent().parent().find("div.wiecej").slideToggle('medium');
		});
		
		$("div.signature img.rozwijacz").click(function(){
			x=$(this).parent().parent().find(".sig");
			y=$(this).parent().parent();
			uid=y.attr('id').split('_')[1];
			
			if(x.hasClass('loaded'))
			{
				x.slideToggle('slow');
			}
			else
			{
				x.html('<div align="center"><img src="templates/subRevival/images/loading-ajax.gif" alt="Loading" /><br /> <span style="font-size: 1.2em; font-weight: bold">'+loadingzor[Math.floor(Math.random()*loadingzor.length)]+'</span></div>').slideDown('fast', function(){
					$.get('ajax.php?uid='+uid, function(data){
						x.slideUp('slow', function(){ $("div#sig_"+uid+" div.sig").html(data); x.slideDown('slow'); });
					});
					$("div#sig_"+uid+" div.sig").addClass('loaded');
				});
			}
		});
		
		$("input#signaturePreview").click(function(){
			var date=new Date;
			uid=$("input[name='user_id']").attr('value');
			$("div#preview").html('<div align="center"><img src="templates/subRevival/images/loading-ajax.gif" alt="Loading" /> <b>'+loadingzor[Math.floor(Math.random()*loadingzor.length)]+'</b>').fadeIn('slow');
			$.post('ajax.php?mode=preview&uid='+uid+'&t='+date.valueOf(), { date: date.valueOf(), sig: $("textarea[name='signature']").attr('value') }, function(data){
                $("body").append('<div id="light" style="display:none;position:fixed;top:10%;left:20%;bottom:10%;width:60%;height:70%;padding:16px;border:5px solid #8B8B8B;background-color:#E4E5EB;z-index:1002;overflow:auto;">'+data+'</div><div id="fade" style="display: none;position: fixed;top: 0%;left: 0%;width: 100%;height: 100%;background-color: black;z-index:1001;-moz-opacity: 0.8;opacity:.80;filter: alpha(opacity=80);"><!-- penis --></div>');
				$("div#preview").hide();
				$("div#light, div#fade").fadeIn('slow');
				$("div#fade").click(function(){
					$("div#light, div#fade").fadeOut('slow', function(){ $(this).remove(); });
				});
			});
		});
	}); 
