//When the page has loaded...
$(document).ready(function() {
	
	//Fix the drop down menu mouse over action for IE 6...
	$('.IE6 #navigation li').mouseenter(function() {
		$('ul', this).css('visibility', 'visible');
	});
	
	//Fix the drop down menu mouse out action for IE 6...
	$('.IE6 #navigation li').mouseleave(function() {
		$('ul', this).css('visibility', 'hidden');
	});
	
	//Call Me Autofill
	$("#callname").attr("value", "Your Name");
	$("#callphone").attr("value", "Your Phone Number");
	$("#callemail").attr("value", "Your Email Address");
	$("#callname").css("color", "#999999");
	$("#callname").css("padding-left", "15px");
	$("#callphone").css("color", "#999999");
	$("#callphone").css("padding-left", "15px");
	$("#callemail").css("color", "#999999");
	$("#callemail").css("padding-left", "15px");
	$("#callname").click(function () {if ($(this).attr("value") == "Your Name") {$(this).attr("value", "");$("#callname").css("color", "#666666");}});
	$("#callname").blur(function () {if ($(this).attr("value") == "") {$(this).attr("value", "Your Name");$("#callname").css("color", "#999999");}});
	$("#callphone").click(function () {if ($(this).attr("value") == "Your Phone Number") {$(this).attr("value", "");$("#callphone").css("color", "#666666");}});
	$("#callphone").blur(function () {if ($(this).attr("value") == "") {$(this).attr("value", "Your Phone Number");$("#callphone").css("color", "#999999");}});
	$("#callemail").click(function () {if ($(this).attr("value") == "Your Email Address") {$(this).attr("value", "");$("#callemail").css("color", "#666666");}});
	$("#callemail").blur(function () {if ($(this).attr("value") == "") {$(this).attr("value", "Your Email Address");$("#callemail").css("color", "#999999");}});

	/* Call Me Check */
	function call() {
		if ($("#callname").attr("value") == "Your Name") {
			alert("Please enter your Name.");
			return false;
		} else if ($("#callphone").attr("value") == "Your Phone Number") {
			alert("Please enter your Phone Number.");
			return false;
		} else if ($("#callemail").attr("value") == "Your Email Address") {
			alert("Please enter your Email Address.");
			return false;
		} else {
			$("#callback").submit();
		}
	}
	
	$("#callme").click(function() {
		return call();
	});

	//Trims post title links in footer
	$("#list li a").each(function () {   
		var trim = $(this).text();
		var trimmed = trim.substring(0, 45);
		if (trimmed != trim) { trimmed += '...'; }
		$(this).text(trimmed);		
	});
});
