//---------------------------------AJAX LIBRARY FUNCTINS------------------------------------------//
function xmlhttp_object() {
    var http;
    try {
      http = new XMLHttpRequest;
        get_http_object = function() {
          return new XMLHttpRequest;
        };
    }
    catch(e) {
      var msxml = [
        'MSXML2.XMLHTTP.3.0',
        'MSXML2.XMLHTTP',
        'Microsoft.XMLHTTP'
      ];
      for (var i=0, len = msxml.length; i < len; ++i) {
        try {
          http = new ActiveXObject(msxml[i]);
          get_http_object = function() {
            return new ActiveXObject(msxml[i]);
          };
          break;
        }
        catch(e) {}
      }
    }
    return http;
  };

function send_request(url,divid,loader)
{
var xmlhttp=xmlhttp_object();
if(xmlhttp.readyState==0)
xmlhttp.open("GET",url,true);
else
alert("Script Execution Error # 1");
xmlhttp.onreadystatechange = function() {//Function Start
if((xmlhttp.readyState==1)||(xmlhttp.readyState==2)||(xmlhttp.readyState==3)) //This is when the Request is in Progress. IF # 1
{
if(loader==0)
img_loader='image_loader';
else
img_loader='image_loader'+loader;
try { document.getElementById(divid).style.visibility='hidden'; } catch(e) {}
try { document.getElementById(img_loader).style.display='inline'; document.getElementById(img_loader).style.visibility='visible' } catch(e) {}
}//End IF # 1
if(xmlhttp.readyState==4) //This is when request has been completely executed IF # 2
{
var response=xmlhttp.responseText;
if(divid=='')
alert(response);
else
{
try {
document.getElementById(divid).innerHTML=response; } catch(e) { /*alert(document.forms[divid].inneHTML);
alert(document.getElementById(divid).innerHTML);
document.all[divid].inneHTML=response;*/
someHtml = response;
oldDiv = document.getElementById(divid);
newDiv = document.createElement(oldDiv.tagName);
newDiv.id = oldDiv.id;
newDiv.className = oldDiv.className;
newDiv.innerHTML = someHtml;
oldDiv.parentNode.replaceChild(newDiv, oldDiv); }
}
try { document.getElementById(img_loader).style.visibility='hidden';
document.getElementById(img_loader).style.diplay='none'; } catch(e) {}
try { document.getElementById(divid).style.visibility='visible'; } catch(e) {}
} //End IF # 2
};//End Function
xmlhttp.send(null);
}

//-------------------------------------AJAX LIBRARY FUNCTIONS---------------------------------


function add_group(name)
{
if(name.value=='')
{
alert("Please Enter a Group Name To Add");
return;
}
var rand=parseInt(Math.random()*99999999);
send_request("../action_layer.php?action=3&rand="+rand+"&group_name="+name.value,"",0);
load_groups_grid();
}


//
//function car_detail(booking_id)
//{
//	var rand=parseInt(Math.random()*99999999);
//	send_request( "system/js/checkin_cardetail.php?action=3&rand="+rand+"&booking_id="+booking_id,"car_detail",0);
//	send_request( "system/application/views/admin/checkin_cardetail.php?action=3&rand="+rand+"&booking_id="+booking_id,"car_detail",0);
//}

