// jQuery is conflicting with the MailChimp subscribe script so reassign $ to jQuery
var $ = jQuery.noConflict();

var time = {
	
        init : function() {
			
			// font replacement
			if($.browser.msie && $.browser.version=="6.0")  {
			
			} else {
				
			}
			Cufon.replace('.module h1');
			Cufon.replace('.module h2');
			//Cufon.replace('.nivo-caption h2');
			
			// find nav items with sub-nav and apply background colour on rollover
			$('ul#navPrimary ul').parent().mouseover(function() {
				$(this).addClass("hover");											  
			});
			
			$('ul#navPrimary ul').parent().mouseout(function() {
				$(this).removeClass("hover");											  
			});
			
			// init superfish navigation
			/*$('ul#navPrimary').superfish({ 
				delay:       500,                            // one second delay on mouseout 
				animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
				speed:       'fast',                          // faster animation speed 
				autoArrows:  false,                           // disable generation of arrow mark-up 
				dropShadows: false                            // disable drop shadows 
        	});*/
			

			// init slideshow
			$('#slideshow').nivoSlider({
				effect:'fade', //Specify sets like: 'fold,fade,sliceDown'
				slices:15,
				animSpeed:800, //Slide transition speed
				pauseTime:7000,
				startSlide:0, //Set starting Slide (0 index)
				directionNav:true, //Next & Prev
				directionNavHide:false, //Only show on hover
				controlNav:true, //1,2,3...
				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:0.8, //Universal caption opacity
				beforeChange: function(){},
				afterChange: function(){},
				slideshowEnd: function(){} //Triggers after all slides have been shown
			});

			var pageId = $("body").attr("id");
		
			//time.newsletterSignup();
			
			switch (pageId) {
				case "homepage":
					// init 'their edinburgh' slideshow
					//time.initScrollableGallery();
				break;
				case "theiredinburgh":
					// init 'their edinburgh' slideshow
					//time.initScrollableGallery();
				break;
			}
		
		}
		
};

$(document).ready(time.init);
