﻿/// <reference path="../jQuery/jquery-1.4.1-vsdoc.js" />

var Nova100 = window["Nova100"] || {};

Nova100.PartnerLogos = function($) {

    function initPartnerLogos() {

        if ($("ul.partner-logos li").length > 8 && $("#partner-scroll")) {
            //$("#partner-scroll").smoothDivScroll({ autoScroll: "always", autoScrollDirection: "endlessloop", pauseAutoScroll: "mouseover", autoScrollSpeed: 1, scrollableArea: "ul.scrollable-area", scrollWrapper: "div.scroll-wrapper", scrollingSpeed: 1 });
        
	    $("#partner-scroll").smoothDivScroll({ autoScroll: "always", autoScrollDirection: "endlessloopright", scrollableArea: "ul.scrollable-area", scrollWrapper: "div.scroll-wrapper", autoScrollStep: 1, autoScrollInterval : 40 });
	}

        setupPartnerLogos();
    };

    function setupPartnerLogos() {

        $("ul.partner-logos li").hover(function() { //On hover...
	    
	    $("#partner-scroll").smoothDivScroll("stopAutoScroll");
	
            var thumbOver = $(this).find("img").attr("src"); //Get image url and assign it to 'thumbOver'

            if ($.support.leadingWhitespace) {  // False in IE 6-8... do not run animation here due to buggy png-fading....

                //Set a background image(thumbOver) on the <a> tag - Set position to bottom
                $(this).find("a.thumb").css({ 'background': 'url(' + thumbOver + ') no-repeat center bottom' });

                //Animate the image to 0 opacity (fade it out)
                $(this).find("span").stop().fadeTo('normal', 0, function() {
                    $(this).hide(); //Hide the image after fade
                });
            }
            else {
                $(this).find("a.thumb").css({ 'background': 'url(' + thumbOver + ') no-repeat center bottom' });
                $(this).find("img").hide();
            }
        }, function() { //on hover out...
	    
 	    $("#partner-scroll").smoothDivScroll("startAutoScroll");

            if ($.support.leadingWhitespace) {  // False in IE 6-8... do not run animation here due to buggy png-fading....

                //Fade the image to full opacity 
                $(this).find("span").stop().fadeTo('normal', 1).show();
            }
            else {
                $(this).find("a.thumb").css({ 'background-position': 'center top' });
            }
        });

    };

    return {
        init: initPartnerLogos
    }

} (jQuery);

$(function() {
    Nova100.PartnerLogos.init();
});

