function pageLoaded() {
	Cufon.replace('#navigation a, h2, h3, .page-title', { fontFamily: 'MyriadPro', hover: true });
	Cufon.replace('#footer h3', {
		fontFamily: 'Myriad Pro Regular'
	});
	Cufon.replace('#top-box', { fontFamily: 'MyriadPro' });
	Cufon.now();	
};

jQuery(document).ready(function($) {
	function mycarousel_initCallback(carousel) {
		$('.slider-navigation a.next').click(function() {
			carousel.next();
			return false;
		});
		$('.slider-navigation a.prev').click(function() {
			carousel.prev();
			return false;
		});
	};
	
	$('.menu .sub-menu').wrap('<div class="dd">').parent().prepend('<div class="dd-t">&nbsp;</div>').append('<div class="dd-b">&nbsp;</div>');
	$('#menu .menu li:first').addClass('first');
	$('.gfield_required').each(function() {
		var li = $(this).closest('li');
		$(this).remove();
		li.append('<span class="err">*</span>');
	});

	$('#navigation li').hover(
		function() {
			$(this).find('a').eq(0).addClass('hover');
			$(this).find('.dd').show();
		},
		function() {
			$(this).find('a').eq(0).removeClass('hover');
			$(this).find('.dd').hide();
		}
	);
	
	/*if ($('#slideshow').length) {
		var hslide_index = 0;
		var hslide_time = 5000;
		function hslide_jump(index) {
			var left = -940*index;
			$('#slideshow').animate({left: left});
			hslide_index = index;
		}
		function hslide_cb() {
			var next = hslide_index + 1;
			if (next >= $('#slideshow img').length) next = 0;
			hslide_jump(next);
		}
		
		var hslide_h = setInterval(hslide_cb, hslide_time);
		$('.slideshow-navigation .next').click(function() {
			if ( $('#slideshow:animated').length ) return;
			clearInterval(hslide_h);
			hslide_cb();
			hslide_h = setInterval(hslide_cb, hslide_time);
			return false;
		});
		$('.slideshow-navigation .prev').click(function() {
			if ( $('#slideshow:animated').length ) return;
			clearInterval(hslide_h);
			var next = hslide_index - 1;
			if (next < 0) next = $('#slideshow img').length - 1;
			hslide_jump(next);
			hslide_h = setInterval(hslide_cb, hslide_time);
			return false;
		});
	};*/
	
	if ($('#slideshow').length) {
		var slideIndex = 0;
		var autoFadeTime = 5000;
		$('#slideshow a:eq('+slideIndex+')').fadeIn();
		function slideshowFade(index) {
			$('#slideshow a').fadeOut();
			$('#slideshow a:eq('+index+')').fadeIn();
		};
		function slideshowAuto() {
			slideIndex += 1;
			if (slideIndex >= $('#slideshow a').length) slideIndex = 0;
			slideshowFade(slideIndex);
		};
		var hslide_h = setInterval(slideshowAuto, autoFadeTime);
		$('.slideshow-navigation .next').click(function() {
			//if ( $('#slideshow:animated').length ) return;
			clearInterval(hslide_h);
			slideshowAuto();
			hslide_h = setInterval(slideshowAuto, autoFadeTime);
			return false;
		});
		$('.slideshow-navigation .prev').click(function() {
			//if ( $('#slideshow:animated').length ) return;
			clearInterval(hslide_h);
			slideIndex -= 1;
			if (slideIndex < 0) slideIndex = $('#slideshow a').length - 1;
			slideshowFade(slideIndex);
			hslide_h = setInterval(slideshowAuto, autoFadeTime);
			return false;
		});
	};
	
	if ($('#slider').length) {
		$("#slider ul").jcarousel({
			//auto: 3,
		scroll: 1,
		//wrap: 'both',
		initCallback: mycarousel_initCallback,
		buttonNextHTML: null,
		buttonPrevHTML: null
	});
	};
	
	/*if ($('#gform_1').length) {
		$('#gform_1').jqTransform();
	};*/
	if ($('#content form').length) {
		var contentForm = $('#content form');
		contentForm.jqTransform();
		contentForm.find('label:contains("City")').prev().addClass('cityField').parent().addClass('cityContainer');
		contentForm.find('label:contains("State")').prev().addClass('stateField').parent().addClass('stateContainer');
		contentForm.find('label:contains("Zip Code")').prev().addClass('zipField').parent().addClass('zipContainer');
		
	};
	
	if ($.browser.msie && $.browser.version.substr(0,1)<7) {
		DD_belatedPNG.fix('h1#logo a, div#logo a, #top-links .ico-phone, #top-links .ico-customer, #primary-box, .link-quick-tips, .small-box .box-t, .box .heading, #secondary-bar .arrow, .about-us img, #slideshow-holder, .slideshow-navigation a, .slider-navigation a, .shadow, .box .box-t, .fancy-box .head ');
	};
	
	$('.media a').colorbox({inline:true});
	
	if ( $('.testimonials').length ) {
		var testim_timeout = 5000;
		var testim_index = 0;
		$('.testimonials').height($('.testimonials .quote-box:first').height());
		function testim_timeout_cb() {
			var next = testim_index + 1;
			if ( next >= $('.testimonials .quote-box').length ) next = 0;
			
			var next_quote = $('.testimonials .quote-box:eq(' + next + ')');
			$('.testimonials .quote-box:eq(' + testim_index + ')').fadeOut();
			var new_height = next_quote.show().height();
			next_quote.hide().fadeIn();
			
			$('.testimonials').animate({height: new_height});
			
			testim_index = next;
		}
		var testim_timeout_h = setInterval(testim_timeout_cb, testim_timeout);
		$('.testimonials .quote-box').hover(function() {
			clearInterval(testim_timeout_h);
			testim_timeout_h = null;
		}, function() {
			if ( testim_timeout_h === null ) {
				testim_timeout_h = setInterval(testim_timeout_cb, testim_timeout);
			};
		});
	};
});

