var xmlHttp

function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  } 
  alert('Query Variable ' + variable + ' not found');
}


function GetValue(which)
{
if (!document.getElementById|document.all)
	{
	return
	}
else
	{
	if (document.getElementById)
		{
		oWhich = eval ("document.getElementById('" + which + "')")
		}
	else
		{
		oWhich = eval ("document.all." + which)
		}
	}

	//window.focus()
	alert(oWhich.Value)
}



function Cover(bottom, top, ignoreSize) {
                var location = Sys.UI.DomElement.getLocation(bottom);
               // alert('33333333333');
                top.style.position = 'absolute';
                top.style.top = location.y + 'px';
                top.style.left = location.x + 'px';
                if (!ignoreSize) {
                    top.style.height = bottom.offsetHeight + 'px';
                    top.style.width = bottom.offsetWidth + 'px';
                }
            }
var xmlHttp            
function showCountries(expr)
{ 
//expr = document.getElementById('qsrch').value
//alert('44444444444')
xmlHttp=GetXmlHttpObject()
//Cover("flyout","txtHint",0)
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
} 

var url="GetCountrysByCat.ashx"
url=url+"?expr="+getQueryVariable('getbyval')
url=url+"&cat="+getQueryVariable('cat')
//url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged2
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
//alert ("Browser does not support HTTP Request")
}

function stateChanged2() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
document.getElementById("countrylist").innerHTML=xmlHttp.responseText;
} 
}

function GetXmlHttpObject()
{ 
var objXMLHttp=null
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
}

function populateqsrch(str) {
    document.getElementById('ctl00_SearchText').value = str.replace('amp;', '&').replace('plus;', '+')
}
function showResults(expr) {
//alert("1")
   // $('#inner').fadeTo("fast", 0)
    $("#inner").fadeOut("slow");
    if (expr == 'ctl00_SearchText') {
        expr = $("input#ctl00_SearchText").val();
    }
  //  alert("2")
    // var expr = $("input#ctl00_SearchText").val();
   //// $(this).fadeTo("expr", 1);
  //   alert(expr) 
    $.ajax({
        type: "get", url: "QuickSearchGet.ashx", data: "expr=" + expr.replace('&', 'amp;').replace('+', 'plus;'),
        beforeSend: function() { $("#loading").show("fast"); $("#inner").hide(); }, //show loading just when link is clicked
        complete: function() { $("#loading").hide("fast"); $("#results").show("fast"); }, //stop showing loading when the process is complete   
        success: function(html) { //so, if data is retrieved, store it in html
        $("#results").html(html); //show the html inside .content div
        //$("#results").slideDown("slow");
            $("#results").fadeIn("slow");
        }
    });
}
function addEngine() {
    try {
        window.external.AddSearchProvider('http://www.kays.co.uk/provider.xml');
    } catch (e) {
        try {
            window.sidebar.addSearchEngine(
'http://www.kays.co.uk/kays.src',
'http://www.kays.co.uk/images/kaysx.gif',
'Kay Media',
'Film TV Theatre');
        } catch (e) {
            alert("The search option could not be installed. "); //'
        }
    }
    return false;
}



