/* Variables for values in textfields */
var active_color = '#80766A'; // Colour of user provided text
var inactive_color = '#d2ccc4'; // Colour of default text

$(document).ready(function() {
    if ($('.langselect, .searchselect').length > 0) {
        // Styled selectboxes - see jquery.stylish-select.min.js
        $('.langselect, .searchselect').sSelect();
    }

    // main navigation dropdown
    $("ul.topnav li").hover(function() {
        $(this).addClass("hover");
        $('div', this).addClass("hover");
        var width = $('ul:first', this).parent().outerWidth();
        $('ul:first', this).css('min-width', width);
        if ($.browser.msie && $.browser.version == "6.0") {
            $('ul:first', this).css('width', width);
        };
        $('ul:first', this).css('display', 'block');
    }, function() {
        $(this).removeClass("hover");
        $('div', this).removeClass("hover")
        $('ul:first', this).css('display', 'none');
    });

    // Values in textfields
    $("input.search-main-text").css("color", inactive_color);
    var default_values = new Array();

    $("input.search-main-submit").click(function(event) {

        if (default_values[$("input.search-main-text").attr('id')] != undefined) {
            if (($("input.search-main-text").val() != default_values[$("input.search-main-text").attr('id')]) && ($("input.search-main-text").val() != '')) {
                $("#searchctrlPostback").val("1");
                return true;
            }
        }
        return false;
    });

    $("input.search-main-text").keydown(function(event) {

        if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {
            if ((this.value != default_values[this.id]) && (this.value != '')) {
                $("input.search-main-submit").click();
                return true;
            }
        }
    });

    $("input.search-main-text").focus(function() {
        if (!default_values[this.id]) {
            default_values[this.id] = this.value;
        }
        if (this.value == default_values[this.id]) {
            this.value = '';
            this.style.color = active_color;
        }
        $(this).blur(function() {
            if (this.value == '') {
                this.style.color = inactive_color;
                this.value = default_values[this.id];
            }
        });
    });

    if ($('.slider').length > 0) {

        $('.slider').bxSlider({         //slider
            mode: 'slide',
            speed: 250,
            width: 350,
            wrapper_class: 'sliderWrap',
            prev_text: '',
            next_text: '',
            showZoom: true
        });
    }

   

    if ($(".detailInformation").length > 0) {
        // When page loads...
        $(".detailInformation div").hide(); //Hide all content
        $("ul.detailTabs li:first").addClass("active").show(); //Activate first tab
        $(".detailInformation div:first").show(); //Show first tab content

        // On Click Event
        $("ul.detailTabs li.custom").click(function() {
            $("ul.detailTabs li").removeClass("active"); //Remove any "active" class
            $(this).addClass("active"); //Add "active" class to selected tab
            $(".detailInformation div").hide(); //Hide all tab content

            var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
            $(activeTab).fadeIn(); //Fade in the active ID content
            return false;
        });
    }
});
function SetAnchorForProductInfo() {
    $(".detailInformation div").hide(); //Hide all content
    $("ul.detailTabs li").removeClass("active"); //Remove any "active" class
    $("ul.detailTabs li:first").addClass("active").show(); //Activate first tab
    $(".detailInformation div:first").show(); //Show first tab content
}