function JumpPage(targ,selObj,restore)
{ 
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}

function Select(row)
{
	if(!eval("row"+row+".className"))
		eval("row"+row+".className = 'Normal'");
	
	if(eval("row"+row+".className == 'Normal'"))
		eval("row"+row+".className = 'Selected'");
	else
		eval("row"+row+".className = 'Normal'");
}

function SelectTransaction(row)
{
	if(!eval("row"+row+".className"))
	{
		eval("row"+row+".className = 'Normal'");
		eval("document.form.Value"+row+".className = 'ValueSelected'");
		eval("document.form.STotal"+row+".className = 'ValueSelected'");
	}
	if(eval("row"+row+".className == 'Normal'"))
	{
		eval("row"+row+".className = 'Selected'");
		eval("document.form.Value"+row+".className = 'ValueSelected'");
		eval("document.form.STotal"+row+".className = 'ValueSelected'");
	}
	else
	{
		eval("row"+row+".className = 'Normal'");
		eval("document.form.Value"+row+".className = 'Value'");
		eval("document.form.STotal"+row+".className = 'Value'");
	}
}

function Swap(qty,active) {
	var table	= new Array(qty)
	var button	= new Array(qty)
	var doc = document.form

	for(var i=1;i<=qty;i++)
	{
		with(document)
			eval("doc.button"+i+".className	= 'BtnMenuTab'")

		eval("table"+i+".style.display	= 'none'")
		
		if(i==active) {
			eval("table"+i+".style.display = 'block'")
			eval("doc.button"+i+".className	= 'BtnMenuActive'")
		}
	}	
}

function FormatNumber(st) 
{
	st += "";
	var theValue = st;
	var finalString = '';
  
	if(theValue.length > 3)
	{
		var modulus = theValue.length % 3
		var count = 0
		finalString = theValue.substring(0, modulus)
	  
		if(modulus != 0) finalString += ','
		for(i = modulus; i < theValue.length; i++) {
			if(count == 3){ 
				finalString += ',';
				count = 0
			}
			finalString += theValue.charAt(i);
			count++;
		}
		return finalString
	}
	else
	{
		finalstring	= st;
		return finalstring
	}
}

function Calculate(row)
{
	var form	= document.form;
	var itemqty	= form.ItemQty.value;
	var price	= 0;
	var qty	= 0;
	var stotal	= 0;
	var gtotal	= 0;

	for(var i=0;i<itemqty;i++)
	{
		price	= eval("form.Price"+ i +".value");
		qty	= eval("form.Qty"+ i +".value");
		stotal	= price * qty;
		gtotal	= gtotal + stotal;
		eval("form.STotal"+ i +".value = FormatNumber(stotal)");
	}
	form.GTotal.value = FormatNumber(gtotal);
}
