var kawasaki = {};
jQuery(function($){
    kawasaki = {
        'increaseQuantity': function(){
            var input = $("div.productInfoContainer div.selection div.quantityContainer input[type='text']");
            var num = Math.floor($(input).val() * 1);
            if ((num % 1 != 0) || num < 0) {
                $(input).val('1');
                return;
            }
            (input).val(num + 1);
        },
        'decreaseQuantity': function(){
            var input = $("div.productInfoContainer div.selection div.quantityContainer input[type='text']");
            var num = Math.floor($(input).val() * 1);
            if ((num % 1 != 0) || num <= 1) {
                $(input).val('1');
                return;
            }
            (input).val(num - 1);
        },
        'ui': {
            'initialize': function(){
            
                // product highlight mode in product overview pages
                $("div.productListingContainer ul li").mouseenter(function(){
                    $(this).addClass('highlight');
                }).mouseleave(function(){
                    $(this).removeClass('highlight');
                });
                
                // product highlight mode in "featured products" bar
                $("div.featuredProductsContainer ul li").mouseenter(function(){
                    $(this).addClass('highlight');
                }).mouseleave(function(){
                    $(this).removeClass('highlight');
                });
                
                // category highlight mode in category selection
                $("div.subCategoriesContainer td[class!='empty']").mouseenter(function(){
                    $(this).addClass('highlight');
                }).mouseleave(function(){
                    $(this).removeClass('highlight');
                });
            }
        },
        'additionalContent': {
            'initialize': function(){
            
                // load slideshow for startpage
                var elem = $("#startPageContentContainer");
                if (elem.length == 1) {
					
					var htmlcode = "<ul id='slideimg'><li><img src='templates/kawasaki/img/slides/kawasaki-footwear-deutschland-1.jpg' alt='kawasaki footwear deutschland' /></li><li><img src='templates/kawasaki/img/slides/kawasaki-footwear-deutschland-4.jpg' alt='kawasaki footwear deutschland' /></li><li><img src='templates/kawasaki/img/slides/kawasaki-footwear-deutschland-3.jpg' alt='kawasaki footwear deutschland' /></li><li><img src='templates/kawasaki/img/slides/kawasaki-footwear-deutschland-2.jpg' alt='kawasaki footwear deutschland' /></li></ul>";
					
					$('#startPageContentContainer #slideShowContainer').html(htmlcode);
					
                    $("head").prepend('<script type="text/javascript" src="templates/kawasaki/javascript/jquery.bxslider2.0.1.min.js"></script>');
                    $('#slideimg').bxSlider({
                        alignment: 'horizontal', // 'horizontal', 'vertical' - direction in which slides will move
                        controls: false, // determines if default 'next'/'prev' controls are displayed
                        speed: 1200, // amount of time slide transition lasts (in milliseconds)
                        pager: false, // determines if a numeric pager is displayed (1 2 3 4...)
                        pager_short: false, // determines if a 'short' numeric pager is displayed (1/4)
                        pager_short_separator: ' / ', // text to be used to separate the short pager
                        margin: 50, // if 'horizontal', applies a right margin to each slide, if 'vertical' a
                        // bottom margin is applied. example: margin: 50
                        next_text: 'next', // text to be displayed for the 'next' control
                        next_image: '', // image to be used for the 'next' control
                        prev_text: 'prev', // text to be displayed for the 'prev' control
                        prev_image: '', // image to be used for the 'prev' control
                        auto: true, // determines if slides will move automatically
                        pause: 3500, // time between each slide transition (auto mode only) 
                        auto_direction: 'left', // order in which slides will transition (auto mode only)
                        auto_hover: true, // determines if slideshow will pause while mouse is hovering over slideshow
                        auto_controls: false, // determines if 'start'/'stop' controls are displayed (auto mode only)
                        ticker: false, // determines if slideshow will behave as a constant ticker
                        ticker_controls: false, // determines if 'start'/'stop' ticker controls are displayed (ticker mode only)
                        ticker_direction: 'next', // order in which slides will transition (ticker mode only)
                        ticker_hover: true, // determines if slideshow will pause while mouse is hovering over slideshow
                        stop_text: 'stop', // text to be displayed for the 'stop' control
                        start_text: 'start', // text to be displayed for the 'start' control
                        wrapper_class: 'bxslider_wrap' // class name to be used for the outer wrapper of the slideshow
                    });  
                }
            }
        },
        'initialize': function(){
            this.ui.initialize();
            this.additionalContent.initialize();
        }
    };
    kawasaki.initialize();
    
    $("a#videoplaynow").click(function(){
		// $("a#videoclosenow").css('display', 'block');
        $("a#videoplaynow").css('display', 'none');
        $("#videokawasakiremady_player").fadeIn(1000, function(){
            $('#startPageContentContainer #slideShowContainer').html("");
        });
    });
	
	 $("a#videoclosenow").click(function(){
		$("a#videoplaynow").css('display', 'block');
        $("a#videoclosenow").css('display', 'none');
        kawasaki.initialize();
		$("#videokawasakiremady_player").css('display', 'none');
    });
});
