
var karta = {
	a:'',
	srcimg:'',
	celsrc:'',
	img:'',
	sw:function(title, ob){
		
		var celsrc = $("#cel").attr("alt");
		
		$("#cel").attr('alt', title);
		ob.title = celsrc;
		
		this.animatecel(ob);
					
		},
	animatecel:function(ob){
		var title = ob.title;
		var title1 = $("#cel").attr('alt');
		var img = $(ob).children()[0];
		//alert(img.className);
		$("#cel").animate({opacity:"hide"},"slow",function(){
		$(this).attr({src:''});	
		karta.animate({src:'up/'+title1}, $("#cel"), Math.random());
			});
		
		$(img).animate({opacity:"hide"},"slow",function(){
		$(img).attr({src:''});	
		karta.animate({src:'upm/'+title}, $(img), Math.random());
			});
		

		},
	animate:function(src, ob, pos){
		var date = new Date();
		var teraz = date.getMilliseconds();
		var potem = date.getMilliseconds()+pos*5;
		potem = potem.toString().split('.');
		potem = parseInt(potem[0]);
		//alert(ob.attr('className')+''+potem);
	
		var i = teraz;
		var t= 0;
		function check(){
			teraz++;
			if(teraz>potem)
			{
				ob.css({display:'none'}).attr(src);
				//$(ob).fadeIn('slow');
				clearInterval(t);
				return;	
			}
			else
			{
				window.status = teraz;
				
			}
			
			}
		t =setInterval(check, 2);
		
			
		
		}
		
	};

