var AjaxKtClass = function()
{
    this.xmlHttp = false;
    this.url = "";
    this.updateFun = null;

    this.Create = function(url, updateFun)
    {

        try{
            this.xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        }catch(e){
            try{
                this.xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }catch(e2){
                this.xmlHttp = false;
            }
        }

        if(!this.xmlHttp&&typeof XMLHttpRequest != 'undefined'){
            this.xmlHttp = new XMLHttpRequest();
        }

        this.url = url;
        this.updateFun = updateFun;
    }

    this.OpenPost = function(param)
    {
        this.xmlHttp.onreadystatechange = this.updateFun;
        this.xmlHttp.open("POST", this.url, true);
        this.xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        this.xmlHttp.setRequestHeader("Content-length", param.length);
        this.xmlHttp.setRequestHeader("Connection", "close");
        this.xmlHttp.send(param);
    }

    this.Open = function()
    {
        this.xmlHttp.open("GET", this.url, true);
        this.xmlHttp.onreadystatechange = this.updateFun;
        this.xmlHttp.send(null);
    }

    this.Open2 = function(url)
    {
        this.xmlHttp.open("GET", url, true);
        this.xmlHttp.onreadystatechange = this.updateFun;
        this.xmlHttp.send(null);
    }

    this.Open3 = function(param)
    {
        this.xmlHttp.open("GET", this.url + param, true);
        this.xmlHttp.onreadystatechange = this.updateFun;
        this.xmlHttp.send(null);
    }

    this.GetData = function()
    {
        if(this.xmlHttp.readyState == 4){
            return this.xmlHttp.responseText;
        }
        return null;
    }
    this.GetXml = function()
    {
        if(this.xmlHttp.readyState == 4){
            return this.xmlHttp.responseXML;
        }
        return null;
    }
}


var ajaxObj = new AjaxKtClass();

var gvar="";

function load_it()
{
    var html = ajaxObj.GetData();
    if(html != null)
        {




        document.getElementById(gvar).innerHTML = "<span style='float: right;'><img src='images/close.png' style='cursor:hand;' onclick='hideMe(this);' /></span>"+html;
    }

}

function load_page(divid, page)
{
    document.getElementById(divid).innerHTML = "<span style='padding:80px;'><h1>Loading...</h1><br /><img src='/Spreadsheet/images/loader.white.gif' /></span>";
    gvar = divid;
    ajaxObj.Create(page,load_it);
    /*var rand = Math.random();
    ajaxObj.Open3("?temp="+rand);*/
    ajaxObj.Open3();
}

function load_page2(divid, page, param)
{
    //alert(divid);
    document.getElementById(divid).innerHTML = "<span style='padding:80px;'><h1>Loading...</h1><br /><img src='images/loader.white.gif' /></span>";
    gvar = divid;
    ajaxObj.Create(page,load_it);
    /*var rand = Math.random();
    ajaxObj.Open3("?temp="+rand+""+param);*/
    ajaxObj.Open3("?"+param);
}


function AutoSizeIFrame() {
    parent.document.getElementById('FloatingCalc').height=document.body.scrollHeight;
}

var spreadsheetiFrameCreated = false;
function mouseShow()
{
    mouseShowPx(300, 300);
}
function mouseShowPx(height, width)
{
    divid = 'FloatingCalc';
    //    if(!spreadsheetiFrameCreated)
    //        {
    //<iframe name = "FloatingCalc" id='FloatingCalc' style="display:none;position:absolute;border-style:solid;background-color:white;padding:5px;height:300px;width:300px;overflow:hidden;"></iframe> 
    //        
    //        var iFrame = document.createElement('iframe');
    //        iFrame.setAttribute('id',divid);
    //        iFrame.setAttribute('name',divid);
    //        iFrame.setAttribute('class','hiddeniframe');
    //        document.body.appendChild(iFrame);
    //        spreadsheetiFrameCreated = true;
    //    }
    ShowContent(divid);
    //load_page(divid, '/Spreadsheet/'+page);
    //document.getElementById('FloatingCalc').height = document.getElementById('FloatingCalc').document.getElementByTag('body').offsetHeight;
    //document.frames['FloatingCalc'].height = document.frames['FloatingCalc'].document.body.offsetHeight;
    //window.frames["FloatingCalc"].document.body.onload = 'getCookieValues();postcode();recalc_onclick("obj");setValueofBtn();ResetRatings();AutoSizeIFrame();'
    //document.getElementById('FloatingCalc').height= document.getElementById('FloatingCalc').document.body.scrollHeight;

    document.getElementById(divid).style.height= height+'px';
    document.getElementById(divid).style.width= width+'px';
}

