/*	
	Format the site search
*/
function jqPngFix() {
    try {
        //ie6 png transperency fix
        $.each($("img[src$=.png],img[src$=.PNG]"), function () {
            var img = $(this);
            img.css({"width": img.width(),"height": img.height(), "filter": "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + img.attr("src") + "', sizingMethod='scale')"});
            img.attr("src","assets/images/construct/general/blank.gif");
        });
    } catch(e) {
        alert(e.description)
    }
}
$(document).ready(function(){
	if ($.browser.msie && $.browser.version == '6.0') {
		jqPngFix();
	}
	$labelText = $("#siteSearch label").html();
	$("#keywords").attr("value",$labelText);
	$("#siteSearch label").hide();
	$("#keywords").focus(function() {
		if ($(this).attr("value") == $labelText) {
			$(this).attr("value","");
		}
	});
	$("#keywords").blur(function() {
		if (!$(this).attr("value")) {
			$(this).attr("value",$labelText);
		}
	});
	
	$labelUser = $("#username").prev("label").html();
	$labelPass = $("#login-password").prev("label").html();
	$("#investorLogin label").hide();
	$("#investorLogin .formRow input:password").css({display:"none"});
	$("#investorLogin .formRow input:password").after('<input type="text" id="passwordVis" name="passwordVis" value="Password" />');
	$("#passwordVis").focus(function() {
		$(this).css({display:"none"});
		$("#investorLogin .formRow input:password").css({display:"block"}).focus();
		$("#investorLogin .formRow input:password").addClass("focussed");
	});
	$("#investorLogin .formRow input:password").focus(function() {
		$(this).addClass("focussed");
	});
	$("#investorLogin .formRow input:password").blur(function() {
		if (!$(this).attr("value")) {
			$(this).css({display:"none"});
			$("#passwordVis").css({display:"block"});
		}
		$(this).removeClass("focussed");
	});
	$("#username").focus(function() {
		if ($(this).attr("value") == $labelUser) {
			$(this).attr("value","");
		}
		$(this).addClass("focussed");
	});
	$("#username").blur(function() {
		if (!$(this).attr("value")) {
			$(this).attr("value",$labelUser);
		}
		$(this).removeClass("focussed");
	});
});