var ie = (typeof window.ActiveXObject != 'undefined'); 
var other = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument!= 'undefined'); 

var xmlFilePath = "phl_rates.xml";


function loadXML() 
{   
 var xmlDoc;  
 if (ie)
 {
  xmlDoc = new ActiveXObject("Microsoft.xmlDOM");
 }
 else
 {
  xmlDoc = document.implementation.createDocument("", "doc", null);
 }
 xmlDoc.async = false;
 xmlDoc.load(xmlFilePath);
 return xmlDoc
}
function displayPrice()
{
 var xmlDoc = loadXML();
 check = document.rateForm;
 strPrice = GetPrice(xmlDoc);
 quote = check.origin.value + ' to ' + check.destination.value + ': ' + strPrice
 document.getElementById("rateInfo").innerHTML = quote; 
 return false;
}

function GetPrice(xmlDoc)
{
 check = document.rateForm;
 var path="/rates/row[Origin='" + check.origin.value + "' and Destination='" + check.destination.value + "' and Fleet='" + check.fleet.value + "']/Price";
  if (ie)

 {
  var node = xmlDoc.selectSingleNode(path);
  return node.text;
 }

 else
 {
  var oEvaluator = new XPathEvaluator();
  var node=oEvaluator.evaluate(path, xmlDoc, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null);
  return node.singleNodeValue.textContent;
  
 }

}

