var CurrFormat = "US";
var currDecimal = 2;

function addToBasket(theID, theqty)
{
  if(isNaN(theqty))
  {
    alert(theqty + " no es una cantidad adecuada. \nPor favor, introduzca un número correcto.")
    return;
  }
  else if(theqty < 1)
  {
    alert("No puede solicitar una cantidad inferior a 1.")
    return;
  }
  else if (document.cookie.indexOf('cookies') == -1 && ("php" != "php")) //cookies doesn't exist!
  {
		if (cookiesEnabled())
			location.href='cgi/added.php?theId=' + theID +'&theQuantity=' + theqty; 
		else
			location.href = "no_cookies.html";
  }
  else
  	location.href='cgi/added.php?theId=' + theID +'&theQuantity=' + theqty; 
}


function cookiesEnabled() 
{ 
	 //half and hour expiry.
	 setCookie("cookies", "cookies", 1); 

	 if (document.cookie.indexOf('cookies') == -1)
	   return false
	 else
		return true;
 }


  function setCookie(name, value, expires, path, domain, secure)
  { 
     var exp = new Date(); 
     exp.setTime(exp.getTime() + (3600000 * expires)); //hrs

    
    var ecommCookie = name + "=" + escape(value) + 
    //var ecommCookie = name + "=" + value + 
      "; expires=" + exp.toGMTString() + 
      ((path) ? "; path=" + path : "") + 
      ((domain) ? "; domain=" + domain : "") + 
      ((secure) ? "; secure" : ""); 
    document.cookie = ecommCookie; 
  }

