function GetXmlHttpObject()
{ 
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest("Msxml2.XMLHTTP");
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}
function showDay(day)
{
    var xmlHttp = GetXmlHttpObject();
    var url = "day.php?date=" + day;
    xmlHttp.open("GET", url, true);
    xmlHttp.onreadystatechange = function()
      {   
        if (xmlHttp.readyState == 4)
          {
              var element = document.getElementById("showDay");
              element.innerHTML = xmlHttp.responseText;        
          }
      }
    xmlHttp.send(null);
}

function showSchedule(day,lid,close)
{
    var xmlHttp = GetXmlHttpObject();
    var url = "day.php?date=" + day + "&lid=" + lid + "&schedule" + close;
    xmlHttp.open("GET", url, true);
    xmlHttp.onreadystatechange = function()
      {   
        if (xmlHttp.readyState == 4)
          {
              var element = document.getElementById("showDay");
              element.innerHTML = xmlHttp.responseText;
              document.getElementById('darken').style.display = 'block';
          }
      }
    xmlHttp.send(null);
}
function editSchedule(day,id)
{
    var xmlHttp = GetXmlHttpObject();
    var url = "day.php?date=" + day + "&editschedule=" + id;
    xmlHttp.open("GET", url, true);
    xmlHttp.onreadystatechange = function()
      {   
        if (xmlHttp.readyState == 4)
          {
              var element = document.getElementById("showDay");
              element.innerHTML = xmlHttp.responseText;
              document.getElementById('darken').style.display = 'block';
          }
      }
    xmlHttp.send(null);
}









/***********************************************
* Drag and Drop Script: 
***********************************************/

var dragobject={
z: 0, x: 0, y: 0, offsetx : null, offsety : null, targetobj : null, dragapproved : 0,
initialize:function(){
document.onmousedown=this.drag
document.onmouseup=function(){this.dragapproved=0}
},
drag:function(e){
var evtobj=window.event? window.event : e
this.targetobj=window.event? event.srcElement : e.target
if (this.targetobj.className=="drag"){
this.dragapproved=1
if (isNaN(parseInt(this.targetobj.style.left))){this.targetobj.style.left=0}
if (isNaN(parseInt(this.targetobj.style.top))){this.targetobj.style.top=0}
this.offsetx=parseInt(this.targetobj.style.left)
this.offsety=parseInt(this.targetobj.style.top)
this.x=evtobj.clientX
this.y=evtobj.clientY
if (evtobj.preventDefault)
evtobj.preventDefault()
document.onmousemove=dragobject.moveit
}
},
moveit:function(e){
var evtobj=window.event? window.event : e
if (this.dragapproved==1){
this.targetobj.style.left=this.offsetx+evtobj.clientX-this.x+"px"
this.targetobj.style.top=this.offsety+evtobj.clientY-this.y+"px"
return false
}
}
}

dragobject.initialize()


/***********************************************
* Change backgoundcolor on textfield 
***********************************************/


function changebgcolor(that, fgcolor, bgcolor){
that.style.color = fgcolor;
that.style.backgroundColor = bgcolor;
}





