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);

$(document).ready(function() { 
    $('#nav').superfish({
	    pathLevels:    1,                  // the number of levels of submenus that remain open or are restored using pathClass 
	    delay:         800,                // the delay in milliseconds that the mouse can remain outside a submenu without it closing 
	    animation:     {height:'show'},   // an object equivalent to first parameter of jQuery’s .animate() method 
	    speed:         'fast',           // speed of the animation. Equivalent to second parameter of jQuery’s .animate() method 
	    autoArrows:    false,               // if true, arrow mark-up generated automatically = cleaner source code at expense of initialisation performance 
	    dropShadows:   false,               // completely disable drop shadows by setting this to false 
	    disableHI:     true,              // set to true to disable hoverIntent detection
	 });
}); 


// Load theme
Galleria.loadTheme('http://www.joviahosting.com/toddbiss/static/js/galleria/themes/galleria-classic/galleria.classic.js');

// run galleria and add some options
$('#galleria').galleria({
    image_crop: true, // crop all images to fit
    thumb_crop: true, // crop all thumbnails to fit
    transition: 'fade', // crossfade photos
    transition_speed: 700, // slow down the crossfade
    autoplay: 5000,
    data_config: function(img) {
        // will extract and return image captions from the source:
        return  {
            title: $(img).parent().next('strong').html(),
            description: $(img).parent().next('strong').next().html()
        };
    },
    extend: function() {
        this.bind(Galleria.IMAGE, function(e) {
            // bind a click event to the active image
            $(e.imageTarget).css('cursor','pointer').click(this.proxy(function() {
                // open the image in a lightbox
                this.openLightbox();
            }));
        });
    }
});
