<script type="text/javascript">


function changeCountryCode(field) {
	
	if (/* field.selectedIndex == 0 || */ field.value == "") 
		return;
		

		
	//var url = "get_country_code.php?country_name="  + field.options[field.selectedIndex].text;
	var url = "<? echo 'https://' . $HTTP_HOST . '/link_authorizations/get_country_code.php?country_name='; ?>" + field.options[field.selectedIndex].text;
	
	
	
	new Ajax.Request(url, {
		method: "POST",
		onSuccess: function(transport) {
			document.getElementById('callingCode').innerHTML = transport.responseText;
			document.getElementById('callingCodeExample').innerHTML = transport.responseText;
		  	if (field.value.trim() != "") {
		  		showValidImg(field);
			}
		}
	});
	
}




function changeTheirFee(field) {

	//alert(field.value);
	
	var myfee = field.value;
	
	var feetotal = "<? echo $account["transaction_fee_total"]; ?>";
	
	
	// THEIR ACTUAL FEE
	
	var theirfee = parseFloat(feetotal - myfee);
	
	theirfee = parseFloat(theirfee * 100).toFixed(1);
	
	document.getElementById('transactionFeeTheir').innerHTML = theirfee;
	
	document.getElementById('myExample').innerHTML = theirfee;
	
	
	// MY EXAMPLE FEE VALUE
	
	var myExampleFee = parseFloat(1 - myfee).toFixed(3);
	
	//alert(myExampleFee);
	
	var myExampleValue = parseFloat(100 * myExampleFee);
	
	document.getElementById('myExample').innerHTML = myExampleValue.toPrecision(4);
	
	
	
	// THEIR EXAMPLE FEE VALUE
	
	var theirExampleFee = parseFloat(theirfee / 100).toFixed(3);
	
	var theirExampleValue = parseFloat(100 * theirExampleFee) + 100;

	
	document.getElementById('theirExample').innerHTML = theirExampleValue.toPrecision(5);
	

}



function displayTheirFee(field) {

	//alert(field.value);

	var amountToPay = parseFloat(field.value).toFixed(2);
	
	var thierFeePercentage = "<? echo $payme["account"]["transaction_fee_their"]; ?>";
	
	
	// THEIR ACTUAL FEE
	
	var theirfee = parseFloat(amountToPay * thierFeePercentage).toFixed(2);
	
	if ( isNaN(theirfee) ) {
		theirfee = "0.00";
	}
	
	document.getElementById('transactionFeeTheir').innerHTML = theirfee;
	
	//alert(theirfee);
	//alert(amountToPay);
	
	var theirtotal = parseFloat(amountToPay) + parseFloat(theirfee);
	
	//alert(theirtotal);
	
	if ( isNaN(theirtotal) ) {
		theirtotal = "0.00";
	}
	
	document.getElementById('theirTotalCharge').innerHTML = theirtotal.toFixed(2);
}


function UCWords(str){
  var arrStr = str.split(" ");
  var strOut = "";
  var i = 0;
  while (i < arrStr.length) {
     firstChar  = arrStr[i].substring(0,1);
     remainChar = arrStr[i].substring(1);
     firstChar  = firstChar.toUpperCase(); 
     remainChar = remainChar.toLowerCase();
     strOut += firstChar + remainChar + ' ';
     i++;
  }
  return strOut.substr(0,strOut.length - 1);
}



function usd2USD(field) {

	//alert(field.value);
	//var amount = parseFloat(field.value).toFixed(2);
	
	
	if( isNaN(field.value) || (field.value == "") || (field.value == " ") ) {
		document.getElementById('usdVALUE').innerHTML = "-.--";
	} else {
		document.getElementById('usdVALUE').innerHTML = parseFloat(field.value).toFixed(2);
	}
}


function translateToUSD(field) {

	//alert(field.value);

	var amount = parseFloat(field.value).toFixed(2);
	
	var usdRATIO = "<? echo get_fx($template['company']['currency1'],$account['currency_code_1'],'1.00'); ?>";
	
	//alert(usdRATIO);
	
	var translatedCURRENCY = parseFloat(amount / usdRATIO);
	
	if ( isNaN(translatedCURRENCY) || (field.value == "") || isNaN(field.value)) {
		document.getElementById('translatedToUSD').value = "";
		//document.getElementById('translatedFromUSD').value = "-.--";
		document.getElementById('translatedVALUE').innerHTML = "-.--";
		document.getElementById('usdVALUE').innerHTML = "-.--";
	} else {
		document.getElementById('translatedToUSD').value = translatedCURRENCY.toFixed(2);
		document.getElementById('translatedVALUE').innerHTML = parseFloat(field.value).toFixed(2);
		document.getElementById('usdVALUE').innerHTML = translatedCURRENCY.toFixed(2);
	}
}



