
Cufon.replace('#header .nav-main A', { fontFamily: 'Myriad Pro', fontWeight: '400' });
Cufon.replace('#content .column-left .nav-sub A', { fontFamily: 'Myriad Pro', fontWeight: '400' });
Cufon.replace('#content .column-main H1', { fontFamily: 'Myriad Pro', fontWeight: '300' });
Cufon.replace('#content .column-front H2', { fontFamily: 'Myriad Pro', fontWeight: '300' });

$(document).ready(function() {

	/* IE6 */
	if ($.browser.msie && parseFloat($.browser.version) < 7) {
		$('INPUT[type=text]').addClass('text');
	}

	/* IE7 */
	if ($.browser.msie && parseFloat($.browser.version) < 8) {

		$('LI:first-child').addClass('first-child');
		$('LI:last-child').addClass('last-child');
		$('TABLE TR:nth-child(odd)').addClass('nth-child-odd');
		$('TABLE TD:first-child').addClass('first-child');
		$('TABLE TH:first-child').addClass('first-child');
	}
	
	// Open external links into new window
	$('A[href^=http://], A[href^=https://]').each(function() {
		$(this).attr('target', '_blank');
	});
	
	$('#footer .print').click(function(e) {
		e.preventDefault();
		window.print();
	});

	// De-obfuscate emails
	$('A[href^=mailto:][href$=.example.com]').each(function() {
		var email = $(this).attr('href').substr(7).split('').reverse().join('').substr(12);
		$(this).attr('href', 'mailto:' + email);
		if ($(this).text().indexOf('@') == -1 && ! $(this).hasClass('keep-text'))
			$(this).text(email);
		$(this).css('visibility', 'visible');
	});
	
	if ($('#carousel').length > 0)
		var carousel = new Carousel('#carousel', 5000, 1000);
		
	$('#content .column FORM INPUT[type=text]:first').not('.no-autofocus').focus();
	
	$('FORM .autoclear').focus(function () {
		if ($(this).hasClass('autoclear-default')) {
			$(this).removeClass('autoclear-default');
			$(this).addClass('autoclear-edited');
			$(this).attr('default_value', $(this).val());
			$(this).val('');
		}
	});

	$('FORM .autoclear').blur(function () {
		if ($(this).val() == '') {
			$(this).addClass('autoclear-default');
			$(this).removeClass('autoclear-edited');
			$(this).val($(this).attr('default_value'));
		}
	});
	
	$('#route-search').submit(function() {
		$('.autoclear-defalt', this).val('');
	});
	
});
