<!--


function format(val, post) {
	var decpoint;
	var begin;
	var end;
	var valstr;
	var temp_char;

	valstr   = "" + val;
	decpoint = valstr.indexOf(".")
	if (decpoint != -1) {
	      begin = valstr.substring(0,decpoint);
	      end   = valstr.substring(decpoint+1,valstr.length);
	}
	else {
		begin = valstr;
		end   = "";
	} 
	if (end.length < post) {
		while (end.length < post) {
			end += "0";
		}
	}
     
	end = end.substring(0,post);
	return (begin+"."+end);
}

function execFunc(funcString) { 

	// Local vars to store arguments
	var funcArgs = new Array();
	funcArgs["func"]  = "null";
	funcArgs["code"]  = "code_not_specified";
	funcArgs["price"] = "0.00";
	funcArgs["desc"]  = "item";
	funcArgs["quan"]  = "1";
	funcArgs["url"]   = "#";
	funcArgs["avail"] = "9999";

	funcArgs["lang"]  = "no";
	funcArgs["firstcall"] = "no";
	

	// Local vars used to store name/value pairs 
	var keyPair  = "";
	var keyName  = "";
	var keyValue = "";

	// Split funcString at each '&', storing the left-hand side
	// of the split in keyPair holder, and chopping the query
	// so that it gets the value of the right-hand string.
	while (funcString.indexOf("&") > -1) {

		keyPair = funcString.substring(0,funcString.indexOf("&"));
		funcString = funcString.substring((funcString.indexOf("&")) + 1);

		keyName  = keyPair.substring(0,keyPair.indexOf("="));
		keyValue = keyPair.substring((keyPair.indexOf("=")) + 1);
		funcArgs[keyName] = keyValue;
	}

	// Get what's left in funcString as the final keyPair.
	keyName  = funcString.substring(0,funcString.indexOf("="));
	keyValue = funcString.substring((funcString.indexOf("=")) + 1);
	funcArgs[keyName] = keyValue;

	if (funcArgs["func"] == "add") { parent.additem(funcArgs["code"],funcArgs["price"],funcArgs["desc"],funcArgs["quan"],funcArgs["url"],funcArgs["avail"],val_thumb,val_thumbwidth,val_thumbheight); }
	if (funcArgs["func"] == "set") { parent.setquantity(funcArgs["code"],funcArgs["price"],funcArgs["desc"],funcArgs["quan"],funcArgs["url"],funcArgs["avail"],val_thumb,val_thumbwidth,val_thumbheight); }
	if (funcArgs["func"] == "del") { parent.deleteitem(funcArgs["code"]); }

	if (funcArgs["firstcall"] == "yes") {
		if (funcArgs["lang"] == "en") { parent.set_lang(0); }
		if (funcArgs["lang"] == "fr") { parent.set_lang(1); }
		if (funcArgs["lang"] == "se") { parent.set_lang(2); }
		if (funcArgs["lang"] == "pt") { parent.set_lang(3); }
		if (funcArgs["lang"] == "de") { parent.set_lang(4); }
		if (funcArgs["lang"] == "it") { parent.set_lang(5); }
		if (funcArgs["lang"] == "es") { parent.set_lang(6); }
	}

}


function Loc_setquantity(code,price,desc,newquantity,url,avail,thumb,thumbwidth,thumbheight) {
	parent.setquantity(code,price,desc,newquantity,url,avail,thumb,thumbwidth,thumbheight);
}


