﻿
function emailForm()
{
    var daReferrer = document.referrer;
    var email = "";
    var mailto_link = 'mailto:'+email+'?body='+window.location.href;
    win = window.open(mailto_link,'emailWindow');
    if (win && win.open &&!win.closed) win.close();
} 
function PrintProductItem()
{ 
    window.print();
}
function productMouseover(id, name, price, image,ImageControl,locale)
{
	//lastMouseoverId = id;
	//name = unescape(name);
//	if (price == "")
//	{
//		contents = name;
//	}
//	else
//	{
//		contents = name + "<br>" + price;
//	}
	//ToolTip.getInstance().showToolTip(contents);
	var overImage = document.getElementById(ImageControl);
	if(overImage !=null)
	{
	    overImage.src = image;
	}
		
}

// ----------------------------------------------
// Function:	productMouseout()
// Author:		Nathan Derksen
// Description:	Function to be called by a mouseover event
// Inputs:		<String> id - The id of the relevant product
// Returns:		<Nothing>
// ----------------------------------------------
function productMouseout(id, image,ImageControl)
{
	ToolTip.getInstance().hideToolTip();
	var outImage = document.getElementById(ImageControl);
	if(outImage !=null)
	{
	    outImage.src = image;
	}
}
function numberformat(items,localeStr)
{
  var num = new NumberFormat();
  var pricevalue;
  if(items.value.indexOf(" ")>=0)
    pricevalue=items.value.split(" ")[0].toString();
  else
    pricevalue=items.value;
  if (localeStr == "" || localeStr == null || typeof(localeStr) == "undefined")
  {
     localeStr = "vi-VN";
  }
  switch(localeStr.toLowerCase())
  {
     case "en" :
      break;
     case "en-us" :
        num.setInputDecimal('.');
        num.setNumber(pricevalue); // obj.value is '1000.247'
        num.setPlaces('2', false);
        num.setCurrencyValue(' $');
        num.setCurrency(false);
        num.setCurrencyPosition(num.RIGHT_INSIDE);
        num.setNegativeFormat(num.RIGHT_DASH);
        num.setNegativeRed(false);
        num.setSeparators(true, ',', ',');
        break;
     case "ja" :
        num.setInputDecimal('.');
        num.setNumber(pricevalue); // obj.value is '1000.247'
        num.setPlaces('2', false);
        num.setCurrencyValue(' ¥');
        num.setCurrency(false);
        num.setCurrencyPosition(num.RIGHT_INSIDE);
        num.setNegativeFormat(num.RIGHT_DASH);
        num.setNegativeRed(false);
        num.setSeparators(true, ',', ',');
        break;
     default :
        num.setInputDecimal(',');
        num.setNumber(pricevalue); // obj.value is '1000.247'
        num.setPlaces('2', false);
        num.setCurrencyValue(' Vnđ');
        num.setCurrency(false);
        num.setCurrencyPosition(num.RIGHT_INSIDE);
        num.setNegativeFormat(num.RIGHT_DASH);
        num.setNegativeRed(false);
        num.setSeparators(true, '.', '.');
        break;
  }
    items.value = num.toFormatted();
}
