
var pageIsLoading = false;
var _ActiveTab = null;

//preload the hover image
tabHover = new Image(100, 28);
tabHover.src = "images/tab-hover.jpg";

function enableMenu(id)
{
	_ActiveTab = document.getElementById(id);
	_ActiveTab.className = "active_tab";
}

//mouse over inactive tab
function hover(id)
{
    if(_ActiveTab != null)
    {
        if(_ActiveTab.id != id)
        {
            tab = document.getElementById(id);
            tab.className = "hover_tab";
        }
    }
}

//mouse off inactive tab
function out(id)
{
    if(_ActiveTab != null)
    {
        if(_ActiveTab.id != id)
        {
            tab = document.getElementById(id);
            tab.className = "inactive_tab";
        }
    }
}

function ghem(id)
{
    document.getElementById(id).innerHTML = "<a style=\"color:#41B4F1\" href=\"mailto:greggh@hendricksongroup.com\">greggh@hendricksongroup.com</a>  &nbsp;&nbsp;(Gregg Hendrickson)";
}

function hg()
{
    return "Hendrickson Group";
}

function ghNm()
{
    document.write('Gregg Hendrickson');
}

function gh(id)
{
    document.getElementById(id).innerHTML = "Gregg Hendrickson";
}

function rh(id)
{
    document.getElementById(id).innerHTML = "Roberta Harris";
}

function devgh(id)
{
    document.getElementById(id).innerHTML = "Developer: Gregg Hendrickson";
}

function cl(id)
{
    txt = document.getElementById(id).innerHTML;
    txt = "<span class=\"body_hilight\">Cyto Laboratories, Inc.</span>" + txt;
    document.getElementById(id).innerHTML = txt;
}

function showIxBanner()
{
    obj = document.getElementById('ix_banner');
    if(obj != null)
    {
        obj.innerHTML="<a href=\"https://www.ixwebhosting.com/templates/ix/v2/affiliate/clickthru.cgi?id=greggh\">" +
                      "<img alt=\"Outstanding Web Hosting\" src=\"images/banner-ix-vert.gif\" style=\"border:0 0 0 \" /></a>";
    }
}

function navtoHref(url)
{
    if(!pageIsLoading)
        location.href=url;
}

function loadingpage()
{
    pageIsLoading = true;
}

function pageisloaded()
{
    pageIsLoading = false;
}

// Web Service functionality
// Global vars
var _xmlDoc = null;
var _serviceCallback = null;

// Calls web service, web service url and parms, and callback function or null must be provided.
// Callback function receives a true of false based on success of call to host
function callWebService(url, callback)
{
    _serviceCallback = callback;
    
    if(_xmlDoc == null)
    {
        _xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
    }

    _xmlDoc.onreadystatechange = stateChange; //callback for readystate
    _xmlDoc.async = true; //do background processing

    _xmlDoc.load(url);
}

// Updates readystate by callback
function stateChange()
{
    if (_xmlDoc.readyState == 4)
    {
        var err = _xmlDoc.parseError;
        var result = false;
        var nd;
        if(err.errorCode == 0)
        {
            nd = _xmlDoc.selectSingleNode("//envelope/date_time");
            if(nd.text != "")
                result = true;
        }
        
        // perform callback if provided
        if(_serviceCallback != null)
            _serviceCallback(result, nd == null ? "" : nd.text);
    }
}

// Callback supplied to XMLHttpRequest call
function callbackTest(result, data)
{
    obj = document.getElementById("txtOuput");
    
	if(result)
		obj.value = "Success " + data;
	else
		obj.value = "Web Service Call Failed";	
}