$(document).ready(function() {
        $('#mainnavigation > li').hover(function() {
                var theElement = this;var sum = 45;var haveToAdd = true;
                $(this).parent().children().each(function() {
                    if (this == theElement) { haveToAdd = false; }
                    if (haveToAdd) { sum += $(this).width() + parseInt($(this).css("padding-right")); }
                });
                $(this).find('ul').css("left", sum);
                if ($(this).find('ul').width() != null) {
                    if ($(this).find('ul').width() < $(this).width()) { $(this).find('ul').css("width", $(this).width());$(this).find('ul li > a').css("width", $(this).width() - parseInt($(this).css("padding-right"))); }
                    else { $(this).find('ul li > a').css("width", $(this).find('ul').width() - parseInt($(this).css("padding-right"))); }
                    if ($.browser.opera) {
                        $(this).find('ul').css("width", '200');
                    }
                }
                $(this).find('ul').show();
        }, function() { $(this).find('ul').hide(); });
        if (!parent.musicPage) {
            $('#metanavigation > li').each(function() {
                if (($(this).text().substr(0, 5) == 'musik') || ($(this).text().substr(0, 5) == 'music') || ($(this).text().substr(0, 5) == 'allum') || ($(this).text().substr(0, 3) == 'arr')) {
                    $(this).hide();
                }
            });
        }
});

function toggleMusic(caller) {
    try {
        if (parent.musicPage) {
            parent.musicPage.document.getElementById('thePlayer').sendEvent('PLAY');
            if ($(caller).text() == 'musik aus') newText = 'musik an';
            if ($(caller).text() == 'musik an') newText = 'musik aus';
            if ($(caller).text() == 'music off') newText = 'music on';
            if ($(caller).text() == 'music on') newText = 'music off';
            if ($(caller).text() == 'arręter la musique') newText = 'allumer la musique';
            if ($(caller).text() == 'allumer la musique') newText = 'arręter la musique';
            
            $(caller).text(newText);
        }
    } catch (e) {
    }
	return false;
}

function deleteFromBasket(num) {
        $(":input").each(function() {
                if ($(this).attr("name") == 'tx_simpleshop_pi2[productCount][' + num + ']') {
                    $(this).attr('value', 0);
                    $('form').submit();
                }
        });
        return false;
}
