 /*
  *  Retrieve data using the XMLHttpRequest object
  *
  */
function ajax_call_server(url, vars)
{
 var xml = null;
 try
 {
     xml = new ActiveXObject("Microsoft.XMLHTTP");
 }
 catch(exception)
 {
     xml = new XMLHttpRequest();
 }

 if(xml!=null)
 {
     xml.open("GET",url + vars, false);
     xml.send(null);
     if(xml.status == 404) alert("Error 404: Incorrect url.");
     return xml.responseText;
 }
 alert("Your browser does not support XMLHTTP.");
 return "";
}

 /*
  *  AJAX dynamic javascript "eval()" function usage to fill
  *  the options of a SELECT list.
  *
  */
function dyl_get_subcategories()
{
 var idcategory = document.getElementById("search_cat").value;
 var response = ajax_call_server( "get-subcategories.php",
                                  "?c="+idcategory);
 eval(response);
}


 /*
  *  Checking onsubmit form
  *
  */
function dyl_check_form()
{
 if(document.getElementById("search_cat").value=='0')
 {
    alert("Category not found. Unable to continue.");
    return false;
 }
}
