// @author Arun M. Thomas
// @version $Id: MerchantJavaScript.js,v 1.1.1.1 2001/07/23 23:11:14 cfrisch Exp $
//
// Function to enable use of the iPIN system.  The function below opens a Payment
// Panel with the dimensions required by iPIN.  These dimensions have been
// widely distributed - pages to be displayed within the pop-up window are
// optimized for display at this size.  This function can be used either
// directly as the action of a link, or within other JavaScript which prepares a
// URL for display.  In either case, this function should be used as the last
// step to actually access the Payment Panel.
//
// Within an html page, this script can be accessed simply by including it via a
// line of the following form:
//		<script language="JavaScript" src="<PATH>/MerchantJavaScript.js"></script>
//
// @param url - A single URL which will be used as the contents of a pop-up
// 							window.  This URL can have parameters which will be interpreted
//							by the resource identified by the URL.
//
function openPaymentPanel(url) {
 	var win = window.open(url,'iPIN_PaymentPanel','width=544,height=370,left=10,top=10,resizable=yes,status,location=no');
}

self.name='MerchantWindow';

function authorize(productId, type)
{
//	var myParam ;
//	if ( type == 2 )
//	{
//		myParam = "2" ;
//	}
//	else
//	{
//		myParam = "" ;
//	}

	var rndSess = Math.round(Math.random () * 1000000000000000) ;
	var url = '/acte' + type +'/pos_init?action=authorize&pId=' + productId + "&idc=" + rndSess ;
	openPaymentPanel(url);
}
