function UpdateOrder(id, name, value)
{

var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

var timestamp = new Date().getTime();
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==1)
		document.getElementById('updateOrderDiv').innerHTML='Cargando...';
	
		if(xmlhttp.readyState==4)
		{		document.getElementById('updateOrderDiv').innerHTML=xmlhttp.responseText;
xmlhttp = false;
}
	}
	xmlhttp.open("GET",orderUpdateTarget+"?id="+id+"&name="+name+"&value="+value+"&anti-cache=" + timestamp,true);
	xmlhttp.send(null);


}

function AddToBasket(id, amount, linked)
{
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

var timestamp = new Date().getTime();
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==1)
		document.getElementById('shoppingBasket').innerHTML='Cargando...';
	
		if(xmlhttp.readyState==4)
		{		document.getElementById('shoppingBasket').innerHTML=xmlhttp.responseText;
$.superbox();
xmlhttp = false;
}
	}
	xmlhttp.open("GET",basketTarget+"?id="+id+"&amount="+amount+"&linked="+linked+"&anti-cache=" + timestamp,true);
	xmlhttp.send(null);


}

function RemoveFromBasket(id)
{
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

var timestamp = new Date().getTime();
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==1)
		document.getElementById('shoppingBasket').innerHTML='Cargando...';
	
		if(xmlhttp.readyState==4)
		{		document.getElementById('shoppingBasket').innerHTML=xmlhttp.responseText;
RemoveFromBasketCallback(xmlhttp.responseText);
xmlhttp = false;
}
	}
	xmlhttp.open("GET",basketRemoveTarget+"?id="+id+"&anti-cache=" + timestamp,true);
	xmlhttp.send(null);


}

function RefreshBasket()
{
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

var timestamp = new Date().getTime();
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==1)
		document.getElementById('shoppingBasket').innerHTML='Cargando...';
	
		if(xmlhttp.readyState==4)
		{		document.getElementById('shoppingBasket').innerHTML=xmlhttp.responseText;
xmlhttp = false;
}
	}
	xmlhttp.open("GET",basketRefreshTarget+"?anti-cache=" + timestamp,true);
	xmlhttp.send(null);


}

function SendCodes()
{
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

var timestamp = new Date().getTime();
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==1)
document.getElementById('sendingStatus').style.display = 'block';		document.getElementById('sendingStatus').innerHTML='Enviando...';
	
		if(xmlhttp.readyState==4)
		{		document.getElementById('sendingStatus').innerHTML=xmlhttp.responseText;

xmlhttp = false;
}
	}
	xmlhttp.open("GET",sendCodeTarget+"?anti-cache=" + timestamp,true);
	xmlhttp.send(null);


}

function AddCode(code, feedback)
{

var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

var timestamp = new Date().getTime();
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==1)
document.getElementById('codeResult').style.display = 'block';
if (language != 'english')		  document.getElementById('codeResult').innerHTML='Verificando...';
else
document.getElementById('codeResult').innerHTML='Verifying...';
	
		if(xmlhttp.readyState==4)
		{		document.getElementById('codeResult').innerHTML=xmlhttp.responseText;
fromFeedback = false;
if (feedback)
{
    if (language == 'english')
    {
    if ($('#codeResult').text().indexOf('incorrect') > -1)
    {
       isOK = false;
       alert('Please check if the discount code is correct');
    }
    else
    {
      fromFeedback = true;
      $('#comprabutton').click();
    }
    }
    else
    {
    if ($('#codeResult').text().indexOf('incorrecto') > -1)
    {
       isOK = false;
       alert('Por favor comprueba el código de descuento');
    }
    else
    {
      fromFeedback = true;
      $('#comprabutton').click();    

    }
    }
}
xmlhttp = false;
}
	}
	xmlhttp.open("GET",addDiscountTarget +"?code="+code+"&language="+language+"&anti-cache=" + timestamp,true);
	xmlhttp.send(null);


}

function CancelCode(codeId)
{
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

var timestamp = new Date().getTime();
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==1)
		document.getElementById(codeId+'_state').innerHTML='Cambiando...';
	
		if(xmlhttp.readyState==4)
		{		document.getElementById(codeId+'_state').innerHTML=xmlhttp.responseText;

xmlhttp = false;
}
	}
	xmlhttp.open("GET",cancelCodeTarget+"?id="+codeId+"&anti-cache=" + timestamp,true);
	xmlhttp.send(null);


}

function DeactivateCode(codeId)
{
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

var timestamp = new Date().getTime();
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==1)
		document.getElementById(codeId+'_state').innerHTML='Desactivando...';
	
		if(xmlhttp.readyState==4)
		{		document.getElementById(codeId+'_state').innerHTML=xmlhttp.responseText;

xmlhttp = false;
}
	}
	xmlhttp.open("GET",deactivateCodeTarget+"?id="+codeId+"&anti-cache=" + timestamp,true);
	xmlhttp.send(null);


}


