
var gShow; //variable holding the id where feedback will be sent to.
var sUrl = "content/pages/omtsearch_ajax.php?val=";//url is the page which will be processing all of the information.  it is important to make sure validationtype is ajax
var gErrors = 0; //number of errors is set to none to begin with
var http = getHTTPObject();//don't worry about this
var rowidorg = "insertrow";
var rowid;


/*validateMe is the function called with onblur each time the user leaves the input box
passed into it is the value entered, the rules (which you could create your own), and the id of the area the results will show in*/
function GetOMT(sVal) {
	rowid = rowidorg + sVal;
	
	//sends the rules and value to the asp page to be validated
	http.open("GET", sUrl + (sVal), true);
  
	http.onreadystatechange = handleHttpResponse; 	// handle what to do with the feedback 
	http.send(null);  
}


function handleHttpResponse() {
	//if the process is completed, decide to do with the returned data
	if (http.readyState == 4) 
  	{
		tables = document.getElementsByTagName('td');
		for (i=0; i<tables.length; i++)//loop through all the <td> elements 
		{
			if (tables[i].className == rowid )
			{
				tables[i].innerHTML = http.responseText;
			}
		}

  	}
}

function getHTTPObject() {
var xmlHttp = null;
// Mozilla, Opera, Safari sowie Internet Explorer 7
if (typeof XMLHttpRequest != 'undefined') {
    xmlHttp = new XMLHttpRequest();
}
if (!xmlHttp) {
    // Internet Explorer 6 und älter
    try {
        xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
    } catch(e) {
        try {
            xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
        } catch(e) {
            xmlHttp  = null;
        }
    }
}
return xmlHttp;
}