// Open the management reports in a new window
function popUp(userID, acctID) {
	url = "https://555admin.com/cf/ent/index.cfm?userID=" + userID + "&acctID=" + acctID;
	var win = window.open (url,'reports','width=550,height=420,left=0,top=0, location=0,menubar=0,status=1,titlebar=0,toolbar=0,hotkeys=0,scrollbars=1,resizable=1');  
	if (!win.opener) win.opener = self; // For JS1.0
}

// Confirm Delete
function confirmGenericDelete(url, key) {
	if ( confirm("Are you sure you want to delete this " + key + "?") ) {
		document.location.href = url;	
	} else {
		return false;
	}
}

/*
 * Toggle between an existing or new credit card
 */
function toggleCreditCard(form, radioName, newValue, radioIndex) {

	// the radio object is identified by name rather than id, 
	// and the particular item picked by index
	radioObjs = document.getElementsByName(radioName);
	radioObj = radioObjs[radioIndex];
	
	// Pick the card being edited
	selectNewCreditCard(radioObj, newValue);
	
	// Make sure only one radio button is selected
	selectOne(form, radioObj);
}

// Select a new credit card
function selectNewCreditCard(radioObj, newValue) {
	if(!radioObj) {
		return;
	}
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	for(var i = 0; i < radioLength; i++) {
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) {
			radioObj[i].checked = true;
		}
	}
}