function addZero(price)
{
	 if(price != null && price !="" )
	 {
			 var tab = price.split('.');
			 if(tab.length >1)
			 {
  				 var particule = tab[1];
  				 if(particule.length < 2 )
  				 {
  					   price = tab [0] + "." + particule + "0";
  				 }
			 }
			 else
			 {
				   price = price + ".00";
			 }
		}			
		return price; 
}


function callAjax(sku, functionToExecute)
{
      $.ajax(
                {
                    type: "GET",
                    url: "/store/xmlPrices.jsp?skuId="+sku,
                    dataType: "xml",
                    
                    complete : function(data, status) 
                    {
                        var products = data.responseXML;
                        var obj = new Object();
                        $(products).find('price').each(function()
                        {
                            obj["priceOnSale"] = $(this).find('salePrice').text();
                            obj["price"] = $(this).find('listPrice').text();
                            obj["pricePerUnit"] = $(this).find('pricePerUnite').text();
                            eval(functionToExecute);
                        }); 
                    }
                }
            );
}

function jEconomise(price,salePrice)
{
    var returned = 0;
    if(salePrice != undefined && price != undefined && salePrice != "" && price != "")
    {     
        if((parseFloat(price) - parseFloat(salePrice) > 0))
        {
            returned = Math.round((parseFloat(price) - parseFloat(salePrice))*100)/100;
        }
    }
    return returned;
}

function getFlap(price, priceOnSale)
{
    var returned = 0;
    if(priceOnSale != undefined && price != undefined && priceOnSale != "" && price != "")
    {
         if((parseFloat(price) - parseFloat(priceOnSale) > 0))
         {
            returned = Math.round((1-(priceOnSale/price))*100);
         }
    }
    return returned;
}