function hideMe(divid){
    //document.getElementById(divid).style.display = "none";      
    divid.parentNode.parentNode.style.display = "none";      
}


<!-- Copyright 2006,2007 Bontrager Connection, LLC
// http://bontragerconnection.com/ and http://willmaster.com/
// Version: July 28, 2007
var cX = 0; var cY = 0; var rX = 0; var rY = 0;
function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }
function AssignPosition(d) {
    if(self.pageYOffset) {
        rX = self.pageXOffset;
        rY = self.pageYOffset;
    }
    else if(document.documentElement && document.documentElement.scrollTop) {
        rX = document.documentElement.scrollLeft;
        rY = document.documentElement.scrollTop;
    }
    else if(document.body) {
        rX = document.body.scrollLeft;
        rY = document.body.scrollTop;
    }
    if(document.all) {
        cX += rX; 
        cY += rY;
    }
    d.style.left = (cX+10) + "px";
    d.style.top = (cY+10) + "px";
}
function HideContent(d) {
    if(d.length < 1) { return; }
    document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
    if(d.length < 1) { return; }
    var dd = document.getElementById(d);
    AssignPosition(dd);
    dd.style.display = "block";
}
function ReverseContentDisplay(d) {
    if(d.length < 1) { return; }
    var dd = document.getElementById(d);
    AssignPosition(dd);
    if(dd.style.display == "none") { dd.style.display = "block"; }
    else { dd.style.display = "none"; }
}


function ShowIconBar(Video,Calc,Prod,MSDS)
{
    
    document.write('<table style="text-align: center;">');
    document.write('<tr>');
    if(Video.length > 2)
    document.write('<td><a href="/Videos.php?Cat='+Video+'&Title=Videos"><img border="0" src="/images/VideoReel.png" /></a></td>');
    if(Calc.length > 2)
    document.write('<td><a href="/Spreadsheet/LoadCalc.php?c='+Calc+'"  target="FloatingCalc" onclick="mouseShow();"><img border="0" src="/images/Calculator.png" /></a></td>');
    if(Prod.length > 2)
    document.write('<td><a href="/datasheets/'+Prod+'" target="_Blank"><img border="0" src="/images/Sheet.png" /></a></td>');
    if(MSDS.length > 2)
    document.write('<td><a href="/msds/'+MSDS+'" target="_Blank"><img border="0" src="/images/Document.png" /></a></td>');
    document.write('</tr>');
    document.write('<tr>');
    if(Video.length > 2)
    document.write('<td><a href="/Videos.php?Cat='+Video+'&Title=Refinishing Hardwood Floors">Video</a></td>');
    if(Calc.length > 2)
    document.write('<td><a href="/Spreadsheet/LoadCalc.php?c='+Calc+'"  target="FloatingCalc" onclick="mouseShow();">Calculator</a></td>');
    if(Prod.length > 2)
    document.write('<td><a href="/datasheets/'+Prod+'" target="_Blank">Product Info</a></td>');
    if(MSDS.length > 2)
    document.write('<td><a href="/msds/'+MSDS+'" target="_Blank">MSDS</a></td>');
    document.write('</tr>');
    document.write('</table>');

} 
