// JavaScript Document
function getHTTPObject() {
	var xmlhttp;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
         xmlhttp = new XMLHttpRequest();
         if (xmlhttp.overrideMimeType) {
            xmlhttp.overrideMimeType('text/xml');
         }
	} else if (window.ActiveXObject) { // IE
         try {
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
	}
    if (!xmlhttp) {
    	alert('Cannot create XMLHTTP instance');
    	return false;
    }
	return xmlhttp; 
} 

var http = getHTTPObject(); // We create the HTTP Object 

function get_data() {
	if (http) { 
		http.open("GET", "electionMay06.php", true); 
		http.send(null);
		http.onreadystatechange = function () {
			if (http.readyState == 4) {
				if (http.responseText.indexOf('invalid') == -1) {
					xmlResponse = http.responseXML;
					xmlroot = xmlResponse.documentElement;
					collectarray = xmlroot.getElementsByTagName('collected');
					document.getElementById('collected').innerHTML = collectarray.nodeName;
					totalarray = xmlroot.getElementsByTagName('total');
					
					var hmtl = '<table width="562" border="0" cellpadding="0" cellspacing="0">'+
  									'<tr>'+
    									'<td height="9" colspan="6" valign="top"><img src="images/top_container.jpg" width="562" height="9" /></td>'+
  									'</tr>'+
  									'<tr>'+
										'<td width="9" rowspan="4">&nbsp;</td>'+
										'<td height="19" colspan="3" valign="top"><span class="style1">County Mayor </span></td>'+
										'<td width="268">&nbsp;</td>'+
										'<td width="10" rowspan="4"></td>'+
									'</tr>'+
									'<tr>'+
										'<td width="23" rowspan="3">&nbsp;</td>'+
										'<td width="176" height="15" valign="top"><span class="style1">Charles Tetstone </span></td>'+
										'<td width="76" valign="top" class="style1">2000</td>'+
										'<td valign="top" class="style1">sdfasdd</td>'+
									'</tr>'+
									'<tr>'+
										'<td height="10"></td>'+
										'<td></td>'+
										'<td></td>'+
									'</tr>'+
									'<tr>'+
										'<td height="15" valign="top" class="style1">Mike Ragsdale </td>'+
										'<td valign="top" class="style1">sds</td>'+
										'<td valign="top" class="style1">sd</td>'+
									'</tr>'+
									'<tr>'+
										'<td height="8"></td>'+
										'<td></td>'+
										'<td></td>'+
										'<td></td>'+
										'<td></td>'+
										'<td></td>'+
									'</tr>'+
									'<tr>'+
										'<td height="10" colspan="6" valign="top"><img src="images/bottom_container.jpg" width="562" height="10" /></td>'+
									'</tr>'+
								'</table>';
					//document.getElementById('entry').innerHTML = html;
				} else {
					var mess = http.responseText;
					//document.getElementById('entry').innerHTML = '<br><br><br><br>There was problem . Error Message is '+mess +'. Try Agian Later.';
				}
			} else {
				//document.getElementById('entry').innerHTML = '<br><br><br><br>Processing your request. Please Wait ...';
			}
		}
	}
}