// lightbox - pretty photo
$(document).ready(function(){
    $("a[rel^='lightbox']").prettyPhoto({deeplinking: false, social_tools:''});
    
    $(".more-full").hide();

    $('p.more-toggle').click(function() {
    	$(this).prev(".more-full").slideToggle(400);
        $(this).children("a").text($(this).text() == 'Více' ? 'Zavřít' : 'Více');
    	$(this).children("a").toggleClass("open");
        return false;
    });
    
    $('#imb-right').hover(
        function() {
            $('#play').addClass('active');
        },
        function() {
            $('#play').removeClass('active');
        }
    );
    
    
    // partner logo
    $('.partners img').hover(
    	function () {
    		$(this).attr('src', $(this).parent().attr('rel'));
    	},
    	function () {
			$(this).attr('src', $(this).parent().attr('rel').replace("th", "bwth"));
    	}
    );
    
    
});

// simple modal - dialog
$(document).ready(function(){
    $("#poslat-emailem").hide();
    $('a#poslat-emailem-link').click(function (e) {
		e.preventDefault();
		$('#poslat-emailem').modal({onOpen: function (dialog) {
        dialog.overlay.fadeIn('slow', function () {
		dialog.data.hide();
		dialog.container.fadeIn('slow', function () {
			dialog.data.show();
		});
	});
}});
	});
	
	$('.icb-box').hover(
		function() {
			$(this).find('h2 a').css('color', '#083ca4');
		},
		function() {
			$(this).find('h2 a').css('color', '#000');
		}	
	);
});

$(document).ready(function(){
   $(".default-value").addDefaultText();
});

/*
$(document).ready(function(){

    $('#ds-in').children().hide();
    $("#tab-"+$("#detail-subpages-header li.act a").attr('rel')).show();

    $("#detail-subpages-header li a").click(function (e) {
        $(this).parent().parent().children().removeClass("act");
        $(this).parent().addClass('act');

        $('#ds-in').children().hide();
        $("#tab-"+$(this).attr('rel')).show();
        return false;
    });
});
*/

$(document).ready(function(){

    $("#detail-subpages-header li a").click(function (e) {
        $(this).parent().parent().children().removeClass("act");
        $(this).parent().addClass('act');

        $('#ds-in').empty().append('<br /><br /><br /><div class="ajax-loader"><img src="/data/files/images/global/ajax-loader.gif" /></div>');
        $("#ds-in").load("/",{"module": "product.tab", "tab": $(this).attr('rel'), "product_id": $("#actual_product").val()}, function () {
            $("a[rel^='lightbox']").prettyPhoto();
            
            $(".more-full").hide();
            $('p.more-toggle').click(function() {
            	$(this).prev(".more-full").slideToggle(400);
                $(this).children("a").text($(this).text() == 'Více' ? 'Zavřít' : 'Více');
            	$(this).children("a").toggleClass("open");
                return false;
            });
            
        });

        return false;
    });
});

$(document).ready(function(){


    $("select.installation").change(function (e) {

        if ($(this).val() == 1) {
            $(this).parent().find('input:submit').val('Do poptávky');
            $(this).parent().find('.price span').text($(this).parent().find('input[name=price1]').val());
            $(this).parent().find('.price_with_dph span').text($(this).parent().find('input[name=price_with_dph1]').val());
            $(this).parent().find('.discount1').hide();
            $(this).parent().find('.discount2').show();
        } else if ($(this).val() == 2) {
            $(this).parent().find('input:submit').val('Do poptávky');
            $(this).parent().find('.price span').text($(this).parent().find('input[name=price2]').val());
            $(this).parent().find('.price_with_dph span').text($(this).parent().find('input[name=price_with_dph2]').val());
            $(this).parent().find('.discount1').hide();
            $(this).parent().find('.discount2').show();
        	
        	$('#soc-bydleni-link').click();
        	
        } else {
            $(this).parent().find('input:submit').val('Do košíku');
            $(this).parent().find('.price span').text($(this).parent().find('input[name=price0]').val());
            $(this).parent().find('.price_with_dph span').text($(this).parent().find('input[name=price_with_dph0]').val());
            $(this).parent().find('.discount2').hide();
            $(this).parent().find('.discount1').show();
            
        }
        return false;
    });
});


$(document).ready(function(){

    $('#header-eshop-login').hide();
    $("a.login-link").toggle(function (e) {
        $('#header-eshop-login').show();
        return false;
    },function (e) {
        $('#header-eshop-login').hide();
        return false;
    }
    );
});


