window.addEvent('domready',function() {
	
if ($$('.produkty')!=null)
{
	var Tips1 = new Tips($$('.produkty'));
}
var p=new Array();
$$('.preload img').each(function(img) {
	if (img.getParent().getTag()=='a')
	{
		
		
	}
	img.setStyle('opacity','0');
	var width=img.width;
	var height=img.height;
	if (width==0 || width==null)
	{
	width=img.getStyle('width').toInt();	
	}
	if (width==0 || width==null)
	{
	height=img.getStyle('height').toInt();	
	}
	var el=new Element('div',{'class':'loading', 'styles':{
					   'visibility':'visible',
					   'width':width,
					   'height':height
					   
					   }});
	
	if (img.getStyle('float')=='left' || img.getStyle('float')=='right')
	{
	el.setStyle('float',img.getStyle('float'));	
	}
el.injectBefore(img);
el.adopt(img);
	p.push(img.src);
	
	var i=img.src.lastIndexOf('.');
	if (i!=0)
	{
	var thumb2=img.src.slice(i);
	var thumb1=img.src.slice(0,i);
	var el=new Element('img',{'src':thumb1+'t'+thumb2,
					   'events': {
        'complete': function(){
            p.push(thumb1+'t'+thumb2);	
        }}
					   });
	
	}
	})

new Asset.images(p,{
					  onComplete: function() {
						 $$('.loading').each(function(e) {
							e.getFirst().injectBefore(e);
								 e.remove();}) 
						 $$('.preload img').each(function(img) {
														  
	var parent=img.getParent();
    if (parent!=null)
	{
	parent.setStyle('opacity','1');
	}
	img.effect('opacity',{duration:1500}).start(0,1);
	})
	
												
									
									}
					  })


									})