window.addEvent('domready', function() {

	new InputPlaceholder($('search'), {placeholder: 'Wpisz nazwę płyty lub artystę', color: '#fff'});
	
	var gallery1 = new slideGallery($$("div.gallery")[0], {
		steps: 1,
		mode: "linear",
		duration: 6000,
		linearAlign: true,
		current: 0,
		transition: Fx.Transitions.Expo.easeOut
	});
	
	
	$$("div.gallery a").addEvent('mouseover', function(e){
		if(!e.target.hasClass('prev') && !e.target.hasClass('next'))
		{
			tag = e.target.getParent();
			img = tag.getChildren('img')[0];
			img.set('morph', {duration: 300, transition: Fx.Transitions.Back.easeOut});
			tag.getChildren('div').setStyles({display: 'block', opacity: 0});
			tag.getChildren('div').set('morph', {duration: 300, transition: Fx.Transitions.linear});
			tag.getChildren('div.back').morph({'opacity': '0.85'});
			tag.getChildren('div.text').morph({'opacity': '1.0'});
			img.morph({'height': '200px', 'width' : '200px','margin-left':'5px', 'margin-top' :'5px'});

		}

	});
	$$("div.gallery a").addEvent('mouseout', function(e){
		if(!e.target.hasClass('prev') && !e.target.hasClass('next'))
		{
			tag = e.target.getParent();
			img = tag.getChildren('img')[0];
			img.set('morph', {duration: 300, transition: Fx.Transitions.Back.easeOut});
			tag.getChildren('div').set('morph', {duration: 300, transition: Fx.Transitions.linear});
			tag.getChildren('div.back').morph({'opacity': '0'});
			tag.getChildren('div.text').morph({'opacity': '0'});
			img.morph({'height': '190px','margin-left':'5px', 'width' : '190px', 'margin-top' :'15px'});
		}
	});
	
	$$('.home .regal li').addEvent('click', function(e){
		$$('.home .regal li').each(function(obj){
			obj.removeClass("select");
		});
		if(this.hasClass('top'))
		{
			this.addClass("select");
			$$('.home .rgt .topList div').each(function(obj){
				if(!obj.hasClass("no_hide"))
				{
					if(!obj.hasClass("all"))
					{
						obj.addClass("hide");
					}
					else
					{
						obj.removeClass("hide");
					}
				}
			});
		}
		if(this.hasClass('toppunk'))
		{
			this.addClass("select");
			$$('.home .rgt .topList div').each(function(obj){
				if(!obj.hasClass("no_hide"))
				{
					if(!obj.hasClass("punk"))
					{
						obj.addClass("hide");
					}
					else
					{
						obj.removeClass("hide");
					}
				}
			});
		}
	});
	
});
