	function Ajax (url, parms, method, callback) {

	    this.url = url;
	    this.parms = parms;
	    this.method = method;
	    this.callback = callback;
	    this.async = true;

	    this.create ();

	    this.req.onreadystatechange = this.dispatch (this);
	}

	Ajax.prototype.dispatch = function (ajax) {

	    function funcRef()
	    {
		if (ajax.req.readyState == 4) {
		    if (ajax.callback) {
			ajax.callback (ajax.req);
		    }
		}
	    }

	    return funcRef;
	}

	Ajax.prototype.request = function () {

	    if (this.method == "POST") {
		this.req.open("POST", this.url, this.async);
		this.req.send (this.parms);
	    }
	    else if (this.method == "GET") {
		this.req.open("GET", this.url + this.parms, this.async);
		this.req.send (null);
	    }

	}

	Ajax.prototype.setAsync = function (async) {

	    this.async = async;
	}

	Ajax.prototype.create = function () {

	    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;
		}
	    }

	    this.req = xmlhttp;
	}

	function trimResults(q,v) {
		var rows = document.getElementsByTagName("tr");
		var on = 0;
		for ( var i = 0; i < rows.length; i++ ) {
			var fullname = rows[i].getAttribute("fullname");
			if ( fullname ) {
				if ( v.length == 0 || (v.length < 3 && fullname.indexOf(v) == 0) || (v.length >= 3 && fullname.indexOf(v) > -1 ) ) {
					rows[i].style.display = "";
					on++;
				} else {
					rows[i].style.display = "none";
				}
			}
		}
	}
	
	function makeRow(item, cnt) {
		var str = "";
		var clz = "white";
		if ( cnt % 2 == 0 ) clz = "gray";
								
		str += "<tr class=\"extraresults " + clz + "\">"
		str += "<td onclick=\"location.href='" + item.bizurl + "';\" nowrap><a href=\"" + item.bizurl + "\">" + item.name + "</a></td>";
		str += "<td onclick=\"location.href='" + item.bizurl + "';\" nowrap><a href=\"" + item.bizurl + "\">" + item.phone + "</a></td>";
		str += "<td onclick=\"location.href='" + item.bizurl + "';\">" + item.cheat;
		str += "&nbsp;<a class=\"pct70\" href=\"" + item.bizurl + "\">more &raquo;</td>";
		str += "<td onclick=\"location.href='" + item.bizurl + "';\" nowrap><a href=\"" + item.rateurl + "\">" + item.wait + "</a></td>";
		str += "<td onclick=\"location.href='" + item.bizurl + "';\" nowrap><a href=\"" + item.rateurl + "\">" + item.rating + "</a></td>";
		str += "</tr>";


		return str;
	}

	function makeRow(item, cnt) {
		var str = "";
		var clz = "white";
		if ( cnt % 2 == 0 ) clz = "gray";
								
		str += "<tr class=\"extraresults " + clz + "\">"
		str += "<td onclick=\"location.href='" + item.bizurl + "';\" nowrap><a href=\"" + item.bizurl + "\">" + item.name + "</a></td>";
		str += "<td onclick=\"location.href='" + item.bizurl + "';\" nowrap><a href=\"" + item.bizurl + "\">" + item.phone + "</a></td>";
		str += "<td onclick=\"location.href='" + item.bizurl + "';\">" + item.cheat;
		str += "&nbsp;<a class=\"pct70\" href=\"" + item.bizurl + "\">more &raquo;</td>";
		str += "<td onclick=\"location.href='" + item.bizurl + "';\" nowrap><a href=\"" + item.rateurl + "\">view all &raquo;</a></td>";
		str += "</tr>";


		return str;
	}

	function makeRowCs(item, cnt) {
		var str = "";
		var clz = "white";
		if ( cnt % 2 == 0 ) clz = "gray";
								
		str += "<tr class=\"extraresults " + clz + "\">"
		str += "<td colspan=\"3\" onclick=\"location.href='" + item.bizurl + "';\" nowrap><a href=\"" + item.bizurl + "\"><b>" + item.name + "</b></a></td>";
		str += "<td onclick=\"location.href='" + item.bizurl + "';\" nowrap><a href=\"" + item.bizurl + "\">Click to see all phone number & support info, reviews and tips</a></td>";
		str += "<td onclick=\"location.href='" + item.bizurl + "';\" nowrap><a href=\"" + item.bizurl + "\">view &raquo;</a></td>";
		str += "</tr>";


		return str;
	}

	function makeRowPh(item, cnt) {
		var str = "";
		var clz = "white";
		if ( cnt % 2 == 0 ) clz = "gray";
								
		str += "<tr class=\"extraresults " + clz + "\">"
		str += "<td colspan=\"2\" onclick=\"location.href='" + item.phoneurl + "';\" nowrap><a href=\"" + item.phoneurl + "\"><b>" + item.name + "</b></a></td>";
		str += "<td onclick=\"location.href='" + item.phoneurl + "';\" nowrap><a href=\"" + item.phoneurl + "\">" + item.phone + " (click for more)</a></td>";
		str += "<td onclick=\"location.href='" + item.phoneurl + "';\" nowrap><a href=\"" + item.phoneurl + "\">" + item.cheat + "</a></td>";
		str += "<td onclick=\"location.href='" + item.phoneurl + "';\" nowrap><a href=\"" + item.phoneurl + "\">see details &raquo;</a></td>";
		str += "</tr>";


		return str;
	}
	
	function afterSearch(req) {
		var data = null;
		try {
			eval("data = " + req.responseText);
			//alert("data is: " + data);

		} catch (ignored) {
			//alert("parseerror");
			document.getElementById("otherres").innerHTML = "";
		}

		if ( data ) {
			//alert("res is: " + data.results.length);
			if ( data.q ) {
				if ( data.q == lastsearched ) {
					if ( data.results ) {
						if ( data.results.length > 0 ) {
							var html = "";
							if ( data.ss == "cs" ) {
								for ( var i = 0; i < data.results.length; i++ ) {
									html += makeRowCs(data.results[i], i);
								}
							} else if ( data.ss == "ph" ) {
								for ( var i = 0; i < data.results.length; i++ ) {
									html += makeRowPh(data.results[i], i);
								}
							} else if ( data.ss == "wo" ) {
								for ( var i = 0; i < data.results.length; i++ ) {
									html += makeRowWo(data.results[i], i);
								}
							} else {
								for ( var i = 0; i < data.results.length; i++ ) {
									html += makeRow(data.results[i], i);
								}
							}
							document.getElementById("otherres").innerHTML = html;
						} else {
							document.getElementById("otherres").innerHTML = "";
						}
					} else {
						document.getElementById("otherres").innerHTML = "";			
					}
				}
			} else {
				try {
					if ( data.q == "" ) {
						document.getElementById("otherres").innerHTML = "";			
					}
				} catch (ignored) {}
			}
		} else {
			document.getElementById("otherres").innerHTML = "";		
		}
	}

	function setSessionCookie(name,value) {
		document.cookie = name+"="+value+"; path=/";
	}

	function getCookie(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	}

	function deleteCookie(name) {
		setCookie(name,"",-1);
	}
	