function translateToUSD2(field,currencyRATIO) {

	//alert(field.value);

	var amount = parseFloat(field.value).toFixed(2);
	
	var usdRATIO = currencyRATIO;
	
	//alert(usdRATIO);
	
	var translatedCURRENCY = parseFloat(amount / usdRATIO);
	
	if ( isNaN(translatedCURRENCY) || (field.value == "") || isNaN(field.value)) {
		document.getElementById('translatedToUSD').value = "";
		//document.getElementById('translatedFromUSD').value = "-.--";
		document.getElementById('translatedVALUE').innerHTML = "-.--";
		document.getElementById('usdVALUE').innerHTML = "-.--";
	} else {
		document.getElementById('translatedToUSD').value = translatedCURRENCY.toFixed(2);
		document.getElementById('translatedVALUE').innerHTML = parseFloat(field.value).toFixed(2);
		document.getElementById('usdVALUE').innerHTML = translatedCURRENCY.toFixed(2);
	}
}


/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////


function translateFromCURRENCY0(field,currency1RATIO,currency2RATIO) {

	var amount = field.value;
	amount = stripCommas(amount);
	amount = parseFloat(amount).toFixed(2);
	
	var translatedToCURRENCY1 = amount * currency1RATIO;
	var translatedToCURRENCY2 = amount * currency2RATIO;
	
	if ((amount == "") || isNaN(amount)) {
		document.getElementById('currency1').value = "";
		document.getElementById('currency2').value = "";
	} else if (isNaN(translatedToCURRENCY1) &&  isNaN(translatedToCURRENCY2)) {
		document.getElementById('currency1').value = "";
		document.getElementById('currency2').value = "";
	} else {
		//translatedToCURRENCY1 = formatCurrency(translatedToCURRENCY1);
		//translatedToCURRENCY2 = formatCurrency(translatedToCURRENCY2);
		document.getElementById('currency1').value = formatCurrency(translatedToCURRENCY1);
		document.getElementById('currency2').value = formatCurrency(translatedToCURRENCY2);
	}
}

function translateFromCURRENCY1(field,currency0RATIO,currency2RATIO) {

	var amount = field.value;
	amount = stripCommas(amount);
	amount = parseFloat(amount).toFixed(2);
	
	var translatedToCURRENCY0 = amount / currency0RATIO;
	var translatedToCURRENCY2 = amount / currency2RATIO;
	
	if ((amount == "") || isNaN(amount)) {
		document.getElementById('currency0').value = "";
		document.getElementById('currency2').value = "";
	
	} else if (isNaN(translatedToCURRENCY0) &&  isNaN(translatedToCURRENCY2)) {
		document.getElementById('currency0').value = "";
		document.getElementById('currency2').value = "";
	
	} else {
		document.getElementById('currency0').value = formatCurrency(translatedToCURRENCY0);
	}
}



function translateFromCURRENCY2(field,currency0RATIO,currency1RATIO) {

	var amount = field.value;
	amount = stripCommas(amount);
	amount = parseFloat(amount).toFixed(2);
	
	var translatedToCURRENCY0 = amount / currency0RATIO;
	var translatedToCURRENCY1 = amount * currency1RATIO;
	
	if ((amount == "") || isNaN(amount)) {
		document.getElementById('currency0').value = "";
		document.getElementById('currency1').value = "";
	
	} else if (isNaN(translatedToCURRENCY0) &&  isNaN(translatedToCURRENCY1)) {
		document.getElementById('currency0').value = "";
		document.getElementById('currency1').value = "";
	
	} else {
		document.getElementById('currency0').value = formatCurrency(translatedToCURRENCY0);
	}
}





/////////////////////////////////////////////////////////////////////////////////

