
function dispInElem(str, elem)
   {
    top.blank.document.getElementById(elem).innerHTML=str;
   }

function clearAll()
   {
/*     dispInElem('','coords');
     dispInElem('','coords_near');
     dispInElem('','start_coords');
     dispInElem('','end_coords');
*/
   }

function set_cookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure )
{
  var cookie_string = name + "=" + escape ( value );

  if ( exp_y )
  {
    var expires = new Date ( exp_y, exp_m, exp_d );
    cookie_string += "; expires=" + expires.toGMTString();
  }

  if ( path )
        cookie_string += "; path=" + escape ( path );

  if ( domain )
        cookie_string += "; domain=" + escape ( domain );

  if ( secure )
        cookie_string += "; secure";

  document.cookie = cookie_string;
}

function get_cookie ( cookie_name )
{
  var results = document.cookie.match ( cookie_name + '=(.*?)(;|$)' );

  if ( results )
    return ( unescape ( results[1] ) );
  else
    return null;
}

function getQuests(m, str, det, el)

   {
    var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
           
           if (el == "map" || el == "coords" || el == "coords_near" || el == "start_coords" || el == "end_coords") {

               top.blank.document.getElementById(el).innerHTML=xmlHttp.responseText;
               

            }

            else if (el == "quests") {
                top.results.document.getElementById(el).innerHTML=xmlHttp.responseText;
            }
            else {
               document.getElementById(el).innerHTML=el;
               document.getElementById(el).innerHTML=xmlHttp.responseText;
            }
        }
      }

    if ((str.length != 0) && (m != "sg")) {

    if (m == "i") {
        if (get_cookie(det) != null) {
             str = get_cookie(det);
        }
    }

    xmlHttp.open("GET","../cgi-bin/wow_api_2_starts.cgi?m=" + m + "&crit=" + str + "&det=" + det,true);


    xmlHttp.send(null);
    }

    else if (m == "sg") {

       if (str.length != 0) {
           xmlHttp.open("GET","../cgi-bin/find_near_starts.cgi?qid=" + str + "&data=" + det,true);
           xmlHttp.send(null);
       }
    }


    else {
    if (el == "map" || el == "coords" || el == "coords_near") {
        top.blank.document.getElementById(el).innerHTML="";
    }
    else { document.getElementById(el).innerHTML=""; }
 }
}

