function update(strURL,querystring,areaid,changeTo) 
{
	var xmlHttpReq = false;
    var self = this;
    
    // Mozilla/Safari
    if (window.XMLHttpRequest) 
    {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) 
    {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL + '?' + querystring, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() 
    {
        if (self.xmlHttpReq.readyState == 4) 
        {
        	var output = self.xmlHttpReq.responseText;
        	output = trim(output);
        	eval("document.getElementById('" + areaid + "').innerHTML = \"" + output + "\";");
        	updatePrice(changeTo);
        }
    }
    self.xmlHttpReq.send(querystring);
}

function updateother(strURL,querystring,areaid) 
{
	var xmlHttpReqOther = false;
    var selfother = this;
    
    // Mozilla/Safari
    if (window.XMLHttpRequest) 
    {
        selfother.xmlHttpReqOther = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) 
    {
        selfother.xmlHttpReqOther = new ActiveXObject("Microsoft.XMLHTTP");
    }
    selfother.xmlHttpReqOther.open('POST', strURL + '?' + querystring, true);
    selfother.xmlHttpReqOther.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    selfother.xmlHttpReqOther.onreadystatechange = function() 
    {
        if (selfother.xmlHttpReqOther.readyState == 4) 
        {
        	var outputother = selfother.xmlHttpReqOther.responseText;
        	outputother = trim(outputother);
        	eval("document.getElementById('" + areaid + "').innerHTML = \"" + outputother + "\";");
        }
    }
    selfother.xmlHttpReqOther.send(querystring);
}

function updateSession(strURL,querystring,runupdate,unitprice,quantity,taxable,baseurl)
{
	var xmlHttpReq = false;
    var self = this;
    
    // Mozilla/Safari
    if (window.XMLHttpRequest) 
    {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) 
    {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL + '?' + querystring, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() 
    {
        if (self.xmlHttpReq.readyState == 4) 
        {
        	var output = self.xmlHttpReq.responseText;
        	if (runupdate == 'yes')
        	{
				querystring = "UNIT_PRICE="+unitprice+"&QUANTITYPERUNIT="+quantity+"&Taxable_Amount_MN="+taxable;
				updateother(baseurl+"/WIAA/Includes/SubTotal.cfm",querystring,"SubTotal");        	
        	}
        }
    }
    self.xmlHttpReq.send(querystring);
}

function trim(thestring)
{
	thestring = thestring.replace(/^\s*|\s*$/g,"");
	thestring = thestring.replace(/\n/g,"");
	thestring = thestring.replace(/\r/g,"");
	thestring = thestring.replace(/\"/g,"'");
	return thestring
}