function dispOrderDetail(val_currency,val_symbol,val_shopman,val_message) {

	val_message = val_message.replace(/sQuote/g, "'");

	var sQuote = "'";
	document.write('<table width="100%" bgcolor="#557755" cellpadding="0" cellspacing="2" border="0"><tr><td align="left" valign="top">');
	document.write('<table width="100%" bgcolor="#F9F9F9" cellpadding="10" cellspacing="0" border="0"><tr>');
	document.write('<td align="left" valign="top">');
	document.write('<input type="hidden" name="subtotal" value="' + format(parent.all_order_totals(),2) + '">');
	// document.write('<span class="sdckeyw">' + parent.lang_array[5][parent.lang_array_ind] + ':</span> <span class="sdcbold">' + format(parent.all_order_totals(),2) + ' ' + val_symbol + ' (' + val_currency + ')</span><img src="trans.gif" border="0" width="25" height="1" /><a class="go" href="javascript:popCurrencyWindow(' + sQuote + format(parent.all_order_totals(),2) + sQuote + ',' +sQuote + val_currency + sQuote + ')">' + parent.lang_array[6][parent.lang_array_ind] + '</a><br />');
	document.write('<span style="font-weight:bold; color:#666666;">' + parent.lang_array[5][parent.lang_array_ind] + ':</span> <span class="sdcbold">' + format(parent.all_order_totals(),2) + ' ' + val_symbol + ' (' + val_currency + ')</span><img src="trans.gif" border="0" width="15" height="1" /><a class="continue" href="javascript:popCurrencyWindow(' + sQuote + format(parent.all_order_totals(),2) + sQuote + ',' +sQuote + val_currency + sQuote + ')"><span style="font-size:11px;">' + parent.lang_array[6][parent.lang_array_ind] + '</span></a><br /><img src="trans.gif" border="0" width="15" height="5" /><br />');

	var j = 0; // items written
	var itemDesc = ""; // receives item description
	var descDisp = ""; // displayed item description
	var itemCode = ""; // receives item code
	var codeDisp = ""; // displayed item code
	var itemThumb = ""; // receives item thumb
	var thumbDisp = ""; // displayed item thumb


	if (parent.item_num > 0) {
		for (i = 1; i < parent.item_num; i++) { 
			if (parent.itemlist[i].quan > 0) {
				j++;
				//
				// unescape for display
				itemDesc = unescape(parent.itemlist[i].desc);
				itemCode = unescape(parent.itemlist[i].code);
				itemThumb = unescape(parent.itemlist[i].thumb);
				//
				// replace "+" with " " in description for display
				descDisp = itemDesc;
				// replace the strange quote character
				// descDisp = descDisp.replace(/’/g, "'");
				while (descDisp.indexOf("+") > -1) {
					descDisp = descDisp.substring(0,descDisp.indexOf("+")) + " " + descDisp.substring(descDisp.indexOf("+") + 1);
				}
				// replace "+" with " " in code for display
				codeDisp = itemCode;
				while (codeDisp.indexOf("+") > -1) {
					codeDisp = codeDisp.substring(0,codeDisp.indexOf("+")) + " " + codeDisp.substring(codeDisp.indexOf("+") + 1);
				}
				// replace "+" with " " in thumb for display
				thumbDisp = itemThumb;
				while (thumbDisp.indexOf("+") > -1) {
					thumbDisp = thumbDisp.substring(0,thumbDisp.indexOf("+")) + " " + thumbDisp.substring(thumbDisp.indexOf("+") + 1);
				}
				document.write('<p><table border="0" cellpadding="0" cellspacing="0"><tr><td align="left" valign="top"><div style="margin-right:10px; border:0px; width:150px; overflow:hidden;"><img src="' + thumbDisp + '" style="border:0px; width:' + parent.itemlist[i].thumbwidth + 'px; height:' + parent.itemlist[i].thumbheight + 'px;" /></div></td><td align="left" valign="top">');
				// document.write('<p><table border="0" cellpadding="0" cellspacing="0"><tr><td align="left" valign="top"><div style="margin-right:10px; border:0px; width:150px; overflow:hidden;"><img src="' + thumbDisp + '" style="border:0px;" /></div></td><td align="left" valign="top">');
				// document.write('<p><table border="0" cellpadding="0" cellspacing="0"><tr><td align="right" valign="top"><img src="' + thumbDisp + '" style="margin-right:15px;" border="0" /></td><td align="left" valign="top">');
				document.write('<span style="font-size:13px; font-weight:bold; color:#666666;">' + descDisp + '</span><br />');
				// if url provided then write link back
				if (parent.itemlist[i].url != "no") {
					document.write('<img src="pagePrev_30x30.gif" border="0" width="30" height="30" style="vertical-align:middle;" /> <a style="font-size:11px;" href="'+ unescape(parent.itemlist[i].url) + '">' + parent.lang_array[7][parent.lang_array_ind] + '</a><br />');
					// document.write('<img src="arrowBlueBack_16x16.gif" border="0" width="16" height="16" valign="middle" /> <a style="font-size:11px;" href="'+ unescape(parent.itemlist[i].url) + '">' + parent.lang_array[7][parent.lang_array_ind] + '</a><br />');
					// document.write('<img src="return_12x14.gif" border="0" width="12" height="14" /> <a style="font-size:11px;" href="'+ unescape(parent.itemlist[i].url) + '">' + parent.lang_array[7][parent.lang_array_ind] + '</a><br />');
					// document.write('<a style="font-size:11px;" href="'+ unescape(parent.itemlist[i].url) + '">' + parent.lang_array[7][parent.lang_array_ind] + '</a><br />');
				}
				//
				document.write(codeDisp + '<br />');
				document.write('<span class="sdcbold">' + parent.itemlist[i].price + ' ' + val_symbol + '</span>');
				if (parent.itemlist[i].avail != "1") { document.write('<img src="trans.gif" border="0" width="8" height="1" /><span class="sdcbold"> x </span><input name="setbox' + j + '" type="text" value="' + parent.itemlist[i].quan + '" size="3" onChange="Loc_setquantity(' + sQuote + parent.itemlist[i].code + sQuote + ',' + sQuote + parent.itemlist[i].price + sQuote + ',' + sQuote + parent.itemlist[i].desc + sQuote + ',this.value,' + sQuote + parent.itemlist[i].url + sQuote + ',' + sQuote + parent.itemlist[i].avail + sQuote + ')" /><img src="trans.gif" border="0" width="10" height="1" /><img src="refresh_16x16.gif" border="0" width="16" height="16" /> <a href="' + val_shopman + '" class="continue"><span style="font-size:11px;">' + parent.lang_array[9][parent.lang_array_ind] + '</span></a>'); } 
				document.write('<br /><img src="trash_21x18.gif" align="top" border="0" width="21" height="18" /><a href="' + val_shopman + '?func=del&code=' + parent.itemlist[i].code + '" class="sdckeyw"><span style="font-size:11px;">' + parent.lang_array[8][parent.lang_array_ind] + '</span></a>');
				document.write('</td></tr></table></p><br />');
				//
				// escape for send to order page
				itemDesc = escape(itemDesc);
				itemCode = escape(itemCode);
				//
				document.write('<input type="hidden" name="desc' + j + '" value="' +  itemDesc + '">');
				document.write('<input type="hidden" name="code' + j + '" value="' +  itemCode + '">');
				document.write('<input type="hidden" name="quan' + j + '" value="' +  parent.itemlist[i].quan + '">');
				document.write('<input type="hidden" name="price' + j + '" value="' +  parent.itemlist[i].price + '">');
			}
		}
	}

	document.write('<br /><br /><div align="center">' + val_message + '<br clear="all" /><hr width="100%"></div>'); 

	if (j == 0) { 
		document.write('<div align="center"><img src="gtArrows10x10.gif" border="0" width="10" height="10" /> <span style="font-size:11px;">' + parent.lang_array[11][parent.lang_array_ind] + '</span></div>'); 
	}
	else { 
		document.write('<div align="center"><img src="gtArrows10x10.gif" border="0" width="10" height="10" /> <span style="font-size:11px;">' + parent.lang_array[0][parent.lang_array_ind] + '</span></div>'); 
	}

	// adding language link TD
	document.write('</td><td align="left" valign="top" width="118" style="background-image:url(greyBorderBack_304x100.gif); background-color:#efefef;"><br /><img src="shoppingcart_118x88.gif" border="0" style="width:118px; height:88px;" /><ul><li><a href="' + val_shopman + '?lang=de&firstcall=yes" style="text-decoration:none; color:#006699; font-size:11px;">Deutsch</a><br /><img src="trans.gif" border="0" width="1" height="7" /></li><li><a href="' + val_shopman + '?lang=en&firstcall=yes" style="text-decoration:none; color:#006699; font-size:11px;">English</a><br /><img src="trans.gif" border="0" width="1" height="7" /></li><li><a href="' + val_shopman + '?lang=es&firstcall=yes" style="text-decoration:none; color:#006699; font-size:11px;">Español</a><br /><img src="trans.gif" border="0" width="1" height="7" /></li><li><a href="' + val_shopman + '?lang=fr&firstcall=yes" style="text-decoration:none; color:#006699; font-size:11px;">Français</a><br /><img src="trans.gif" border="0" width="1" height="7" /></li><li><a href="' + val_shopman + '?lang=it&firstcall=yes" style="text-decoration:none; color:#006699; font-size:11px;">Italiano</a><br /><img src="trans.gif" border="0" width="1" height="7" /></li><li><a href="' + val_shopman + '?lang=pt&firstcall=yes" style="text-decoration:none; color:#006699; font-size:11px;">Português</a><br /><img src="trans.gif" border="0" width="1" height="7" /></li><li><a href="' + val_shopman + '?lang=se&firstcall=yes" style="text-decoration:none; color:#006699; font-size:11px;">Svenska</a><br /><img src="trans.gif" border="0" width="1" height="7" /></li></ul>');

	// ending bordered table for order details
	document.write('</td></tr></table></td></tr></table>');

	document.write('<br /><input type="hidden" name="itemcount" value="' + j + '"><br />');

}

function scoopemail(theForm) {
	if (theForm.email.value == "") {
		// alert("Please enter your email address to place the order.");
		alert(parent.lang_array[10][parent.lang_array_ind]);
		theForm.email.focus();
		return (false);
	}
	else {
		return (true);
	}
}


// -->
