var xmlHttp

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
document.getElementById("ajaxDiv").innerHTML=xmlHttp.responseText 
} 
} 

function stateChangedExtended() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
document.getElementById("setDiv").innerHTML=xmlHttp.responseText 
} 
}

function GetXmlHttpObject()
{ 
var objXMLHttp=null
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
}

/////////////////////////////////////////////////////////////////////////////////////////////
// SHOPPING LIST FUNCTIONS
/////////////////////////////////////////////////////////////////////////////////////////////
function ajaxAddToShoppingList()
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
} 
var url="functioncaller.php?fcall=addProductToShoppingList"
url=url+"&shoppingListID="+document.shoppingListForm.shoppingListID.value
url=url+"&productID="+document.shoppingListForm.productID.value
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}



function ajaxShowShoppingListForm(productID)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
} 
var url="ajax_shopping_list_popup.php?productID="+productID
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
/////////////////////////////////////////////////////////////////////////////////////////////
// CROSS SELLING ITEMS
/////////////////////////////////////////////////////////////////////////////////////////////

function ajaxShowCrossSellingItems(productID)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
showMeExtended("ajaxDiv", 120, 100)
var url="ajax_cross_selling.php?productID="+productID
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
/////////////////////////////////////////////////////////////////////////////////////////////
// ZOOM IMAGE
/////////////////////////////////////////////////////////////////////////////////////////////

function ajaxZoomImage(productID)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
showMeExtended("ajaxDiv", -500, 300);
var url="ajax_zoom_image.php?productID="+productID
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
/////////////////////////////////////////////////////////////////////////////////////////////
// BASKET PREVIEW
/////////////////////////////////////////////////////////////////////////////////////////////
function ajaxBasketPreviewFilled()
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
showMeExtended("ajaxDiv", -310, -50);
var url="ajax_basket_preview_products.php"
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
/////////////////////////////////////////////////////////////////////////////////////////////
// SELECTSHIPPINGADDRESS
/////////////////////////////////////////////////////////////////////////////////////////////
function ajaxRefreshShippingAddress(addressID)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="ajax_shipping_address_display.php?shippingAddressID="+addressID
xmlHttp.onreadystatechange=stateChangedExtended
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


