$(document).ready(function() {
	$("#signInLink").click(function() {
		$("a#signInLink").addClass("showTab");
		$("#quickSignInFormWrapper").fadeIn("normal")
	});
	$("#quickSignInForm a.close").click(function() {
		$("#quickSignInFormWrapper").hide();
		$("a#signInLink").removeClass("showTab")
	});
	$("a.forgotPasswordLink").click(function() {
		$("#consumerForgotPassword").modal({containerId:"consumerForgotPasswordModalContainer", close:false})
	});
	$(".messageBody .chatDeclineLink").click(function() {
		$("#messageWrapper").fadeOut("fast")
	});
	$(".messageBody .chatAcceptLink").click(function() {
		$("#messageWrapper").fadeOut("fast")
	});
	var a = $("form.validate input.inputHint");
	a.length && a.inputHint().focus().blur();
	$.isFunction($.pngFix) && $("div.MSVE_MapContainer").pngFix();
	$(".loading[id^=profilelist_]").length && $(window).bind("scroll", {_selector:".loading[id^=profilelist_]", _container:window, _threshold:100}, llProfileImages).trigger("scroll")
});
function openWin(a, e, g, h) {
	myname = "extra";
	LeftPosition = screen.width ? (screen.width - e) / 2 : 0;
	TopPosition = screen.height ? (screen.height - g) / 2 : 0;
	settings = "height=" + g + ",width=" + e + ",top=" + TopPosition + ",left=" + LeftPosition + ",scrollbars  = " + h + ",resizable";
	win = window.open(a, myname, settings)
}
function openChatWindow(a) {
	window.open(a, "chatwin", "toolbar=0,location=0,directories=0,menubar=0,status=0,scrollbars=no,resizable=0,width=180,height=370,top=0,left=0")
}
function selectMyToolsTab(a) {
	var e = window.location.pathname;
	e = e.substring(e.lastIndexOf("\\") + 1);
	myToolsPageName = "/mytools/";
	if(e == myToolsPageName) {
		$("#mytoolsTabsWrapper > ul").tabs("select", a)
	}else {
		window.location = myToolsPageName + a
	}
}
function encodeString(a) {
	a = a.replace(/^[\s]+|[\s]+$/g, "");
	return a = a.replace(/\s/g, "+")
}
function llProfileImages(a) {
	var e = $(a.data._selector), g = a.data._container || window, h = a.data._threshold || 0, f = g === window ? {top:$(window).scrollTop(), left:$(window).scrollLeft()} : $(g).offset();
	f.bottom = f.top + $(g).height();
	f.right = f.left + $(g).width();
	var i = [];
	$(e).each(function(b, d) {
		d = $(d);
		if(!d.hasClass("inprog")) {
			b = d.parent();
			var c = b.offset();
			c.top = Math.max(0, c.top - h);
			c.left = Math.max(0, c.left - h);
			c.bottom = c.top + b.height() + h;
			c.right = c.left + b.width() + h;
			f.top < c.bottom && f.left < c.right && f.bottom > c.top && f.right > c.left && i.push(d.addClass("inprog").attr("id").replace(/^profilelist_/, ""))
		}
	});
	i.length && $.ajax({async:true, url:"/ajax/profile/getimages/profilelist/" + i.join(",") + "/?nd=" + (new Date).getTime(), type:"GET", dataType:"text", success:function(b) {
		b = new Envelope(b);
		b = b.payload.images || [];
		for(var d = 0, c = b.length;d < c;d++) {
			b[d] && b[d].id && b[d].src && $("#profilelist_" + b[d].id).attr("src", b[d].src).removeClass("loading inprog")
		}
	}})
}
;
