$(function() {
	$('#telefondiv').hide();
    var current_tab = 'b1';
    
    $('#contact').hide();
    $('#player_div').hide();
    $('.default').hide();
    $('#content1').show();
    $('#phone').hide();
    
    switch(screen.width)
    {
        case 800:$('#bandImage').attr('src','images/maestral_800.png');break;
        case 1024:$('#bandImage').attr('src','images/maestral_1024.png');break;
        case 1280:$('#bandImage').attr('src','images/maestral_1280.png');break;
        default:$('#bandImage').attr('src','images/maestral_big.png');break;
    }

    $('#b1').hover(
        function(){
            $(this).attr('src','images/button_oferta_hover.png');
            if(!$.browser.msie) {
                $(this).animate({paddingLeft:'3px'}, {duration:200});
            }
        },
        function(){
            $(this).attr('src','images/button_oferta.png');
            if(!$.browser.msie) {
              $(this).animate({paddingLeft:'0px'}, {duration:200});
            }
        });

    $('#b2').hover(
        function(){
            $(this).attr('src','images/button_posluchaj_nas_hover.png');
            if(!$.browser.msie) {
                $(this).animate({paddingLeft:'3px'}, {duration:200});
            }
        },
        function(){
            $(this).attr('src','images/button_posluchaj_nas.png');
            if(!$.browser.msie) {
                $(this).animate({paddingLeft:'0px'}, {duration:200});
            }
        });

    $('#b3').hover(
        function(){
            $(this).attr('src','images/button_klipy_hover.png');
            if(!$.browser.msie) {
                $(this).animate({paddingLeft:'3px'}, {duration:200});
            }
        },
        function(){
            $(this).attr('src','images/button_klipy.png');
            if(!$.browser.msie) {
                $(this).animate({paddingLeft:'0px', paddingLeft: '0px'}, {duration:200});
            }
        });

    $('#b4').hover(
        function(){
            $(this).attr('src','images/button_galeria_hover.png');
            if(!$.browser.msie) {
                $(this).animate({paddingLeft: '3px'}, {duration:200});
            }
        },
        function(){
            $(this).attr('src','images/button_galeria.png');
            if(!$.browser.msie) {
                $(this).animate({paddingLeft: '0px'}, {duration:200});
            }
        });

    $('#b5').hover(
        function(){
            $(this).attr('src','images/button_przyjaciele_hover.png');
            if(!$.browser.msie) {
                $(this).animate({paddingLeft: '3px'}, {duration:200});
            }
        },
        function(){
            $(this).attr('src','images/button_przyjaciele.png');
            if(!$.browser.msie) {
                $(this).animate({paddingLeft: '0px'}, {duration:200});
            }
        });

    $('#b6').hover(
        function(){
            $(this).attr('src','images/button_kontakt_hover.png');
            if(!$.browser.msie) {
                $(this).animate({paddingLeft: '3px'}, {duration:200});
            }
        },
        function(){
            $(this).attr('src','images/button_kontakt.png');
            if(!$.browser.msie) {
                $(this).animate({paddingLeft: '0px'}, {duration:200});
            }
        });

    $('#phone').hover(
        function() {
            $(this).animate({'right': '0px'}, {duration:500});
        },
        function() {
            $(this).animate({'right': '-120px'}, {duration:500});
        }
    );

	$('#b1').click(function(){
		$('.default').fadeOut(0);
        $('#content1').fadeIn(1000);
        current_tab = 'b1';                
	});
	
	$('#b2').click(function(){
		$('#player_div').fadeIn(500).show();
        $('#player_div').draggable();
        current_tab = 'b2';                
	});
	
	$('#b3').click(function(){
        $('.default').fadeOut(0);
        $('#content3_ch').fadeIn(1000);
        current_tab = 'b3';           
	});
	
	$('#b4').click(function(){
		$('.default').fadeOut(0);
        $('#content4').fadeIn(1000);
        current_tab = 'b4';                
	});
	
	$('#b5').click(function(){
		$('.default').fadeOut(0);
        $('#content5').fadeIn(1000);
        current_tab = 'b5';                
	});
	
	$('#b6').click(function(){
		$('#contact').fadeIn(500).show();
        $('#contact').draggable();               
	});
	/*
    $('.menuLink').click(function(){

        switch($(this).attr('id'))
        {
            case 'b1':
                if (current_tab != 'b1') {
                    $('.default').fadeOut(0);
                    $('#content1').fadeIn(1000);
                    current_tab = 'b1';
                }
                break;
            case 'b2':
                $('#player_div').fadeIn(500).show();
                $('#player_div').draggable();
                break;
            case 'b3':
                if (current_tab != 'b3') {
                    $('.default').fadeOut(0);
                    $('#content3').fadeIn(1000);
                    current_tab = 'b3';
                }
                break;
            case 'b4':
                if (current_tab != 'b4') {
                    $('.default').fadeOut(0);
                    $('#content4').fadeIn(1000);
                    current_tab = 'b4';
                }
                break;
            case 'b5':
                if (current_tab != 'b5') {
                    $('.default').fadeOut(0);
                    $('#content5').fadeIn(1000);
                    current_tab = 'b5';
                }
                break;
            case 'b6':
                $('#contact').fadeIn(500).show();
                $('#contact').draggable();
                break;
        }
    });*/

    $('#contactClose').click(function(){$('#contact').fadeOut().hide();});
    $('#playerClose').click(function(){$('#player_div').fadeOut().hide();});

    $("#content4 a[rel^='prettyPhoto']").prettyPhoto({animationSpeed:'fast',slideshow:4000});
    $("#content3_ch a[rel^='prettyPhoto']").prettyPhoto({animationSpeed:'fast',slideshow:4000, opacity:0});

/*    $('table.gallery img').mouseover(function(){
	var s = $(this).attr('src');     
	var b = s.replace('m', 's');
	$('div#popup img').attr('src',b)
	$('div#popup').fadeIn(600);
    }).mouseout(function(){
        $('div#popup').hide();
    }).mousemove(function(e){
        $('div#popup').css('left',e.pageX +10);
        $('div#popup').css('top',e.pageY +10);
    }); */
});

$(window).load(function(){
    $('#preloader').fadeOut('slow',function(){
        $(this).remove();
        $('#phone').show();
		$('#telefondiv').show();
    });
});
