function sifr_init(base_url){
	if(typeof sIFR == "function"){
		sIFR.replaceElement(named({ sSelector:"#container-promo H3", sFlashSrc: APP_TPL_DIR+"js/sifr/futura.swf", sWmode: "transparent", sColor:"#017DC5"}));
		sIFR.replaceElement(named({ sSelector:"#continut-principal-efectiv H2", sFlashSrc: APP_TPL_DIR+"js/sifr/futura.swf", sWmode: "transparent", sColor:"#017DC5"}));


	}
}

function show(id){
	$('#'+id).toggle('slow');
}

$(document).ready(function() {
		$(".submit").click(function(){
			myform = this.rel;
			funct = "validateForm_"+myform;
			eval("x="+funct+"()");
			if(x) {
				document.forms[myform].submit();
			}
			return false;
		});

		$(".simple_submit").click(function(){
			myform = this.rel;
			document.forms[myform].submit();
			return false;
		});
		$(".delete").click(function(){
			conf = confirm("Are you sure?");
			if(!conf) return false;
		});

		$(".switchType").click(function(){
			val = $(this).attr("value");
			window.location=APP_DIR+"cart.checkout/?type="+val;
		});
});

function number_format (number, decimals, dec_point, thousands_sep)
{
  var exponent = "";
  var numberstr = number.toString ();
  var eindex = numberstr.indexOf ("e");
  if (eindex > -1)
  {
    exponent = numberstr.substring (eindex);
    number = parseFloat (numberstr.substring (0, eindex));
  }

  if (decimals != null)
  {
    var temp = Math.pow (10, decimals);
    number = Math.round (number * temp) / temp;
  }
  var sign = number < 0 ? "-" : "";
  var integer = (number > 0 ?
      Math.floor (number) : Math.abs (Math.ceil (number))).toString ();

  var fractional = number.toString ().substring (integer.length + sign.length);
  dec_point = dec_point != null ? dec_point : ".";
  fractional = decimals != null && decimals > 0 || fractional.length > 1 ?
               (dec_point + fractional.substring (1)) : "";
  if (decimals != null && decimals > 0)
  {
    for (i = fractional.length - 1, z = decimals; i < z; ++i)
      fractional += "0";
  }

  thousands_sep = (thousands_sep != dec_point || fractional.length == 0) ?
                  thousands_sep : null;
  if (thousands_sep != null && thousands_sep != "")
  {
	for (i = integer.length - 3; i > 0; i -= 3)
      integer = integer.substring (0 , i) + thousands_sep + integer.substring (i);
  }

  return sign + integer + fractional + exponent;
}
