function getDoc()
{	 
	if (window.XMLHttpRequest) 
	{
    	request = new XMLHttpRequest();
 	} 
	else if (window.ActiveXObject) 
	{
    	request = new ActiveXObject("Microsoft.XMLHTTP");
  	}

	if (request.overrideMimeType) 
	{         
		request.overrideMimeType("text/xml");
	}

  	if(request) 
  	{
    	request.open("GET", "ForexProxy.php", true); 

    	request.onreadystatechange = function() 
		{ 
      		if ((request.readyState == 4) && (request.status == 200)) 
      		{ 
      			var xmlDocument = request.responseXML;
				findClass(xmlDocument);
      		}
     
    	} 

		request.send(null); 
    
    } 

}

function findClass(doc) 
{
	var swiftnameNode = doc.getElementsByTagName('swift_name');
	var swiftcodeNode = doc.getElementsByTagName('swift_code');
	var buycashNode = doc.getElementsByTagName('buy_cash');
	var sellcashNode = doc.getElementsByTagName('sell_cash');
	var sellcashchangeNode = doc.getElementsByTagName('sell_cash_change');
	
	for (i=0; i<swiftnameNode.length; i++) 
	{
  		var swiftname = swiftnameNode[i];
  		var swiftnameValue = swiftname.firstChild.nodeValue;

  		var swiftcode = swiftcodeNode[i];
  		var swiftcodeValue = swiftcode.firstChild.nodeValue;

  		var buycash = buycashNode[i];
  		var buycashValue = buycash.firstChild.nodeValue;

  		var sellcash = sellcashNode[i];
  		var sellcashValue = sellcash.firstChild.nodeValue;

  		var sellcashchange = sellcashchangeNode[i];
  		var sellcashchangeValue = sellcashchange.firstChild.nodeValue;

//
//  		var myEl = document.createElement('p');
//  		var newText = swiftnameValue.toLowerCase() + " " + swiftcodeValue + " " + buycashValue + " " + sellcashValue + " " + sellcashchangeValue;
//     	var myTx = document.createTextNode(newText);
//     	myEl.appendChild(myTx);
//     	
//     	var course = document.getElementById('swiftname');
//     	course.appendChild(myEl);
//
//  		var creditStatus = doc.getElementsByTagName('credits');
//  		var creditAttr = creditStatus[i].attributes;
//  		var reqAttr = creditAttr.getNamedItem('req');
//  		var reqVal = reqAttr.nodeValue;
//
//    	if (reqVal == 'yes') 
//    	{
//      		var addlText = " This is a required course.";
//      		var addlText2 = document.createTextNode(addlText);
//      		myEl.appendChild(addlText2);
//    	}
    	
    	
    	var table = document.getElementById("table1");
    	
		var row = table.insertRow(table.rows.length); 
		
		var cell1 = row.insertCell(row.cells.length);
		var cell1tx = document.createTextNode(swiftnameValue.toLowerCase()); 
		cell1.appendChild(cell1tx); 
		
		var cell2 = row.insertCell(row.cells.length); 
		var cell2tx = document.createTextNode(swiftcodeValue); 
		cell2.appendChild(cell2tx); 
		
		var cell3 = row.insertCell(row.cells.length); 
		var cell3tx = document.createTextNode(buycashValue); 
		cell3.appendChild(cell3tx); 
		
		var cell4 = row.insertCell(row.cells.length); 
		var cell4tx = document.createTextNode(sellcashValue); 
		cell4.appendChild(cell4tx); 
		
		var cell5 = row.insertCell(row.cells.length); 
		var cell5tx = document.createTextNode(sellcashchangeValue); 
		cell5.appendChild(cell5tx); 

	}
}