var ajax_load = '<center><img src="i/loader.gif" /></center>';
var loadUrl = 'inc/ajax/rating.php';

function processRating(html, rating, id){
    activeid = html.replace("#","");
    $(html).html(ajax_load).load(loadUrl+"?rating="+rating+"&id="+id);
}

function getCities(html, id) {
    activeid = html.replace("#","");
    $(html).html('<img src="i/input_box.jpg" />').load('inc/ajax/city.php?id='+id);
}
function getCitiesAdmin(html, id) {
    activeid = html.replace("#","");
    $(html).html('<img style="margin-left: 90px;margin-right: 90px;" src="i/ajax-loader.gif" />').load('../inc/ajax/city.php?id='+id);
}

function getPath(html, ifa, county) {
    activeid = html.replace("#","");
    $(html).html('<img style="margin-left: 90px;margin-right: 90px;" src="i/ajax-loader.gif" />').load('../inc/ajax/genpath.php?ifa='+ifa+'&county='+county);
}

function safePath(str)
{
    newstr = str.replace(/ /g,'_');
    //newstr = newstr.replace(/./g,'');
    newstr = newstr.replace(/-/g,'_');
    newstr = newstr.replace(/\(/g,'_');
    newstr = newstr.replace(/\)/g,'_');
    newstr = newstr.replace('/','_');
    return newstr.toLowerCase();
}

function locate_pc(html, postcode)
{
    activeid = html.replace("#","");
    $(html).html('').load('../inc/ajax/locate.php?pc='+postcode);
}

function toggleStatus(html, id)
{
    activeid = html.replace("#","");
    $(html).html('').load('../inc/ajax/toggleifa.php?id='+id);
}

/// IFA page
function qSearch(val){
document.getElementById('fatype').value = val;
document.getElementById('quickform').submit();
}

function moreresults(lat,lng,begin,end,where,miles){
  var xmlHttp1;
      try// Firefox, Opera 8.0+, Safari
    {xmlHttp1=new XMLHttpRequest(); }
      catch (e)  // Internet Explorer
    {
    try
      {xmlHttp1=new ActiveXObject("Msxml2.XMLHTTP");}
    catch (e)
      {
      try
        { xmlHttp1=new ActiveXObject("Microsoft.XMLHTTP"); }
      catch (e)
        {//  alert("Your browser does not support AJAX!");
     //   return false;
        }
      }
    }
      xmlHttp1.onreadystatechange=function(){
      if(xmlHttp1.readyState==4)
        {document.getElementById('searchresultsajax').innerHTML = xmlHttp1.responseText;}
      }
    xmlHttp1.open("GET","/js/ajax-search.php?lat="+lat+"&lng="+lng+"&where="+where+"&begin="+begin+"&end="+end+"&miles="+miles ,true);
    xmlHttp1.send(null);
}