﻿function xmlhttpPost(strURL, divId) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        try{
        self.xmlHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
        }catch(e){
            try{
                self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
            }catch(E){
            }
        }
    }
    self.xmlHttpReq.open('GET', strURL, true);
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatepage(self.xmlHttpReq.responseText, divId);
        }
    }
    self.xmlHttpReq.send(null);
}

function updatepage(str, divId){
    document.getElementById(divId).innerHTML = str;    
}

function xmlhttpPostImage(strURL, image) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        try{
        self.xmlHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
        }catch(e){
            try{
                self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
            }catch(E){
            }
        }
    }
    self.xmlHttpReq.open('GET', strURL, true);
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updateimage(self.xmlHttpReq.responseText, image);
        }
    }
    self.xmlHttpReq.send(null);
}

function updateimage(str, image){
    document.getElementById(image).src = str;    
}

