﻿/// <reference path="http://ajax.microsoft.com/ajax/jQuery/jquery-1.3.2-vsdoc.js" />

var emailFieldString = "Email";

$(document).ready(function() {
	$("a#ctl00_AccountsLink").click(function() {
		$("div#ctl00_MiniAccountsContainer").slideToggle("fast");
		$(".pageHelpContainer").toggle();
		$("div#accountLinks").toggle();
		$("span.readyCheckbox").toggle();
	});

	$("#accountsMiniWindowCloseContainer").click(function() {
		$("div#accountLinks").show();
		$(".pageHelpContainer").show();
		$("span.readyCheckbox").show();
		$("div#ctl00_MiniAccountsContainer").slideToggle("fast");
	});

	$(".lightboxTermslink").colorbox({ width: "750", height: "550", iframe: true });

	//Initialize Password Watermark field (not done by default to handle users with Javascript disabled)
	$("input[id $= 'PasswordWatermarkTextbox']").show();
	$("input[id $= 'PasswordTextbox']").hide();

	/* Password Watermark */
	$("input[id $= 'PasswordWatermarkTextbox']").focus(function() {
		$("input[id $= 'PasswordWatermarkTextbox']").hide();
		$("input[id $= 'PasswordTextbox']").show().focus();
	});

	$("input[id $= 'PasswordTextbox']").blur(function() {
	if ($("input[id $= 'PasswordTextbox']").val().length == 0) {
			$("input[id $= 'PasswordWatermarkTextbox']").show();
			$("input[id $= 'PasswordTextbox']").hide();
		}
	});

});

function hideWatermark(objname) { obj = document.getElementById(objname); if (obj.value == emailFieldString) { obj.value = ""; obj.style.color = "#333333"; } }
function showWatermark(objname) { obj = document.getElementById(objname); if (obj.value == "") { obj.value = emailFieldString; obj.style.color = "#888888"; } }
function replaceChar(strOriginal, strChar, strReplace, bolSensitive) { bolSensitive = "boolean" == typeof (bolSensitive) ? bolSensitive : false; var regReplace = eval("/" + strChar + "/g" + (bolSensitive ? "i" : "")); return strOriginal.replace(regReplace, strReplace); }

//clicking 'Enter' key should only submit this form when it (submit button must have UseSubmitBehavior="false", so Enter key doesn't submit other forms by default)
function miniEnterSubmit(e, frm) { var pressedKey = document.all ? window.event.keyCode : e.which; var btnID = $("input[id $= 'SignInButton']").attr("id").val(); btnID = replaceChar(btnID, "_", "$", false); if (pressedKey == 13) __doPostBack(btnID, ''); else { return true; } }