function RemoveFromBasketCallback(content)
{

var micrositeObjName = "";
if (theMicrosite == "English")
{
 micrositeObjName = "flower-shop";
}
else
{
 micrositeObjName = "floristeria-online";
}

  if (content.indexOf("REDIRECT") > -1)
    window.location.href= theSiteUrl + "/" + micrositeObjName + "/";


}

function GetDeliveryHours(date,pocode)
{
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

var timestamp = new Date().getTime();
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==1)
		document.getElementById('deliveryHours').innerHTML='Cargando...';
	
		if(xmlhttp.readyState==4)
		{		
                        var result = xmlhttp.responseText;
			if (result.indexOf('sentimos') == -1 && result.indexOf('sorry') == -1)
			{
  dateVerified=true;
if (codeVerified == true)
{
if (document.getElementById('comprabutton') != null)
{
			document.getElementById('comprabutton').style.display = 'inline';
}
}


			}
			else
			{
			dateVerified=false;
if(document.getElementById('comprabutton') != null)
{	$('#comprabutton').hide();
}
			}
if (document.getElementById('deliveryHours') != null)
{
document.getElementById('deliveryHours').innerHTML=result;
}
changeDeliveryHours();
xmlhttp = false;

}
	}
	xmlhttp.open("GET",deliveryHoursTarget+"?date="+date+"&pocode="+pocode+"&anti-cache=" + timestamp,true);
	xmlhttp.send(null);


}

function GetDeliveryHoursF(date,pocode,selectedH)
{
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

var timestamp = new Date().getTime();
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==1)
		document.getElementById('deliveryHours').innerHTML='Cargando...';
	
		if(xmlhttp.readyState==4)
		{		document.getElementById('deliveryHours').innerHTML=xmlhttp.responseText;
 $('select[name=shipping_hora]').val(selectedH);
changeDeliveryHours();
xmlhttp = false;

}
	}
	xmlhttp.open("GET",deliveryHoursTarget+"?date="+date+"&pocode="+pocode+"&anti-cache=" + timestamp,true);
	xmlhttp.send(null);


}


function UpdateDeliveryCost(date,pocode,time)
{
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

var timestamp = new Date().getTime();
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==1)
		document.getElementById('shoppingBasket').innerHTML='Cargando...';
	
		if(xmlhttp.readyState==4)
		{
		document.getElementById('shoppingBasket').innerHTML=xmlhttp.responseText;
xmlhttp = false;
}
	}
	xmlhttp.open("GET",deliveryCostTarget+"?date="+date+"&pocode="+pocode+"&time="+time+"&anti-cache=" + timestamp,true);
	xmlhttp.send(null);


}


function VerifyPostCode(postCode)
{
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

var timestamp = new Date().getTime();
	xmlhttp.onreadystatechange=function()
	{
		/*if(xmlhttp.readyState==1)
		document.getElementById('invoiceResult').innerHTML='Generando...';*/
	
		if(xmlhttp.readyState==4)
		{
			var result = xmlhttp.responseText;
			if (result == 'yes')
			{

document.getElementById('postcodeCheck').style.display = 'none';
codeVerified = true;
				if (dateVerified ==true || PlantasLiofilizadas)
{				document.getElementById('comprabutton').style.display = 'inline';
}
			}
			else
			{
		codeVerified = false;		document.getElementById('postcodeCheck').style.display = 'block';
				document.getElementById('comprabutton').style.display = 'none';
			}
			//document.getElementById('invoiceResult').innerHTML=xmlhttp.responseText;
			xmlhttp = false;
		}
	}
	xmlhttp.open("GET",verifyPoCodeTarget+"?po_code="+postCode+"&anti-cache=" + timestamp,true);
	xmlhttp.send(null);


}

function GenerateInvoice(id)
{
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

var timestamp = new Date().getTime();
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==1)
		document.getElementById('invoiceResult').innerHTML='Generando...';
	
		if(xmlhttp.readyState==4)
		{		document.getElementById('invoiceResult').innerHTML=xmlhttp.responseText;
xmlhttp = false;
}
	}
	xmlhttp.open("GET",generateInvoiceTarget+"?order-id="+id+"&anti-cache=" + timestamp,true);
	xmlhttp.send(null);


}


function UpdateInvoice(id,value)
{
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

var timestamp = new Date().getTime();
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==1)
		document.getElementById('updateInvoiceDiv').innerHTML='Cargando...';
	
		if(xmlhttp.readyState==4)
		{		document.getElementById('updateInvoiceDiv').innerHTML=xmlhttp.responseText;
xmlhttp = false;
}
	}
	xmlhttp.open("GET",invoiceUpdateTarget+"?id="+id+"&value="+value+"&anti-cache=" + timestamp,true);
	xmlhttp.send(null);


}
