
function xmlhttpGet(strURL, strQuery) {
	agt = navigator.userAgent.toLowerCase();
	topPos = (getScrollXY() + 20) + 'px';
	document.getElementById("ajaxDiv").style.top = topPos;
	if(document.getElementById("TB_overlay"))
		document.getElementById("TB_overlay").style.display = 'inline';
	document.getElementById("ajaxDiv").style.display = 'inline';
	document.getElementById("ajaxDiv").innerHTML = '<img src="/images/loadingAnimationv3.gif" />';
    var xmlHttpReq = false;
    var self = this;
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updateDiv(self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send(strQuery);
}

function updateDiv(str){
	document.getElementById("ajaxDiv").innerHTML = str;
}

function getScrollXY() {
  var scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
  } else if( document.body && document.body.scrollTop ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
  } else if( document.documentElement && document.documentElement.scrollTop ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
  }
  return scrOfY;
}

function ajaxSaveSlide(strURL, strQuery) {
	agt = navigator.userAgent.toLowerCase();
    var xmlHttpReq = false;
    var self = this;
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
			progressStr = strQuery.split('progress=');
			progressStr = progressStr[1];
			str = '<div style="border:1px solid #6B9C04; color:#6B9C04; background-color:#CCEDBC; padding:10px;">Your progress has been saved</div>';
			str+= '<p>Current Saved Progress: ' + progressStr + '</p>';
            document.getElementById("progress_message").innerHTML = str;
			setTimeout('hideSaveSlide(progressStr)', 5000);
        }
    }
    self.xmlHttpReq.send(strQuery);
}

function hideSaveSlide(str)
{
	document.getElementById("progress_message").innerHTML = '<p>Current Saved Progress: ' + str + '</p>';
}

function ajaxLearningActions(strURL, strQuery) {
	agt = navigator.userAgent.toLowerCase();
    var xmlHttpReq = false;
    var self = this;
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
			document.getElementById("learning_actions").innerHTML = self.xmlHttpReq.responseText;
        }
    }
    self.xmlHttpReq.send(strQuery);
}


function ajaxLearningPoints(strURL, strQuery) {
	agt = navigator.userAgent.toLowerCase();
    var xmlHttpReqB = false;
    var self = this;
    if (window.XMLHttpRequest) {
        self.xmlHttpReqB = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
        self.xmlHttpReqB = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReqB.open('POST', strURL, true);
    self.xmlHttpReqB.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReqB.onreadystatechange = function() {
        if (self.xmlHttpReqB.readyState == 4) {
			document.getElementById("key_notes").innerHTML = self.xmlHttpReqB.responseText;
        }
    }
    self.xmlHttpReqB.send(strQuery);
}


