
// Tunnel action handlers
function doAction(formID,action,fieldID,fieldValue) {
	// get the form name
	myForm = document.getElementById(formID);
	// set the submitted action
	if (document.getElementById("submission_action")) {
		document.getElementById("submission_action").value = action;
	}
	if( document.getElementById(fieldID) ) {
		document.getElementById(fieldID).value = fieldValue;
	}
	// submit it
	myForm.submit();
	return false;
}

// popups for credit card form fields

function abbreviationsPopUp (what) {
	var url = "NewStateAbbreviations.jsp?&localeid=" + locale + "&display="+what;
	var newWin = window.open(url,"abbrev","scrollbars,resizable,width=390,height=500");
	newWin.focus();
	return false;
}

function ccIDPopUp () {
	var url = "CCIdPopUp.jsp";
	var newWin = window.open(url,"ccid","scrollbars,resizable,width=435,height=550");
	newWin.focus();
	return false;
}

function Securitypopup(securitypopupURL, windowHeight, windowWidth, toolbar) {

        var height    = "435";
        var width     = "550";

        if (windowHeight) {
                height = windowHeight;
        }
        if (windowWidth) {
                width = windowWidth;
        }

        var left      = Math.floor( (screen.width - width) / 2);
        var top      = Math.floor( (screen.height - height) / 2);

        // If the window contains a toolbar, subtract 50 from location of the
        // top of the window to accomodate the size of the toolbar, so that
        // the window will still be centered in the screen.

        if (toolbar) {
                top = top - 50;
        }

        var winParams = "top=" + top + ",left=" + left + ",height=" + height + ",width=" + width + ",scrollbars,resizable";
        if (toolbar) {
                winParams = winParams + ",toolbar";
        }
        msgWindow     = window.open('','targetname',winParams);
        
        msgWindow.location.href = securitypopupURL;		
        if (msgWindow.opener == null) msgWindow.opener = self;

} 


