function trim(str){
  str = new String(str);
  reg = /^\s+/gi;
  str = str.replace(reg,'');
  reg = /\s+$/gi;
  str = str.replace(reg,'');
 
  return str;
}
function  PreviewImage(imageUrl){
  window.open('/previewimage.php?img='+escape(imageUrl),'','toolbar=0,address=0menubar=0');
}
function FormatPrice(price){
  if(price.toString().indexOf('.') < 0)
    price = price.toString()+'.00';
  else
    price = price.toString().substring(0, (price.toString().indexOf('.') + 3));
  return price;
}