//AHAJAX Functions - Copyright 2008 TNAFlix.com All rights reserved
//Proceses GET Request with server
var xmlhttp
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	  try {
	  xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")
	 } catch (e) {
	  try {
	    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
	  } catch (E) {
	   xmlhttp=false
	  }
	 }
	@else
	 xmlhttp=false
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	 try {
	  xmlhttp = new XMLHttpRequest();
	 } catch (e) {
	  xmlhttp=false
	 }
	}
	function myXMLHttpRequest() {
	  var xmlhttplocal;
	  try {
	    xmlhttplocal= new ActiveXObject("Msxml2.XMLHTTP")
	 } catch (e) {
	  try {
	    xmlhttplocal= new ActiveXObject("Microsoft.XMLHTTP")
	  } catch (E) {
	    xmlhttplocal=false;
	  }
	 }

	if (!xmlhttplocal && typeof XMLHttpRequest!='undefined') {
	 try {
	  var xmlhttplocal = new XMLHttpRequest();
	 } catch (e) {
	  var xmlhttplocal=false;
	  alert('couldn\'t create xmlhttp object');
	 }
	}
	return(xmlhttplocal);
}

function startSearch(text,page) {
    var what = new String(text);
    if(what.length > 3){
        if(page != '' && page == 0){
            page = 1;
        }
        document.getElementById('searchOutput').innerHTML = '<br /><br /><div style="text-align: center;"><img src="images/spinna.gif" alt="Loading..." /></div>';
        var url = "ajax/searchAjax.php?what=" + what+"&page="+page;

        xmlhttp.open("GET", url);
        xmlhttp.onreadystatechange = showAjaxRightResults;
        xmlhttp.send(null);
    }
}

function showAjaxRightResults() {
    if(xmlhttp.readyState == 4) {
    	if(xmlhttp.responseText != ""){
            document.getElementById('searchOutput').innerHTML = '';
            document.getElementById('searchOutput').innerHTML = xmlhttp.responseText;
    	}
    }
}