// JavaScript Document
var xmlHttp;

function createXMLHttpRequest() {
    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    } 
    else if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
    }
}
    
function addToItin(lID) {
   	createXMLHttpRequest();
    
    var queryString = "act_addItinerary.cfm?listingID=" + lID;
	xmlHttp.onreadystatechange = handleStateChange;
    xmlHttp.open("GET", queryString, true);
    xmlHttp.send(null);
}
    
function handleStateChange() {
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200) {
			theDiv = "itin_" + parseInt(xmlHttp.responseText);
            //alert(xmlHttp.responseText);
			document.getElementById(theDiv).innerHTML = '<b>Added to Itinerary</b>';
        } else {
            alert('There was a problem retrieving the XML data:\n' + xmlHttp.statusText);
        }
    } 
}

