// <!-- Custom --> 16 November 2002
// multiconverter.js

// NB
// After editing this file the shop must be fully reloaded in the browser
// for changes to take effect

// Function for placing converter in Review
//
function reviewTotalPosition3(win,cSpan){
// Use of reviewTotalPosition3() positions line AFTER   the 2 standard totals

var captionString= "";   // Set a string value or use top.SL. language variable
var captionclass = null; // set alternate style class for caption cells
var figureclass  = null; // set alternate style class for "figure" cell

var useCaptionClass = (captionclass==null) ? "totalcaption" : captionclass;
var useFigureClass  = (figureclass==null)  ? "totalfigure"  : figureclass;

// data for button object
top.actions["rconverter"] = "top.X.Converter(top.BASKET.GoodsNet+top.BASKET.GoodsTax);";
top.imageObj["rconverter"]=  top.imageObj["converter"] // use existing image
top.textObj["rconverter"] =  top.textObj["converter"] // use existing alt/status text

win.document.write('<tr>',
	'<td class="',useCaptionClass,'" colspan="',cSpan,'" align="right">',captionString,'</td>',
	'<td  class="',useFigureClass,'" align="right">');

top.makeButtonBarH(win,["rconverter"]);

win.document.write('</td>',
	'<td class="',useCaptionClass,'"><br></td>',
	'</tr>');
}

top.sp.converterBrand="Fieba";

function Converter(Amount){
Amount=Amount*top.MONEY.cMult;
if(top.sp.converterBrand=="Fieba")
	{
	// Fieba Pre-set Currency Converter
	 var Loc="http://www.fieba.net/fieba/openconverter.jsp?Amount="
	 + Amount + "&From=" + top.MONEY.Code.toUpperCase();
	 top.TRG.location=Loc;
	}

else if(top.sp.converterBrand=="Xenon")
	{
	// Xenon Cross-Converter
	var msgWindow=window.open("http://www.shopassistant.net/currency/mc4conversion.htm?"
	 +Amount
	 +"&"+top.MONEY.Code,"displayWindow","toolbar=no,width=650,height=450,top=30,left=30,screenX=30,screenY=30,directories=no,status=no,scrollbars=yes,resize=yes,menubar=no");
	}
}//

// Function for placing converter in summary
//
function summaryConverterLine(win,Amount){
var d=win.document;
var captionclass = null; // set alternate style class for caption cells
var figureclass  = null; // set alternate style class for "figure" cell

var useCaptionClass = (captionclass==null) ? "totalcaption" : captionclass;
var useFigureClass  = (figureclass==null)  ? "totalfigure"  : figureclass;

// data for button object
top.actions["sconverter"] = "top.X.Converter(top.BASKET.TOTAL);";
top.imageObj["sconverter"]=  top.imageObj["converter"] // use existing image
top.textObj["sconverter"] =  top.textObj["converter"] // use existing alt/status text


if(top.T.TaxPerItem)
	{
	d.write('<tr><td colspan="4" class="',useCaptionClass,'">&nbsp;</td>');
	d.write('<td colspan="3" align="center" class="',useFigureClass,'">');
	}
else
	{
	d.write('<tr><td colspan="5" class="',useCaptionClass,'">');
	}
top.makeButtonBarH(win,new Array("sconverter" ));
d.write('</td>');
d.writeln("</tr>");
}


// function to support user of "converter" in button bar on Payments Page (retro compatibility)
// The object created also supports on page buttons
// to REMOVE converter button from payment page change in user/settings.js
// BEFORE sp.payRequiredLinks =  new Array("order", "converter" );
// AFTER  sp.payRequiredLinks =  new Array("order");

function paymentPageConverter(bdir,bext){

top.actions["converter"]= "top.X.Converter(top.BASKET.TOTAL);";
top.imageObj["converter"]= new top.ImgObj( bdir+"currency"+bext, top.sp.buttonWid, top.sp.buttonHei);
top.textObj["converter"]= new top.TxtObj(top.SL.lConverterAlt, top.SL.lConverterStat);

}


// Function for placing converter button on shopping page
//
function converterButton(win,Amount){
// data for button object
top.actions["pconverter"] = "top.X.Converter("+Amount+");";
top.imageObj["pconverter"]=  top.imageObj["converter"] // use existing image
top.textObj["pconverter"] =  top.textObj["converter"] // use existing alt/status text
top.makeButtonBarH(win,new Array("pconverter" ));
}


// Function for placing converter button on shopping page in a button bar
// For this to work you must have ONE product on the page and
// its price must be sent as PRICE parameter

function makeButtonBarWithConverter(win,myButtons,Amount,hvMode){
hvMode=typeof(hvMode)=="string" && "HVhv".indexOf(hvMode)>-1 ? hvMode : "H"; // Horizontal bar is default
top.actions["bconverter"] = "top.X.Converter("+Amount+");";
top.imageObj["bconverter"]=  top.imageObj["converter"] // use existing image
top.textObj["bconverter"] =  top.textObj["converter"] // use existing alt/status text
eval("top.makeButtonBar"+hvMode.toUpperCase()+"(win,myButtons)");
// top.makeButtonBarH(win,myButtons);
}