function C0FeeTotal(field,theirFeePercentage) {
	
	var amount = field.value;
	amount = stripCommas(amount);
	amount = parseFloat(amount).toFixed(2);
	
	var currency0fee = parseFloat(amount * theirFeePercentage);
	var currency0total = (parseInt(amount) + currency0fee).toFixed(2);
	
	if ((amount == "") || isNaN(amount)) {
		document.getElementById('currency0fee').innerHTML = "0.00";
		document.getElementById('currency0total').innerHTML = "0.00";
	} else if (isNaN(currency0total)) {
		document.getElementById('currency0fee').innerHTML = "0.00";
		document.getElementById('currency0total').innerHTML = "0.00";
	} else {
		//alert(currency0fee);
		document.getElementById('printCurrency0total').innerHTML = formatCurrency(currency0total);
		document.getElementById('printCurrency0fee').innerHTML = formatCurrency(currency0fee);
	}
}


function C1toC0FeeTotal(field,theirFeePercentage,currency1ratio) {
	
	var amount = field.value;
	amount = stripCommas(amount);
	amount = parseFloat(amount).toFixed(2);
	
	var currency0 = parseFloat(amount / currency1ratio);
	var currency0fee = parseFloat(currency0 * theirFeePercentage);
	var currency0total = (currency0 + currency0fee).toFixed(2);
	
	if ((amount == "") || isNaN(amount)) {
		document.getElementById('currency0fee').innerHTML = "0.00";
		document.getElementById('currency0total').innerHTML = "0.00";
	} else if (isNaN(currency0total)) {
		document.getElementById('currency0fee').innerHTML = "0.00";
		document.getElementById('currency0total').innerHTML = "0.00";
	} else {
		//alert(currency0fee);
		document.getElementById('printCurrency0total').innerHTML = formatCurrency(currency0total);
		document.getElementById('printCurrency0fee').innerHTML = formatCurrency(currency0fee);
	}
}


function C2toC0FeeTotal(field,theirFeePercentage,currency2ratio) {
	
	//alert(field.value);
	
	var amount = field.value;
	amount = stripCommas(amount);
	amount = parseFloat(amount).toFixed(2);
	
	var currency0 = parseFloat(amount / currency2ratio);
	var currency0fee = parseFloat(currency0 * theirFeePercentage);
	var currency0total = (currency0 + currency0fee).toFixed(2);
	
	if ((amount == "") || isNaN(amount)) {
		document.getElementById('currency0fee').innerHTML = "0.00";
		document.getElementById('currency0total').innerHTML = "0.00";
	} else if (isNaN(currency0total)) {
		document.getElementById('currency0fee').innerHTML = "0.00";
		document.getElementById('currency0total').innerHTML = "0.00";
	} else {
		//alert(currency0fee);
		document.getElementById('printCurrency0total').innerHTML = formatCurrency(currency0total);
		document.getElementById('printCurrency0fee').innerHTML = formatCurrency(currency0fee);
	}
}





/////////////////////////////////////////////////////////////////////////////////


function formatCurrency(strValue)
{
	strValue = strValue.toString().replace(/\$|\,/g,'');
	dblValue = parseFloat(strValue);
 
	blnSign = (dblValue == (dblValue = Math.abs(dblValue)));
	dblValue = Math.floor(dblValue*100+0.50000000001);
	intCents = dblValue%100;
	strCents = intCents.toString();
	dblValue = Math.floor(dblValue/100).toString();
	if(intCents<10)
		strCents = "0" + strCents;
	for (var i = 0; i < Math.floor((dblValue.length-(1+i))/3); i++)
		dblValue = dblValue.substring(0,dblValue.length-(4*i+3))+','+
		dblValue.substring(dblValue.length-(4*i+3));
	return (((blnSign)?'':'-') + dblValue + '.' + strCents);
}

function stripCommas(numString) {
    var re = /,/g;
    return numString.replace(re,"");
}



/////////////////////////////////////////////////////////////////////////////////

function translateC1toC2(field,currency1RATIO,currency2RATIO) {

	//alert(field.value);
	
	var amount = field.value;
	amount = stripCommas(amount);
	amount = parseFloat(amount).toFixed(2);
	
	var translatedToCURRENCY2 = amount * parseFloat(currency2RATIO / currency1RATIO);
	
	//alert(translatedToCURRENCY2);
	
	if ((amount == "") || isNaN(amount)) {
		document.getElementById('currency2').value = "";
	} else if (isNaN(translatedToCURRENCY2)) {
		document.getElementById('currency2').value = "";
	} else {
		document.getElementById('currency2').value = formatCurrency(translatedToCURRENCY2);
	}
}

