// JavaScript Document

var searchFormTimer = 0;

$(document).ready(function(){
	//$("div.headerWrapper div.leftMenu ul li.selected a").click(function() {return false;});
	
	$(window).resize(function() {fixBottomWrapper()});
	fixBottomWrapper()
	
	$("div.commercialsHolder div.item:nth-child(3n)").after('<div class="clear"></div>');
	
	/*
	$("#searchForm").hover(
		function() {
			clearInterval(searchFormTimer);
		},
		function() {
			searchFormTimer = setInterval(hideSearchForm, 2000);
		}
	);
	*/
	
	$('.pollHolder input[type=submit]').click(function() {
		if ($('.pollHolder input:checked').length == 0) {
			return false;
		}
	});
	
	Cufon.replace('.cufonBk', { fontFamily: 'ITCFranklinGothicStd_BkCd', hover: true });
	Cufon.replace('.cufonMd', { fontFamily: 'ITCFranklinGothicStd-MdCd', hover: true });
	Cufon.replace('.cufonDm', { fontFamily: 'ITCFranklinGothicStd-DmCd', hover: true });
	Cufon.replace('div.woodBgHolder div.leftColumn h1', { fontFamily: 'ITCFranklinGothicStd-MdCd', color: '-linear-gradient(#ffffff, #cccccc)' });
	
});

function onFocusEvent(selectObj, defText) {
	if ($(selectObj).val().toLowerCase() == defText.toLowerCase()) {
		$(selectObj).val("").addClass("typedText");
	}
}

function onBlurEvent(selectObj, defText) {
	if ($(selectObj).val().toLowerCase() == defText.toLowerCase() || $(selectObj).val().trim() == "") {
		$(selectObj).val(defText).removeClass("typedText");
	}
}

String.prototype.trim = function() {
	return this.replace(/\s+$/, '');
}

function fixBottomWrapper() {
	$("#aspnetForm").css("height", "auto");
	if ($("#aspnetForm").height() < $(document).height()) {
		$("#aspnetForm").height($(document).height() - 52);
	}
}

function showSearchForm() {
	$("#searchForm").fadeIn(200, function() { $("#searchForm input").focus(); });
}

function hideSearchForm() {
	$("#searchForm").fadeOut(100);
	//$("#searchForm input").val("");
}
