﻿Namespace.Register("HaydenQuinn.HG");

HaydenQuinn.HG.ImageMaps = function () {
    $('area[alt]').qtip(
   {
      content: {
         attr: 'alt'
      },
      style: {
         classes: 'ui-tooltip-tipsy ui-tooltip-shadow'
      },
	  position: {
		my: 'left center',
		adjust: {
			y: -50,
			x: 0
		}
	  }
   });
};

HaydenQuinn.HG.Menu = function () {
    var sfHover = function () {
        var sfEls = document.getElementById("nav").getElementsByTagName("LI");
        for (var i = 0; i < sfEls.length; i++) {
            sfEls[i].onmouseover = function () {
                this.className += " sfhover";
            };
            
            sfEls[i].onmouseout = function() {
                this.className = this.className.replace(new RegExp(" sfhover\\b"), "");
            };
        }
    };
    if (window.attachEvent) {
        window.attachEvent("onload", sfHover);
    }
};

HaydenQuinn.HG.Slideshow = function () {
    //    $('#slideshow').each(function (index) {
    //        var elem = $(this);
    //        
    //        elem.jqFancyTransitions(
    //        {
    //            //effect: '',           // wave, zipper, curtain
    //            width: HaydenQuinn.Data.SlideshowWidth,           // width of panel
    //            height: HaydenQuinn.Data.SlideshowHeight,          // height of panel
    //            strips: 1,             // number of strips
    //            delay: 5000,            // delay between images in ms
    //            stripDelay: 5,         // delay between strips in ms
    //            titleOpacity: 1,    // opacity of title
    //            //titleSpeed: 1000,     // speed of title appearance in ms
    //            position: 'top',        // top, bottom, alternate, curtain
    //            direction: 'left',      // left, right, alternate, random, fountain, fountainAlternate
    //            navigation: true,      // previous and next navigation buttons
    //            links: false            // show images as links
    //        });
    //    });
    $('#slideshow').nivoSlider({
        effect: 'fade', // Specify sets like: 'fold,fade,sliceDown'
        //slices: 15, // For slice animations
        //boxCols: 8, // For box animations
        //boxRows: 4, // For box animations
        animSpeed: 500, // Slide transition speed
        pauseTime: 3000, // How long each slide will show
        startSlide: 0, // Set starting Slide (0 index)
        directionNav: false, // Next & Prev navigation
        //directionNavHide: true, // Only show on hover
        controlNav: true, // 1,2,3... navigation
        controlNavThumbs: false, // Use thumbnails for Control Nav
        controlNavThumbsFromRel: false, // Use image rel for thumbs
        //controlNavThumbsSearch: '.jpg', // Replace this with...
        //controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
        keyboardNav: true, // Use left & right arrows
        pauseOnHover: true, // Stop animation while hovering
        manualAdvance: false, // Force manual transitions
        captionOpacity: 1, // Universal caption opacity
        prevText: 'Prev', // Prev directionNav text
        nextText: 'Next', // Next directionNav text
        beforeChange: function () {
        }, // Triggers before a slide transition
        afterChange: function () {
        }, // Triggers after a slide transition
        slideshowEnd: function () { }, // Triggers after all slides have been shown
        lastSlide: function () { }, // Triggers when last slide is shown
        afterLoad: function () {
            $('#slideshow').find('.nivo-caption')
                .css('top', HaydenQuinn.Data.SlideshowHeight + 'px')
                .css('bottom', 'auto')
                .css('width', HaydenQuinn.Data.SlideshowWidth / 2 + 'px');
            $('#slideshow').find('.nivo-controlNav')
                .css('margin-top', HaydenQuinn.Data.SlideshowHeight + 'px')
                .css('bottom', 'auto')
                .css('left', 'auto')
                .css('right', '0')
                .css('width', HaydenQuinn.Data.SlideshowWidth / 2 + 'px');
        } // Triggers when slider has loaded
    });
};

$(document).ready(function () {
    HaydenQuinn.HG.Slideshow();
    //HaydenQuinn.HG.ImageMaps();
    HaydenQuinn.HG.Menu();
});
