/*
<!--- AUTHOR: Davin Leier --->
<!--- DATE CREATED: 2006.08.09 --->
<!--- PURPOSE: Common Javascript functions and methods used throughout the site --->
<!--- REVISIONS: 
--->
*/
function openWindow(winURL, winName, winWidth, winHeight, winX, winY, boolScrollBars) 
{
	if (!winURL) winURL = '/';
	if (!winName) winName = 'newWin';
	if (!winWidth) winWidth = 100;
	if (!winHeight) winHeight = 100;
	if (!winX) winX = 0;
	if (!winY) winY = 0;		
	if (!boolScrollBars) boolScrollBars = 1;
    
	newWinObject = window.open(winURL, winName,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=' + boolScrollBars + ',resizable=1,width=' + winWidth + ',height=' + winHeight + ',left=' +  winX + ',top=' + winY);

	if (newWinObject)	{
    // popup successfully created
		newWinObject.focus();
	} else {
	// popup was not created.
		//showPopupNotice();
	}
	return newWinObject;
}

// expands a page element so that the footer is at the bottom of the page
function expandPage(heightElement,ieDifference,navDifference){
	if (document.getElementById(heightElement)){
		 if (navigator.appName == "Microsoft Internet Explorer"){
			
			var intScreenHeight = screen.height;
			var intDocumentHeight = document.getElementById(heightElement).height;
			var intBrowserHeight = document.body.clientHeight;
			
			if (intDocumentHeight > intBrowserHeight) {
				var setDocumentHeight = (intScreenHeight - ieDifference);				
			}
			else {
				var setDocumentHeight = (intBrowserHeight - ieDifference);
			}	
			document.getElementById(heightElement).height = setDocumentHeight;	
		}
		else if (navigator.appName == "Netscape"){
				
			var intInnerHeight = window.innerHeight;
			var intDocumentHeight = document.height;
		
			if (intInnerHeight > intDocumentHeight) {
				var setDocumentHeight = (intInnerHeight - navDifference);		
			}
			else {
				var setDocumentHeight = (intDocumentHeight - navDifference);
			}
			document.getElementById(heightElement).height = setDocumentHeight;	
		}	
	}
}

// Display a DHTML div notice that popups are being blocked
function showPopupNotice()	{
	if (!document.createElement)	{
		return;
	}
    var elmDiv = document.createElement('div');
	if (typeof(elmDiv.innerHTML) != 'string')	{
		return;
	}
	elmDiv.id  = 'popupnotice';
	
	elmDiv.style.cssText = 
         'position: absolute; left: 200px; top: 200px;' +
         'width: 400px;' +
         'color: black; ' +
         'background-color: white; ' +
         'font-weight: bold; ' +
         'border: solid #cecfce 3px; ' +
         'padding: 1em;';

	var html = '<p>You are blocking popups'
         	 + '<div><a href="#" onclick="hidePopupNotice(); return false;">Close this message</a></div></p>';
			 
    document.body.appendChild(elmDiv);
    elmDiv.innerHTML = html;
}

// Hide the popup notice after it has appeared
function hidePopupNotice()	{
	var elmDiv = document.getElementById('popupnotice');
	if (elmDiv)	
		{
     elmDiv.parentNode.removeChild(elmDiv);
    }
}

// Functions used during the online join process
function blurCCInfo(){
	// CHANGE THE COLOR OF THE LABELS
	document.getElementById("CCCardType").style.color = "#999999";
	document.getElementById("CCCardNumber").style.color = "#999999";
	document.getElementById("CCExpDate").style.color = "#999999";
	document.getElementById("CCSecurityCode").style.color = "#999999";
	document.getElementById("CCOwnersName").style.color = "#999999";
	
	// DISABLE THE FIELDS
	document.frmAccountInfo.intCCAccountTypeId.disabled = true;
	document.frmAccountInfo.intCCAccountNumber.disabled = true;
	document.frmAccountInfo.intCCAccountExpirationMonth.disabled = true;
	document.frmAccountInfo.intCCAccountExpirationYear.disabled = true;
	document.frmAccountInfo.intCCAccountSecurityCode.disabled = true;
	document.frmAccountInfo.strCCAccountOwnersName.disabled = true;
	
	// RESET THE ACH FIELD COLORS
	document.getElementById("ACHAccountType").style.color = "#000000";
	document.getElementById("ACHBankName").style.color = "#000000";
	document.getElementById("ACHRoutingNumber").style.color = "#000000";
	document.getElementById("ACHAccountNumber").style.color = "#000000";
	document.getElementById("ACHOwnersName").style.color = "#000000";
	
	// RE-ENABLE THE ACH INPUT FIELDS
	document.frmAccountInfo.strBankName.disabled = false;
	document.frmAccountInfo.intBankAccountTypeId.disabled = false;
	document.frmAccountInfo.intBankAccountRoutingNumber.disabled = false;
	document.frmAccountInfo.intBankAccountNumber.disabled = false;
	document.frmAccountInfo.strBankAccountOwnersName.disabled = false;
}

function blurClubTabCCInfo(){
	// CHANGE THE COLOR OF THE LABELS
	document.getElementById("CCCardType").style.color = "#999999";
	document.getElementById("CCCardNumber").style.color = "#999999";
	document.getElementById("CCExpDate").style.color = "#999999";
	document.getElementById("CCSecurityCode").style.color = "#999999";
	document.getElementById("CCOwnersName").style.color = "#999999";
	
	// DISABLE THE FIELDS
	document.frmClubTabInfo.intClubTabCCAccountTypeId.disabled = true;
	document.frmClubTabInfo.intClubTabCCAccountNumber.disabled = true;
	document.frmClubTabInfo.intClubTabCCAccountExpirationMonth.disabled = true;
	document.frmClubTabInfo.intClubTabCCAccountExpirationYear.disabled = true;
	document.frmClubTabInfo.intClubTabCCAccountSecurityCode.disabled = true;
	document.frmClubTabInfo.strClubTabCCAccountOwnersName.disabled = true;
}

function enableClubTabCCInfo(){
	// CHANGE THE COLOR OF THE LABELS
	document.getElementById("CCCardType").style.color = "#000000";
	document.getElementById("CCCardNumber").style.color = "#000000";
	document.getElementById("CCExpDate").style.color = "#000000";
	document.getElementById("CCSecurityCode").style.color = "#000000";
	document.getElementById("CCOwnersName").style.color = "#000000";
	
	// DISABLE THE FIELDS
	document.frmClubTabInfo.intClubTabCCAccountTypeId.disabled = false;
	document.frmClubTabInfo.intClubTabCCAccountNumber.disabled = false;
	document.frmClubTabInfo.intClubTabCCAccountExpirationMonth.disabled = false;
	document.frmClubTabInfo.intClubTabCCAccountExpirationYear.disabled = false;
	document.frmClubTabInfo.intClubTabCCAccountSecurityCode.disabled = false;
	document.frmClubTabInfo.strClubTabCCAccountOwnersName.disabled = false;
}
function toggleClubTab(){
	if(document.frmClubTabInfo.boolUsePreviousCCInformation.checked == true){
		blurClubTabCCInfo();
	} else {
		enableClubTabCCInfo();
	}
}
function blurACHInfo(){
	// CHANGE THE COLOR OF THE LABELS
	document.getElementById("ACHAccountType").style.color = "#999999";
	document.getElementById("ACHBankName").style.color = "#999999";
	document.getElementById("ACHRoutingNumber").style.color = "#999999";
	document.getElementById("ACHAccountNumber").style.color = "#999999";
	document.getElementById("ACHOwnersName").style.color = "#999999";
	
	// DISNABLE THE ACH INPUT FIELDS
	document.frmAccountInfo.strBankName.disabled = true;
	document.frmAccountInfo.intBankAccountTypeId.disabled = true;
	document.frmAccountInfo.intBankAccountRoutingNumber.disabled = true;
	document.frmAccountInfo.intBankAccountNumber.disabled = true;
	document.frmAccountInfo.strBankAccountOwnersName.disabled = true;
	
	// RESET THE CC FIELD COLORS
	document.getElementById("CCCardType").style.color = "#000000";
	document.getElementById("CCCardNumber").style.color = "#000000";
	document.getElementById("CCExpDate").style.color = "#000000";
	document.getElementById("CCSecurityCode").style.color = "#000000";
	document.getElementById("CCOwnersName").style.color = "#000000";
	
	// RE-ENABLE THE FIELDS
	document.frmAccountInfo.intCCAccountTypeId.disabled = false;
	document.frmAccountInfo.intCCAccountNumber.disabled = false;
	document.frmAccountInfo.intCCAccountExpirationMonth.disabled = false;
	document.frmAccountInfo.intCCAccountExpirationYear.disabled = false;
	document.frmAccountInfo.intCCAccountSecurityCode.disabled = false;
	document.frmAccountInfo.strCCAccountOwnersName.disabled = false;
}

if (document.images) {	
	nav_AboutTransfer_on = new Image();
	nav_AboutTransfer_on.src = "/images/transfer_framework/nav_images/AboutTransfer_on.gif";
	nav_AboutTransfer_off = new Image();
	nav_AboutTransfer_off.src = "/images/transfer_framework/nav_images/AboutTransfer_off.gif";

	nav_AboutLTF_on = new Image();
	nav_AboutLTF_on.src = "/images/transfer_framework/nav_images/aboutLTF_on.gif";
	nav_AboutLTF_off = new Image();
	nav_AboutLTF_off.src = "/images/transfer_framework/nav_images/aboutLTF_off.gif";

	nav_Transfer_on = new Image();
	nav_Transfer_on.src = "/images/transfer_framework/nav_images/transfer_on.gif";
	nav_Transfer_off = new Image();
	nav_Transfer_off.src = "/images/transfer_framework/nav_images/transfer_off.gif";	
}