var pathF = {
    timeReloader: 10000,
    timeTicker: 4000,
    boxNumber: 1,
    tickerNumber: 1,
    intervalHandler: null,
    intervalHandlerTicker: null,

    construct: function () {
        $(function () {
            pathF.nav();
            pathF.nneVersion();
        });
    },
    nneVersion: function () {
        if ($('body').attr('class') == 'nne' && $('body').attr('class') != 'nne-for-homepage') {

            $("h1, h2, h3, h4, div, a, span, strong, li").each(function () {
                if ($(this).css('color') == 'rgb(174, 0, 95)')
                    $(this).css('color', '#002C76');
            });
            $("input").each(function () {
                if (
                   $(this).css('background-color') == 'rgb(172, 1, 97)' ||
                   $(this).css('background-color') == 'rgb(174, 0, 95)' ||
                   $(this).css('background-color') == 'rgb(0, 129, 171)'
                )
                    $(this).css('background-color', '#DA5E17');
            });
			$(".rightMainHeader p").css('color', '#002C76');
			$(".link-blue").css('color', '#002C76');
        }
    },
    characters: function () {

    },
    questions: function () {

        $('textarea').text('');

        jQuery('.input_example3 textarea').show_char_limit(1000, {
            status_element: '.input_example3 .status',
            error_element: '.input_example3',
            status_style: 'chars_typed'
        });

        $(".select1 select").change(function () {
            $('.sub1').addClass("hidden");
            $('.sub2').addClass("hidden");
            $('.sub3').addClass("hidden");
            $('.sub4').addClass("hidden");
            var str = "";
            $(".select1 select option:selected").each(function () {
                str += $(this).attr('value')
            });
            $('.select1-sub' + str).removeClass("hidden");

        })
        $(".select1-sub1 select").change(function () {
            $('.select1-sub1-sub1.sub1').addClass("hidden");
            $('.select1-sub1-sub1.sub2').addClass("hidden");
            $('.select1-sub1-sub1.sub3').addClass("hidden");
            $('.select1-sub1-sub1.sub4').addClass("hidden");
            var str = "";
            $(".select1-sub1 select option:selected").each(function () {
                str += $(this).attr('value');
            });
            $('.select1-sub1-sub1.sub' + str).removeClass("hidden");

        })
        $(".select1-sub1-sub1 select").change(function () {
            //$('.select1-sub1-sub1-sub1.sub1').addClass("hidden");
            //$('.select1-sub1-sub1-sub1.sub2').addClass("hidden");
            //$('.select1-sub1-sub1-sub1.sub3').addClass("hidden");
            //$('.select1-sub1-sub1-sub1.sub4').addClass("hidden");
            //$('.select1-sub1-sub1-sub1.sub11').addClass("hidden");
            //$('.select1-sub1-sub1-sub1.sub22').addClass("hidden");
            var str = $(this).attr('value');
            if (str == "33" || str == "0") {
                if ($('.select1-sub1-sub1-sub1.sub11').is(':visible')) {
                    $('.select1-sub1-sub1-sub1.sub11').addClass("hidden");
                }

            }
            if (str == "44" || str == "55" || str == "0") {
                if ($('.select1-sub1-sub1-sub1.sub1').is(':visible')) {
                    $('.select1-sub1-sub1-sub1.sub1').addClass("hidden");
                }

            }
            $('.select1-sub1-sub1-sub1.sub' + str).removeClass("hidden");
        })

        //$(".select1-sub1-sub1-sub1 input").click( function () {
        //alert($(this).attr('value'));
        //})


        $(".select1-sub1-sub1-sub1 select").change(function () {
            $('.select1-sub1-sub1-sub1-sub1.sub1').addClass("hidden");
            $('.select1-sub1-sub1-sub1-sub1.sub2').addClass("hidden");
            $('.select1-sub1-sub1-sub1-sub1.sub3').addClass("hidden");
            $('.select1-sub1-sub1-sub1-sub1.sub4').addClass("hidden");
            $('.select1-sub1-sub1-sub1-sub1.sub11').addClass("hidden");
            $('.select1-sub1-sub1-sub1-sub1.sub22').addClass("hidden");
            var str = "";
            $(".select1-sub1-sub1-sub1 select option:selected").each(function () {
                str += $(this).attr('value');
            });
            $('.select1-sub1-sub1-sub1-sub1.sub' + str).removeClass("hidden");
        })
        //styling select
        $(function () {

            $('.select1-sub1-sub1.sub1 select').selectmenu({
                style: 'popup',
                width: 230,
                format: addressFormatting
            });

            $('.select1-sub1-sub1.sub1 select').selectmenu({
                style: 'popup',
                width: 230,
                format: addressFormatting
            });

            $('.select1 select').selectmenu({
                style: 'popup',
                width: 230,
                format: addressFormatting
            });

            $('.select1-sub1 select').selectmenu({
                style: 'popup',
                width: 230,

                format: addressFormatting
            });
            $('.select1-sub2 select').selectmenu({
                style: 'popup',
                width: 230,

                format: addressFormatting
            });
            $('.select1-sub3 select').selectmenu({
                style: 'popup',
                width: 230,

                format: addressFormatting
            });
            $('.select1-sub3 select').selectmenu({
                style: 'popup',
                width: 230,

                format: addressFormatting
            });
            $('.select1-sub4 select').selectmenu({
                style: 'popup',
                width: 230,

                format: addressFormatting
            });
            $('.select1-sub1-sub1 sub1').selectmenu({
                style: 'popup',
                width: 230,

                format: addressFormatting
            });
            $('.select1-sub1-sub1-sub1 select').selectmenu({
                style: 'popup',
                width: 230,

                format: addressFormatting
            });
        });
        //a custom format option callback
        var addressFormatting = function (text) {
            var newText = text;
            //array of find replaces
            var findreps = [
            { find: /^([^\-]+) \- /g, rep: '<strong class="ui-selectmenu-item-header">$1</strong>' },
            { find: /([^\|><]+) \| /g, rep: '<strong class="ui-selectmenu-item-content">$1</strong>' },
            { find: /([^\|><\(\)]+) (\()/g, rep: '<strong class="ui-selectmenu-item-content">$1</strong>$2' },
            { find: /([^\|><\(\)]+)$/g, rep: '<strong class="ui-selectmenu-item-content">$1</strong>' },
            { find: /(\([^\|><]+\))$/g, rep: '<strong class="ui-selectmenu-item-footer">$1</strong>' }
            ];

            for (var i in findreps) {
                newText = newText.replace(findreps[i].find, findreps[i].rep);
            }
            return newText;
        }
        /////

    },
    date_picker: function () {

        // date selector
        (function ($) {
            $.fn.inputToSelect = function (options) {
                options = $.extend({
                    years: 100,
                    months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'Septembre', 'October', 'November', 'December'],
                    useLeapYear: true,
                    yearsOverToday: 0,
                    selectClass: '',
                    beforeReplace: function () {
                    },
                    afterReplace: function () {
                    }
                }, options);

                var _private = {
                    days: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
                }

                return this.each(function () {
                    if (jQuery(this).is('input')) {
                        options.beforeReplace();

                        jQuery(this).hide();

                        jQuery(this).wrap('<div class="date_selector_div" />');

                        var _element = this;

                        var parent_div = jQuery(this).parent();
                        var i, d, cd = new Date(); ;
                        if (jQuery(_element).val()) {
                            var vals = jQuery(_element).val().split('-');
                            d = new Date(vals[0], vals[1] - 1, vals[2]);
                        } else {
                            d = new Date();
                        }
                        var year = d.getFullYear();
                        var month = d.getMonth();
                        var day = d.getDate();

                        var currentYear = cd.getFullYear();
                        jQuery(_element).data('month', month);
                        jQuery(_element).data('day', day);

                        jQuery(_element).data('year', year);
                        //month
                        parent_div.append(' <select class="date_selector_month ' + options.selectClass + '" />');
                        for (i = 0; i < 12; i++) {
                            parent_div.find('.date_selector_month').append('<option value="' + i + '">' + options.months[i] + '</option>');
                        }
                        parent_div.find('.date_selector_month').change(function () {
                            parent_div.find('.date_selector_day').empty();
                            for (i = 1; i <= _private.days[jQuery(this).val()]; i++) {
                                parent_div.find('.date_selector_day').append('<option value="' + i + '">' + i + '</option>');
                            }
                            jQuery(_element).data('month', jQuery(this).val());

                            parent_div.find('.date_selector_day').val(jQuery(_element).data('day'));

                            parent_div.find('input').val(jQuery(_element).data('year') +
                            '-' + (parseInt(jQuery(_element).data('month')) + 1) +
                            '-' + jQuery(_element).data('day'));

                            //aktualizacja pola daty
                            $('input.date_input').attr('value', jQuery(_element).data('year') +
                            '-' + (parseInt($('.date_selector_month').attr('value')) + 1) +
                            '-' + $('.date_selector_day').attr('value')
                            );
                            ///

                        });
                        //day
                        parent_div.append('<select class="date_selector_day ' + options.selectClass + '" />');
                        for (i = 1; i <= _private.days[month]; i++) {
                            parent_div.find('.date_selector_day').append('<option value="' + i + '">' + i + '</option>');
                        }
                        parent_div.find('.date_selector_day').change(function () {
                            jQuery(_element).data('day', jQuery(this).val());

                            parent_div.find('input').val(jQuery(_element).data('year') +
                            '-' + (parseInt(jQuery(_element).data('month')) + 1) +
                            '-' + jQuery(_element).data('day'));

                            //aktualizacja pola daty
                            $('input.date_input').attr('value', jQuery(_element).data('year') +
                            '-' + (parseInt(jQuery(_element).data('month')) + 1) +
                            '-' + jQuery(_element).data('day')
                            );
                            ////
                        });
                        //year
                        parent_div.append(' <select class="date_selector_year ' + options.selectClass + '" />');
                        for (i = currentYear + options.yearsOverToday; i > currentYear - options.years; i--) {
                            parent_div.find('.date_selector_year').append('<option value="' + i + '">' + i + '</option>');
                        }
                        parent_div.find('.date_selector_year').change(function () {
                            if (jQuery(this).val() % 4 == 0 && options.useLeapYear) {
                                _private.days[1] = 29;
                            } else {
                                _private.days[1] = 28;
                            }
                            if (jQuery(_element).data('month') == 1) { //is february
                                parent_div.find('.date_selector_day').empty();
                                for (i = 1; i <= _private.days[1]; i++) {
                                    parent_div.find('.date_selector_day').append('<option value="' + i + '">' + i + '</option>');
                                }
                            }
                            jQuery(_element).data('year', jQuery(this).val());

                            parent_div.find('.date_selector_day').val(jQuery(_element).data('day'));

                            parent_div.find('input.date_input').val(jQuery(_element).data('year') +
                            '-' + (parseInt(jQuery(_element).data('month')) + 1) +
                            '-' + jQuery(_element).data('day'));

                            //aktualizacja pola daty
                            $('input.date_input').attr('value', $(this).attr('value') +
                            '-' + (parseInt(jQuery(_element).data('month')) + 1) +
                            '-' + $('.date_selector_day').attr('value')
                            );
                            ///
                        });
                        //set the dates
                        parent_div.find('.date_selector_day').val(day);
                        parent_div.find('.date_selector_month').val(month);
                        parent_div.find('.date_selector_year').val(year);

                        //set the input value
                        parent_div.find('input').val(jQuery(_element).data('year') +
                        '-' + (parseInt(jQuery(_element).data('month')) + 1) +
                        '-' + jQuery(_element).data('day'));

                        //run the function
                        options.afterReplace();
                    }
                });
            };
        })(jQuery);
        $(document).ready(function () {
            $('.date_input').inputToSelect();

        });
    },
    reset_password: function () {
        /// form validation
        var jVal = {

            'password': function () {

                var ele = $('.reset-password .password');
                var pos = ele.offset();

                if (ele.val().length < 1) {
                    jVal.errors = true;

                    ele.removeClass('normal').addClass('wrong');
                } else {
                    nameInfo.removeClass('error').addClass('correct').html('&radic;').show();
                    ele.removeClass('wrong').addClass('normal');
                }
            },
            'confirm_password': function () {

                var ele = $('.reset-password .confirm_password');
                var pos = ele.offset();

                if (ele.val().length < 1) {
                    jVal.errors = true;

                    ele.removeClass('normal').addClass('wrong');
                } else {
                    nameInfo.removeClass('error').addClass('correct').html('&radic;').show();
                    ele.removeClass('wrong').addClass('normal');
                }
            }
        };

        // ====================================================== //

        $('input.submit').click(function () {

            var obj = $.browser.webkit ? $('body') : $('html');
            obj.animate({ scrollTop: $('.reset-password').offset().top }, 750, function () {
                jVal.errors = false;

                jVal.password();
                jVal.confirm_password();
            });
            return false;
        });
        $('.reset-password .password').change(jVal.password);
        $('.reset-password .confirm_password').change(jVal.confirm_password);
        /// end of form validation

    },
    log_in: function () {

        /// form validation
        var jVal = {

            'password': function () {

                var ele = $('.log-in .password');
                var pos = ele.offset();

                if (ele.val().length < 1) {
                    jVal.errors = true;

                    ele.removeClass('normal').addClass('wrong');
                } else {
                    nameInfo.removeClass('error').addClass('correct').html('&radic;').show();
                    ele.removeClass('wrong').addClass('normal');
                }
            },
            'sendIt': function () {
                if (!jVal.errors) {
                    $('.log-in').submit();
                }
            }
        };

        // ====================================================== //

        $('input.log-in').click(function () {

            $('.log-in span.warning').removeClass('hidden')

            var obj = $.browser.webkit ? $('body') : $('html');
            obj.animate({ scrollTop: $('.log-in').offset().top }, 750, function () {
                jVal.errors = false;

                jVal.password();
            });
            return false;
        });
        $('.log-in .password').change(jVal.password);

        /// end of form validation

    },
    sign_up: function () {
        /// form validation
        var jVal = {

            'first_name': function () {

                var ele = $('.sign-up .first-name');
                var pos = ele.offset();

                if (ele.val().length < 1) {
                    jVal.errors = true;

                    ele.removeClass('normal').addClass('wrong');
                } else {
                    nameInfo.removeClass('error').addClass('correct').html('&radic;').show();
                    ele.removeClass('wrong').addClass('normal');
                }
            },
            'sendIt': function () {
                if (!jVal.errors) {
                    $('.sign-up').submit();
                }
            }
        };

        // ====================================================== //

        $('input.sign-up').click(function () {

            $('.sign-up span.warning').removeClass('hidden')

            var obj = $.browser.webkit ? $('body') : $('html');
            obj.animate({ scrollTop: $('.sign-up').offset().top }, 750, function () {
                jVal.errors = false;

                jVal.first_name();
            });
            return false;
        });
        $('.sign-up .first-name').change(jVal.first_name);

        /// end of form validation

    },
    review: function () {

        $('.email-us a.close-filter').click(function () {
            $('.email-us').addClass('hidden');
        });
        $("select.select-product").change(function () {
            var str = "";
            $("select.select-product option:selected").each(function () {
                str += $(this).attr('class');
                $('div.reviewed-product').removeClass("prod*");
                $('div.reviewed-product').addClass(str);

            });
        })
    },
    submit_review: function () {
        /// form validation
        var jVal = {

            'nickname': function () {

                var ele = $('.form1 .nickname');
                var pos = ele.offset();

                if (ele.val().length < 1) {
                    jVal.errors = true;

                    ele.removeClass('normal').addClass('wrong');
                } else {
                    nameInfo.removeClass('error').addClass('correct').html('&radic;').show();
                    ele.removeClass('wrong').addClass('normal');
                }
            },
            'sendIt': function () {
                if (!jVal.errors) {
                    $('.preview-review').submit();
                }
            }
        };

        // ====================================================== //

        $('input.preview-review').click(function () {

            $('.form1 span.warning').removeClass('hidden')

            var obj = $.browser.webkit ? $('body') : $('html');
            obj.animate({ scrollTop: $('.form1 ').offset().top }, 750, function () {
                jVal.errors = false;

                jVal.nickname();
            });
            return false;
        });
        $('.preview-review  .nickname').change(jVal.nickname);

        /// end of form validation

    },
    email_us: function () {
        /// form validation
        var jVal = {

            'first_name': function () {

                var ele = $('.email-us .first-name');
                var pos = ele.offset();

                if (ele.val().length < 1) {
                    jVal.errors = true;

                    ele.removeClass('normal').addClass('wrong');
                } else {
                    nameInfo.removeClass('error').addClass('correct').html('&radic;').show();
                    ele.removeClass('wrong').addClass('normal');
                }
            },
            'sendIt': function () {
                if (!jVal.errors) {
                    $('.email-us').submit();
                }
            }
        };

        // ====================================================== //

        $('input.send-email').click(function () {

            $('.email-us span.warning').removeClass('hidden')

            var obj = $.browser.webkit ? $('body') : $('html');
            obj.animate({ scrollTop: $('.email-us ').offset().top }, 750, function () {
                jVal.errors = false;

                jVal.first_name();
            });
            return false;
        });
        $('.email-us .first-name').change(jVal.first_name);

        /// end of form validation

    },
    review: function () {

        $('.email-us a.close-filter').click(function () {
            $('.email-us').addClass('hidden');
        });
        $("select.select-product").change(function () {
            var str = "";
            $("select.select-product option:selected").each(function () {
                str += $(this).attr('class');
                $('div.reviewed-product').removeClass("prod*");
                $('div.reviewed-product').addClass(str);

            });
        })
    },
    match: function () {

        var $ = jQuery;
        $(document).ready(function () {

            $("#viewer").iviewer(
            {
                src: "i/products/ne1.png",
                update_on_resize: false,
                zoom: 100,
                initCallback: function () {
                    var object = this;
                    $("#in").click(function () {
                        object.zoom_by(1);
                    });
                    $("#out").click(function () {
                        object.zoom_by(-1);
                    });
                    $("#fit").click(function () {
                        object.fit();
                    });
                    $("#orig").click(function () {
                        object.set_zoom(100);
                    });
                    $("#update").click(function () {
                        object.update_container_info();
                    });
                    console.log(this.img_object.display_width); //works*
                    console.log(object.img_object.display_width); //getting undefined.*

                },
                onFinishLoad: function () {
                    $("#viewer").data('viewer').setCoords(-500, -500);
                    //this.setCoords(-0, -500);
                }
                //                       onMouseMove: function(object, coords) { },
                //                       onStartDrag: function(object, coords) { return false; }, //this image will not be dragged
                //                       onDrag: function(object, coords) { }

            });

        });
        $('a.match-link').click(function () {
            $('.wrapper').removeClass('hidden');
        });
        $('a.close-match').click(function () {
            $('.wrapper').addClass('hidden');
        });
    },
    buy_now: function () {

        $('li.level-1').click(function () {

            var a = $(this).attr('id');

            $('.buy-now-list li').removeClass('selected');
            $(this).addClass('selected');

            $('.buy-now-details:not(.' + a + ')').addClass('hidden');
            $('.buy-now-details.' + a).removeClass('hidden');
        });
        $('a.close-filter').click(function () {
            $('.buy-now-list li').removeClass('selected', 1000);
            $('.buy-now-details').addClass('hidden', 1000);
        });
        $('.buy-now-button').click(function () {
            $('div.shop').removeClass('hidden');

        });
        $('a.close-shop').click(function () {
            $('div.shop').addClass('hidden');
        });
    },
    carousel: function () {

        $("#slides").slides({

            width: 295,
            height: 400,
            play: 100

        });
        setTimeout(function () {
            $("#slides").slides("play")
        }, 5000);
        /*
        Get the curent slide
        */
        function currentSlide(current) {
            $(".current_slide").text(current + " of " + $("#slides").slides("status", "total"));
        }

        $(function () {
            /*
            Initialize SlidesJS
            */
            $("#slides").slides({
                navigateEnd: function (current) {
                    currentSlide(current);
                },
                loaded: function () {
                    currentSlide(1);
                }
            });

            /*
            Play/stop button
            */
            $(".controls").click(function (e) {
                e.preventDefault();

                // Example status method usage
                var slidesStatus = $("#slides").slides("status", "state");

            });
        });
        $('.slidesNext').addClass('next-img');
        $('.prev-arrow').click(function () {
            $("#slides").slides("previous");
        })
        $('.next-arrow').click(function () {
            $("#slides").slides("next");
        })
        $('.border-all.featured').hover(function () {
            $('.next-arrow').toggle();
            $('.prev-arrow').toggle();
        }, function () {
            $('.next-arrow').toggle();
            $('.prev-arrow').toggle();
        })
        $('.slidesNext').addClass('link');

    },
    howto: function () {

        $('#BVSummaryReadReviewsLink').click(function () {
            $('.smenu li.second a').trigger('click');
        });

        $('.tabs li.create-rev a').click(function () {

            $('div.create-review').removeClass('hidden-review');
        });
        $(' .create-review a.close-filter').click(function () {

            $(this).parent('div.create-review').addClass('hidden-review');
        });
        if ($.browser.msie) {
            $('img.sim-round-bottom').css('top', '2px');
        };
        if ($.browser.msie && ($.browser.version == 9)) {

            $('.similiar .screenshot2 h4').css('top', '99px');

        };

    },
    nav: function () {
        //footer menu
        $('.footer .products img.nae').hover(function () {
            $(this).attr('src', '/i/logo/ne-hover.png');
        }, function () {
            $(this).attr('src', '/i/logo/ne.png');
        });
        $('.footer .products img.cbf').hover(function () {
            $(this).attr('src', '/i/logo/cbf-hover.png');
        }, function () {
            $(this).attr('src', '/i/logo/cbf.png');
        });
        $('.footer .products img.ni').hover(function () {
            $(this).attr('src', '/i/logo/ni-hover.png');
        }, function () {
            $(this).attr('src', '/i/logo/ni.png');
        });
        $('.footer .products img.rtu').hover(function () {
            $(this).attr('src', '/i/logo/rt-hover.png');
        }, function () {
            $(this).attr('src', '/i/logo/rt.png');
        });
        $('.footer .products img.p10').hover(function () {
            $(this).attr('src', '/i/logo/p10-hover.png');
        }, function () {
            $(this).attr('src', '/i/logo/p10.png');
        });
        $('.footer .products img.niv').hover(function () {
            $(this).attr('src', '/i/logo/niv-hover.png');
        }, function () {
            $(this).attr('src', '/i/logo/niv.png');
        });
        ///smenu
        if (!($('.main-content-box.fourth').hasClass('hidden'))) {
            $('.smenu li.fourth').addClass('active')
        };
        if (!($('.main-content-box.third').hasClass('hidden'))) {
            $('.smenu li.third').addClass('active')
        };
        if (!($('.main-content-box.second').hasClass('hidden'))) {
            $('.smenu li.second').addClass('active')
        };
        if (!($('.main-content-box.first').hasClass('hidden'))) {
            $('.smenu li.first').addClass('active')
        };
        $('.smenu li.first a').click(function () {
            $('.smenu li').removeClass('active');
            $(this).parents('li').addClass('active');
            $('div.main-content-box').addClass('hidden');
            $('div.first').removeClass('hidden');
        });
        $('.smenu li.second a').click(function () {
            $('.smenu li').removeClass('active');
            $(this).parents('li').addClass('active');
            $('div.main-content-box').addClass('hidden');
            $('div.second').removeClass('hidden');
        });
        $('.smenu li.third a').click(function () {
            $('.smenu li').removeClass('active');
            $(this).parents('li').addClass('active');
            $('div.main-content-box').addClass('hidden');
            $('div.third').removeClass('hidden');
        });
        $('.smenu li.fourth a').click(function () {
            $('.smenu li').removeClass('active');
            $(this).parents('li').addClass('active');
            $('div.main-content-box').addClass('hidden');
            $('div.fourth').removeClass('hidden');
        });
        $('.smenu li.fifth a').click(function () {
            $('.smenu li').removeClass('active');
            $(this).parents('li').addClass('active');
            $('div.main-content-box').addClass('hidden');
            $('div.fifth').removeClass('hidden');
        });
        ///end of smenu

        ///filter by (checkboxes)

        $('input.reset').click(function () {
            $('div.filter-products input').removeAttr('checked');

            $('div.products-list ul li.prod-all').addClass('hidden');

        });
        $('div.filter-products input').change(function () {

            if ($(this).is(':checked')) {

                $name_t = $(this).attr('class');
                $('div.products-list ul li.' + $name_t).removeClass('hidden');
            } else {
                $name_t = $(this).attr('class');
                $('div.products-list ul li.' + $name_t).addClass('hidden');

            }
        }
        );

        ///end of filter by (checkboxes)

        $('a.sim-link').click(function () {
            $('div.similiar').removeClass('hidden');
            $('div.similiar').removeClass('hide');
        });
        $('a.close').click(function () {
            $('div.similiar').addClass('hidden');

        });
        $('.smenu li a').hover(function () {
            $(this).parent('li').addClass('bg-white');
        }, function () {
            $(this).parent('li').removeClass('bg-white');
        }
        );
        if ($.browser.msie && ($.browser.version == 7 || $.browser.version == 8)) {

            $('.similiar .screenshot2 h4').css('top', '95px');
            $('.similiar .screenshot2 p').css('top', '0px');
            $('.cloud-language').css({ 'margin-left': '-459px' });

            $('.nav-top .cloud-contact').corner({ tl: { radius: 0 }, tr: { radius: 0 }, bl: { radius: 7 }, br: { radius: 7} });
            $('.nav-top .cloud-language').corner({ tl: { radius: 0 }, tr: { radius: 0 }, bl: { radius: 7 }, br: { radius: 7} });
            $('.header .nav2  ul.cloud').css('border-top', 'none');
            $('.nav2 ul.cloud ').corner({ tl: { radius: 0 }, tr: { radius: 0 }, bl: { radius: 7 }, br: { radius: 7} });

        };
        if ($.browser.msie && ($.browser.version == 7)) {

            $('li.activate').css({ 'padding-bottom': '15px' });
            $('.cloud-contact').css({ 'margin-top': '26px' });
            $('.cloud-contact').css({ 'margin-left': '-70px' });
            $('.cloud-contact').css({ 'padding': '10px' });
            $('.cloud-language').css({ 'margin-top': '26px' });
            $('.cloud-language').css({ 'right': '213px' });
            $('.cloud-language').css({ 'padding': '10px' });
            $('.cloud-language').css({ 'width': '645px' });
        };

    },
    slider: function () {
        var liLength = $('ul.images li').length;

        //move the last item and put it as first item
        $('.images li:first').before($('.images li:last'));

        var item_width = $('.images li:first').outerWidth();
        if (liLength > 4) {
            $('ul.images').css({ 'left': (-1) * item_width });
        }

        $('a.next').hide();
        $('a.prev').hide();

        $('.main-area, .scroll li, .main-photo').bind('mouseenter', function () {
            $('a.next').hide();
            $('a.prev').hide();
        })
        $('.content').bind('mouseleave', function () {
            $('a.next').hide();
            $('a.prev').hide();
        })
        $('.scroll li:eq(0), .scroll li:eq(1)').bind('mouseenter', function () {
            $('a.prev').show();
        })
        $('.scroll li:eq(4), .scroll li:eq(5)').bind('mouseenter', function () {
            $('a.next').show();
        })
        $('.next').click(function () {

            var all_width = 0;
            $('.images li').each(function () {
                all_width += $(this).outerWidth();
            })
            var sub_width = all_width - $('#slider').outerWidth();

            //slide the item
            $('ul.images').stop().animate({ 'left': (-1) * sub_width }, 500, function () {

                //move the last item and put it as first item
                $('.images li:last').after($('.images li:first'));

                var item_width = $('.images li:last').outerWidth();
                $('ul.images').css({ 'left': (-1) * (sub_width - item_width) });
            });
            $('.scroll li').bind('mouseenter', function () {
                $('a.next').hide();
                $('a.prev').hide();
            })
            $('.scroll li:eq(' + (liLength - 4) + '), .scroll li:eq(' + (liLength - 5) + ')').bind('mouseenter', function () {
                $('a.prev').show();
            })
            $('.scroll li:eq(' + (liLength - 1) + ')').bind('mouseenter', function () {
                $('a.next').show();
            })
            //cancel the link behavior
            return false;

        });
        $('.prev').click(function () {

            //slide the item
            $('ul.images').stop().animate({ 'left': 0 }, 500, function () {

                //move the last item and put it as first item
                $('.images li:first').before($('.images li:last'));

                var item_width = $('.images li:first').outerWidth();
                $('ul.images').css({ 'left': (-1) * item_width });
            });
            $('.scroll li').bind('mouseenter', function () {
                $('a.next').hide();
                $('a.prev').hide();
            })
            $('.scroll li:eq(0)').bind('mouseenter', function () {
                $('a.prev').show();
            })
            $('.scroll li:eq(3)').bind('mouseenter', function () {
                $('a.next').show();
            })
            //cancel the link behavior
            return false;

        });
    },
    main: function () {
        $('.steps li a').bind('click', function () {
            if ($(this).attr('class').search("active") == -1) {
                pathF.showBaner($(this).attr('rel'));
                clearInterval(pathF.intervalHandler);
                pathF.boxNumber = $(this).attr('rel');
                pathF.intervalHandler = setInterval(pathF.reloadBoxes, pathF.timeReloader);
            }

        })
        pathF.intervalHandler = setInterval(pathF.reloadBoxes, pathF.timeReloader);

        //title
        if ($.browser.msie && $.browser.version == 9) {
            $('.content .main-area li h1 em, .content .main-area li h2 em').css({ 'padding-bottom': '15px' });
            $('.content .main-area li h1 big, .content .main-area li h2 big').css('padding-bottom', '0px');
            $('.content .main-area li.bg-3 h1 big, .content .main-area li.bg-3 h2 big').css('padding-bottom', '0px');
            $('.content .main-area li.bg-3 h1 em, .content .main-area li.bg-3 h2 em').css({ 'margin-top': '-15px' });
            $('.content .main-area li.bg-3 h2 small, .content .main-area li.bg-3 h2 a.small').css({ 'padding-top': '0', 'margin-top': '-5px' });
        }
        if ($.browser.msie) {
            $('h1.v-2 strong, h2.v-2 strong').css({ 'padding-top': '10px' });
        }

    },
    reloadBoxes: function () {
        pathF.boxNumber++;
        if (pathF.boxNumber == $('.steps li').length + 1)
            pathF.boxNumber = 1;
        pathF.showBaner(pathF.boxNumber);
    },
    showBaner: function (boxNumber) {
        $('.steps li a').removeClass('active');
        $('.steps li a[rel="' + boxNumber + '"]').addClass('active');

        $('ul.fade li').css('z-index', 2);
        $('ul.fade li.bg-' + boxNumber).css('z-index', 3);

        $('ul.fade li').fadeOut(2500);
        $('ul.fade li.bg-' + boxNumber).fadeIn(2500);
    },
    ticker: function () {
        pathF.intervalHandlerTicker = setInterval(pathF.reloadTicker, pathF.timeTicker);
    },
    reloadTicker: function () {
        pathF.tickerNumber++;
        if (pathF.tickerNumber == $('.ticker li').length + 1)
            pathF.tickerNumber = 1;
        pathF.showTicker(pathF.tickerNumber);
    },
    showTicker: function (tickerNumber) {
        tickerNumber = tickerNumber - 1;
        $('.ticker li').hide();
        $('.ticker li:eq(' + tickerNumber + ')').fadeIn();
    },
    goddes: function () {
        /// similiarlink
        $('a.sim-link').click(function () {
            $('div.similiar').removeClass('hide')
        });
        $('a.close').click(function () {
            $('div.similiar').addClass('hide')
        });
        ///prevent default
        $('a.screenshott').click(function (e) {
            //e.preventDefault();
        });
        $('ul li.filter-by a').click(function (e) {
            //e.preventDefault();
        });
        ///filter-menu
        $('ul.swatches-list li').click(function () {
            nazwa = $(this).children('a').attr('tabindex');
            $('div.product-info').removeClass('visible');
            $('div.product-info').addClass('hidden');
            $('div.product' + nazwa).removeClass('hidden');
            $('div.product' + nazwa).addClass('visible');
            $('ul.swatches-list li').removeClass('chosen');
            $(this).addClass('chosen');
            $('img.checkmark').remove();
            $(this).children('a').append("<img src='/i/icons/checkmark.png' alt='' class='checkmark' />");

        });
        $('ul.boxes-list li').click(function () {
            nazwa = $(this).children('a').attr('tabindex');
            $('div.product-info').removeClass('visible');
            $('div.product-info').addClass('hidden');
            $('div.product' + nazwa).removeClass('hidden');
            $('div.product' + nazwa).addClass('visible');
            $('ul.boxes-list li').removeClass('chosen');
            $(this).addClass('chosen');

        });
        $('.content:not(.foam) ul li.filter-by, .content:not(.gs) ul li.filter-by').hover(function () {
            //$(this).css('height','154px');
            $('li.filter-by img').removeClass('hidden');
            $('li.filter-by ul').removeClass('hidden')
            $('li.filter-by img').attr('src', '/i/arrow/bottom-white.png');
        }, function () {
            //$(this).css('height','18px');
            $('li.filter-by ul').addClass('hidden');
            $('li.filter-by img').attr('src', '/i/arrow/right-white.png');

        });
        $('.content.foam ul li.filter-by,.content.ni-base ul li.filter-by,.content.ni-vibrant ul li.filter-by,.content.p10 ul li.filter-by,.content.rtu ul li.filter-by').hover(function () {
            //$(this).css('height','154px');
            $('li.filter-by img').removeClass('hidden');
            $('li.filter-by ul').removeClass('hidden')
            $('li.filter-by img').attr('src', '/i/arrow/bottom-white.png');
        }, function () {
            //$(this).css('height','18px');
            $('li.filter-by ul').addClass('hidden');
            $('li.filter-by img').attr('src', '/i/arrow/right-white.png');

        });
        $('.content.gs ul li.filter-by').hover(function () {
            //$(this).css('height','154px');
            $('li.filter-by img').removeClass('hidden');
            $('li.filter-by ul').removeClass('hidden')
            $('li.filter-by img').attr('src', '/i/arrow/bottom-white.png');
        }, function () {
            //$(this).css('height','18px');
            $('li.filter-by ul').addClass('hidden');
            $('li.filter-by img').attr('src', '/i/arrow/right-white.png');

        });
        $('li.swatches-type').click(function () {

            $('ul.boxes-list').slideUp('fast');

            $('ul.swatches-list').delay(500).slideDown('fast');
            $('div.main-left').removeClass('boxes');
            $('div.main-left').addClass('swatches');
            $('img.axis-h').attr('src', '/i/bg/axis-h.png');

        });
        $('li.boxes-type').click(function () {

            $('ul.swatches-list').slideUp('fast');

            $('ul.boxes-list').delay(500).slideDown('fast');
            $('div.main-left').addClass('boxes');
            $('div.main-left').removeClass('swatches');
            $('img.axis-h').attr('src', '/i/bg/axis-h2.png');

        });
    },
    tabs: function () {

        $('a.view-transcript').toggle(function () {
            $('div.transcript').removeClass('not-visible');
            $(this).html("Close transcript <img src='/i/arrow/down-blue.png' alt='' />");
        }, function () {
            $('div.transcript').addClass('not-visible');
            $(this).html("View transcript <img src='/i/arrow/right-blue.png' alt='' />");
        });
        var a = $('.level-2 li.active a').parent('li').attr('id');

        $('.right-box-content.' + a).css('display', 'block');

        $('.level-2 ').click(function (e) {

        });
        $('.level-2 li.active').parent('ul').removeClass('hide');
        $('.level-2 li.active').parent('ul').addClass('active');
        $('ul.active').parent('li').children('span').children('img').attr('src', '/i/arrow/down-gray.png');

        $('.level-2 li').click(function () {
            $('.right-box-content').css('display', 'none');
            var a = $(this).attr('id');


            $('.right-box-content.' + a).css('display', 'block');

            $('.level-1 ul.active').removeClass('active');
            $('li.active').removeClass('active');
            $(this).addClass('active');
            $(this).parent('ul').addClass('active');

            $('li').removeClass('next_li');
            $(this).next('li').addClass('next_li')
            $('li').removeClass('before_li');
            $(this).prev('li').addClass('before_li')
        });
        $('.level-1 li span').toggle(function () {
            if (!($(this).next('ul').hasClass('hide'))) {

                $('.level-1 li ul').slideUp('fast', function () {
                    $('.level-1 li ul').addClass('hide');
                    $(this).prev('span').children('img').attr('src', '/i/arrow/right-gray.png');
                });
                $(this).children().attr('src', '/i/arrow/right-gray.png');
                $(this).parent('li').removeClass('category-active');
                $('.right-box-content').css('display', 'none');
                var a = $(this).parent('li').attr('id');
                $('.right-box-content.' + a + '-box').css('display', 'block');
                var b = $('.left-box .level-2 li.active a').parent('li').attr('id');

                $('.right-box .level-2 li.' + b).addClass('active');

                $(this).next('ul').slideUp('fast', function () {
                    $(this).addClass('hide');
                    $(this).prev('span').children('img').attr('src', '/i/arrow/right-gray.png');
                });
            } else {
                $('.level-1 li ul').slideUp('fast', function () {
                    $('.level-1 li ul').addClass('hide');
                    $(this).prev('span').children('img').attr('src', '/i/arrow/right-gray.png');
                });
                $(this).next().slideDown("fast", function () {
                    $(this).removeClass('hide');

                });
                $('.right-box-content').css('display', 'none');
                $(this).children().attr('src', '/i/arrow/down-gray.png');
                var a = $(this).parent('li').attr('id');
                $('.right-box-content.' + a + '-box').css('display', 'block');

            }

        }, function () {
            if (($(this).next('ul').hasClass('hide'))) {

                $('.level-1 li ul').slideUp('fast', function () {
                    $('.level-1 li ul').addClass('hide');
                    $(this).prev('span').children('img').attr('src', '/i/arrow/right-gray.png');
                    $(this).parent('li').removeClass('category-active');
                    var a = $(this).parent('li').attr('id');
                    $('.right-box-content.' + a + '-box').css('display', 'none');
                    var a = $('.level-2 li.active a').parent('li').attr('id');

                    $('.right-box-content.' + a).css('display', 'block');

                });
                $(this).next('ul').slideDown('fast', function () {
                    $(this).removeClass('hide');

                });
                $(this).children().attr('src', '/i/arrow/down-gray.png');
                $(this).addClass('active');
            } else {

                $('.level-1 li ul').slideUp('fast', function () {
                    $('.level-1 li ul').addClass('hide');
                    $(this).prev('span').children('img').attr('src', '/i/arrow/right-gray.png');
                    $(this).parent('li').removeClass('category-active');
                });
                $(this).next().slideUp('fast', function () {
                    $(this).addClass('hide')
                });
                $(this).children().attr('src', '/i/arrow/right-gray.png');
                $(this).parent('li').removeClass('category-active');
                var a = $(this).parent('li').attr('id');
                $('.right-box-content.' + a + '-box').css('display', 'none');
                var a = $('.level-2 li.active a').parent('li').attr('id');

                $('.right-box-content.' + a).css('display', 'block');
            }
        });
    },
    corner: function (options) {

        var settings = {
            tl: { radius: 10 },
            tr: { radius: 10 },
            bl: { radius: 10 },
            br: { radius: 10 },
            antiAlias: true,
            autoPad: true,
            validTags: ["div"]
        };
        if (options && typeof (options) != 'string')
            jQuery.extend(settings, options);

        return this.each(function () {
            new curvyObject(settings, this).applyCorners();
            //new curvyCorners(settings, this ).applyCornersToAll();
        });
    }
}








