/* Declare a namespace for the site */
var Site = window.Site || {};

/* Create a closure to maintain scope of the '$'
   and remain compatible with other frameworks.  */
(function($) {
	
	//same as $(document).ready();
	$(function() {
		
		// Replace HR tags
		$('hr').replaceWith('<div class="hr"><hr /></div>');
		
		// Tooltip effect on 5-wide grid layout
		$('ul.condensed a').tooltip({ effect: 'slide', tipClass: 'tooltip'}).dynamic({ bottom: { direction: 'down', bounce: true } });
		
		// Generic tabs
		$('ul.tabs').tabs('div.panes > div');
		$('ul.tabs a').click(function(){ $(this).blur(); }); // Remove outline

		// Product photo switcher
		$('ul.thumbnails').tabs('div.main-image img', {effect: 'fade'});
		$('ul.thumbnails a').click(function(){ $(this).blur(); }); // Remove outline

		// Homepage Slideshow
		// -- Add grungy border with span tag
		$('#slideshow .slide a').append('<span class="border" />');
		// -- Cycle plugin		
	    $('#slideshow').cycle({
	        fx:			'fade',
	        speed:		500,
	    	timeout:	3000,
	        prev:		'#hero .prev',
	        next:		'#hero .next',
	        pager:		'#slideshow-nav'
	    });
	
	});

	$(window).bind("load", function() {

		if(typeof sIFR == "function"){
		    sIFR.replaceElement(named({sSelector:".content-header h1,#content h2", sFlashSrc:"js/aachen.swf", sColor:"#333333", sWmode: "transparent"}));
		    sIFR.replaceElement(named({sSelector:".phone-number", sFlashSrc:"js/aachen.swf", sColor:"#555555", sLinkColor:"#333333", sBgColor:"#FFFFFF", sHoverColor:"#000000", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left&offsetTop=0", sWmode: "transparent"}));
		    sIFR.replaceElement(named({sSelector:".pillar-hero .intro h1", sFlashSrc:"js/aachen.swf", sColor:"#ffffff", sWmode: "transparent"}));
		}
		
	});
	
})(jQuery);