function translateC0toC1(field,currency1RATIO) {

	//alert(field.value);
	
	var amount = field.value;
	amount = stripCommas(amount);
	amount = parseFloat(amount).toFixed(2);
	
	var translatedToCURRENCY1 = parseFloat(amount * currency1RATIO);
	//alert(translatedToCURRENCY1);
	
	if ((amount == "") || isNaN(amount)) {
	//alert("1");
		document.getElementById('currency_1').value = "";
	} else if (isNaN(translatedToCURRENCY1)) {
	//alert("2");
		document.getElementById('currency_1').value = "";
	} else {
	//alert("3");
		document.getElementById('currency_1').value = formatCurrency(translatedToCURRENCY1);
	//alert("4");
	}
}


function printC0_C0(field) {

	//alert(field.value);
	
	var amount = field.value;
	amount = stripCommas(amount);
	amount = parseFloat(amount).toFixed(2);
	
	//var translatedToCURRENCY1 = parseFloat(amount * currency1RATIO);
	//alert(translatedToCURRENCY1);
	
	if ((amount == "") || isNaN(amount)) {
	//alert("1");
		document.getElementById('print_currency_0').innerHTML = "-.--";
		//document.getElementById('print_currency_1').innerHTML = "-.--";
	} else {
	//alert("3");
		document.getElementById('print_currency_0').innerHTML = formatCurrency(amount);
		//document.getElementById('print_currency_1').innerHTML = formatCurrency(translatedToCURRENCY1);
	//alert("4");
	}
}

function printC0_C1(field,currency1RATIO) {

	//alert(field.value);
	
	var amount = field.value;
	amount = stripCommas(amount);
	amount = parseFloat(amount).toFixed(2);
	
	var translatedToCURRENCY1 = parseFloat(amount * currency1RATIO);
	//alert(translatedToCURRENCY1);
	
	if ((amount == "") || isNaN(amount)) {
	//alert("1");
	
		if(document.getElementById('print_currency_0') != null)
			document.getElementById('print_currency_0').innerHTML = "-.--";
		
		if(document.getElementById('print_currency_1') != null)
			document.getElementById('print_currency_1').innerHTML = "-.--";
	
	} else if (isNaN(translatedToCURRENCY1)) {
	//alert("2");
		if(document.getElementById('print_currency_0') != null)
			document.getElementById('print_currency_0').innerHTML = "-.--";
		
		if(document.getElementById('print_currency_1') != null)
			document.getElementById('print_currency_1').innerHTML = "-.--";
	} else {
	//alert("3");
		if(document.getElementById('print_currency_0') != null)
			document.getElementById('print_currency_0').innerHTML = formatCurrency(amount);
		
		if(document.getElementById('print_currency_1') != null) {
			document.getElementById('print_currency_1').innerHTML = formatCurrency(translatedToCURRENCY1);
		}
	
	//alert("4");
	}
}


function printC1_C0(field,currency1RATIO) {

	//alert(field.value);
	
	var amount = field.value;
	amount = stripCommas(amount);
	amount = parseFloat(amount).toFixed(2);
	
	var translatedToCURRENCY0 = parseFloat(amount / currency1RATIO);
	//alert(translatedToCURRENCY1);
	
	if ((amount == "") || isNaN(amount)) {
	//alert("1");
	if(document.getElementById('print_currency_0') != null)
		document.getElementById('print_currency_0').innerHTML = "-.--";
	if(document.getElementById('print_currency_1') != null)
		document.getElementById('print_currency_1').innerHTML = "-.--";
	} else if (isNaN(translatedToCURRENCY0)) {
	//alert("2");
		if(document.getElementById('print_currency_0') != null)
		document.getElementById('print_currency_0').innerHTML = "-.--";
		if(document.getElementById('print_currency_1') != null)
		document.getElementById('print_currency_1').innerHTML = "-.--";
	} else {
	//alert("3");
		if(document.getElementById('print_currency_1') != null)
		document.getElementById('print_currency_1').innerHTML = formatCurrency(amount);
		
		if(document.getElementById('print_currency_0') != null)
		document.getElementById('print_currency_0').innerHTML = formatCurrency(translatedToCURRENCY0);
	//alert("4");
	}
}


