$(function(){

//------------------------------------//
// Dropdown Nav
//------------------------------------//
    $("ul.sf-menu").superfish().find('ul').bgIframe({opacity:false}); 

//------------------------------------//

//------------------------------------//
// Forms
//------------------------------------//
// clear the default text when the user clicks the input field
$('.search-input').click(function(){
    $(this).val("");
    $('#searchTickler').fadeOut();
});
//------------------------------------//

//------------------------------------//
// Sliders
//------------------------------------//
	
	
	// Homepage: Main -----// 
	
		// Initialize
		$('#h-slides').cycle({ 
			fx: 'fade', 
			speed: 'slow', 
			timeout: 5000,
			prev:    '.btn-home-slideshow-prev',
			next:    '.btn-home-slideshow-next'
		});
		
		
		//Controls
		$("#pause-resume").toggle(
			function(){ $('#h-slides').cycle('pause') },
			function(){ $('#h-slides').cycle('resume') }
		);
		
		// Homepage: Featured Projects-----//
	
		// Initialize
		$('#h-projects').cycle({ 
			fx: 'scrollHorz', 
			speed: 'slow', 
			timeout: 7000,
			prev:    '.featured-projects .btn-projects-prev',
			next:    '.featured-projects .btn-projects-next'
		});	
		
		// Projects page: Current Projects-----//
	
		// Initialize
		/* */
		$('#p-slides').cycle({ 
			speed: 'slow',
			fx: 'scrollHorz', 
			timeout: 7000,
			prev:    '.current-projects .btn-projects-prev',
			next:    '.current-projects .btn-projects-next'
		});	
		        
        // this initializes the scollpane on the project detail page.
		$('#project-details').jScrollPane();
		
		

//------------------------------------//
// Icons for various Links
//------------------------------------//
 //var iconPath = "/images/icons/"; //----------------------------for dev&prod
 var iconPath = "/images/icons/"; 
 $("a[href^='mailto:']").append('&nbsp;<img class="linkIcon" src="' + iconPath + 'iconEmail.gif" alt="Send Email" width="16" />');
 $('a.pdf').append('<img class="linkIcon" src="' + iconPath + 'iconPDF.gif" alt="PDF Download" height="16" width="16" />');
 $('a.xls').append('<img class="linkIcon" src="' + iconPath + 'iconXLS.gif" alt="Excel Download" height="16" width="16" />');
 
 $('a.arrow').append('<img src="' + iconPath + 'iconArrowGrey.gif" alt="Arrow" height="9" width="9" />');
//------------------------------------// 
	
	//Timeline
	$("#makeMeScrollable").smoothDivScroll({
		autoScrollStep: 2,
		autoScrollInterval: 20,
		visibleHotSpots: "always"
	});
	
	$("#makeMeScrollable").smoothDivScroll("showHotSpotBackgrounds");

});
