Cufon.replace('h1');
Cufon.replace('h2');
Cufon.replace('.services h3');
Cufon.replace('.widget_text h5');
Cufon.replace('#tweet_box h3');

$(document).ready(function() {
	$('#slider').tabs({ fx: { opacity: 'toggle' } }).tabs('rotate', 5500);
	
	//EMAIL ENCRYPT
	$(".cloak").each(function(){
		var ats, dots, address, i;
		ats = [ ' at ', ' (at) ', ' [at] ' ];
		dots = [ ' dot ', ' (dot) ', ' [dot] ' ];
		address = $(this).html();
		for ( i = 0; i < ats.length; i++ ) {
			address = address.replace(ats[i], '@');
		}
		for ( i = 0; i < dots.length; i++ ) {
			address = address.replace(dots[i], '.');
		}
		$(this).html('<a href="mailto:' + address + '">' + address + '</a>');
	});
	
	//NEW TAB POPUP
	$("a.popup_tab").attr("target", "_blank");
	
	//AUTOPOPULATE
	$("#content #contactForm .content .gfield input, #content #contactForm .content .gfield textarea").each( function() {
		if ( $(this).val() != "" ) {
			$(this).parent().prev("label").hide();
		}
	});
	$("#content #contactForm .content .gfield input, #content #contactForm .content .gfield textarea").focus(function() {
		$(this).parent().prev("label").hide();
	});
	$("#content #contactForm .content .gfield input, #content #contactForm .content .gfield textarea").blur(function() {
		if ( $(this).val() == "" ) {
			$(this).parent().prev("label").show();
		}
	});
});

