var homeGallery = {
	init: function() {
		$("#photo-slider").slidingGallery();
	}
}

function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}

var mainNav = {
	init: function() {
		jQuery(function(){
			jQuery('ul.sf-menu').superfish();
		});
		
		if(getInternetExplorerVersion() < 8 && getInternetExplorerVersion() > 0)
		{
			alert("IE 7-");
			$('.menu-wrapper').css('width', '1100px');
		}
		else
		{
			$('.menu-wrapper').css('width', $('ul.sf-menu').outerWidth()+5+'px');
		}
	}
}

// Gallery
var galleryModal = {
    init: function(){
        $('#photoGallery').lbGallery();
    }
}

function initialize() {
	homeGallery.init();
	mainNav.init();
	galleryModal.init();
}

$(document).ready(function () {
    initialize();
});

$(window).unload(function(){
	//$('ul.sf-menu li.current').hideSuperfishUl();
});