function translateC1toC0(field,currency1RATIO) {

	//alert(field.value);
	//alert(currency1RATIO);
	
	
	var amount = field.value;
	amount = stripCommas(amount);
	amount = parseFloat(amount).toFixed(2);
	//alert(amount);
	
	var translatedToCURRENCY0 = parseFloat(amount / currency1RATIO);
	//alert(translatedToCURRENCY0);
	
	
	if ((amount == "") || isNaN(amount)) {
		document.getElementById('currency_0').value = "";
	} else if (isNaN(translatedToCURRENCY0)) {
		document.getElementById('currency_0').value = "";
	} else {
		document.getElementById('currency_0').value = formatCurrency(translatedToCURRENCY0);
	}
}



function translateC2toC1(field,currency1RATIO,currency2RATIO) {

	//alert(field.value);
	
	var amount = field.value;
	amount = stripCommas(amount);
	amount = parseFloat(amount).toFixed(2);
	
	var translatedToCURRENCY1 = amount * parseFloat(currency1RATIO / currency2RATIO);
	
	//alert(translatedToCURRENCY2);
	
	if ((amount == "") || isNaN(amount)) {
		document.getElementById('currency1').value = "";
	} else if (isNaN(translatedToCURRENCY1)) {
		document.getElementById('currency1').value = "";
	} else {
		//translatedToCURRENCY1 = formatCurrency(translatedToCURRENCY1);
		document.getElementById('currency1').value = formatCurrency(translatedToCURRENCY1);
	}
}

function translateC2toC0(field,currency2RATIO) {

	//alert(field.value);
	
	var amount = field.value;
	amount = stripCommas(amount);
	amount = parseFloat(amount).toFixed(2);
	
	var translatedToCURRENCY0 = parseFloat(amount / currency2RATIO);
	
	//alert(translatedToCURRENCY0);
	
	if ((amount == "") || isNaN(amount)) {
		document.getElementById('currency0').value = "";
	} else if (isNaN(translatedToCURRENCY0)) {
		document.getElementById('currency0').value = "";
	} else {
		//translatedToCURRENCY0 = formatCurrency(translatedToCURRENCY0);
		document.getElementById('currency0').value = formatCurrency(translatedToCURRENCY0);
		//document.getElementById('currency2').value = formatCurrency(amount);
	}
}




/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////


function translateFromUSD(field) {

	//alert(field.value);
	
	if( isNaN(field.value) || (field.value == "") || (field.value == " ") ) {
		//alert("1");
		//alert(field.value);
		//document.getElementById('translatedToUSD').value = "-.--";
		document.getElementById('translatedFromUSD').value = "";
		document.getElementById('translatedVALUE').innerHTML = "-.--";
		document.getElementById('usdVALUE').innerHTML = "-.--";	

	} else {
		
		//alert("2");
		//alert(field.value);
		
		var amount = parseFloat(field.value).toFixed(2);
		var amountUSD = parseFloat(field.value).toFixed(2);
		//alert(amount);
		//alert(amountUSD);

		var usdRATIO = "<? echo get_fx($template['company']['currency1'],$account['currency_code_1'],'1.00'); ?>";
	//alert(usdRATIO);
		var translatedCURRENCY = parseFloat(amount * usdRATIO);
	//alert(translatedCURRENCY);
		document.getElementById('translatedFromUSD').value = translatedCURRENCY.toFixed(2);
		document.getElementById('translatedVALUE').innerHTML = translatedCURRENCY.toFixed(2);
		document.getElementById('usdVALUE').innerHTML = amountUSD;
	
	}
}


function translateFromUSD2(field,currencyRATIO) {

	//alert(field.value);
	
	if( isNaN(field.value) || (field.value == "") || (field.value == " ") ) {
		//alert("1");
		//alert(field.value);
		//document.getElementById('translatedToUSD').value = "-.--";
		document.getElementById('translatedFromUSD').value = "";
		document.getElementById('translatedVALUE').innerHTML = "-.--";
		document.getElementById('usdVALUE').innerHTML = "-.--";	

	} else {
		
		//alert("2");
		//alert(field.value);
		
		var amount = parseFloat(field.value).toFixed(2);
		var amountUSD = parseFloat(field.value).toFixed(2);
		//alert(amount);
		//alert(amountUSD);

		var usdRATIO = currencyRATIO;
	//alert(usdRATIO);
		var translatedCURRENCY = parseFloat(amount * usdRATIO);
	//alert(translatedCURRENCY);
		document.getElementById('translatedFromUSD').value = translatedCURRENCY.toFixed(2);
		document.getElementById('translatedVALUE').innerHTML = translatedCURRENCY.toFixed(2);
		document.getElementById('usdVALUE').innerHTML = amountUSD;
	
	}
}


