$(function() {
	function supports_input_placeholder() {
	    var i = document.createElement('input');
	    return 'placeholder' in i;
	};
	
	//if (!supports_input_placeholder()) {
        //PLACEHOLDER NOT SUPPORTED.
        $('input[type="text"], input[type="email"], textarea').each(function() {

            var placeholder = $(this).attr('placeholder');

            $(this).val(placeholder).focus(function() {
                if ($(this).val() == $(this).attr('placeholder'))
                {
                    $(this).val('');
                };
            }).blur(function() {
                if ($(this).val() == '')
                {
                    $(this).val($(this).attr('placeholder'));
                };
            });
        });
    //};
});

$(document).ready(function() {
	$("#menu li:first").css("borderLeft", "0 none");
	
	/*
	$("#menu #nav_one ul:first li").each(function() {		
		if ($("a", this).size() > 1) {
			var link = "<li><a href=\"";
			link += $("a:first", this).attr("href");
			link += "\">";
			link += $("a:first", this).html();
			link += "</a></li>";
			//alert(link);
			$("ul", this).prepend(link);
		};
	});
	*/	
	
	$("#topsearch .text").attr("rel", $("#topsearch .text").val());
	$("#topsearch input.text").focus(function() {
		if ($(this).val() == $(this).attr("rel")) {
			$(this).val("");
		};
	}).blur(function() {
		if ($(this).val() == "") {
			$(this).val($(this).attr("rel"));
		};
	});
	
	$("#sections .panel").mouseenter(function() {
		$("a", this).fadeIn(300);
	}).mouseleave(function() {
		$("a", this).fadeOut(300);
	});
	
	$("a.facebox").facebox({
		loading_image: '/js/facebox/loading.gif',
		close_image: '/js/facebox/closelabel.gif'
	});
	
	if ($("#content #right").height() > $("#content").height()) {	
		var height = $("#content #right").height();
		$("#content").css({"height": height+"px"});
	};
	
	//alert($(document).height());
	$("#blackFade").css("height", $(document).height()+"px").click(function() {
		$("#blackFade, #frmClientLogin").fadeOut(500);
	});
	
	$("#frmClientLogin .close").click(function() {
		$("#blackFade, #frmClientLogin").fadeOut(500);
	});
	
	$("a#btnClientLogin").click(function() {
		$("#blackFade").css({display: "block", opacity: 0}).animate({opacity: 0.75}, 500, function() {
			$("#frmClientLogin").fadeIn(500);
		});
		return false;
	});
	
});
