function changeQuantity( $base, $item, $quantity, $varrecid ){
	location.href=$base + '?item=' + $item + '&quantity=' + $quantity + '&var=' + $varrecid;
}

function formatAsMoney(mnt) {
    mnt -= 0;
    mnt = (Math.round(mnt*100))/100;
    return (mnt == Math.floor(mnt)) ? mnt + '.00' 
              : ( (mnt*10 == Math.floor(mnt*10)) ? 
                       mnt + '0' : mnt);
}

// ---------------- Create a pop up window
// 2.2rc13
function launchPopupWindow( url){
	// Positions
	w=680;
	h=512;
	sw=(screen.width / 2);
	sh=(screen.height / 2);
	x = sw - (w / 2);
	y = sh - (h / 2);
	
	// Display
	toolbar_str =  'no';
	menubar_str =  'no';
	statusbar_str = 'no';
	scrollbar_str = 'no';
	resizable_str = 'no';
	var popwindow = window.open( url, 'popupwindow', 'left='+x+',top='+y+',width='+w+',height='+h+
		',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+
		',scrollbars='+scrollbar_str+',resizable='+resizable_str);

}
// ---------------- Pop up an image centered and resized to the size of the image itself
function popup( image ){
	// Positions
	w=640;
	h=480;
	sw=(screen.width / 2);
	sh=(screen.height / 2);
	x = sw - (w / 2);
	y = sh - (h / 2);
	
	// Display
	toolbar_str =  'no';
	menubar_str =  'no';
	statusbar_str = 'no';
	scrollbar_str = 'no';
	resizable_str = 'no';
	var popwindow = window.open( '', 'popupimage', 'left='+x+',top='+y+',width='+w+',height='+h+
		',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+
		',scrollbars='+scrollbar_str+',resizable='+resizable_str);
	popwindow.document.write( '<html><head>\n<title>Click on the image to close</title>\n</head><body>\n');
	popwindow.document.write( '<script language=\'javascript\'>\n' );
	popwindow.document.write( 'function fixSize(){\n');
	popwindow.document.write( '	      var NS = (navigator.appName=="Netscape")?true:false;\n');
	popwindow.document.write( '       iWidth = (NS)?window.innerWidth:document.body.clientWidth;\n' );
	popwindow.document.write( '       iHeight = (NS)?window.innerHeight:document.body.clientHeight;\n' );
	popwindow.document.write( '       iWidth = document.images[0].width - iWidth;\n' );
	popwindow.document.write( '       iHeight = document.images[0].height - iHeight;\n' );
	popwindow.document.write( '       window.resizeBy(iWidth, iHeight);\n' );
	popwindow.document.write( '       x = ' + sw + ' - (document.images[0].width / 2);\n');
	popwindow.document.write( '       y = ' + sh + ' - (document.images[0].height / 2);\n');
	popwindow.document.write( '       window.moveTo( x, y );\n');
	popwindow.document.write( '       self.focus();\n' );
	popwindow.document.write( '}\n' );
	popwindow.document.write( '</script>\n');
	popwindow.document.write( '<a href=\"#\" onClick=\"window.close();\"><img onLoad=\"fixSize()\" src=\"' + image + '\" border=0></a>\n');
	popwindow.document.write( '</body></html>\n');
}
