window.addEvent( 'domready', function() {
									  
	$$( 'body' ).addClass( "mooTools" );
		
		pics=$$('.itemDetails ul.thumbs a');
	if ( pics.length ) {
		
		pics.addEvent( 'click', function() {
			var a=$('photo');
			a.href=$(this).href;
			a.getElement('img').src=$(this).rel;
			return false;
		});
		
	}
		
	currentImageIndex = 0;
	$each( $$( "#submenu ul li a" ), function( el ) {
		
		el.addEvent( 'click', function() {
															  
			var p = $( this ).getParent();
			if( p.hasClass( 'clickable' ) ) return;
			if( p.hasClass( 'collapsed' ) ) {
				p.removeClass( 'collapsed' ).addClass( 'expanded' );
				return false;
			}
			else if( p.hasClass( 'expanded' ) ) {
				p.removeClass( 'expanded' ).addClass( 'collapsed' );
				return false;
			}
		
		});
	
	});
	
	$each( $$( ".itemsOverview .oddItem" ), function( el ) {
	
		c = new Element( 'li', {
						'class': 'clear'
						});
	
		c.inject( el, 'before' );
	
	});
if(Browser.Engine.trident){
       var zIndexNumber = 1000;
       // Put your target element(s) in the selector below!
       $$('div').each(function(el,i){
               el.setStyle('z-index',zIndexNumber);
               zIndexNumber -= 10;
       });
};




	
	$$( ".itemsOverview .pic" ).each( function( pic ) {
	
		pic.setStyle( "z-index", 100 );
	
	});
	
	$$( ".itemsOverview .pic" ).addEvent( "mouseover", function() {
		adres=	$( this ).getElement('a').get( "href" );											
		$( this ).setStyle( "z-index", 1000 );
		thumb = $( this ).getChildren( '.script-enlarge' )[0];
		
		if( thumb.getNext() == null ) {
			
			href = thumb.get( "href" );
			
			myImg = new Element( 'img', {
								 'src': href,
								 'class': 'pic-large',
								 'alt': ''
								} );
			
			myImg.addClass( 'h' );
			myImg.addEvent( "click", function(){
				document.location.href=adres;
			});
			myImg.inject( thumb, 'after' );
			
		}
		
		large = thumb.getNext();		
		large.removeClass( 'h' );
		
	});
	
	$$( ".itemsOverview .pic" ).addEvent( "mouseout", function() {
																
		$( this ).setStyle( "z-index", 100 );
		
		thumb = $( this ).getChildren( '.script-enlarge' )[0];
		
		if( thumb.getNext() != null ) {
		
			large = thumb.getNext();		
			large.addClass( 'h' );
			
		}
		
	});

});


function display_loading () {Loading();}

function hide_loading() {
    destroyLoading();
}

function zaznacz_wszystkie(obiekt) {
	ile=obiekt.length;
	i=0;
	while (i < ile) {
		obiekt.options[i].selected=1;
		i=i+1;
	}

}
function odznacz_wszystkie(obiekt) {
	ile=obiekt.length;
	i=0;
	while (i < ile) {
		obiekt.options[i].selected=0;
		i=i+1;
	}
}
