//Cufon.replace('.topnav li');

jQuery(document).ready(function($) {
	
	// Create PDF link icons
	//jQuery('a[href$=".pdf"]').addClass("pdflink");
	$('a[href$=".pdf"]').after('&nbsp;<img src="/images/pdf-icon.png" class="pdficon">');

	// Contact form field clearing

	$('.ajax-contact-footer input[type="text"], .ajax-contact-footer textarea').focus(function () {
		if (this.value == this.defaultValue) {
			this.value = '';
		}

		if (this.value != this.defaultValue) {
			this.select();
		}
	});

	$('.ajax-contact-footer input[type="text"], .ajax-contact-footer textarea').blur(function () {
		if ($.trim(this.value) == '') {
			this.value = (this.defaultValue ? this.defaultValue : '');
		}

	});

	//$("#home-slider").hrzAccordion({ openOnLoad: "1",  handlePositionArray: "left,left,left,left", fixedWidth:876 });

	$("#home-slider").tabs("#home-slider .pc", {
		tabs: '.handle', 
		effect: 'horizontal'
	});


	jQuery("a[rel].yt").overlay({
		mask: { 
			color: '#000', 
			loadSpeed: 200, 
			opacity: 0.7
		},
		onBeforeLoad: function() {
			var ifrm = this.getOverlay().find("iframe");
			var a = this.getTrigger().attr('href');
			a = a.replace('/watch?v=','/embed/');
			a = a.replace('&','?');
			ifrm.attr('src',a);
		},
		onClose: function() {
			var ifrm = this.getOverlay().find("iframe");
			ifrm.attr('src','/favicon.ico');
		}
		
	});
	
	jQuery("a[rel].ei").overlay({
		mask: { 
			color: '#000', 
			loadSpeed: 200, 
			opacity: 0.7
		}		
	});

});