function updateBusinessFee(businessFee) {
	if(businessFee == "Goods") {
		document.getElementById('printBusinessFee').innerHTML = "<span style='color:#007D02;'><? echo $master_config_business_transaction_fee_goods*100; ?>%</span>";
	} else {
		document.getElementById('printBusinessFee').innerHTML = "<span style='color:#560E61;'><? echo $master_config_business_transaction_fee_services*100; ?>%</span>";
	}
}


function printSalutation(field) {

	//alert(field.value);
	var salutation = field.value;
	
	if ( salutation == "none") {
		document.getElementById('printSalutation').innerHTML = "";
		document.getElementById('printSalutation2').innerHTML = "";
		document.getElementById('printSalutation3').innerHTML = "";
	} else {
		document.getElementById('printSalutation').innerHTML = salutation + "&nbsp;";
		document.getElementById('printSalutation2').innerHTML = salutation + "&nbsp;";
		document.getElementById('printSalutation3').innerHTML = salutation + "&nbsp;";
	}
}




function printFirstName(field) {

	//alert(field.value);
	
	if(field.value) {
		var tmpConverstion = UCWords(field.value);
		document.getElementById('printFirstName').innerHTML = tmpConverstion;
		document.getElementById('printFirstName2').innerHTML = tmpConverstion;
		document.getElementById('printFirstName3').innerHTML = tmpConverstion;
	} else {
		document.getElementById('printFirstName').innerHTML = "";
		document.getElementById('printFirstName2').innerHTML = "";
		document.getElementById('printFirstName3').innerHTML = "";
	}
}



function printLastName(field) {

	//alert(field.value);

	if(field.value) {
		var tmpConverstion = UCWords(field.value);
		document.getElementById('printLastName').innerHTML = "&nbsp;" + tmpConverstion;
		document.getElementById('printLastName2').innerHTML = "&nbsp;" + tmpConverstion + ",";
		document.getElementById('printLastName3').innerHTML = "&nbsp;" + tmpConverstion;
	} else {
		document.getElementById('printLastName').innerHTML = "";
		document.getElementById('printLastName2').innerHTML = "";
		document.getElementById('printLastName3').innerHTML = "";
		
	}	
}

function printEmailaddress(field) {

	//alert(field.value);
	
	if(field.value) {
		document.getElementById('printEmailaddress').innerHTML = "&#60;" + field.value + "&#62;";
	} else {
		document.getElementById('printEmailaddress').innerHTML = "";
	}
}



function printReference(field) {
	//alert(field.value);
	if(field.value) {
		document.getElementById('printReference').innerHTML = "Invoice No. / Reference ID:&nbsp;&nbsp;" + field.value + "<p>";
	} else {
		document.getElementById('printReference').innerHTML = "";
	}
}


function printNote(field) {
	
	if(field.value) {
		
		var convertedText = field.value.replace( new RegExp("\\n", "g"),"<br>");
		
		document.getElementById('printNote').innerHTML = "Extra Note:<p>" + convertedText + "<br><br>";
	} else {
		document.getElementById('printNote').innerHTML = "";
	}
}


function confirmLinkOut(url) {
	//alert(url);
	var answer = window.confirm("Warning:  Any changes to the Payment Request Form will not be saved. Click \"Cancel\" to stay on this page.");
	if(answer) {
		window.location = url;
	}
}



function cancelLinkWWW() {
	top.window.location.replace("<? echo $http . $template['company']['host_www']; ?>/cancel.b!");
}

function generateGUID() {
   return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
}

function generateUUID() {
   return (generateGUID()+generateGUID()+"-"+generateGUID()+"-"+generateGUID()+"-"+generateGUID()+"-"+generateGUID()+generateGUID()+generateGUID());
}

</script>