/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2010/08/05 12:00:00 $
*       Filename:  $RCSfile: blkNs.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin blkNs.js
// ************************************************************************************************

if(typeof BLK === "undefined" || !BLK)
{
	var BLK = {};
	BLK.EBIZ = {};
	BLK.BRS = {};
}
BLK.EBIZ.debugMode = true;
BLK.BRS.debugMode = false;

// ************************************************************************************************
// end blkNs.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2010/08/05 12:00:00 $
*       Filename:  $RCSfile: ebizNs.js,v $
*       Revision:  $Revision: 1.0 $
*/
 
// ************************************************************************************************
// begin ebizNs.js
// ************************************************************************************************

if(typeof EBIZ === "undefined" || !EBIZ)
{
	var EBIZ = {};
}
EBIZ.thisSite = "";

// ************************************************************************************************
// end ebizNs.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2010/11/05 12:00:00 $
*       Filename:  $RCSfile: trace.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin trace.js
// ************************************************************************************************

/*global BLK, console, window */

BLK.EBIZ.trace = function(message)
{
    if(!BLK.EBIZ.debugMode)
    {
        return;
    }
    if(typeof console !== "undefined")
    {
        if(typeof console.log !== "undefined")
        {
            console.log(message);
        }
    }
    else
    {
        if(typeof window.opera !== "undefined")
        {
            if(typeof window.opera.postError !== "undefined")
            {
                window.opera.postError(message);
            }
        }
    }
}; // end BLK.EBIZ.trace = function(message)

BLK.EBIZ.trace2 = function(message)
{
    if(typeof console !== "undefined")
    {
        if(typeof console.log !== "undefined")
        {
            console.log(message);
        }
    }
    else
    {
        if(typeof window.opera !== "undefined")
        {
            if(typeof window.opera.postError !== "undefined")
            {
                window.opera.postError(message);
            }
        }
    }
}; // end BLK.EBIZ.trace2 = function(message)

// ************************************************************************************************
// end trace.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2010/08/05 12:00:00 $
*       Filename:  $RCSfile: buildDynScr.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin buildDynScr.js
// ************************************************************************************************

/*global document, randomBetween */

function buildDynamicScriptTag(url, data)
{
	var headObj = document.getElementsByTagName("head")[0];
	//var bodyObj = document.getElementsByTagName("body")[0];
	
	var scriptObj = document.createElement("script");
	//var prefix = new Date().getTime();
	var prefix = randomBetween(10001, 99999);
	var suffix = randomBetween(10001, 99999);
	var id = prefix + "_" + suffix;
	var requestId = "?requestId=" + id;
	//scriptObj.src = url + requestId + data;
	scriptObj.setAttribute("id", id);
	scriptObj.setAttribute("type", "text/javascript");
	
	
	// 20100614 rhoward
	scriptObj.setAttribute("charset", "UTF-8");
	
	
	var src = url + requestId + data;

	function callback(origin, id)
	{
        //window.alert("loaded. . ." + origin);
	}
    if(typeof scriptObj.onreadystatechange !== "undefined")
    {  
        //  ie
        scriptObj.onreadystatechange = function ()
        {
            if(scriptObj.readyState === "loaded" ||
                    scriptObj.readyState === "complete")
            {
                scriptObj.onreadystatechange = null;
                callback("onreadystatechange", id);
            }
        };
    } 
    else 
    {  
        // not ie
        scriptObj.onload = function ()
        {
            callback("onload", id);
        };
    }

    buildDynamicScriptTag.src = src;
	scriptObj.src = src;
	scriptObj.setAttribute("src", src);
	
	if(scriptObj.nextSibling === null)
	{
	    headObj.appendChild(scriptObj);
	}
	else
	{
	    headObj.insertBefore(scriptObj, scriptObj.nextSibling);
	}
} // end function buildDynamicScriptTag(url, data)
buildDynamicScriptTag.src = "";

/*
function appendScriptTags(scriptObj, headObj, src)
{
	//scriptObj.setAttribute("src", src);
    //scriptObj.src = src;	
	if(scriptObj.nextSibling === null)
	{
	    headObj.appendChild(scriptObj);
	}
	else
	{
	    headObj.insertBefore(scriptObj, scriptObj.nextSibling);
	}
}
function buildDynamicScriptTagImpl(url, data)
{
	var headObj = document.getElementsByTagName("head")[0];
	var bodyObj = document.getElementsByTagName("body")[0];
	
	var scriptObj = document.createElement("script");
	var prefix = new Date().getTime();
	var suffix = randomBetween(10001, 99999);
	var id = prefix + "_" + suffix;
	var requestId = "?requestId=" + id;
	//scriptObj.src = url + requestId + data;
	scriptObj.setAttribute("id", id);
	scriptObj.setAttribute("type", "text/javascript");
	
	var src = url + requestId + data;

	function callback(origin, id)
	{
        window.alert("loaded. . ." + origin);
	}
    if(typeof scriptObj.onreadystatechange !== "undefined")
    {  
        //  ie
        scriptObj.onreadystatechange = function ()
        {
            if(scriptObj.readyState === "loaded" ||
                    scriptObj.readyState === "complete")
            {
                scriptObj.onreadystatechange = null;
                callback("onreadystatechange", id);
            }
        };
    } 
    else 
    {  
        // not ie
        scriptObj.onload = function ()
        {
            callback("onload", id);
        };
    }

    buildDynamicScriptTag.src = src;
    
    
	scriptObj.src = src;
	scriptObj.setAttribute("src", src);

	//if(scriptObj.nextSibling === null)
	//{
	//    headObj.appendChild(scriptObj);
	//}
	//else
	//{
	//    headObj.insertBefore(scriptObj, scriptObj.nextSibling);
	//}
	
    //appendScriptTags(scriptObj, headObj, src);
    
    
    buildDynamicScriptTagImpl.scriptObj = scriptObj;
    buildDynamicScriptTagImpl.headObj = headObj;
    buildDynamicScriptTagImpl.src = src;
    
} // end function buildDynamicScriptTagImpl(url, data)
buildDynamicScriptTagImpl.scriptObj = null;
buildDynamicScriptTagImpl.headObj = null;
buildDynamicScriptTagImpl.src = "";

function buildDynamicScriptTag(url, data)
{
    buildDynamicScriptTagImpl(url, data);
    var scriptObj = buildDynamicScriptTagImpl.scriptObj;
    var headObj = buildDynamicScriptTagImpl.headObj;
    var src = buildDynamicScriptTagImpl.src;
    appendScriptTags(scriptObj, headObj, src);
}
buildDynamicScriptTag.src = "";
*/

function buildDynamicScriptTagOnLoad(url, data, script)
{
	var headObj = document.getElementsByTagName("head")[0];
	//var bodyObj = document.getElementsByTagName("body")[0];
	
	var scriptObj = document.createElement("script");
	//var prefix = new Date().getTime();
	var prefix = randomBetween(10001, 99999);
	var suffix = randomBetween(10001, 99999);
	var id = prefix + "_" + suffix;
	var requestId = "?requestId=" + id;
	//scriptObj.src = url + requestId + data;
	scriptObj.setAttribute("id", id);
	scriptObj.setAttribute("type", "text/javascript");
	
	var src = url + requestId + data;

    /*
	function callback(origin, id)
	{
        //window.alert("loaded. . ." + origin);
	}
    if(typeof scriptObj.onreadystatechange !== "undefined")
    {  
        //  ie
        scriptObj.onreadystatechange = function ()
        {
            if(scriptObj.readyState === "loaded" ||
                    scriptObj.readyState === "complete")
            {
                scriptObj.onreadystatechange = null;
                callback("onreadystatechange", id);
            }
        };
    } 
    else 
    {  
        // not ie
        scriptObj.onload = function ()
        {
            callback("onload", id);
        };
    }
    */
    
	scriptObj.setAttribute("src", src);
	
	if(scriptObj.nextSibling === null)
	{
	    headObj.appendChild(scriptObj);
	}
	else
	{
	    headObj.insertBefore(scriptObj, scriptObj.nextSibling);
	}
    //bodyObj.appendChild(scriptObj);
    
    return id;
} // end function buildDynamicScriptTagOnLoad(url, data, script)

// ************************************************************************************************
// end buildDynScr.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2010/10/29 16:00:00 $
*       Filename:  $RCSfile: envLoad.js,v $
*       Revision:  $Revision: 2.0 $
*/

// ************************************************************************************************
// begin envLoad.js
// ************************************************************************************************

/*global location, document, buildDynamicScriptTagOnLoad */

// new version without hard coding by Warren Jackter
function loadConfigFiles(fileNameArray)
{
    //window.alert("load config files");
    var id = 0;
    var idArray = [];
    var hostName = location.hostname;
    var src = "";

    if(BLK.envConfig !== undefined && BLK.envSetting !== undefined)
    {
        // config variables already exist
        // no need to obtain files dynamically
        return idArray;
    } // end if(BLK.envConfig !== undefined && BLK.envSetting !== undefined)

	var scripts = document.getElementsByTagName("script");
	var index = -1;
	var prefix = "";
	var src_split = [];
	var script = null;
	for (var x = 0; x < scripts.length; x++) 
	{
	    script = scripts[x];
		src = scripts[x].getAttribute("src");
		if (src === null || src === "") 
		{
			continue;
		}
		src = src.toLowerCase();
		src_split = src.split("/");
		if (src_split[src_split.length - 1] === "common.js") 
		{
			index = src.indexOf("common.js");
			prefix = src.substring(0, index);
			break;
		}
	} // end for (var x = 0; x < scripts.length; x++) 

	if(prefix !== "")
	{
	    for(var i = 0; i < fileNameArray.length; i++)
	    {
	        id = buildDynamicScriptTagOnLoad(prefix + fileNameArray[i], "", script);
	        idArray[i] = id;
	    } // end for(var i = 0; i < fileNameArray.length; i++)
	} // end if(prefix !== "")
    return idArray;
} // end function loadConfigFiles(fileNameArray)

// old version with hard coding
/*
function loadConfigFiles(fileNameArray)
{
    var id = 0;
    var idArray = [];
    var hostName = location.hostname;
    var src = "";
    var found = false;
    var prefix = "https://www2.blackrock.com/content/groups/globaltemplates/js/";
    var scriptList = document.getElementsByTagName("script");
    for(var k = 0; k < scriptList.length; k++)
    {
        src = scriptList[k].getAttribute("src");
        if(src === null || src === "")
        {
            continue;
        }
        src = src.toLowerCase();
        if(src.indexOf("common.js") !== -1)
        {
            found = true;
            if(src.indexOf("www2.blackrock.com/content/groups/globaltemplates/js/") !== -1)
            {
                // prod
                prefix = "https://www2.blackrock.com/content/groups/globaltemplates/js/";
            }
            else if(src.indexOf("consumptiontst.blackrock.com/content/groups/globaltemplates/js/") !== -1)
            {
                // test
                prefix = "https://consumptiontst.blackrock.com/content/groups/globaltemplates/js/";
            }
            else if(src.indexOf("pcctvapp12.bfm.com") !== -1)
            {
                // dev
                //prefix = "http://pcctvapp12.bfm.com:911/blackrock/GENERIC/js/";
                prefix = "http://pcctvapp12.bfm.com:911/blackrock/roark/forprod/GENERIC/js/";
            }
            else
            {
                // prod
                prefix = "https://www2.blackrock.com/content/groups/globaltemplates/js/";
            }
            break;
        } // end if(src.indexOf("common.js") !== -1)
    } // end for(var k = 0; k < scriptList.length; k++)

    for(var i = 0; i < fileNameArray.length; i++)
    {
        id = buildDynamicScriptTag(prefix + fileNameArray[i], "");
        idArray[i] = id;
    } // end for(var i = 0; i < fileNameArray.length; i++)
    return idArray;
} // end function loadConfigFiles(fileNameArray)
*/

loadConfigFiles(["envSetting.js", "envConfig.js"]);
//loadConfigFiles(["envConfig.js"]);

// ************************************************************************************************
// end envLoad.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2010/10/05 11:00:00 $
*       Filename:  $RCSfile: makeSure.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin makeSure.js
// ************************************************************************************************

/*global BLK, window */

BLK.EBIZ.makeSureConfigFileIsLoaded = function(initFxnRef)
{
    BLK.EBIZ.makeSureConfigFileIsLoaded.attemptCount++;
    BLK.EBIZ.trace("Attempt to load config file - attempt:" + BLK.EBIZ.makeSureConfigFileIsLoaded.attemptCount);
    if(BLK.EBIZ.makeSureConfigFileIsLoaded.attemptCount > BLK.EBIZ.makeSureConfigFileIsLoaded.maxNumberOfTimes)
    {
        window.clearTimeout(BLK.EBIZ.makeSureConfigFileIsLoaded.timerId);
        BLK.EBIZ.trace("Config file not loaded. . .FAILURE");
        return;
    }
    //if(BLK.envConfig !== undefined)
    if(BLK.envConfig !== undefined && BLK.envSetting !== undefined)
    {
        BLK.EBIZ.trace("Config file loaded. . .SUCCESS");
        window.clearTimeout(BLK.EBIZ.makeSureConfigFileIsLoaded.timerId);
        BLK.EBIZ.makeSureConfigFileIsLoaded.configFileLoaded = true;


        if(typeof initFxnRef === "function")
        {
            initFxnRef();
        }

        /*
        for(var i = 0; i < BLK.EBIZ.makeSureConfigFileIsLoaded.fxnArray.length; i++)
        {
        if(typeof BLK.EBIZ.makeSureConfigFileIsLoaded.fxnArray[i] === "function")
        {
        BLK.EBIZ.makeSureConfigFileIsLoaded.fxnArray[i]();
        }
        } // end for(var i = 0; i < BLK.EBIZ.makeSureConfigFileIsLoaded.fxnArray.length; i++)
        */
    }
    else
    {
        //BLK.EBIZ.makeSureConfigFileIsLoaded.timerId = window.setTimeout("BLK.EBIZ.makeSureConfigFileIsLoaded();", 100);
        BLK.EBIZ.makeSureConfigFileIsLoaded.timerId = window.setTimeout(function() { BLK.EBIZ.makeSureConfigFileIsLoaded(initFxnRef); }, 100);
    }
};  // end function makeSureConfigFileIsLoaded()
BLK.EBIZ.makeSureConfigFileIsLoaded.timerId = null;
BLK.EBIZ.makeSureConfigFileIsLoaded.maxNumberOfTimes = 256;
BLK.EBIZ.makeSureConfigFileIsLoaded.attemptCount = 0;
BLK.EBIZ.makeSureConfigFileIsLoaded.configFileLoaded = false;
//BLK.EBIZ.makeSureConfigFileIsLoaded.fxnArray = [];
//BLK.EBIZ.makeSureConfigFileIsLoaded.subscribe = function (fxnRef)
//{
//    if(typeof fxnRef === "function")
//    {
//        BLK.EBIZ.makeSureConfigFileIsLoaded.fxnArray[BLK.EBIZ.makeSureConfigFileIsLoaded.fxnArray.length] = fxnRef;
//    }
//};

// ************************************************************************************************
// end makeSure.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2010/04/09 09:00:00 $
*       Filename:  $RCSfile: userData.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin userData.js
// ************************************************************************************************

/*global BLK, document, window */

BLK.EBIZ.getFirmId = function ()
{
    var firmId = "";
    if(typeof userIdFirmIdObj === "object")
    {
        if(typeof userIdFirmIdObj["firmId"] !== "undefined")
        {
            firmId = userIdFirmIdObj["firmId"];
        }
    }
    return firmId;
}; // end BLK.EBIZ.getFirmId = function ()

BLK.EBIZ.getUserId = function ()
{
    var userId = "";
    if(typeof userIdFirmIdObj === "object")
    {
        if(typeof userIdFirmIdObj["firmId"] !== "undefined")
        {
            userId = userIdFirmIdObj["userId"];
        }
    }
    return userId;
}; // end BLK.EBIZ.getUserId = function ()

BLK.EBIZ.isBlackRockCurrentFirm = function ()
{
    var firmId = BLK.EBIZ.getFirmId();
    var isBlackRock = false;
    if(firmId === "99998")
    {
        isBlackRock = true;
    }
    return isBlackRock;
}; // end BLK.EBIZ.isBlackRockCurrentFirm = function ()

// ************************************************************************************************
// end userData.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2010/10/29 16:00:00 $
*       Filename:  $RCSfile: language.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin language.js
// ************************************************************************************************

/*global BLK, document, trim */

BLK.EBIZ.language = "en";
BLK.EBIZ.setLanguage = function()
{
    var bodyRef = document.body;
    var language = bodyRef.getAttribute("lang");
    if(language === null)
    {
        language = "en";
        BLK.EBIZ.language = language;
        //window.alert("lang not specified, using default:" + language);
        return;
    }
    if(language === "")
    {
        language = "en";
        BLK.EBIZ.language = language;
        //window.alert("lang not specified, using default:" + language);
        return;
    }
    if(typeof BLK.envSetting === "undefined")
    {
        language = "en";
        BLK.EBIZ.language = language;
        return;
    }
    if(typeof BLK.envSetting.commonText === "undefined")
    {
        language = "en";
        BLK.EBIZ.language = language;
        return;
    }
    if(typeof BLK.envSetting.commonText.language === "undefined")
    {
        language = "en";
        BLK.EBIZ.language = language;
        return;
    }
    language = trim(language.toLowerCase());
    if(typeof BLK.envSetting.commonText.language[language] === "undefined")
    {
        //window.alert("lang not implemented:" + language);
        language = "en";
        BLK.EBIZ.language = language;
        return;
    }
    // language is implemented
    BLK.EBIZ.language = language;
    //window.alert("language: " + BLK.EBIZ.convStart.language);
};
//BLK.EBIZ.setLanguage();
BLK.EBIZ.getLanguage = function()
{
    return BLK.EBIZ.language;
};

// ************************************************************************************************
// end language.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2010/10/07 15:30:00 $
*       Filename:  $RCSfile: common.js,v $
*       Revision:  $Revision: 2.0 $
*/

// ************************************************************************************************
// begin common.js
// ************************************************************************************************

// ************************************************************************************************
// begin common functions
// ************************************************************************************************

/*global BLK, document, window, alert, location, navigator, ActiveXObject,  XMLHttpRequest, 
createXmlHttpReqObj, iframeDocument, escape, unescape*/

// ************************************************************************************************
// events/listeners
// ************************************************************************************************
var g_listeners = [];

function setupEventListenersCleaner()
{
	if(typeof window.attachEvent !== "undefined")
	{
		window.attachEvent("onunload", function()
		{
			var len = g_listeners.length;
			//alert("listeners len before: " + g_listeners.length);
			for(var i = len - 1; i >= 0; --i)
			{
				g_listeners[i][0].detachEvent(g_listeners[i][1], g_listeners[i][2]);
			}
			g_listeners = [];
		});
	}
} // end function cleanupEventListeners()

setupEventListenersCleaner();

function addLoadListener(fn)
{
	if(typeof window.addEventListener !== "undefined")
	{
		window.addEventListener("load", fn, false);
	}
	else if(typeof document.addEventListener !== "undefined")
	{
        document.addEventListener("load", fn, false);
	}
	else if(typeof window.attachEvent !== "undefined")
	{
		window.attachEvent("onload", fn);
        g_listeners[g_listeners.length] = [window, "onload", fn];
	}
	else
	{
		var oldFn = window.onload;
		if(typeof window.onload !== "function")
		{
			window.onload = fn;
		}
		else
		{
			window.onload = function()
			{
				oldFn();
				fn();
			};
		}
	}
} // end function addLoadListener(fn)

function attachEventListener(target, eventType, functionRef, capture)
{
    if(typeof target.addEventListener !== "undefined")
    {
        target.addEventListener(eventType, functionRef, capture);
    }
    else if(typeof target.attachEvent !== "undefined")
    {
        target.attachEvent("on" + eventType, functionRef);
        g_listeners[g_listeners.length] = [target, "on" + eventType, functionRef];
    }
    else
    {
        eventType = "on" + eventType;
        if(typeof target[eventType] === "function")
        {
            var oldListener = target[eventType];
            target[eventType] = function()
            {
                oldListener();
                return functionRef();
            };
        }
        else
        {
            target[eventType] = functionRef;
        }
    }
} // end function attachEventListener(target, eventType, functionRef, capture)

/*
function detachEventListener(target, eventType, functionRef, capture)
{
    if(typeof target.removeEventListener !== "undefined")
    {
        target.removeEventListener(eventType, functionRef, capture);
    }
    else if(typeof target.detachEvent !== "undefined")
    {
        target.detachEvent("on" + eventType, functionRef);
        // ****************************************************************************************
        // ****************************************************************************************
        var found = false;
        var foundAt = -1;
        for(var i = 0; i < g_listeners.length; i++)
        {
            if(target === g_listeners[i][0])
            {
                found = true;
                foundAt = i;
                break;
            } // end if (target === g_listeners[i][0])
        } // end for(var i = 0; i < g_listeners.length; i++)
        if(found)
        {
            var temp = [];
            var j = 0;
            for(j = 0; j < foundAt; j++)
            {
                temp[temp.length] = g_listeners[j];
            }
            for(j = foundAt + 1; j < g_listeners.length; j++)
            {
                temp[temp.length] = g_listeners[j];
            }
            g_listeners = temp;
            temp = null;
        } // end if(found)
        // ****************************************************************************************
        // ****************************************************************************************
    }
    else
    {
	    target["on" + eventType] = null;
    }
} // end function detachEventListener(target, eventType, functionRef, capture)
*/


function detachEventListener(target, eventType, functionRef, capture)
{
    if(typeof target.removeEventListener !== "undefined")
    {
        target.removeEventListener(eventType, functionRef, capture);
    }
    else if(typeof target.detachEvent !== "undefined")
    {
        target.detachEvent("on" + eventType, functionRef);
    }
    else
    {
	    target["on" + eventType] = null;
    }
} // end function detachEventListener(target, eventType, functionRef, capture)


function stopDefaultAction(event)
{
	event.returnValue = false;
	if(typeof event.preventDefault !== "undefined")
	{
		event.preventDefault();
	}
} // end function stopDefaultAction(event)

function stopEvent(event)
{
	if(typeof event.stopPropagation !== "undefined")
	{
		event.stopPropagation();
	}
	else
	{
		event.cancelBubble = true;
	}
} // end function stopEvent(event)

function getEventTarget(event)
{
	var targetElement = null;
	if(typeof event === "undefined")
	{
		event = window.event;
	}
	if(typeof event.target !== "undefined")
	{
		targetElement = event.target;
	}
	else
	{
		targetElement = event.srcElement;
	}
	while(targetElement.nodeType === 3 && targetElement.parentNode !== null)
	{
		targetElement = targetElement.parentNode;
	}
	return targetElement;
} // end function getEventTarget(event)

function triggerEvent(target, eventName, canBubble, cancelEvent)
{
	var cancelled = true;
	var clickEvent = null;
	if(document.createEvent)
	{
		// ff
		//var ex = null;
		try
		{
			clickEvent = document.createEvent("MouseEvents");
			clickEvent.initEvent(eventName, canBubble, cancelEvent);
			cancelled = true;
			if(typeof target.dispatchEvent === "function")
			{
				cancelled = !target.dispatchEvent(clickEvent);
			}
		}
		catch(ex)
		{
			cancelled = true;
			window.alert(ex.name + "|" + ex.message);
		}
	}
	else
	{
		// ie
		eventName = "on" + eventName;
		cancelled = true;
		if(document.createEventObject)
		{
		    var event = document.createEventObject();
			cancelled = !target.fireEvent(eventName, event);
		}
	} // end if(document.createEvent)
	return cancelled;
} // end function triggerEvent(target, eventName, canBubble, cancelEvent)
// ************************************************************************************************

// ************************************************************************************************
// styles/classes
// ************************************************************************************************
function retrieveComputedStyle(element, styleProperty)
{
	var computedStyle = null;
	if(typeof element.currentStyle !== "undefined")
	{
		computedStyle = element.currentStyle;
	}
	else
	{
		computedStyle = document.defaultView.getComputedStyle(element, null);
	}
	return computedStyle[styleProperty];
} // end function retrieveComputedStyle(element, styleProperty)

function getElementsByClassName(node, className)
{
	var a = [];
	var re = new RegExp("(^| )" + className + "( |$)");
	var els = node.getElementsByTagName("*");
	var el = null;
	for(var i = 0; els[i]; i++)
	{
		el = els[i];
		if(re.test(el.className))
		{
			a.push(el);
		}
	}
	return a;
} // end function getElementsByClassName(node, classname)

function getElementsByMultiTagName(ref, tagNameArray)
{
    var tagArray = [];
    var tagList = null;
    for(var i = 0; i < tagNameArray.length; i++)
    {
        tagList = ref.getElementsByTagName(tagNameArray[i]);
        for(var j = 0; j < tagList.length; j++)
        {
            tagArray[tagArray.length] = tagList[j];
        }
    }
    return tagArray;
} // end function getElementsByMultiTagName(ref, tagNameArray)

function getElementsByAttribute(attribute, attributeValue)
{
	var elementArray = [];
	var matchedArray = [];
	if(typeof document.all !== "undefined")
	{
		elementArray = document.all;
	}
	else
	{
		elementArray = document.getElementsByTagName("*");
	}
	for(var i = 0; i < elementArray.length; i++)
	{
		if(attribute === "class")
		{
			var pattern = new RegExp("(^| )" + attributeValue + "( |$)");
			if(pattern.test(elementArray[i].className))
			{
				matchedArray[matchedArray.length] = elementArray[i];
			}
			pattern = null;
		}
		else if(attribute === "for")
		{
			if(elementArray[i].getAttribute("htmlFor" || elementArray[i].getAttribute("for")))
			{
				if(elementArray[i].htmlFor === attributeValue)
				{
					matchedArray[matchedArray.length] = elementArray[i];
				}
			}
		}
		else if(elementArray[i].getAttribute(attribute) === attributeValue)
		{
			matchedArray[matchedArray.length] = elementArray[i];
		}
	}
	
	elementArray = null;
	
	return matchedArray;
} // end function getElementsByAttribute(attribute, attributeValue)

function addClass(target, classValue)
{
	var pattern = new RegExp("(^| )" + classValue + "( |$)");
	if(pattern.test(target.className))
	{
		return false;
	}
	target.className += " " + classValue;
	return true;
} // end function addClass(target, classValue)

function removeClass(target, classValue)
{
	var removedClass = target.className;
	var pattern = new RegExp("(^| )" + classValue + "( |$)");
	removedClass = removedClass.replace(pattern, "$1");
	removedClass = removedClass.replace(/ $/, "");
	target.className = removedClass;
	return true;
} // end function removeClass(target, classValue)

function findClassMulti(target, classValueArray)
{
	var className = target.className;
	for(var i = 0, len = classValueArray.length; i < len; i++)
	{
		var pattern = new RegExp("(^| )" + classValueArray[i] + "( |$)");
		if(pattern.test(className))
		{
			return true;
		}
	}
	return false;
} // end function findClassMulti(target, classValue)

function findClass(target, classValue)
{
	var className = target.className;
	var pattern = new RegExp("(^| )" + classValue + "( |$)");
	if(pattern.test(className))
	{
		return true;
	}
	return false;
} // end function findClass(target, classValue)

function changeClass(target, fromClassValue, toClassValue)
{
	if(typeof fromClassValue === "string")
	{
		removeClass(target, fromClassValue);
		addClass(target, toClassValue);
		return;
	}
	for(var i = fromClassValue.length - 1; i >= 0; --i)
	{
		removeClass(target, fromClassValue[i]);
	}
	addClass(target, toClassValue);
} // end function changeClass(target, fromClassValue, toClassValue)
// ************************************************************************************************

// ************************************************************************************************
// position/size
// ************************************************************************************************
function getScrollingPosition()
{
	var scrollingPosition = [0, 0];
	
	if(typeof window.pageYOffset !== "undefined")
	{
		// ff
		//alert("ff");
		scrollingPosition = [window.pageXOffset, window.pageYOffset];
	}
	else if(typeof document.documentElement.scrollTop !== "undefined")
	{
		// ie
		//alert("ie documentelement");
		scrollingPosition = [document.documentElement.scrollLeft, document.documentElement.scrollTop];
	}
	else if(typeof document.body.scrollTop !== "undefined")
	{
		// ie
		//alert("ie body");
		scrollingPosition = [document.body.scrollLeft, document.body.scrollTop];
	}
	//alert("(" + scrollingPosition[0] + "," + scrollingPosition[0] + ")");
	return scrollingPosition;
} // end function getScrollingPosition()

function getCursorPosition(event)
{
	if(typeof event === "undefined")
	{
		event = window.event;
	}
	
	var scrollingPosition = getScrollingPosition();
	var cursorPosition = [0, 0];
	if(typeof event.pageX !== "undefined" &&
		typeof event.x !== "undefined")
	{
		cursorPosition[0] = event.pageX;
		cursorPosition[1] = event.pageY;
	}
	else
	{
		cursorPosition[0] = event.clientX + scrollingPosition[0];
		cursorPosition[1] = event.clientY + scrollingPosition[1];
	}
	return cursorPosition;
} // end function getCursorPosition(event)

function getViewportSize()
{
	var size = [0, 0];
	if(typeof window.innerWidth !== "undefined")
	{
		size = [window.innerWidth, window.innerHeight];
	}
	else if(typeof document.documentElement !== "undefined" && 
		typeof document.documentElement.clientWidth !== "undefined" && 
		document.documentElement.clientWidth !== 0)
	{
		size = [document.documentElement.clientWidth, document.documentElement.clientHeight];		
	}
	else
	{
		size = [document.getElementsByTagName("body")[0].clientWidth, 
			document.getElementsByTagName("body")[0].clientHeight];
	}
	return size;
} // end function getViewportSize()

function getPosition(theElement)
{
	var positionX = 0;
	var positionY = 0;
	while(theElement !== null)
	{
		positionX += theElement.offsetLeft;
		positionY += theElement.offsetTop;
		theElement = theElement.offsetParent;
	}
	return [positionX, positionY];
} // end function getPosition(theElement)

function getPageDimensions()
{
	var body = document.getElementsByTagName("body")[0];
	var bodyOffsetWidth = 0;
	var bodyOffsetHeight = 0;
	var bodyScrollWidth = 0;
	var bodyScrollHeight = 0;
	var pageDimensions = [0, 0];

	if(typeof document.documentElement !== "undefined" &&
		typeof document.documentElement.scrollWidth !== "undefined")
	{
		pageDimensions[0] = document.documentElement.scrollWidth;
		pageDimensions[1] = document.documentElement.scrollHeight;
	}
	bodyOffsetWidth = body.offsetWidth;
	bodyOffsetHeight = body.offsetHeight;
	bodyScrollWidth = body.scrollWidth;
	bodyScrollHeight = body.scrollHeight;
	if(bodyOffsetWidth > pageDimensions[0])
	{
		pageDimensions[0] = bodyOffsetWidth;
	}
	if(bodyOffsetHeight > pageDimensions[1])
	{
		pageDimensions[1] = bodyOffsetHeight;
	}
	if(bodyScrollWidth > pageDimensions[0])
	{
		pageDimensions[0] = bodyScrollWidth;
	}
	if(bodyScrollHeight > pageDimensions[1])
	{
		pageDimensions[1] = bodyScrollHeight;
	}
	return pageDimensions;
} // end function getPageDimensions()
// ************************************************************************************************

// ************************************************************************************************
// miscellaneous
// ************************************************************************************************
/*
function buildDynamicScriptTag(url, data, defer)
{
	var headObj = document.getElementsByTagName("head")[0];
	var scriptObj = document.createElement("script");
	var id = new Date().getTime();
	var requestId = "?requestId=" + id;
	//scriptObj.src = url + requestId + data;
	scriptObj.setAttribute("id", id);
	scriptObj.setAttribute("type", "text/javascript");
	
	if(defer)
	{
		scriptObj.setAttribute("defer", "defer");
	}
	//window.alert(scriptObj.src);
	
	//window.alert("before. . .");
	scriptObj.setAttribute("src", url + requestId + data);
	headObj.appendChild(scriptObj);
	//window.alert("after. . .");
	
	return id;
} // end function buildDynamicScriptTag(url, data, defer)
*/

/*
function buildDynamicScriptTag(url, data, defer)
{
	var headObj = document.getElementsByTagName("head")[0];
	var scriptObj = document.createElement("script");
	var id = new Date().getTime();
	var requestId = "?requestId=" + id;
	scriptObj.setAttribute("id", id);
	scriptObj.setAttribute("type", "text/javascript");
	

    function callback()
    {
        window.alert("finished. . .");
    }
    if(scriptObj.readyState)
    {  
        //IE
        script.onreadystatechange = function()
        {
            if (scriptObj.readyState == "loaded" ||
                    scriptObj.readyState == "complete")
            {
                scriptObj.onreadystatechange = null;
                callback();
            }
        };
    } 
    else 
    {  
        //Others
        scriptObj.onload = function ()
        {
            callback();
        };
    }

	scriptObj.setAttribute("src", url + requestId + data);
	headObj.appendChild(scriptObj);
	
	return id;
} // end function buildDynamicScriptTag(url, data, defer)
*/

// ************************************************************************************************
// begin get configuration/environment
// ************************************************************************************************
// old version with hard coding
/*
function loadConfigFiles(fileNameArray)
{
    var id = 0;
    var idArray = [];
    var hostName = location.hostname;
    var src = "";
    var found = false;
    var prefix = "https://www2.blackrock.com/content/groups/globaltemplates/js/";
    var scriptList = document.getElementsByTagName("script");
    for(var k = 0; k < scriptList.length; k++)
    {
        src = scriptList[k].getAttribute("src");
        if(src === null || src === "")
        {
            continue;
        }
        src = src.toLowerCase();
        if(src.indexOf("common.js") !== -1)
        {
            found = true;
            if(src.indexOf("www2.blackrock.com/content/groups/globaltemplates/js/") !== -1)
            {
                // prod
                prefix = "https://www2.blackrock.com/content/groups/globaltemplates/js/";
            }
            else if(src.indexOf("consumptiontst.blackrock.com/content/groups/globaltemplates/js/") !== -1)
            {
                // test
                prefix = "https://consumptiontst.blackrock.com/content/groups/globaltemplates/js/";
            }
            else if(src.indexOf("pcctvapp12.bfm.com") !== -1)
            {
                // dev
                //prefix = "http://pcctvapp12.bfm.com:911/blackrock/GENERIC/js/";
                prefix = "http://pcctvapp12.bfm.com:911/blackrock/roark/forprod/GENERIC/js/";
            }
            else
            {
                // prod
                prefix = "https://www2.blackrock.com/content/groups/globaltemplates/js/";
            }
            break;
        } // end if(src.indexOf("common.js") !== -1)
    } // end for(var k = 0; k < scriptList.length; k++)

    for(var i = 0; i < fileNameArray.length; i++)
    {
        id = buildDynamicScriptTag(prefix + fileNameArray[i], "", false);
        idArray[i] = id;
    } // end for(var i = 0; i < fileNameArray.length; i++)
    return idArray;
} // end function loadConfigFiles(fileNameArray)
*/

// new version without hard coding by Warren Jackter
/*
function loadConfigFiles(fileNameArray)
{
    var id = 0;
    var idArray = [];
    var hostName = location.hostname;
    var src = "";

	var scripts = document.getElementsByTagName("script");
	var index = -1;
	var prefix = "";
	var src_split = [];
	for (var x = 0; x < scripts.length; x++) 
	{
		src = scripts[x].getAttribute("src");
		if (src === null || src === "") 
		{
			continue;
		}
		src = src.toLowerCase();
		src_split = src.split("/");
		if (src_split[src_split.length - 1] === "common.js") 
		{
			index = src.indexOf("common.js");
			prefix = src.substring(0, index);
			break;
		}
	}

    for(var i = 0; i < fileNameArray.length; i++)
    {
        id = buildDynamicScriptTag(prefix + fileNameArray[i], "", false);
        idArray[i] = id;
    } // end for(var i = 0; i < fileNameArray.length; i++)
    return idArray;
} // end function loadConfigFiles(fileNameArray)

//loadConfigFiles(["envSetting.js", "envConfig.js"]);
loadConfigFiles(["envConfig.js"]);
*/
// ************************************************************************************************
// end get configuration/environment
// ************************************************************************************************

function collToArray(coll)
{
    // iterating through a HTML collection can be slower than
    // iterating through an array
    // copy HTML collection into array
    for(var i = 0, a = [], len = coll.length; i < len; i++)
    {
        a[i] = coll[i];
    }
    return a;
} // end function collToArray(coll)

function yieldToUI(fxn, delay)
{
    setTimeout(function() { setTimeout(function() { fxn(); }, delay); }, delay);
} // end function yieldToUI(fxn, delay)

function compareDates(dOne, dTwo)
{
	if(dOne < dTwo)
	{
		return -1;
	}
	else if(dOne === dTwo)
	{
		return 0;
	}
	else
	{
		return 1;
	}
} // end function compareDates(dOne, dTwo)

function compareNumbers(nOne, nTwo)
{
	return nOne - nTwo;
} // end function compareNumbers(nOne, nTwo)

function getInnerText(target)
{
	var innerText = "";
	var outerText = "";
	var value = "";
	var foundInnerText = false;
	var foundOuterText = false;
	var length = 0;
	var node = null;
	if(target.childNodes.length > 0)
	{
		length = target.childNodes.length;
		for(var i = 0; i < length; ++i)
		{
			node = target.childNodes[i];
			if(node.nodeType === 3)
			{
				if(node.nodeValue !== "")
				{
					foundOuterText = true;
					outerText += node.nodeValue;
				}
			} // end if(target.childNodes[i].nodeType === 3)
			else if(node.nodeType === 1)
			{
				if(node.childNodes.length > 0)
				{
					if(node.firstChild.nodeType === 3)
					{
						foundInnerText = true;
						innerText += node.firstChild.nodeValue;
					}
				}
			} // end if(target[i].nodeType === 1)
		} // end for(var i = 0; i < target.childNodes.length; i++)
	} // end if(target.hasChildNodes())
	if(foundInnerText)
	{
		value = innerText;
	}
	else if(foundOuterText)
	{
		value = outerText;
	}
	else
	{
		value = "";
	} // end if(foundInnerText)
	return value;
} // end function getInnerText(target)

function getInternalText(target)
{
	var elementChildren = target.childNodes;
	var internalText = "";
	var elementChildrenLength = elementChildren.length;
	for(var i = 0; i < elementChildrenLength; i++)
	{
	    var elementChildrenItem = elementChildren[i];
		if(elementChildrenItem.nodeType === 3)
		{
			var pattern = /^\s*$/;
			//if(!/^\s*$/.test(elementChildrenItem.nodeValue))
			if(!pattern.test(elementChildrenItem.nodeValue))
			{
				internalText += elementChildrenItem.nodeValue;
			}
		}
		else
		{
			internalText += getInternalText(elementChildrenItem);
		}
	}
	return internalText;
} // end function getInternalText(target)

function getInternalTextOld(target)
{
	var elementChildren = target.childNodes;
	var internalText = "";
	for(var i = 0; i < elementChildren.length; i++)
	{
		if(elementChildren[i].nodeType === 3)
		{
			var pattern = /^\s*$/;
			//if(!/^\s*$/.test(elementChildren[i].nodeValue))
			if(!pattern.test(elementChildren[i].nodeValue))
			{
				internalText += elementChildren[i].nodeValue;
			}
		}
		else
		{
			internalText += getInternalText(elementChildren[i]);
		}
	}
	return internalText;
} // end function getInternalText(target)

function getNextSibling(beginNode)
{
    var endNode = beginNode.nextSibling;
    while(endNode && endNode.nodeType !== 1)
    {
        endNode = endNode.nextSibling;
    }
    return endNode;
} // end function getNextSibling(beginNode)

function getPreviousSibling(beginNode)
{
    var endNode = beginNode.previousSibling;
    while(endNode && endNode.nodeType !== 1)
    {
        endNode = endNode.previousSibling;
    }
    return endNode;
} // end function getPreviousSibling(beginNode)

function getParentNodeWithTagName(nodeIn, tagNameIn)
{
	var node = nodeIn;
	while(node !== null)
	{
		if(node.nodeName.toLowerCase() === tagNameIn.toLowerCase())
		{
			break;
		}
		node = node.parentNode;
	}
	return node;
} // end function getParentNodeWithTagName(nodeIn, tagNameIn)

function identifyBrowser()
{
	var agent = navigator.userAgent.toLowerCase();
	
	if(typeof navigator.vendor !== "undefined" && 
	   navigator.vendor === "KDE" &&
	   typeof window.sidebar !== "undefined")
	{
		return "kde";
	}
	else if(typeof window.opera !== "undefined")
	{
		var version = parseFloat(agent.replace(/.*opera[\/ ]([^ $]+).*/, "$1"));
		if(version >= 7)
		{
			return "opera7";
		}
		else if(version >= 5)
		{
			return "opera5";
		}
		return "";
	}
	else if(typeof document.all !== "undefined")
	{
		if(typeof document.getElementById !== "undefined")
		{
			var browser = agent.replace(/.*ms(ie[\/ ][^ $]+).*/, "$1").replace(/ /, "");
			if(typeof document.uniqueID !== "undefined")
			{
				if(browser.indexOf("5.5") !== -1)
				{
					return browser.replace(/(.*5\.5).*/, "$1");
				}
				else
				{
					return browser.replace(/(.*)\..*/, "$1");
				}
			}
			else
			{
				return "ie5mac";
			}
		}
		return "";
	}
	else if(typeof document.getElementById !== "undefined")
	{
		if(navigator.vendor.indexOf("Apple Computer, Inc.") !== -1)
		{
			if(typeof window.XMLHttpRequest !== "undefined")
			{
				return "safari1.2";
			}
			return "safari1";
		}
		else if(agent.indexOf("gecko") !== -1)
		{
			return "mozilla";
		}
	}
	return "";
} // end function identifyBrowser()

function identifyOS()
{
	var agent = navigator.userAgent.toLowerCase();
	if(agent.indexOf("win") !== -1)
	{
		return "win";
	}
	else if(agent.indexOf("mac") !== -1)
	{
		return "mac";
	}
	else
	{
		return "unix";
	}
	return "";
} // end function identifyOS()

function randomBetween(min, max)
{
	return min + Math.floor(Math.random() * (max - min + 1));
} // end function randomBetween(min, max)

function readyForRegExp(textIn)
{
	var textOut = "";
	var charIn = "";
	var regExpChar = "\\^$*+?.[]-{}()|";
	
	for(var i = 0; i < textIn.length; ++i)
	{
		charIn = textIn.charAt(i);
		if(regExpChar.indexOf(charIn) !== -1)
		{
			textOut += "\\" + charIn;
		}
		else
		{
			textOut += charIn;
		}
	}
	return textOut;
} // end function readyForRegExp(textIn)

function trim(stringIn)
{
	if(stringIn === "" || stringIn === null)
	{
		return "";
	}
	else
	{
		return stringIn.replace(/^\s*/, "").replace(/\s*$/, "");
	}
} // end function trim(stringIn)

function getValueFromURL(urlNameIn)
{
	var urlValue = "";
	var urlName = readyForRegExp(urlNameIn);
	var search = trim(location.search);
	if(search === "")
	{
		return "";
	}
	
	// [\?&]open=(\w+)&?
	var pattern = new RegExp("[\\?&]" + urlName + "=(\\w+)&?");
	
	urlValue = "";
	if(pattern.test(search))
	{
		urlValue = RegExp.$1;
	}
	return urlValue;
} // end function getValueFromURL(urlNameIn)
// ************************************************************************************************

// ************************************************************************************************
// cookies
// ************************************************************************************************
/*
1>  Once the specified date is reached, the cookie expires and is deleted. 
2>  If expires is not specified, the cookie will be deleted when the browser is closed. 
3>  If expires is set to a date in the past, the cookie is deleted immediately. 
    This is how to delete a cookie (some browsers may take a few seconds to actually delete the cookie). 
4>  In theory, computers should be able to accept any future date but in reality, 
    UNIX computers will not currently accept a date after 03:14 on 18 Jan 2038 and many Macintosh 
    computers will not currently accept a date after 06:28 6 Feb 2040 or the same date as that for UNIX. 
    These are the UNIX and Macintosh equivalent of the millennium bug.
*/
function setCookie(cookieName, value, expireDays, secure)
{
	var expDate = new Date();
	expDate.setDate(expDate.getDate() + expireDays);
	if(secure === undefined)
	{
	    document.cookie = trim(cookieName) + "=" +
		escape(value) + ((expireDays === null) ? "" : ";expires=" + expDate.toGMTString());
    }
    else if(secure === true)
    {	
	    document.cookie = trim(cookieName) + "=" +
		escape(value) + ((expireDays === null) ? "" : ";expires=" + expDate.toGMTString() + ";secure");
	}
	else
	{
	    document.cookie = trim(cookieName) + "=" +
		escape(value) + ((expireDays === null) ? "" : ";expires=" + expDate.toGMTString());
	}
		
	expDate = null;
} // end function setCookie(cookieName, value, expireDays, secure)

function getCookie(searchName)
{
	var cookies = document.cookie.split(";");
	var found = false;
	var cookieCrumbs = [];
	var cookieName = "";
	var cookieValue = "";

	for(var i = 0; i < cookies.length && !found; i++)
	{
		cookieCrumbs = cookies[i].split("=");
		cookieName = cookieCrumbs[0];
		cookieName = trim(cookieName);
		
		cookieValue = cookieCrumbs[1];
		
		if(cookieName === searchName)
		{
			found = true;
		}
	}
	if(!found)
	{
	    cookieValue = "";
	}
	
	return cookieValue;
} // end function getCookie(searchName)

function getSubCookie(cookieName, subCookieName)
{
    var cookies = document.cookie.split(";");
    for(var i = 0; i < cookies.length; i++)
    {
        var cookieCrumbs = cookies[i].split("=");
        cookieCrumbs[0] = cookieCrumbs[0].replace(/^\s+/, "");
        if(cookieCrumbs[0] === cookieName)
        {
            var cookieValue = cookieCrumbs[1];
            cookieValue = unescape(cookieValue);
            var subCookies = cookieValue.split("/");
            for(var j = 0; j < subCookies.length; j++)
            {
                var subCookieCrumbs = subCookies[j].split(":");
                if(subCookieCrumbs[0] === subCookieName)
                {
                    return subCookieCrumbs[1];
                }
            }
        }
    }
    return "";
} // end function getSubCookie(cookieName, subCookieName)
// ************************************************************************************************

// ************************************************************************************************
// validation
// ************************************************************************************************
function validContentId(strText)
{
	var blnValid;
	var re;

	if(strText === "" || strText === null)
	{
		return true;
	}
	//re = /^\d{5}$/i;  
	re = /^(\d{5}|\d{10})$/i;  

	blnValid = re.test(strText);

	//alert(strText + " is " + (blnValid ? "valid" : "invalid"));
	return blnValid;
} // end function validContentId(strText)

function validInteger(strText)
{
	var blnValid;
	var re;

	if(strText === "" || strText === null)
	{
		return true;
	}
	re = /^\d+$/i;  
	blnValid = re.test(strText);
	//alert(strText + " is " + (blnValid ? "valid" : "invalid"));
	return blnValid;
} // end function validInteger(strText)

function validFloat(strText)
{
	var blnValid;
	var re;

	if(strText === "" || strText === null)
	{
		return true;
	}
	re = /^\d+\.\d+$/i;  
	blnValid = re.test(strText);
	//alert(strText + " is " + (blnValid ? "valid" : "invalid"));
	return blnValid;
} // end function validFloat(strText)

function validEmailAddress(strText)
{
	var blnValid;
	var re;

	if(strText === "" || strText === null)
	{
		return true;
	}
	// erhoward@prodigy.net
	re = /^[^@]+@([a-z0-9\-]+\.)+[a-z]{2,4}$/i;
	blnValid = re.test(strText);
	return blnValid;
} // end function validEmailAddress(strText)

function validPhoneNumber(strText)
{
	var blnValid;
	var re;

	if(strText === "" || strText === null)
	{
		return true;
	}
	// 609-882-2489 or (609) 882-2489
	re = /^((\d{3}-\d{3}-\d{4})|(\(\d{3}\)\s\d{3}-\d{4}))$/i;

	blnValid = re.test(strText);
	return blnValid;
} // end function validPhoneNumber(strText)

function validSocialSecurityNumber(strText)
{
	var blnValid;
	var re;

	if(strText === "" || strText === null)
	{
		return true;
	}
	re = /^\d{3}-\d{2}-\d{4}$/i;  
	blnValid = re.test(strText);
	//alert(strText + " is " + (blnValid ? "valid" : "invalid"));
	return blnValid;
} // end function validSocialSecurityNumber(strText)

function validZipCode(strText)
{
	var blnValid;
	var re;

	if(strText === "" || strText === null)
	{
		return true;
	}
	re = /^\d{5}-\d{4}$/i;  
	blnValid = re.test(strText);
	//alert(strText + " is " + (blnValid ? "valid" : "invalid"));
	return blnValid;
} // end function validZipCode(strText)

function validDate(strText)
{
	var blnValid;
	var nDate;

	if(strText === "" || strText === null)
	{
		return true;
	}
	nDate = Date.parse(strText);
	blnValid = true;
	if(isNaN(nDate))
	{
		blnValid = false;    
	}

	//alert(strText + " is " + (blnValid ? "valid" : "invalid"));
	return blnValid;
} // end function validDate(strText)
// ************************************************************************************************

// ************************************************************************************************
// memory reclamation
// ************************************************************************************************
function purge(d)
{
	var a = d.attributes, i, l, n;
	if(a)
	{
		l = a.length;
		for(i = 0; i < l; i += 1)
		{
			n = a[i].name;
			if(typeof d[n] === "function")
			{ 
				d[n] = null;
			}
		}
	}
	a = d.childNodes;
	if(a)
	{
		l = a.length;
		for(i = 0; i < l; i += 1)
		{
			purge(d.childNodes[i]);
		}
	}
} // end function purge(d)
// ************************************************************************************************

// ************************************************************************************************
// xml
// ************************************************************************************************
var g_xmlDoc = null;
function loadXmlFile(fileName, fxn, async)
{
    var fileLoaded = false;
    try
    {
		if(window.ActiveXObject)
		{
		    // code for IE
		    g_xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		    g_xmlDoc.async = false;
		    g_xmlDoc.load(fileName);
		    fxn();
		    fileLoaded = true;
		}
		else if(document.implementation &&
		    document.implementation.createDocument)
		{
		    // code for Mozilla, Firefox, Opera, etc.
		    g_xmlDoc = document.implementation.createDocument("", "", null);
		    
		    //g_xmlDoc.async = false;
		    if(typeof async === "undefined")
		    {
			    g_xmlDoc.async = false;
		    }
		    else if(typeof async === "boolean")
		    {
				if(async)
				{
				    g_xmlDoc.async = true;
				}
				else
				{
				    g_xmlDoc.async = false;
				}
		    } // end if(typeof async === "undefined")
		    
		    //g_xmlDoc.onload = fxn;
		    //g_xmlDoc.load(fileName);
		    
			if(g_xmlDoc.async)
			{
			    g_xmlDoc.onload = fxn;
			    g_xmlDoc.load(fileName);
			}
			else
			{
			    g_xmlDoc.load(fileName);
			    fxn();
			}
		    fileLoaded = true;
		}
		else
		{
		    window.status = "File load not supported.";
		    //window.alert("File load not supported.");
		    g_xmlDoc = null;
		    fileLoaded = false;
		}
    }
    catch(e)
    {
		if(typeof e.message === "undefined")
		{
			window.status = "Could not create XML document.";
		}
		else
		{
			window.status = e.message;	
		}
		fileLoaded = false;
    }
    return fileLoaded;
} // end function loadXmlFile(fileName, fxn)
// ************************************************************************************************

// ************************************************************************************************
// iframes
// ************************************************************************************************
function locationReplaceIE5(url)
{
	this.iframeRef.setAttribute("src", url);
	return true;
} // end function locationReplaceIE5(url)

function createIframeRPC(iframeRpcId)
{
	var body = document.getElementsByTagName("body")[0];
	var iframe = document.createElement("iframe");
	iframe.setAttribute("id", iframeRpcId);
	body.appendChild(iframe);
	if(typeof iframe.document !== "undefined" && 
	   typeof iframe.contentDocument === "undefined" && 
	   typeof iframe.contentWindow === "undefined")
	{
		body.removeChild(iframe);
		var iframeHTML = '<iframe id="iframeRPC"></iframe>';
		body.innerHTML += iframeHTML;
		
		iframe = document.getElementById(iframeRpcId);
		iframe.contentWindow = {};
		iframe.contentWindow.document = {};
		iframe.contentWindow.document.location = {};
		iframe.contentWindow.document.location.iframeRef = iframe;
		iframe.contentWindow.document.location.replace = locationReplaceIE5;
	}
	iframe.style.position = "absolute";
	iframe.style.left = "-1500em";
	iframe.style.top = "0";
	iframe.style.width = "0";
	iframe.style.height = "0";
	iframe.setAttribute("tabIndex", "-1");

	body = null;
	iframe = null;

	return true;
} // end functtion createIframeRPC()

function executeIframeRPC(iframeRpcId, url)
{
	var iframe = document.getElementById(iframeRpcId);
	var iframeDocument = null;
	if(typeof iframe.contentDocument !== "undefined")
	{
		iframeDocument = iframe.contentDocument;
	}
	else if(typeof iframe.contentWindow !== "undefined")
	{
		iframeDocument = iframe.contentWindow.document;
	}
	else
	{
		iframe = null;
		return false;
	}
	iframeDocument.location.replace(url);
	iframe = null;
	
	return true;
} // end function executeIframeRPC(url)

function createIframeLayer(menu, zIndex)
{
    var layer = document.createElement("iframe");
    layer.tabIndex = "-1";
    layer.src = "javascript:false;";
    layer.className = "iframeOverSelectElements";
    menu.parentNode.appendChild(layer);
    
    layer.style.position = "absolute";
    if(typeof zIndex !== "undefined")
    {
        layer.style.zIndex = zIndex;
    }
    layer.style.border = "none";
    
    layer.style.left = menu.offsetLeft + "px";
    layer.style.top = menu.offsetTop + "px";
    layer.style.width = menu.offsetWidth + "px";
    layer.style.height = menu.offsetHeight + "px";
} // end function createIframeLayer(menu)

function removeIframeLayer(menu)
{
    var layers = menu.parentNode.getElementsByTagName("iframe");
    while(layers.length > 0)
    {
        layers[0].parentNode.removeChild(layers[0]);
    }
} // end function removeIframeLayer(menu)
// ************************************************************************************************

// ************************************************************************************************
// xml http request
// ************************************************************************************************
var g_xmlHttpReqObj = null;
var g_ajaxCallbackFn = null;

function ajaxResponse() 
{ 
    if (g_xmlHttpReqObj.readyState === 4)
    { 
	    if(g_xmlHttpReqObj.status === 200 || g_xmlHttpReqObj.status === 304)
		{
			if(typeof g_ajaxCallbackFn !== "undefined")
			{
				g_ajaxCallbackFn();
			}
			else
			{
				alert("Callback function not specified.");
			}
	    }
	    else if(g_xmlHttpReqObj.status === 401)
	    {
			alert("Access unauthorized.");
	    }
	    else if(g_xmlHttpReqObj.status === 403)
	    {
			alert("Access forbidden.");
	    }
	    else if(g_xmlHttpReqObj.status === 404)
	    {
			alert("Requested URL not found.");
	    }
		else
	    {
			alert("Request failed: " + g_xmlHttpReqObj.statusText);
			//alert("Request failed.");
	    }
	}	    
} // end function ajaxResponse()

function getXmlHttpReqObj()
{
    //g_xmlHttpReqObj = null;
    var g_xmlHttpReqObj = null;
    try
    {
        // ff, op
        g_xmlHttpReqObj = new XMLHttpRequest();
    }
    catch(e1)
    {
        // ie
        try
        {
            g_xmlHttpReqObj = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch(e2)
        {
            try
            {
                g_xmlHttpReqObj = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(e3)
            {
                g_xmlHttpReqObj = null;
            }
        }
    }
    return g_xmlHttpReqObj;
} // end function getXmlHttpReqObj()

function ajaxRequest(fileName, data, method)
{ 
	// filename must be name of file on server
	// data must be in form &name1=value1&name2=value2&name3=value3
	// method must be get or post
    g_xmlHttpReqObj = getXmlHttpReqObj();
    
    if(g_xmlHttpReqObj === null)
    {
        alert("Cannot complete request.");
        return false;
    } 
    g_xmlHttpReqObj.onreadystatechange = ajaxResponse;
    
    var requestId = "requestId=" + new Date().getTime();
    
    if(method.toLowerCase() === "get")
    {
		var url;
		if(data === "")
		{
			url = fileName + "?" + requestId;
		}
		else
		{
			url = fileName + "?" + requestId + data;
		}
        //alert(url);
        try
        {
            g_xmlHttpReqObj.open("GET", url, true);
            g_xmlHttpReqObj.send(null);
        }
        catch(ex1)
        {
			if(typeof ex1.message === "undefined")
			{
				window.alert(ex1);
			}
			else
			{
				window.alert(ex1.message);
			}
        }
	}
	else
	{
		// method post
		if(data === "")
		{
			data = requestId;
		}
		else
		{
			data = requestId + data;
		}
		//alert(data);
		try
		{
			g_xmlHttpReqObj.setRequestHeader("content-type", "application/x-www-form-urlencoded");
			g_xmlHttpReqObj.open("POST", fileName, true);
			g_xmlHttpReqObj.send(data);
		}
		catch(ex2)
		{
			if(typeof ex2.message === "undefined")
			{
				window.alert(ex2);
			}
			else
			{
				window.alert(ex2.message);
			}
		}
	}
    return true;
} // end function ajaxRequest(fileName, data, method)
// ************************************************************************************************

// ************************************************************************************************
// Christo - Changed function name Ajax to AjaxEbiz
//function AjaxEbiz(ajaxCallbackFn, responseXML)
if(typeof Ajax === "undefined")
{
    function Ajax(ajaxCallbackFn, responseXML)
    {
        var m_xmlHttpReqObj = null;
        var m_ajaxCallbackFn = null;
        var m_responseXML = true; // true === XML, false === text
        var that = this;

        var initialize = function(ajaxCallbackFn, responseXML)
        {
            m_ajaxCallbackFn = ajaxCallbackFn;
            m_responseXML = responseXML;
        }; // end var initialize = function(ajaxCallbackFn, responseXML)

        this.makeAjaxRequest = function(fileName, data, method)
        {
            // filename must be name of file on server
            // data must be in form &name1=value1&name2=value2&name3=value3
            // method must be get or post

            /*
            var denied = false;
            if(window.XMLHttpRequest)
            {
            try
            {
            netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
            }
            catch(ex)
            {
            denied = true;
            if(typeof ex.message === "undefined")
            {
            alert("Exception - Open/Send\n\n" + "Message: " + ex);
            }
            else
            {
            alert("Exception - Open/Send\n\n" + "Name: " + ex.name + "\nMessage: " + ex.message);
            }
            }
            }

		if(denied)
            {
            alert("Permission for universal browser read denied.");
            return false;			
            }
            */

            m_xmlHttpReqObj = createXmlHttpReqObj();
            if(m_xmlHttpReqObj === null)
            {
                //alert("Exception - Request\nCould not create XML HTTP request object.");
                return false;
            }
            m_xmlHttpReqObj.onreadystatechange = this.getAjaxResponse;

            //var requestId = "requestId=" + new Date().getTime();
            var prefix = randomBetween(10001, 99999);
            var suffix = randomBetween(10001, 99999);
            var id = prefix + "_" + suffix;
            var requestId = "?requestId=" + id;

            if(method.toLowerCase() === "get")
            {
                var url;
                if(data === "")
                {
                    url = fileName + "?" + requestId;
                }
                else
                {
                    url = fileName + "?" + requestId + data;
                }

                //alert(data + "||" + url);
                //alert(url);

                try
                {
                    m_xmlHttpReqObj.open("GET", url, true);  // ascynchronous call
                    m_xmlHttpReqObj.send(null);
                }
                catch(ex1)
                {
                    if(typeof ex1.message === "undefined")
                    {
                        alert("Exception - Open/Send\n\n" +
						"Method: GET\n" + "Message: " + ex1);
                    }
                    else
                    {
                        alert("Exception - Open/Send\n\n" +
						"Method: GET\n" + "Name: " + ex1.name + "\nMessage: " + ex1.message);
                    }
                    return false;
                }
            }
            else
            {
                // method post
                if(data === "")
                {
                    data = requestId;
                }
                else
                {
                    data = requestId + data;
                }
                //alert(data);
                try
                {
                    //alert(data.length);
                    m_xmlHttpReqObj.open("POST", fileName, true);  // ascynchronous call
                    m_xmlHttpReqObj.setRequestHeader("content-type", "application/x-www-form-urlencoded");
                    m_xmlHttpReqObj.setRequestHeader("content-length", data.length);
                    m_xmlHttpReqObj.setRequestHeader("connection", "close");
                    m_xmlHttpReqObj.send(data);
                }
                catch(ex2)
                {
                    if(typeof ex2.message === "undefined")
                    {
                        alert("Exception - Open/Send\n\n" +
						"Method: POST\n" + "Message: " + ex2);
                    }
                    else
                    {
                        alert("Exception - Open/Send\n\n" +
						"Method: POST\n" + "Name: " + ex2.name + "\nMessage: " + ex2.message);
                    }
                    return false;
                }
            } // end if(method.toLowerCase() === "get")
            return true;
        }; // end this.makeAjaxRequest = function(fileName, data, method)

        this.getAjaxResponse = function()
        {
            if(m_xmlHttpReqObj.readyState === 4)
            {
                if(m_xmlHttpReqObj.status === 200 || m_xmlHttpReqObj.status === 304)
                {
                    if(typeof m_ajaxCallbackFn === "function")
                    {
                        if(m_responseXML)
                        {
                            m_ajaxCallbackFn(m_xmlHttpReqObj.responseXML);
                        }
                        else
                        {
                            m_ajaxCallbackFn(m_xmlHttpReqObj.responseText);
                        } // end if(m_responseXML)
                    }
                    else
                    {
                        alert("Callback function not specified.");
                    } // end if(typeof m_ajaxCallbackFn === "function")
                }
                else if(m_xmlHttpReqObj.status === 301)
                {
                    alert("Moved permanently.");
                }
                else if(m_xmlHttpReqObj.status === 307)
                {
                    alert("Temporary redirect.");
                }
                else if(m_xmlHttpReqObj.status === 401)
                {
                    alert("Access unauthorized.");
                }
                else if(m_xmlHttpReqObj.status === 403)
                {
                    alert("Access forbidden.");
                }
                else if(m_xmlHttpReqObj.status === 404)
                {
                    alert("Requested URL not found.");
                }
                else
                {
                    if(m_xmlHttpReqObj.statusText === "" || m_xmlHttpReqObj.statusText === null)
                    {
                        alert("Request failed.");
                    }
                    else
                    {
                        alert("Request failed: " + m_xmlHttpReqObj.statusText);
                    }
                } // end if(m_xmlHttpReqObj.status === 200 || m_xmlHttpReqObj.status === 304)
            } // end if (m_xmlHttpReqObj.readyState === 4)
        }; // end this.getAjaxResponse = function()

        var createXmlHttpReqObj = function()
        {
            m_xmlHttpReqObj = null;
            try
            {
                // ff, op
                m_xmlHttpReqObj = new XMLHttpRequest();
            }
            catch(e1)
            {
                // ie
                try
                {
                    m_xmlHttpReqObj = new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch(e2)
                {
                    try
                    {
                        m_xmlHttpReqObj = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    catch(e3)
                    {
                        m_xmlHttpReqObj = null;
                    }
                }
            }
            return m_xmlHttpReqObj;
        }; // end var createXmlHttpReqObj = function()

        initialize(ajaxCallbackFn, responseXML);
    } // end function AjaxEbiz(ajaxCallbackFn, responseXML)
} // end if(typeof Ajax === "undefined")

// ************************************************************************************************
// end common functions
// ************************************************************************************************

// ************************************************************************************************
// end common.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2009/01/06 10:00:00 $
*       Filename:  $RCSfile: duplicate.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin duplicate.js
// ************************************************************************************************

// similarly named/used functions from various venues

function createCookie(name,value,days)
{
	var expires = "";
	if (days) 
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		expires = "; expires="+date.toGMTString();
	}
	else 
	{
		expires = "";
	}
	document.cookie = name+"="+value+expires+"; path=/";
} // end function createCookie(name,value,days)

function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) 
	{
		var c = ca[i];
		while(c.charAt(0) === ' ')
		{
			c = c.substring(1,c.length);
		}
		if (c.indexOf(nameEQ) === 0)
		{
			return c.substring(nameEQ.length,c.length);
		}
	}
	return null;
} // end function readCookie(name)

function eraseCookie(name) 
{
	createCookie(name,"",-1);
} // end function eraseCookie(name)

// ************************************************************************************************
// ************************************************************************************************

function SetCookie(cookieName, cookieValue, daysToExpire)
{
	var theCookie = cookieName + "=" + cookieValue;
	var expDate = new Date();
	expDate.setDate(expDate.getDate() + daysToExpire);
	var cookieDate = expDate.toGMTString();
	theCookie += ";expires=" + cookieDate;
	document.cookie = theCookie;
	//document.title = document.cookie;
} // end function SetCookie(cookieName, cookieValue, daysToExpire)

function GetCookie(searchName)
{
	var cookies = document.cookie.split(";");
	for(var i = 0; i < cookies.length; i++)
	{
		var cookieCrumbs = cookies[i].split("=");
		var cookieName = Trim(cookieCrumbs[0]);
		var cookieValue = cookieCrumbs[1];
		if(cookieName == searchName)
		{
			//document.title = document.cookie;
			return cookieValue;
		}
	}
	return "";
} // end function function GetCookie(searchName)

// ************************************************************************************************
// ************************************************************************************************

function Trim(stringIn)
{
	if(stringIn === "" || stringIn === null)
	{
		return "";
	}
	else
	{
		return stringIn.replace(/^\s*/, "").replace(/\s*$/, "");
	}
} // end function Trim(stringIn)

// ************************************************************************************************
// ************************************************************************************************

// funtion added by CC for JS to Edit AI pages //
// function fillAttributes START
function fillAttributes(at1, at2) 
{
	//document.all.estudioId.value=at1;
	//document.all.username.value=at2;
	
	if(document.forms["frmEditContent"])
	{
		if(document.forms["frmEditContent"]["estudioId"] && document.forms["frmEditContent"]["username"])
		{
			document.forms["frmEditContent"]["estudioId"].value = at1;
			document.forms["frmEditContent"]["username"].value = at2;
			document.forms["frmEditContent"].submit();
		}
	}
} // end function fillAttributes(at1, at2) 

// ************************************************************************************************
// end duplicate.js
// ************************************************************************************************
// checkAll.js

// ************************************************************************************************
// begin check all
// requires common.js
// ************************************************************************************************

/*global BLK, document, getElementsByClassName, getEventTarget, window */

BLK.EBIZ.CheckAll = 
{
	className : "checkAllGadget",
	setup : function ()
	{
		var checkAllList = getElementsByClassName(document.body, this.className);
		var fxn = null;
		for(var i = 0; i < checkAllList.length; i++)
		{
			if(checkAllList[i].type !== "checkbox")
			{
				continue;
			}
			if(checkAllList[i].name === null)
			{
				continue;
			}
			var groupName = checkAllList[i].name;
			//window.alert(groupName);
			checkAllList[i].onclick = function (groupNameIn)
			{
				return function (event)
				{
					if(typeof event === "undefined")
					{
					    event = window.event;
					}
					var targetElement = getEventTarget(event);
					
					//document.title = this.checked;
					//window.alert(groupNameIn);
					
					var groupNameList = null;
					var disabled = "";
					var j = 0;
					if(this.checked)
					{
						groupNameList = document.getElementsByTagName("input");
						for(j = 0; j < groupNameList.length; j++)
						{
							if(groupNameList[j] === this)
							{
								continue;
							}
							if(groupNameList[j].type.toLowerCase() !== "checkbox")
							{
								continue;
							}
							if(groupNameList[j].name !== groupNameIn)
							{
								continue;
							}
							disabled = groupNameList[j].getAttribute("disabled");
							if(disabled === true || disabled === "disabled")
							{
								continue;
							}
							groupNameList[j].checked = true;
						}
					}
					else
					{
						groupNameList = document.getElementsByTagName("input");
						for(j = 0; j < groupNameList.length; j++)
						{
							if(groupNameList[j] === this)
							{
								continue;
							}
							if(groupNameList[j].type.toLowerCase() !== "checkbox")
							{
								continue;
							}
							if(groupNameList[j].name !== groupNameIn)
							{
								continue;
							}
							disabled = groupNameList[j].getAttribute("disabled");
							if(disabled === true || disabled === "disabled")
							{
								continue;
							}
							groupNameList[j].checked = false;
						}
					} // end if(this.checked)
					
					return true;
				}; // end fxn = function (event)
			}(groupName);
			
		} // end for(var i = 0; i < checkAll.length; i++)
	} // end setup : function ()
}; // end BLK.EBIZ.CheckAll = 
// ************************************************************************************************
// end check all
// ************************************************************************************************
// fileUpload.js

// ************************************************************************************************
// begin file upload
// requires common.js
// ************************************************************************************************

/*global BLK, document, getElementsByClassName, getEventTarget, window */

BLK.EBIZ.FileUpload = function ()
{
	this.setup = function ()
	{
		var fileUploadGadgetList = getElementsByClassName(document.body, "fileUploadGadget");
		for(var i = 0; i < fileUploadGadgetList.length; i++)
		{
			var fileUploadGadgetFileList = getElementsByClassName(fileUploadGadgetList[i], "fileUploadGadgetFile");
			var fileUploadGadgetTextList = getElementsByClassName(fileUploadGadgetList[i], "fileUploadGadgetText");
			var fileUploadGadgetButtonList = getElementsByClassName(fileUploadGadgetList[i], "fileUploadGadgetButton");
			if(!(fileUploadGadgetFileList.length === 1 && 
				fileUploadGadgetTextList.length === 1 && 
				fileUploadGadgetButtonList.length === 1))
			{
				fileUploadGadgetFileList = null;
				fileUploadGadgetTextList = null;
				fileUploadGadgetButtonList = null;
				continue;
			}
			var textRef = fileUploadGadgetTextList[0];
			for(var j = 0; j < fileUploadGadgetFileList.length; j++)
			{
				//fileUploadGadgetFileList[j].onmouseout = function (textRefIn)
				fileUploadGadgetFileList[j].onchange = function (textRefIn)
				{
					return function (event)
					{
						if(typeof event === "undefined")
						{
							event = window.event;
						}
						var target = getEventTarget(event);
						
						textRefIn.value = this.value;
						//textRefIn.click();
						textRefIn.focus();
					}; // end return function (event)
				}(textRef);
			} // end for(var j = 0; j < fileUploadGadgetFileList.length; j++)
			fileUploadGadgetFileList = null;
			fileUploadGadgetTextList = null;
			fileUploadGadgetButtonList = null;
			textRef = null;
		} // end for(var i = 0; i < fileUploadGadgetList.length; i++)
		fileUploadGadgetList = null;
	}; // end this.setup = function ()
	this.setup();
}; // end BLK.EBIZ.FileUpload = function ()
// ************************************************************************************************
// end file upload
// ************************************************************************************************
// informationBubble.js

// ************************************************************************************************
// begin information bubble
// requires common.js
// ************************************************************************************************

/*global BLK, addLoadListener, attachEventListener, document, findClass, getElementsByClassName, getEventTarget, getPosition, getScrollingPosition, getViewportSize, window
*/

BLK.EBIZ.InformationBubble = function (linkRef, contactName, arrayIndex, arrayName)
{
	// verify array
	if(typeof window[arrayName] === "undefined")
	{
		window.alert("Data array does not exist. . .");
		return false;
	}

	// get subscriber
	var subscriberName = contactName ;
	if(subscriberName === "")
	{
		window.alert("Subscriber name not given. . .");
		return false;
	}
	
	// get array index
	if(typeof window[arrayName][arrayIndex] === "undefined")
	{
		window.alert("Array index out of bounds. . .");
		return false;
	}
		
	// get document name, subscription date					
	var subscriberArray = [];					
	var nameDateArray = [];
	var documentName = "";
	var subscriptionDate = "";
	var message = "";
	var div;
	var html;

	subscriberArray = window[arrayName][arrayIndex].split("|");

	div = document.createElement("div");
	div.id = "subscribedToDocs";
	div.className = "bubbleGadget subscribedToDocs";
	
	html = 
		//"<div id='subscribedToDocs' class='bubbleGadget'>" + 
		"<div class='bubbleHeader'>" + 
		"<h3>" + subscriberName + "</h3>" + 
		"<h5>is already subscribed to the following document:</h5>" + 
		"</div>" + 
		"<div class='bubbleBody'>" + 
		"<div class='tableGadget highlight alternate'>" + 
		"<div class='tableGadgetHeader'><span class='tableGadgetCaption'></span></div>" + 
		"<div class='tableGadgetBody'>" + 
		"<table border='0' cellspacing='0' cellpadding='0' class='altRowsGrid rollOver'>" + 
		"<thead>" + 
		"<tr>" + 
		"<th class='docNameCol'>Document</th>" + 
		"<th class='dateCol'>Subscription Date</th>" + 
		"</tr>" + 
		"</thead>" + 
		"<tbody>";
	
	for(var j = 0; j < subscriberArray.length; j++)
	{
		nameDateArray = subscriberArray[j].split("~");
		documentName = nameDateArray[0];
		subscriptionDate = nameDateArray[1];
		
		html += "<tr><td>" + documentName + "</td><td class='right'>" + subscriptionDate + "</td></tr>";
	} // end for(var j = 0; j < subscriberArray.length; j++)
	
	html += 
		"</tbody>" + 
		"</table>" + 
		"</div>" + 
		"</div>" + 
		"</div>" + 
		"<div class='bubbleAction'>" + 
		"<button class='buttonOK' title='Close. . .' onclick='BLK.EBIZ.InformationBubble.removeBubbles();'>Close</button>" + 
		"</div>";
		//+ "</div>";
	
	div.innerHTML = html;

	// put bubble into document
	document.body.appendChild(div);
	
	// position bubble
	div.style.position = "absolute";
	div.style.display = "block";
	div.style.zIndex = "999999";

	div.style.visibility = "visible";
		
	var linkSpacer = 10;
	var scrollbarSpacer = 25;
	var widthOfBalloon = parseInt(div.offsetWidth, 10);
	var heightOfBalloon = parseInt(div.offsetHeight, 10);
	var viewportSize = getViewportSize();
	var scrollingPosition = getScrollingPosition();
	var heightOfLink = parseInt(linkRef.offsetHeight, 10);
	var widthOfLink = parseInt(linkRef.offsetWidth, 10);
	var positionOfLink = getPosition(linkRef);
	var top = 0;
	var left = 0;

	div.style.visibility = "hidden";

	// left position
	if((widthOfBalloon + linkSpacer) > viewportSize[0])
	{
		left = 
			(scrollingPosition[0] + 
			parseInt((viewportSize[0] / 2), 10) - parseInt((div.offsetWidth / 2), 10));
	}
	else if((positionOfLink[0] + widthOfBalloon) > 
		(viewportSize[0] + scrollingPosition[0]))
	{
    	left = positionOfLink[0] - 
			((positionOfLink[0] + widthOfBalloon) - 
			(viewportSize[0] + scrollingPosition[0] - scrollbarSpacer));
	}
	else if(positionOfLink[0] < scrollingPosition[0])
	{
		left = (scrollingPosition[0] + scrollbarSpacer + linkSpacer);
	}
	else
	{
    	left = (positionOfLink[0] + linkSpacer);
	}
	div.style.left = left + "px";

	// top position
	if((heightOfBalloon + linkSpacer) > viewportSize[1])
	{
		// not enough vertical space -- arrow points side ways
		top = 
			(scrollingPosition[1] + 
			parseInt((viewportSize[1] / 2), 10) - parseInt((div.offsetHeight / 2), 10));
	}
	else if((positionOfLink[1] + heightOfBalloon + heightOfLink) > 
		(viewportSize[1] + scrollingPosition[1]))
	{
		// below link - arrow points up
    	top = positionOfLink[1] - ((positionOfLink[1] + heightOfBalloon + heightOfLink) - 
    		(viewportSize[1] + scrollingPosition[1]));
	}
	else if((positionOfLink[1] - heightOfBalloon - heightOfLink) < scrollingPosition[1])
	{
		// below link - arrow points up
    	top = (positionOfLink[1] + heightOfLink + linkSpacer);
	}
	else
	{
		// above link - arrow points down
    	top = (positionOfLink[1] - heightOfBalloon - linkSpacer);
	}
	div.style.top = top + "px";
	
	//document.title = 
	//	"(" + viewportSize[0] + "," + viewportSize[1] + 
	//	")||(" +
	//	scrollingPosition[0] + "," + scrollingPosition[1] + 
	//	")||(" +
	//	widthOfBalloon + "," + heightOfBalloon + 
	//	")||(" +
	//	left + "," + top + 
	//	")";

	div.style.visibility = "visible";
	
	/*
	if(typeof EBIZ_INITIALIZE !== "undefined")
	{
		EBIZ_INITIALIZE.setupAll();
	}
	*/	
	/*
	if(typeof EBIZ_TABLE !== "undefined")
	{
		EBIZ_TABLE.setup2();
	}
	*/
	if(typeof BLK.EBIZ.Table !== "undefined")
	{
		BLK.EBIZ.Table.setup2();
	}
	return false;
}; // end BLK.EBIZ.InformationBubble = function (linkRef, contactName, arrayIndex, arrayName)
BLK.EBIZ.InformationBubble.removeBubbles = function ()
{
	var bubbleGadgetList = getElementsByClassName(document.body, "bubbleGadget");
	var parentNode = null;
	var i = 0;
	
	for(i = 0; i < bubbleGadgetList.length; i++)
	{
		//$(bubbleGadgetList[i]).fadeOut("slow");
		parentNode = bubbleGadgetList[i].parentNode;
		parentNode.removeChild(bubbleGadgetList[i]);
	}
}; // end BLK.EBIZ.InformationBubble.removeBubbles = function ()
BLK.EBIZ.InformationBubble.removeBubblesOnBodyClick = function (event)
{
	if(typeof event === "undefined")
	{
		event = window.event;
	}
	var targetElement = getEventTarget(event);
	
	if(findClass(targetElement, "infoBubbleLink"))
	{
		return false;
	}
	var node = targetElement;
	var found = false;
	while(node !== null)
	{
		if(findClass(node, "bubbleGadget"))
		{
			found = true;
		}
		node = node.parentNode;
	}
	if(found)
	{
		return false;
	}
	BLK.EBIZ.InformationBubble.removeBubbles();
	return false;
}; // end BLK.EBIZ.InformationBubble.removeBubblesOnBodyClick = function (event)
// ************************************************************************************************
// end information bubble
// ************************************************************************************************
// loadXmlFile.js

// ************************************************************************************************
// begin load xml file
// requires common.js
// ************************************************************************************************

/*global window, ActiveXObject, document, BLK */

BLK.EBIZ.loadXmlFile = function (fileName, fxn, async)
{
    //window.alert("load xml file. . .");
    var fileLoaded = false;
    var that = BLK.EBIZ.loadXmlFile;
    try
    {
		if(window.ActiveXObject)
		{
		    // code for IE
		    //window.alert("ie. . . ");
		    arguments.callee.xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		    arguments.callee.xmlDoc.async = false;
		    arguments.callee.xmlDoc.load(fileName);
		    if(arguments.callee.xmlDoc.documentElement === null)
		    {
				throw {"name":"Not found","message":"Document element not found."};
		    }
		    fxn();
		    fileLoaded = true;
		}
		else if(document.implementation &&
		    document.implementation.createDocument)
		{
		    // code for Mozilla, Firefox, Opera, etc.
		    //window.alert("mozilla, etc. . .");
		    
		    
            /*		    
		    arguments.callee.xmlDoc = document.implementation.createDocument("", "", null);
		    if(arguments.callee.xmlDoc === null)
		    {
				throw {"name":"Not implemented","message":"Could not create document."};
		    }

		    //arguments.callee.xmlDoc.async = true;
		    arguments.callee.xmlDoc.async = false;
			
			if(arguments.callee.xmlDoc.async)
			{
			    arguments.callee.xmlDoc.onload = fxn;
			    arguments.callee.xmlDoc.load(fileName);
			}
			else
			{
			    arguments.callee.xmlDoc.load(fileName);
			    if(arguments.callee.xmlDoc.documentElement === null)
			    {
					throw {"name":"Not found","message":"Document element not found."};
			    }
			    fxn();
			} // end if(arguments.callee.xmlDoc.async)
            */



		    that.xmlDoc = document.implementation.createDocument("", "", null);
		    if(that.xmlDoc === null)
		    {
				throw {"name":"Not implemented","message":"Could not create document."};
		    }

		    //arguments.callee.xmlDoc.async = true;
		    that.xmlDoc.async = false;
			
			if(that.xmlDoc.async)
			{
			    that.xmlDoc.onload = fxn;
			    that.xmlDoc.load(fileName);
    		    fileLoaded = true;
			}
			else
			{
			    //window.alert("that.xmlDoc: " + typeof that.xmlDoc + "||" + that.xmlDoc);
			    
			    try
			    {
			        that.xmlDoc.load(fileName);
			        if(that.xmlDoc.documentElement === null)
			        {
					    throw {"name":"Not found","message":"Document element not found."};
			        }
			        fxn();
        		    fileLoaded = true;
			    }
			    catch(e2)
			    {
                    // chrome
                    try
                    {
                        var xmlhttp = new window.XMLHttpRequest();
                        xmlhttp.open("GET", fileName, false);
                        xmlhttp.send(null);
                        that.xmlDoc = xmlhttp.responseXML.documentElement;
                        fxn();
            		    fileLoaded = true;
                    }
                    catch(e3)
                    {
			            window.status = e3.message;	
			            //window.alert(e3.message);	
            		    fileLoaded = false;
                    }
			    }
			} // end if(arguments.callee.xmlDoc.async)
		}
		else
		{
			throw {"name":"Not supported","message":"File load not supported."};
		}
    }
    catch(e)
    {
		if(typeof e.message === "undefined")
		{
			window.status = "Could not create XML document.";
			//window.alert("Could not create XML document.");
		}
		else
		{
			window.status = e.message;	
			//window.alert("chrome exception 2: " + e.message);	
		}
		//arguments.callee.xmlDoc = null;
		that.xmlDoc = null;
		fileLoaded = false;
    }
    return fileLoaded;
}; // end function loadXmlFile(fileName, fxn)
BLK.EBIZ.loadXmlFile.xmlDoc = null;
// ************************************************************************************************
// end load xml file
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2008/11/28 15:00:00 $
*       Filename:  $RCSfile: modalDialog.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin modalDialog.js
// ************************************************************************************************

/*global BLK, document, getElementsByClassName, getEventTarget, getPageDimensions, getScrollingPosition, getViewportSize, window */


// ************************************************************************************************
// begin usage
// ************************************************************************************************
// html setup
/*
<div class="modalDialogGadget" id="modalDialogGadget2">
<div class="modalDialogGadgetHeader">
<a class="modalDialogGadgetTitle" href="#nogo" rel="width" rev="height">prompt here. . .</a>
<span class="modalDialogGadgetDescription">description here. . .</span>
</div>
<div class="modalDialogGadgetBody">
content here. . .
</div>
</div>
*/
// javascript setup
/*
	if(typeof BLK.EBIZ.ModalDialog !== "undefined")
	{
		//var dlg = new BLK.EBIZ.ModalDialog({"width":700, "height":300});
		var dlg = new BLK.EBIZ.ModalDialog();
	}
*/
// ************************************************************************************************
// end usage
// ************************************************************************************************


//BLK.EBIZ.ModalDialog = function (configuration)
BLK.EBIZ.ModalDialog = function ()
{
	var that = this;
	this.configuration = {"width":600, "height":400};
	//this.setup = function (configuration)
	this.setup = function ()
	{
		//window.alert("Dialog setup. . .");
		//this.configuration.width = configuration.width;
		//this.configuration.height = configuration.height;
		
		var modalDialogGadgetList = getElementsByClassName(document.body, "modalDialogGadget");
		var modalDialogGadgetTitleList = null;
		//window.alert("Number of alerts: " + modalDialogGadgetList.length);
		for(var i = 0; i < modalDialogGadgetList.length; i++)
		{
			modalDialogGadgetTitleList = getElementsByClassName(modalDialogGadgetList[i], "modalDialogGadgetTitle");
			for(var j = 0; j < modalDialogGadgetTitleList.length; j++)
			{
				modalDialogGadgetTitleList[j].onclick = function (modalDialogGadgetRef)
				{
					return function (event)
					{
						var isIe = false;
						if(typeof event === "undefined")
						{
							isIe = true;
							event = window.event;
						}
						var targetElement = getEventTarget(event);
						
						that.createDialog(modalDialogGadgetRef, isIe);
						
						/*
						var modalDialogGadgetBodyList = getElementsByClassName(modalDialogGadgetRef, "modalDialogGadgetBody");
						var innerHTML = "";
						var winObj = window.open("", 
							"win", 
							"width=600,height=400,toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1");
						for(var k = 0; k < modalDialogGadgetBodyList.length; k++)
						{
							innerHTML += modalDialogGadgetBodyList[k].innerHTML;
						}
						winObj.document.body.innerHTML = innerHTML;
						*/
						
						return false;
					};
				}(modalDialogGadgetList[i]);
			} // end for(var j = 0; j < modalDialogGadgetTitleList.length; j++)
		} // end for(var i = 0; i < modalDialogGadgetList.length; i++)
		return true;
	};

	this.createDialog = function (modalDialogGadgetRef, isIe)
	{
		var that = this;
		var bodyRef = document.getElementsByTagName("body")[0];
		
		// disable <select> drop downs
		// b/c ie bug
		var selectList = document.getElementsByTagName("select");
		for(var i = 0; i < selectList.length; i++)
		{
			selectList[i].disabled = "disabled";
		}
		
		var scrollingPosition = [0,0];
		var widthOfBalloon = 0;
		var heightOfBalloon = 0;
		
		var pageDimensions = getPageDimensions();
		var viewportSize = getViewportSize();
		
		if(viewportSize[1] > pageDimensions[1])
		{
			pageDimensions[1] = viewportSize[1];
		}
		
		// ****************************************************************************************
		// begin prepare dropsheet
		// ****************************************************************************************
		var dropSheet = document.createElement("div");
		dropSheet.onclick = function (event)
		{
			if(typeof event === "undefined")
			{
				event = window.event;
			}
			var target = getEventTarget(event);
			that.closeDialog();
			return false;
		};

		dropSheet.onkeyup = function (event)
		{
			if(typeof event === "undefined")
			{
				event = window.event;
			}
			var target = getEventTarget(event);
			var key;
			if(event.keyCode)
			{
				key = event.keyCode;
			}
			else
			{
				key = event.which;
			}	
			if(key === 27)
			{
				// esc
				that.closeDialog();
				return false;
			}
			else
			{
				return true;
			}
		};

		dropSheet.setAttribute("id", "modalDialogGadgetDropSheet");
		dropSheet.style.position = "absolute";
		dropSheet.style.left = "0";
		dropSheet.style.top = "0";
		dropSheet.style.width = pageDimensions[0] + "px";
		dropSheet.style.height = pageDimensions[1] + "px";
		bodyRef.appendChild(dropSheet);
		// ****************************************************************************************
		// end prepare dropsheet
		// ****************************************************************************************

		var div = null;
		var a = null;
		var text = null;
		var ul = null;
		var li = null;
		var input = null;
		var label = null;
		var span = null;
		var table = null;
		var tr = null;
		var td = null;
		
		var iframe;
		var divContainer;
		
		var divBody;
		var divHeader;
		var divFooter;
		var divAction;
		var divClear;
		var divLeft;
		var divRight;

		var iFrame_zIndex = 99998;
		// ****************************************************************************************
		// create iframe to combat ie z-index problem
		
		if(isIe)
		{
			iframe = document.createElement("iframe");
			iframe.style.position = "absolute";
			iframe.style.border = "0";
			iframe.style.zIndex = iFrame_zIndex;
			iframe.style.backgroundColor = "lime";
			iframe.style.opacity = "1";
			iframe.style.filter = "alpha(opacity=100)";
			iframe.style.filter = "mask()";
			iframe.className = "modalDialogGadgetIFrame";
		}
		
		// ****************************************************************************************

		// container
		divContainer = document.createElement("div");
		divContainer.className = "modalDialogGadgetContainer";
		divContainer.style.position = "absolute";
		divContainer.style.visibility = "hidden";
		divContainer.style.zIndex = iFrame_zIndex + 1;
		//divContainer.style.width = that.configuration.width + "px";
		
		// ****************************************************************************************
		// header begin
		// ****************************************************************************************
		divHeader = document.createElement("div");
		divHeader.className = "modalDialogGadgetContainerHeader";
		//divHeader.style.position = "relative";
		//divHeader.style.width = that.configuration.width + "px";

		divLeft = document.createElement("div");
		divLeft.className = "modalDialogGadgetContainerHeaderLeft";
		
		
		span = document.createElement("span");
		span.className = "modalDialogGadgetContainerHeaderTitle";
		//text = document.createTextNode(document.title);
		text = document.createTextNode("Alert");
		span.appendChild(text);
		
		divLeft.appendChild(span);
		divHeader.appendChild(divLeft);
		
		
		// close button
		divRight = document.createElement("div");
		divRight.className = "modalDialogGadgetContainerHeaderRight";

		input = document.createElement("input");
		input.setAttribute("type", "button");
		input.className = "modalDialogGadgetContainerHeaderCloseButton";
		input.setAttribute("value", "X");
		input.title = "Close Alert";
		input.onclick = function (event)
		{
			if(typeof event === "undefined")
			{
				event = window.event;
			}
			var target = getEventTarget(event);
			
			that.closeDialog();
			
			return false;
		};


		divRight.appendChild(input);
		divHeader.appendChild(divRight);
		
		divClear = document.createElement("div");
		divClear.style.clear = "both";
		
		divHeader.appendChild(divClear);
		
		
		
		// ****************************************************************************************
		// header end
		// ****************************************************************************************

		// ****************************************************************************************
		// body begin
		// ****************************************************************************************
		divBody = document.createElement("div");
		divBody.className = "modalDialogGadgetContainerBody";
		//divBody.style.clear = "both";
		//divBody.style.overflow = "auto";

		var modalDialogGadgetBodyList = getElementsByClassName(modalDialogGadgetRef, "modalDialogGadgetBody");
		var innerHTML = "";
		for(var q = 0; q < modalDialogGadgetBodyList.length; q++)
		{
			innerHTML += modalDialogGadgetBodyList[q].innerHTML;
		}
		divBody.innerHTML = innerHTML;
		//divBody.style.width = (that.configuration.width - 16) + "px";
		//divBody.style.height = that.configuration.height + "px";
		// ****************************************************************************************
		// body begin
		// ****************************************************************************************

		// ****************************************************************************************
		// footer begin
		// ****************************************************************************************
		divFooter = document.createElement("div");
		divFooter.className = "modalDialogGadgetContainerFooter";

		// previous button
		/*
		input = document.createElement("input");
		input.setAttribute("type", "button");
		input.className = "modalDialogGadgetContainerFooterPreviousButton";
		input.setAttribute("value", "<< Previous");
		input.title = "Previous. . .";
		input.onclick = function (event)
		{
			if(typeof event === "undefined")
			{
				event = window.event;
			}
			var target = getEventTarget(event);
			
			window.alert("Previous. . .");
			
			return false;
		};
		divFooter.appendChild(input);
		*/

		// next button
		/*
		input = document.createElement("input");
		input.setAttribute("type", "button");
		input.className = "modalDialogGadgetContainerFooterNextButton";
		input.setAttribute("value", "Next >>");
		input.title = "Next. . .";
		input.onclick = function (event)
		{
			if(typeof event === "undefined")
			{
				event = window.event;
			}
			var target = getEventTarget(event);
			
			window.alert("Next. . .");
			
			return false;
		};
		divFooter.appendChild(input);
		*/

		// close button
		input = document.createElement("input");
		input.setAttribute("type", "button");
		input.className = "modalDialogGadgetContainerFooterCloseButton";
		input.setAttribute("value", "Close Alert");
		input.title = "Close Alert";
		input.onclick = function (event)
		{
			if(typeof event === "undefined")
			{
				event = window.event;
			}
			var target = getEventTarget(event);
			
			that.closeDialog();
			
			return false;
		};
		divFooter.appendChild(input);
		//divFooter.style.width = that.configuration.width + "px";
		// ****************************************************************************************
		// footer begin
		// ****************************************************************************************
		
		
		divContainer.appendChild(divHeader);
		divContainer.appendChild(divBody);
		divContainer.appendChild(divFooter);
		

		bodyRef.appendChild(divContainer);
		
		scrollingPosition = getScrollingPosition();
		viewportSize = getViewportSize();
		
		// make visible to obtain height and width
		divContainer.style.visibility = "visible";
		//divGadget.style.display = "block";
		
		//divContainer.style.width = that.configuration.width + "px";
		//divContainer.style.height = that.configuration.height + "px";
        
        var offsetWidth = parseInt(divContainer.offsetWidth, 10);
        var offsetHeight = parseInt(divContainer.offsetHeight, 10);
        
        // make hidden to set position
		divContainer.style.visibility = "hidden";
		//divGadget.style.display = "none";
        
        //document.title = "width:" + widthOfBalloon + "|"+ "height:" + heightOfBalloon;
		
		var offsetLeft = scrollingPosition[0] + (viewportSize[0] / 2) - (offsetWidth / 2);
		var offsetTop = scrollingPosition[1] + (viewportSize[1] / 2) - (offsetHeight / 2);

		// position popup
		divContainer.style.left = offsetLeft + "px";
		divContainer.style.top = offsetTop + "px";
			
			
		// ****************************************************************************************
		// position and size iframe
		
		if(isIe)
		{
			iframe.style.top    = offsetTop + "px";
			iframe.style.left   = offsetLeft + "px";
			iframe.style.width  = offsetWidth + "px";
			iframe.style.height = offsetHeight + "px";
			
			divContainer.parentNode.insertBefore(iframe, divContainer);
		}
		
		// ****************************************************************************************
			
		// make popup visible			
		divContainer.style.visibility = "visible";
		//divGadget.style.display = "block";
	}; // end this.createDialog = function (modalDialogGadgetRef, isIe)
	
	this.closeDialog = function ()
	{
		var dialogGadgetList = getElementsByClassName(document.body, "modalDialogGadgetContainer");
		var parentNode = null;
		var i = 0;
		for(i = 0; i < dialogGadgetList.length; i++)
		{
			parentNode = dialogGadgetList[i].parentNode;
			parentNode.removeChild(dialogGadgetList[i]);
		}

		var dialogGadgetIFrameList = getElementsByClassName(document.body, "modalDialogGadgetIFrame");
		for(i = 0; i < dialogGadgetIFrameList.length; i++)
		{
			parentNode = dialogGadgetIFrameList[i].parentNode;
			parentNode.removeChild(dialogGadgetIFrameList[i]);
		}
		
		var dropSheetRef = document.getElementById("modalDialogGadgetDropSheet");
		dropSheetRef.parentNode.removeChild(dropSheetRef);
		
		// re-enable <select> drop downs
		// b/c ie bug
		var selectList = document.getElementsByTagName("select");
		for(i = 0; i < selectList.length; i++)
		{
			selectList[i].disabled = "";
		}
	};
	
	//this.setup(configuration);
	this.setup();
}; // end BLK.EBIZ.ModalDialog = function ()

// ************************************************************************************************
// end modalDialog.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2009/08/12 10:00:00 $
*       Filename:  $RCSfile: modalWindow.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin control modal window
// requires prototype.js, control.modal.js, common.js
// ************************************************************************************************

/*global document, BLK, Control, window, $ */

BLK.EBIZ.openControlModalWindow = function (id, widthIn, heightIn)
{
	// ****************************************************************************
	// verify id of <a>; href is src of modal <iframe>
	// ****************************************************************************
	var idRef = document.getElementById(id);
	if(idRef === null)
	{
		//window.status = "Modal window data source id not found. . .";
		return false;
	}
	// ****************************************************************************
	// go to top
	// ****************************************************************************
	window.scrollTo(0, 0);
	if(window.parent)
	{
		window.parent.scrollTo(0, 0);
	}
	try
	{
		window.top.scrollTo(0, 0);
	}
	catch(ex)
	{
		window.status  = ex.message;
	}
	// ****************************************************************************
	// setup modal window
	// ****************************************************************************

	var configuration = 
	{
		iframe: true,
		width: widthIn,
		height: heightIn,
		overlayCloseOnClick:true,
		opacity:0.8,
		position:'absolute', 
		afterOpen : function ()
		{
			var div = null;	
			var a = null; 
			
			div = document.createElement("div");
			div.id = "modal_close_wrapper";
			
			a = document.createElement('a'); 
			a.href = "#nogo"; 
			a.title = "Close"; 
			a.id = 'modal_close_button'; 
			a.appendChild(document.createTextNode('Close')); 
			a.onclick = function() { Control.Modal.close(); };
			
			div.appendChild(a);
			
			$('modal_container').insertBefore(div, $('modal_container').firstChild); 

			// re-dimension iframe taking into account height of newly created modal close wrapper
			var modalContainer = document.getElementById("modal_container");
			var modalCloseWrapper = document.getElementById("modal_close_wrapper");
			var modalIframe = document.getElementById("modal_iframe");
			if(modalCloseWrapper && modalIframe && modalContainer)
			{
				modalIframe.height = 
					modalContainer.clientHeight - modalIframe.offsetTop - ((modalContainer.offsetHeight - modalContainer.clientHeight) * 2);
			}
		}
	};

	var win = new Control.Modal(id,	configuration);
	var width = parseInt(widthIn, 10);
	var height = parseInt(heightIn, 10);
	var defaultWidth = 600;
	var defaultHeight = 400;
	if(isNaN(width))
	{
		width = defaultWidth;
	}
	else
	{
		if(width <= 0)
		{
			width = defaultWidth;
		}
	}
	if(isNaN(height))
	{
		height = defaultHeight;
	}
	else
	{
		if(height <= 0)
		{
			height = defaultHeight;
		}
	}

	win.options["width"] = width;
	win.options["height"] = height;
	
	//alert(win.href);
	
	win.open();
	
	return false;
}; // end BLK.EBIZ.openControlModalWindow = function (id, widthIn, heightIn)


BLK.EBIZ.openControlModalWindow2 = function (id, widthIn, heightIn)
{
	// ****************************************************************************
	// verify id of <a>; href is src of modal <iframe>
	// ****************************************************************************
	var idRef = document.getElementById(id);
	if(idRef === null)
	{
		//window.status = "Modal window data source id not found. . .";
		return false;
	}
	// ****************************************************************************
	// go to top
	// ****************************************************************************
	/*
	window.scrollTo(0, 0);
	if(window.parent)
	{
		window.parent.scrollTo(0, 0);
	}
	try
	{
		window.top.scrollTo(0, 0);
	}
	catch(ex)
	{
		window.status  = ex.message;
	}
	*/
	// ****************************************************************************
	// setup modal window
	// ****************************************************************************
    var configuration = {};
    configuration["iframe"] = true;
	configuration["overlayCloseOnClick"] = true;
	configuration["opacity"] = 0.8;
	configuration["position"] = "absolute";
	if(typeof widthIn !== "undefined" && typeof heightIn !== "undefined")
	{
	    configuration["width"] = widthIn;
	    configuration["height"] = heightIn;
	}

    // begin override center function
    Object.extend(Control.Modal,{center: function (element)
    {
	    if(!element._absolutized){
		    element.setStyle({
			    position: 'absolute'
		    }); 
		    element._absolutized = true;
	    }
	    var dimensions = element.getDimensions();
	    Position.prepare();
	    var offset_left = (Position.deltaX + Math.floor((Control.Modal.getWindowWidth() - dimensions.width) / 2));
	    var offset_top = (Position.deltaY + ((Control.Modal.getWindowHeight() > dimensions.height) ? Math.floor((Control.Modal.getWindowHeight() - dimensions.height) / 2) : 0));
	    element.setStyle({
	        // begin roark 20090819
		    // in ff modal window is positioned at top of view port 
		    // if image height is bigger than viewport height (i.e. dimensions.height <= Control.Modal.getDocumentHeight())
		    // however modal window should stay at offset_top - near where the user clicked the image
		    // all other browsers (ie6,ie7,op,gc) behave this way
		    //top: ((dimensions.height <= Control.Modal.getDocumentHeight()) ? ((offset_top != null && offset_top > 0) ? offset_top : '0') + 'px' : 0),
		    top: ((dimensions.height <= Control.Modal.getDocumentHeight()) ? ((offset_top != null && offset_top > 0) ? offset_top : offset_top) + 'px' : offset_top + 'px'),
		    // end roark 20090819
		    left: ((dimensions.width <= Control.Modal.getDocumentWidth()) ? ((offset_left != null && offset_left > 0) ? offset_left : '0') + 'px' : 0)
	    });
    }});
    // end override center function
    
	var win = new Control.Modal(id,	configuration);
	win.options["zIndex"] = 99999;
	
	var modalContainerRef = document.getElementById("modal_container");
	if(modalContainerRef !== null)
	{
	    modalContainerRef.style.backgroundColor = "transparent";
	    modalContainerRef.style.image = "none";
	    modalContainerRef.style.border = "none";
	}
	win.open();
	
	return false;
}; // end BLK.EBIZ.openControlModalWindow2 = function (id, widthIn, heightIn)

BLK.EBIZ.modalWindowGadget = 
{
    "setupThis" : function (id, width, height)
    {
        BLK.EBIZ.openControlModalWindow2(id, width, height);
        return false;
    },
    "setupAll" : function ()
    {
        var modalWindowLinkList = getElementsByClassName(document.body, "modalWindowGadget");
        for(var i = 0; i < modalWindowLinkList.length; i++)
        {
            if(modalWindowLinkList[i].nodeName.toLowerCase() !== "a")
            {
                continue;
            }
            modalWindowLinkList[i].onclick = function (event)
            {
        	    if(typeof event === "undefined")
	            {
        		    event = window.event;
        	    }
        	    var target = getEventTarget(event);
            
                //BLK.EBIZ.openControlModalWindow2(target.id, target.rel, target.rev);
                BLK.EBIZ.openControlModalWindow2(this.id, this.rel, this.rev);
                return false;
            };
        }
    }
}; // end BLK.EBIZ.modalWindowGadget = 

// ************************************************************************************************
// end control modal window
// ************************************************************************************************
// moreInfo.js

// ************************************************************************************************
// begin site map info
// requires common.js
// ************************************************************************************************

/*global BLK, changeClass, document, findClass, getElementsByClassName, getEventTarget, getNextSibling, window, addLoadListener */

BLK.EBIZ.MoreInfo = function (expandTextIn, collapseTextIn)
{
	var that = this;
	this.className = "moreInfoGadget";
	this.classNameAll = "moreInfoGadgetAll";

	this.expandText = "Show. . .";
	this.collapseText = "Hide. ..";
	if(arguments.length === 2)
	{
		if(typeof expandTextIn === "string" && typeof collapseTextIn === "string")
		{
			this.expandText = expandTextIn;
			this.collapseText = collapseTextIn;
		}
	}

	this.setup = function ()
	{
		// ****************************************************************************************
		// toggle each
		// ****************************************************************************************
		var moreInfoGadgetList = getElementsByClassName(document.body, this.className);
		var moreInfoGadgetBodyId = "";
		var moreInfoGadgetBodyRef = null;
		var a = null;
		var i = 0;
		var text = null;
		for(i = 0; i < moreInfoGadgetList.length; i++)
		{
			moreInfoGadgetBodyId = moreInfoGadgetList[i].getAttribute("rel");
			if(moreInfoGadgetBodyId === this.classNameAll)
			{
				continue;
			}
			moreInfoGadgetBodyRef = document.getElementById(moreInfoGadgetBodyId);
			if(moreInfoGadgetBodyRef === null)
			{
				continue;
			}
			moreInfoGadgetBodyRef.style.display = "none";
			var parentNode = moreInfoGadgetList[i].parentNode;
			a = document.createElement("a");
			a.href = "#null";
			a.className = "moreInfoGadgetCtrl moreInfoGadgetShow";
			a.title = this.expandText;
			a.setAttribute("rel", moreInfoGadgetBodyId);
			a.onclick = function (that)
			{
				return function (event)
				{
					if(typeof event === "undefined")
					{
						event = window.event;
					}
					var target = getEventTarget(event);
				
					var ref = document.getElementById(this.rel);
					var remainingShowList = null;
					var remainingHideList = null;
					var remainingShowCounter = 0;
					var remainingHideCounter = 0;
					var moreInfoGadgetCtrlList = null;
					var text = null;
					var nextSibling = null;
					if(findClass(this, "moreInfoGadgetShow"))
					{
						changeClass(this, "moreInfoGadgetShow", "moreInfoGadgetHide");
						ref.style.display = "block";
						this.title = that.collapseText;
						remainingShowList = getElementsByClassName(document.body, "moreInfoGadgetShow");
						remainingShowCounter = 0;
						for(i = 0; i < remainingShowList.length; i++)
						{
							if(remainingShowList[i].getAttribute("rel") === "moreInfoGadgetAll")
							{
								continue;
							}
							remainingShowCounter++;
						}
						if(remainingShowCounter === 0)
						{
							// change all ctrl to show
							moreInfoGadgetCtrlList = getElementsByClassName(document.body, "moreInfoGadgetCtrl");
							for(i = 0; i < moreInfoGadgetCtrlList.length; i++)
							{

								if(moreInfoGadgetCtrlList[i].getAttribute("rel") !== "moreInfoGadgetAll")
								{
									continue;
								}

								changeClass(moreInfoGadgetCtrlList[i], "moreInfoGadgetShow", "moreInfoGadgetHide");
								moreInfoGadgetCtrlList[i].title = that.collapseText;
						
								nextSibling = getNextSibling(moreInfoGadgetCtrlList[i]);
								nextSibling.firstChild.nodeValue = that.collapseText;
								
								/*
								//alert(nextSibling.childNodes.length);
								while(nextSibling.childNodes.length > 0)
								{
									nextSibling.removeChild(nextSibling.childNodes[0]);
								}
								text = document.createTextNode(that.collapseText);
								nextSibling.appendChild(text);
								*/
							}
						}
					}
					else
					{
						changeClass(this, "moreInfoGadgetHide", "moreInfoGadgetShow");
						ref.style.display = "none";
						this.title = that.expandText;

						remainingHideList = getElementsByClassName(document.body, "moreInfoGadgetHide");
						
						remainingHideCounter = 0;
						for(i = 0; i < remainingHideList.length; i++)
						{
							if(remainingHideList[i].getAttribute("rel") === "moreInfoGadgetAll")
							{
								continue;
							}
							remainingHideCounter++;
						} // end for(i = 0; i < remainingHideList.length; i++)
						
						if(remainingHideCounter === 0)
						{
							// change all ctrl to hide
							moreInfoGadgetCtrlList = getElementsByClassName(document.body, "moreInfoGadgetCtrl");
							for(i = 0; i < moreInfoGadgetCtrlList.length; i++)
							{
							
								if(moreInfoGadgetCtrlList[i].getAttribute("rel") !== "moreInfoGadgetAll")
								{
									continue;
								}
							
								changeClass(moreInfoGadgetCtrlList[i], "moreInfoGadgetHide", "moreInfoGadgetShow");
								moreInfoGadgetCtrlList[i].title = that.expandText;
						
								nextSibling = getNextSibling(moreInfoGadgetCtrlList[i]);
								nextSibling.firstChild.nodeValue = that.expandText;
								
								//alert(nextSibling.childNodes.length);
								/*
								while(nextSibling.childNodes.length > 0)
								{
									nextSibling.removeChild(nextSibling.childNodes[0]);
								}
								text = document.createTextNode(that.expandText);
								nextSibling.appendChild(text);
								*/
							}
						} // end if(remainingHideCounter === 0)
					} // end if(findClass(this, "moreInfoGadgetShow"))
					
					return false;
				}; // end return function (event)
			}(this); // end a.onclick = function ()
			//parentNode.insertBefore(a, moreInfoGadgetList[i]);
			parentNode.insertBefore(a, parentNode.firstChild);
		} // end for(var i = 0; i < moreInfoGadgetList.length; i++)
		
		// ****************************************************************************************
		// toggle all
		// ****************************************************************************************
		moreInfoGadgetList = getElementsByClassName(document.body, this.className);
		moreInfoGadgetBodyId = "";
		moreInfoGadgetBodyRef = null;
		a = null;
		for(i = 0; i < moreInfoGadgetList.length; i++)
		{
			moreInfoGadgetBodyId = moreInfoGadgetList[i].getAttribute("rel");
			if(moreInfoGadgetBodyId !== this.classNameAll)
			{
				continue;
			}
			moreInfoGadgetBodyRef = document.getElementById(moreInfoGadgetBodyId);
			if(moreInfoGadgetBodyRef !== null)
			{
				continue;
			}

			//moreInfoGadgetList[i].firstChild.nodeValue = this.expandText;
			while(moreInfoGadgetList[i].childNodes.length > 0)
			{
				moreInfoGadgetList[i].removeChild(moreInfoGadgetList[i].childNodes[0]);
			}
			text = document.createTextNode(this.expandText);
			moreInfoGadgetList[i].appendChild(text);

			parentNode = moreInfoGadgetList[i].parentNode;
			a = document.createElement("a");
			a.href = "#null";
			a.className = "moreInfoGadgetCtrl moreInfoGadgetShow";
			a.title = this.expandText;
			a.setAttribute("rel", this.classNameAll);
			a.onclick = function (that)
			{
				return function (event)
				{
					if(typeof event === "undefined")
					{
						event = window.event;
					}
					var target = getEventTarget(event);

					var ref = document.getElementById(this.rel);
					var i = 0;
					var text = null;
					var moreInfoGadgetList = null;
					var moreInfoGadgetBodyId = "";
					var moreInfoGadgetBodyRef = null;
					var moreInfoGadgetCtrlList = null;
					var nextSibling = null;
					
					if(findClass(this, "moreInfoGadgetShow"))
					{
						changeClass(this, "moreInfoGadgetShow", "moreInfoGadgetHide");
						this.title = that.collapseText;
						
						nextSibling = getNextSibling(this);
						while(nextSibling.childNodes.length > 0)
						{
							nextSibling.removeChild(nextSibling.childNodes[0]);
						}
						text = document.createTextNode(that.collapseText);
						nextSibling.appendChild(text);
						
						moreInfoGadgetList = getElementsByClassName(document.body, that.className);
						for(i = 0; i < moreInfoGadgetList.length; i++)
						{
							moreInfoGadgetBodyId = moreInfoGadgetList[i].getAttribute("rel");
							if(moreInfoGadgetBodyId === that.classNameAll)
							{
								continue;
							}
							moreInfoGadgetBodyRef = document.getElementById(moreInfoGadgetBodyId);
							if(moreInfoGadgetBodyRef === null)
							{
								continue;
							}
							moreInfoGadgetBodyRef.style.display = "block";
						} // end for(i = 0; i < moreInfoGadgetList.length; i++)

						moreInfoGadgetCtrlList = getElementsByClassName(document.body, "moreInfoGadgetCtrl");
						for(i = 0; i < moreInfoGadgetCtrlList.length; i++)
						{
							if(moreInfoGadgetCtrlList[i].getAttribute("rel") === "moreInfoGadgetAll")
							{
								continue;
							}
							changeClass(moreInfoGadgetCtrlList[i], "moreInfoGadgetShow", "moreInfoGadgetHide"); 
							moreInfoGadgetCtrlList[i].title = that.collapseText;
						}
					}
					else
					{
						changeClass(this, "moreInfoGadgetHide", "moreInfoGadgetShow");
						this.title = that.expandText;
						
						nextSibling = getNextSibling(this);
						while(nextSibling.childNodes.length > 0)
						{
							nextSibling.removeChild(nextSibling.childNodes[0]);
						}
						text = document.createTextNode(that.expandText);
						nextSibling.appendChild(text);
						
						moreInfoGadgetList = getElementsByClassName(document.body, that.className);
						for(i = 0; i < moreInfoGadgetList.length; i++)
						{
							moreInfoGadgetBodyId = moreInfoGadgetList[i].getAttribute("rel");
							if(moreInfoGadgetBodyId === that.classNameAll)
							{
								continue;
							}
							moreInfoGadgetBodyRef = document.getElementById(moreInfoGadgetBodyId);
							if(moreInfoGadgetBodyRef === null)
							{
								continue;
							}
							moreInfoGadgetBodyRef.style.display = "none";
						} // end for(i = 0; i < moreInfoGadgetList.length; i++)
						
						moreInfoGadgetCtrlList = getElementsByClassName(document.body, "moreInfoGadgetCtrl");
						for(i = 0; i < moreInfoGadgetCtrlList.length; i++)
						{
							if(moreInfoGadgetCtrlList[i].getAttribute("rel") === "moreInfoGadgetAll")
							{
								continue;
							}
							changeClass(moreInfoGadgetCtrlList[i], "moreInfoGadgetHide", "moreInfoGadgetShow"); 
							moreInfoGadgetCtrlList[i].title = that.expandText;
						}
					} // end if(findClass(this, "moreInfoGadgetShow"))
					return false;
				}; // end return function (event)
			}(this); // end a.onclick = function ()
			//parentNode.insertBefore(a, moreInfoGadgetList[i]);
			parentNode.insertBefore(a, parentNode.firstChild);
		} // end for(var i = 0; i < moreInfoGadgetList.length; i++)
	}; // end this.setup = function ()
	this.setup();
}; // end BLK.EBIZ.MoreInfo = function (expandTextIn, collapseTextIn)
// ************************************************************************************************
// end site map info
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2010/01/13 09:30:00 $
*       Filename:  $RCSfile: table.js,v $
*       Revision:  $Revision: 1.4 $
*/

// ************************************************************************************************
// begin table.js
// ************************************************************************************************

/*global BLK, document, findClass, getElementsByClassName, getEventTarget, getInternalText, 
retrieveComputedStyle, triggerEvent, window, addClass, changeClass, removeClass, trim, navigator */

BLK.EBIZ.Table = 
{
	idIndex : 0,
	
	classType : "table",
	
	buildGadgetId : function (number)
	{
		return this.classType + "_" + String(number);
	}, // end buildGadgetId : function (number)
	
	setupThis : function (gadgetId)
	{
		var ok = true;
		var gadgetRef = document.getElementById(gadgetId);
		if(gadgetRef === null)
		{
		    //window.status = "Gadget id '" + gadgetId + "' not found.";
		    return;
		}
		if(ok)
		{
			ok = this.setTableClassNames(gadgetId);
		}
		if(ok)
		{
			ok = this.createShowHideEventHandlers(gadgetId);
		}
		if(ok)
		{
			this.createSortEventHandlers(gadgetId);
			this.createDeleteRowEventHandlers(gadgetId);
			
			// begin sort initial								
			this.sortInitial(gadgetId);
			// end sort initial								
			
			this.setAlternatingRows(gadgetId);
			this.setRowHighlight(gadgetId);
			this.setRowSelection(gadgetId);


			this.tableHasRows(gadgetId);

			
			this.setTableScrollBars(gadgetId);
			this.calculateColumnSum(gadgetId);
		} // end if(ok)
	}, // end setupThis : function (gadgetId)
	
	setup : function ()
	{
	    this.setup2();
	}, // end setup : function ()

	setup2 : function ()
	{
		var i = 0;
		var tableGadgetList = null;
		var tableGadgetListLength = 0;
		var gadgetId = "";
		var ok = true;
		
		tableGadgetList = getElementsByClassName(document.body, "tableGadget");
		tableGadgetListLength = tableGadgetList.length;
		for(i = 0; i < tableGadgetListLength; i++)
		{
		    ok = true;
			this.idIndex++;
			
			//gadgetId = this.buildGadgetId(this.idIndex);
			//tableGadgetList[i].id = gadgetId;
			if(tableGadgetList[i].id === "")
			{
			    gadgetId = this.buildGadgetId(this.idIndex);
	            tableGadgetList[i].id = gadgetId;
			}
			else
			{
                gadgetId = tableGadgetList[i].id;
			}
			
			//window.alert(gadgetId);
			
			if(ok)
			{
				ok = this.setTableClassNames(gadgetId);
			}
			if(ok)
			{
				ok = this.createShowHideEventHandlers(gadgetId);
			}
			if(ok)
			{
				this.createSortEventHandlers(gadgetId);
				this.createDeleteRowEventHandlers(gadgetId);
				
				// begin sort initial								
				this.sortInitial(gadgetId);
				// end sort initial								
				
				this.setAlternatingRows(gadgetId);
				this.setRowHighlight(gadgetId);
				this.setRowSelection(gadgetId);


				this.tableHasRows(gadgetId);

				
				this.setTableScrollBars(gadgetId);
				this.calculateColumnSum(gadgetId);
			} // end if(ok)
		} // end for(i = 0; i < tableGadgetListLength; i++)
	}, // end setup2 : function ()

    tableHasRows : function (gadgetId)
    {
		var gadgetRef = document.getElementById(gadgetId);
		if(gadgetRef === null)
		{
			//window.alert("tableHasRows: Gadget not found.");
			//window.status = "tableHasRows: Gadget not found.";
			return false;
		}
    
		var tableList = gadgetRef.getElementsByTagName("table");
		if(tableList.length === 0)
		{
			//window.alert("tableHasRows: Table list not found.");
			//window.status = "tableHasRows: Table list not found.";
			return false;
		}
		
		var tableRef = tableList[0];
		if(tableRef === null)
		{
			//window.alert("tableHasRows: Table not found.");
			//window.status = "tableHasRows: Table not found.";
			return false;
		}

		var targetTheadList = tableRef.getElementsByTagName("thead");
		if(targetTheadList.length === 0)
		{
			//window.alert("tableHasRows: Table head list not found.");
			//window.status = "tableHasRows: Table head list not found.";
			return false;
		}
		
		var targetThead = targetTheadList[0];
		if(targetThead === null)
		{
			//window.alert("tableHasRows: Table head not found.");
			//window.status = "tableHasRows: Table head not found.";
			return false;
		}

		var targetTheadTrs = targetThead.getElementsByTagName("tr");
		if(targetTheadTrs.length === 0)
		{
			//window.alert("tableHasRows: Table head rows not found.");
			//window.status = "tableHasRows: Table head rows not found.";
			return false;
        }
		var tHeadThList = targetTheadTrs[0].getElementsByTagName("th");
		var colSpan = tHeadThList.length;
		//window.alert(colSpan);

		var tfoot = null;
		var tr = null;
		var td = null;
		var th = null;
		var text = null;
		var targetTfootList = null;
		var targetTfootNoDataList = null;
		var i = 0;
		var j = 0;
        var hasRows = true;
		var tBodyFound = true;

        // ie does create <tbody> even if no rows exist
        // ff, op, gc do not create <tbody> if no rows exist

		// ff, op, gc
		var targetTbodyList = tableRef.getElementsByTagName("tbody");
		if(targetTbodyList.length === 0)
		{
		    //window.alert(BLK.EBIZ.Table.tableEmptyMessage);
		    //window.status = BLK.EBIZ.Table.tableEmptyMessage;
            targetTfootList = tableRef.getElementsByTagName("tfoot");
            if(targetTfootList.length === 0)
            {
		        tfoot = null;
		        tr = null;
		        td = null;
		        th = null;
		        text = null;

		        tfoot = document.createElement("tfoot");
		        tfoot.className = "noDataInTableFooter";
		        tr = document.createElement("tr");
		        th = document.createElement("th");
		        th.setAttribute("colspan", colSpan);
		        th.colSpan = colSpan;
		        text = document.createTextNode(BLK.EBIZ.Table.tableEmptyMessage);
		        th.appendChild(text);
		        tr.appendChild(th);
		        tfoot.appendChild(tr);
		        tableRef.appendChild(tfoot);
            } // end if(targetTfootList.length === 0)
			tBodyFound = false;
			hasRows = false;
		} // end if(targetTbodyList.length === 0)
		
        // ie
        if(tBodyFound)
        {
		    var targetTbody = targetTbodyList[0];
		    if(targetTbody === null)
		    {
			    //window.alert("tableHasRows: Table body not found.");
			    //window.status = "tableHasRows: Table body not found.";
			    return false;
		    }

		    var targetTbodyTrs = targetTbody.getElementsByTagName("tr");
		    if(targetTbodyTrs.length === 0)
		    {
		        //window.alert(BLK.EBIZ.Table.tableEmptyMessage);
		        //window.status = BLK.EBIZ.Table.tableEmptyMessage;
                targetTfootList = tableRef.getElementsByTagName("tfoot");
                if(targetTfootList.length === 0)
                {
	                tfoot = null;
	                tr = null;
	                td = null;
	                th = null;
	                text = null;

	                tfoot = document.createElement("tfoot");
	                tfoot.className = "noDataInTableFooter";
	                tr = document.createElement("tr");
	                th = document.createElement("th");
	                th.setAttribute("colspan", colSpan);
	                th.colSpan = colSpan;
	                text = document.createTextNode(BLK.EBIZ.Table.tableEmptyMessage);
	                th.appendChild(text);
	                tr.appendChild(th);
	                tfoot.appendChild(tr);
	                tableRef.appendChild(tfoot);
                } // end if(targetTfootList.length === 0)
			    hasRows = false;
		    } // end if(targetTbodyTrs.length === 0)
		} // end if(tBodyFound)

        if(hasRows)
        {
		    // table has rows
		    // remove no data found footer if it exists
		    targetTfootList = tableRef.getElementsByTagName("tfoot");
		    for(i = 0; i < targetTfootList.length; i++)
		    {
		        if(findClass(targetTfootList[i], "noDataInTableFooter"))
		        {
		            targetTfootList[i].parentNode.removeChild(targetTfootList[i]);
		        }
		    }
        } // end if(hasRows)
        
		tfoot = null;
		tr = null;
		td = null;
		th = null;
		text = null;
		targetTfootList = null;
		targetTfootNoDataList = null;
		i = 0;
		j = 0;
		
		return hasRows;
    }, // end tableHasRows : function (gadgetId)
    
	sortInitial : function (gadgetId)
	{
		var gadgetRef = null;
		var i = 0;
		var that = this;
		var found = false;
		
		// verify table gadget was created properly
		gadgetRef = document.getElementById(gadgetId);
		if(gadgetRef === null)
		{
			//window.alert("Invalid gadget id.");
			//window.status = "sortInitial: Invalid gadget id - " + gadgetId;
			return false;
		}

		var sortInitialList = getElementsByClassName(gadgetRef, "sortInitial");
		var tableSortList = null;
		i = 0;
		if(sortInitialList.length > 0)
		{
			tableSortList = getElementsByClassName(sortInitialList[i], "tableSort");
			if(tableSortList.length > 0)
			{
				triggerEvent(tableSortList[i], "click", true, true);
			}
			found = true;
		}
		if(found)
		{
			return true;
		}
		
		sortInitialList = getElementsByClassName(gadgetRef, "sortInitialAsc");
		tableSortList = null;
		i = 0;
		if(sortInitialList.length > 0)
		{
			tableSortList = getElementsByClassName(sortInitialList[i], "tableSort");
			if(tableSortList.length > 0)
			{
				triggerEvent(tableSortList[i], "click", true, true);
			}
			found = true;
		}
		if(found)
		{
			return true;
		}

		sortInitialList = getElementsByClassName(gadgetRef, "sortInitialDesc");
		tableSortList = null;
		i = 0;
		if(sortInitialList.length > 0)
		{
			tableSortList = getElementsByClassName(sortInitialList[i], "tableSort");
			if(tableSortList.length > 0)
			{
				triggerEvent(tableSortList[i], "click", true, true);
				triggerEvent(tableSortList[i], "click", true, true);
			}
			found = true;
		}
		if(found)
		{
			return true;
		}
		return false;		
	}, // end sortInitial : function (gadgetId)
	
	createDeleteRowEventHandlers : function (gadgetId)
	{
		var eventHandlersOk = false;
		var fxn = null;
		var gadgetRef = null;
		var i = 0;
		var deleteOneRowList = null;
		var deleteAllRowsList = null;
		var that = this;
		var toggleList = null;
		
		// verify table gadget was created properly
		gadgetRef = document.getElementById(gadgetId);
		if(gadgetRef === null)
		{
			//window.alert("Invalid gadget id.");
			//window.status = "createDeleteRowEventHandlers: Invalid gadget id - " + gadgetId;
			return false;
		}
		
		// delete one row
		deleteOneRowList = getElementsByClassName(gadgetRef, "tableGadgetDeleteOneRow");
		for(i = 0; i < deleteOneRowList.length; i++)
		{
			deleteOneRowList[i].onclick = function (event)
			{
				if(typeof event === "undefined")
				{
				    event = window.event;
				}
				var targetElement = getEventTarget(event);
			
				var tableRef = null;
				var tBodyRef = null;
				var gadgetRef = null;
				var trRef = null;
				var node = null;
				var foundTBody = false;
				var foundTable = false;
				var foundGadget = false;
				var foundRow = false;
				
				node = targetElement;
				
				while(node !== null)
				{
					if(!foundRow)
					{
						if(node.nodeName.toLowerCase() === "tr")
						{
							foundRow = true;
							trRef = node;
						}
					}
					if(!foundTBody)
					{
						if(node.nodeName.toLowerCase() === "tbody")
						{
							foundTBody = true;
							tBodyRef = node;
						}
					}
					if(!foundTable)
					{
						if(node.nodeName.toLowerCase() === "table")
						{
							foundTable = true;
							tableRef = node;
						}
					}
					if(!foundGadget)
					{
						if(findClass(node, "tableGadget"))
						{
							foundGadget = true;
							gadgetRef = node;
						}
					}
					node = node.parentNode;
				} // end while(node !== null)
				if(!(foundRow && foundTBody && foundTable && foundGadget))
				{
					return false;
				}
				
				// delete row
				tableRef.deleteRow(trRef.rowIndex);


				// delete tfoot if necessary
				var tBodyList = tableRef.getElementsByTagName("tbody");
				var rowsRemaining = false;
				for(var i = 0; i < tBodyList.length; i++)
				{
					if(tBodyList[i].getElementsByTagName("tr").length > 0)
					{
						rowsRemaining = true;
					}
				}
				if(!rowsRemaining)
				{
					tableRef.deleteTFoot();
				}


				// re-configure table gadget
				that.createSortEventHandlers(gadgetRef.id);
				//this.createDeleteRowEventHandlers(gadgetRef.id);
				that.setAlternatingRows(gadgetRef.id);
				that.setRowHighlight(gadgetRef.id);
				that.setRowSelection(gadgetRef.id);

				
				that.tableHasRows(gadgetRef.id);

				
				that.setTableScrollBars(gadgetRef.id);
				that.calculateColumnSum(gadgetRef.id);
				
				return false;
			}; // end deleteOneRowList[i].onclick = function (event)
		} // end for(var i = 0; i < deleteOneRowList.length; i++)
		
		// delete all rows
		deleteAllRowsList = getElementsByClassName(gadgetRef, "tableGadgetDeleteAllRows");
		for(i = 0; i < deleteAllRowsList.length; i++)
		{
			deleteAllRowsList[i].onclick = function (event)
			{
				if(typeof event === "undefined")
				{
				    event = window.event;
				}
				var targetElement = getEventTarget(event);
				
				var tableRef = null;
				var tBodyRef = null;
				var gadgetRef = null;
				var trRef = null;
				var node = null;
				var foundTBody = false;
				var foundTable = false;
				var foundGadget = false;
				var foundRow = false;
				
				node = targetElement;

				while(node !== null)
				{
					if(!foundRow)
					{
						if(node.nodeName.toLowerCase() === "tr")
						{
							foundRow = true;
							trRef = node;
						}
					}
					if(!foundTable)
					{
						if(node.nodeName.toLowerCase() === "table")
						{
							foundTable = true;
							tableRef = node;
						}
					}
					if(!foundGadget)
					{
						if(findClass(node, "tableGadget"))
						{
							foundGadget = true;
							gadgetRef = node;
						}
					}
					node = node.parentNode;
				}
				if(!(foundRow && foundTable && foundGadget))
				{
					return;
				}

				// delete rows		
				while(tableRef.getElementsByTagName("tr").length > 1)
				{
					tableRef.deleteRow(1);
				}
				
				// delete tfoot if necessary
				var tBodyList = tableRef.getElementsByTagName("tbody");
				var rowsRemaining = false;
				var trList = null;
				var numOfTrs = 0;
				for(var i = 0; i < tBodyList.length; i++)
				{
					trList = tBodyList[i].getElementsByTagName("tr");
					numOfTrs = trList.length;
					if(numOfTrs > 0)
					{
						rowsRemaining = true;
					}
				}
				//alert(numOfTrs);
				if(!rowsRemaining)
				{
					tableRef.deleteTFoot();
				}
				
				// re-configure table gadget
				that.createSortEventHandlers(gadgetRef.id);
				//this.createDeleteRowEventHandlers(gadgetRef.id);
				that.setAlternatingRows(gadgetRef.id);
				that.setRowHighlight(gadgetRef.id);
				that.setRowSelection(gadgetRef.id);

				
				that.tableHasRows(gadgetRef.id);
				
				
				that.setTableScrollBars(gadgetRef.id);
				that.calculateColumnSum(gadgetRef.id);
			}; // end deleteAllRowsList[i].onclick = function (event)
		} // end for(i = 0; i < deleteAllRowsList.length; i++)
	
		return true;
	}, // end createDeleteRowEventHandlers : function (gadgetId)
	
	tableIsEmpty : function (aRefIn)
	{
	    // check for empty table through click on <a> tag from element within table
		var aRef = aRefIn;
		var tBodyRef = null;
		var tableRef = null;
		var gadgetRef = null;
		var trRef = null;
		var node = null;
		var foundTBody = false;
		var foundTable = false;
		var foundGadget = false;
		var foundRow = false;
		
		// find link within table gadget
		node = aRefIn;
		while(node !== null)
		{
			
			if(!foundRow)
			{
				if(node.nodeName.toLowerCase() === "tr")
				{
					foundRow = true;
					trRef = node;
				}
			}
			/*
			if(!foundTBody)
			{
				if(node.nodeName.toLowerCase() === "tbody")
				{
					foundTBody = true;
					tBodyRef = node;
				}
			}
			*/
			if(!foundTable)
			{
				if(node.nodeName.toLowerCase() === "table")
				{
					foundTable = true;
					tableRef = node;
				}
			}
			if(!foundGadget)
			{
				if(findClass(node, "tableGadget"))
				{
					foundGadget = true;
					gadgetRef = node;
				}
			}
			node = node.parentNode;
		}
		if(!(foundRow && foundTable && foundGadget))
		{
			return false;
		}

		var tBodyList = tableRef.getElementsByTagName("tbody");
		var rowsRemaining = false;
		for(var i = 0; i < tBodyList.length; i++)
		{
			if(tBodyList[i].getElementsByTagName("tr").length > 0)
			{
				rowsRemaining = true;
			}
		}
		if(rowsRemaining)
		{
			return false;
		}
		return true;
	}, // end tableIsEmpty : function (aRefIn)
	
    deleteRow : function (aRefIn)
    {
		var aRef = aRefIn;
		var tableRef = null;
		var tBodyRef = null;
		var gadgetRef = null;
		var trRef = null;
		var node = null;
		var foundTBody = false;
		var foundTable = false;
		var foundGadget = false;
		var foundRow = false;
		var rowsRemaining = true;
		
		// find link within table gadget
		node = aRefIn;
		while(node !== null)
		{
			if(!foundRow)
			{
				if(node.nodeName.toLowerCase() === "tr")
				{
					foundRow = true;
					trRef = node;
				}
			}
			if(!foundTBody)
			{
				if(node.nodeName.toLowerCase() === "tbody")
				{
					foundTBody = true;
					tBodyRef = node;
				}
			}
			if(!foundTable)
			{
				if(node.nodeName.toLowerCase() === "table")
				{
					foundTable = true;
					tableRef = node;
				}
			}
			if(!foundGadget)
			{
				if(findClass(node, "tableGadget"))
				{
					foundGadget = true;
					gadgetRef = node;
				}
			}
			node = node.parentNode;
		}
		if(!(foundRow && foundTBody && foundTable && foundGadget))
		{
			return;
		}
		
		// delete row
		tableRef.deleteRow(trRef.rowIndex);
		
		// delete tfoot if necessary
		var trList = tBodyRef.getElementsByTagName("tr");
		if(trList.length === 0)
		{
			tableRef.deleteTFoot();
		}


		/*
		var tBodyList = tableRef.getElementsByTagName("tbody");
		var rowsRemaining = false;
		for(var i = 0; i < tBodyList.length; i++)
		{
			if(tBodyList[i].getElementsByTagName("tr").length > 1)
			{
				rowsRemaining = true;
			}
		}
		if(!rowsRemaining)
		{
			tableRef.deleteTFoot();
		}
		*/



		// re-configure table gadget		
		this.createSortEventHandlers(gadgetRef.id);
		//this.createDeleteRowEventHandlers(gadgetRef.id);
		this.setAlternatingRows(gadgetRef.id);
		this.setRowHighlight(gadgetRef.id);
		this.setRowSelection(gadgetRef.id);
		this.setTableScrollBars(gadgetRef.id);
		this.calculateColumnSum(gadgetRef.id);
    }, // deleteRow : function (aRefIn)

    deleteRows : function (aRefIn)
    {
		var aRef = aRefIn;
		var tBodyRef = null;
		var tableRef = null;
		var gadgetRef = null;
		var trRef = null;
		var node = null;
		var foundTBody = false;
		var foundTable = false;
		var foundGadget = false;
		var foundRow = false;
		
		// find link within table gadget
		node = aRefIn;
		while(node !== null)
		{
			if(!foundRow)
			{
				if(node.nodeName.toLowerCase() === "tr")
				{
					foundRow = true;
					trRef = node;
				}
			}
			if(!foundTable)
			{
				if(node.nodeName.toLowerCase() === "table")
				{
					foundTable = true;
					tableRef = node;
				}
			}
			if(!foundGadget)
			{
				if(findClass(node, "tableGadget"))
				{
					foundGadget = true;
					gadgetRef = node;
				}
			}
			node = node.parentNode;
		}
		if(!(foundRow && foundTable && foundGadget))
		{
			return;
		}

		// delete rows		
		while(tableRef.getElementsByTagName("tr").length > 1)
		{
			tableRef.deleteRow(1);
		}
		
		// delete tfoot if necessary
		var tBodyList = tableRef.getElementsByTagName("tbody");
		var rowsRemaining = false;
		var numOfTrs = 0;
		var trList = null;
		for(var i = 0; i < tBodyList.length; i++)
		{
			trList = tBodyList[i].getElementsByTagName("tr");
			numOfTrs = trList.length;
			if(numOfTrs > 0)
			{
				rowsRemaining = true;
			}
		}
		//alert(numOfTrs);
		if(!rowsRemaining)
		{
			tableRef.deleteTFoot();
		}
		
		// re-configure table gadget
		this.createSortEventHandlers(gadgetRef.id);
		//this.createDeleteRowEventHandlers(gadgetRef.id);
		this.setAlternatingRows(gadgetRef.id);
		this.setRowHighlight(gadgetRef.id);
		this.setRowSelection(gadgetRef.id);
		this.setTableScrollBars(gadgetRef.id);
		//this.calculateColumnSum(gadgetRef.id);
    }, // deleteRows : function (aRefIn)

	calculateColumnSum : function (gadgetId)
	{
		var gadgetRef = document.getElementById(gadgetId);
		if(gadgetRef === null)
		{
			//window.alert("Gadget not found.");
			//window.status = "calculateColumnSum: Gadget not found - " + gadgetId;
			return;
		}
		
		var summand = 0;
		var sum = 0;
		var valueString = "";
		var tableGadgetSummandList = getElementsByClassName(gadgetRef, "tableGadgetSummand");
		for(var i = 0; i < tableGadgetSummandList.length; i++)
		{
			valueString = getInternalText(tableGadgetSummandList[i]);
			//alert(valueString);
			if(isNaN(parseInt(valueString, 10)))
			{
				continue;
			}
			
			//alert(valueString);
			
			summand = parseInt(valueString, 10);
			sum += summand;
			//window.alert(valueString + "|" + summand + "|" + sum);
		}

		var tableGadgetSumList = getElementsByClassName(gadgetRef, "tableGadgetSum");
		var text = null;
		for(var j = 0; j < tableGadgetSumList.length; j++)
		{
			while(tableGadgetSumList[j].childNodes.length > 0)
			{
				tableGadgetSumList[j].removeChild(tableGadgetSumList[j].childNodes[0]);
			}
			text = document.createTextNode(sum + " KB");
			tableGadgetSumList[j].appendChild(text);
		}
	}, // end calculateColumnSum : function (gadgetId)

	// ********************************************************************************************
	// ********************************************************************************************
	// ********************************************************************************************
	// ********************************************************************************************
	
	setTableScrollBars : function (gadgetId)
	{
		var that = this;
		var MINIMUM_WIDTH_OF_SCROLLBAR = 16;
		var MINIMUM_HEIGHT_OF_SCROLLBAR = 16;
		
		var gadgetRef = document.getElementById(gadgetId);
		if(gadgetRef === null)
		{
			//window.alert("setTableScrollBars: Gadget not found.");
			//window.status = "setTableScrollBars: Gadget not found - " + gadgetId;
			return;
		}
		var gadgetBodyList = null;
		var j = 0;
		var tableList = null;
		var tableWidth = 0;
		
		var useFloatingHeader = findClass(gadgetRef, "float");
		
		var isie = (typeof document.all !== "undefined" && typeof window.opera === "undefined" && navigator.vendor !== "KDE");
        if(!isie)
        {
		    gadgetBodyList = getElementsByClassName(gadgetRef, "tableGadgetBody");
		    for(j = 0; j < gadgetBodyList.length; j++)
		    {
                tableList = gadgetBodyList[j].getElementsByTagName("table");
                tableWidth = 0;
                if(tableList.length > 0)
                {
                    tableList[0].style.width = "100%";
                }
                gadgetBodyList[j].style.overflow = "auto";
                
                //if(useFloatingHeader)
                //{
                //    gadgetBodyList[j].onscroll = fxn;
                //}
            } // end for(j = 0; j < gadgetBodyList.length; j++)
        }
        else
        {
            tableList = gadgetRef.getElementsByTagName("table");
            tableWidth = 0;
            var tableHeight = 0;
            var gadgetOffsetWidth = 0;
            var gadgetClientWidth = 0;
            var gadgetOffsetHeight = 0;
            var gadgetClientHeight = 0;
            var scrollbarWidth = 0;
            var scrollbarHeight = 0;
            
		    gadgetBodyList = getElementsByClassName(gadgetRef, "tableGadgetBody");
		    for(j = 0; j < gadgetBodyList.length; j++)
		    {
                tableList = gadgetBodyList[j].getElementsByTagName("table");
                tableWidth = 0;
                if(tableList.length > 0)
                {
                    tableList[0].style.width = "100%";
                }

                gadgetBodyList[j].style.overflow = "auto";

                if(tableList.length > 0)
                {
                    tableWidth  = tableList[0].offsetWidth;
                    tableHeight = tableList[0].offsetHeight;
                }

                gadgetOffsetWidth  = gadgetBodyList[j].offsetWidth;
                gadgetClientWidth  = gadgetBodyList[j].clientWidth;
                gadgetOffsetHeight = gadgetBodyList[j].offsetHeight;
                gadgetClientHeight = gadgetBodyList[j].clientHeight;

                scrollbarWidth = gadgetOffsetWidth - gadgetClientWidth;
                scrollbarHeight = gadgetOffsetHeight - gadgetClientHeight;

                /*
                window.alert(
                    "id: " + gadgetRef.id + "\n" + 
                    "offset width: " + gadgetOffsetWidth + "\n" + 
                    "client width: " + gadgetClientWidth + "\n" + 
                    "offset height: " + gadgetOffsetHeight + "\n" + 
                    "client height: " + gadgetClientHeight + "\n" + 
                    "scroll bar width: " + scrollbarWidth + "\n" + 
                    "scroll bar height: " + scrollbarHeight + "\n" + 
                    "table width: " + tableWidth + "\n" + 
                    "table height: " + tableHeight
                    );
                */

                if(tableList.length > 0)
                {
                    tableWidth  = tableList[0].offsetWidth;
                    tableHeight = tableList[0].offsetHeight;
                }

                if(scrollbarWidth >= MINIMUM_WIDTH_OF_SCROLLBAR)
                {
                    if(scrollbarHeight >= MINIMUM_HEIGHT_OF_SCROLLBAR)
                    {
                        // vertical and horizontal scrollbar present
                        if(tableList.length > 0)
                        {
                            //window.alert("before v and h");
                            tableList[0].style.width = gadgetClientWidth + "px";
                            gadgetBodyList[j].style.overflow = "hidden";
                            gadgetBodyList[j].style.overflow = "scroll";
                            //window.alert("after v and h");
                        }    
                    }
                    else
                    {
                        // vertical scrollbar present
                        if(tableList.length > 0)
                        {
                            tableList[0].style.width = gadgetClientWidth + "px";
                            gadgetBodyList[j].style.overflow = "hidden";
                            gadgetBodyList[j].style.overflow = "scroll";
                        }    
                    }
                }
                else
                {
                    if(scrollbarHeight >= MINIMUM_HEIGHT_OF_SCROLLBAR)
                    {
                        // horizontal scrollbar present
                        if(tableList.length > 0)
                        {
                            tableList[0].style.width = gadgetClientWidth + "px";
                            gadgetBodyList[j].style.overflow = "hidden";
                            gadgetBodyList[j].style.overflow = "auto";
                        }    
                    }
                    else
                    {
                        // no scrollbar present
                    }
                }
                
                /*
                if(tableList.length > 0)
                {
                    tableWidth = tableList[0].offsetWidth;
                    tableHeight = tableList[0].offsetHeight;
                }
                
                gadgetOffsetWidth  = gadgetBodyList[j].offsetWidth;
                gadgetClientWidth  = gadgetBodyList[j].clientWidth;
                gadgetOffsetHeight = gadgetBodyList[j].offsetHeight;
                gadgetClientHeight = gadgetBodyList[j].clientHeight;
                
                scrollbarWidth = gadgetOffsetWidth - gadgetClientWidth;
                scrollbarHeight = gadgetOffsetHeight - gadgetClientHeight;
                
                window.alert(
                    "id: " + gadgetRef.id + "\n" + 
                    "offset width: " + gadgetOffsetWidth + "\n" + 
                    "client width: " + gadgetClientWidth + "\n" + 
                    "offset height: " + gadgetOffsetHeight + "\n" + 
                    "client height: " + gadgetClientHeight + "\n" + 
                    "scroll bar width: " + scrollbarWidth + "\n" + 
                    "scroll bar height: " + scrollbarHeight + "\n" + 
                    "table width: " + tableWidth + "\n" + 
                    "table height: " + tableHeight
                    );
                */

                //if(useFloatingHeader)
                //{
                //    gadgetBodyList[j].onscroll = fxn;
                //}

            } // end for(j = 0; j < gadgetBodyList.length; j++)
        } // end if(!isie)
	}, // setTableScrollBars : function (gadgetId)
	
	// ********************************************************************************************
	// ********************************************************************************************
	// ********************************************************************************************
	// ********************************************************************************************
	
	setRowSelection : function (gadgetId)
	{
		var fxn = null;
		var that = this;
		var rowIndex = 0;
		
		var gadgetRef = document.getElementById(gadgetId);
		if(gadgetRef === null)
		{
			//window.alert("Gadget not found.");
			//window.status = "setRowSelection: Gadget not found - " + gadgetId;
			return;
		}

		if(!findClass(gadgetRef, "select"))
		{
			return;
		}
		//window.alert("select");
		
		var tableList = gadgetRef.getElementsByTagName("table");
		if(tableList.length === 0)
		{
			//window.alert("Table list not found.");
			//window.status = "setRowSelection: Table list not found.";
			return;
		}
		
		var tableRef = tableList[0];
		if(tableRef === null)
		{
			//window.alert("Table not found.");
			//window.status = "setRowSelection: Table not found.";
			return;
		}
		
		var targetTbodyList = tableRef.getElementsByTagName("tbody");
		if(targetTbodyList.length === 0)
		{
			//window.alert("Table body list not found.");
			//window.status = "setRowSelection: Table body list not found.";
			return;
		}
		
		var targetTbody = targetTbodyList[0];
		if(targetTbody === null)
		{
			//window.alert("setRowSelection: Table body not found.");
			//window.status = "setRowSelection: Table body not found.";
			return;
		}
		
		var targetTrs = targetTbody.getElementsByTagName("tr");
		if(targetTrs.length === 0)
		{
		    //window.alert = "Table has no rows.";
		    //window.status = "setRowSelection: Table has no rows in gadget " + gadgetId;
		    return;
		}
		
		fxn = function (event)
		{
	        //if(typeof event === "undefined")
	        //{
	        //    event = window.event;
	        //}
            //var targetElement = getEventTarget(event);
		
			//that.clearAlternatingRows(gadgetId);
			//that.setAlternatingRows(gadgetId);
			
			that.clearRowSelection(gadgetId);
			
			addClass(this, "selected");
		};
		var targetTrsLength = targetTrs.length;
		for(var i = 0; i < targetTrsLength; i++)
		{
			rowIndex++;
			targetTrs[i].onclick = fxn;
		}
	}, // end setRowSelection : function (gadgetId)
	
	clearRowSelection : function (gadgetId)
	{
		var gadgetRef = document.getElementById(gadgetId);
		if(gadgetRef === null)
		{
			//window.alert("Gadget not found.");
			//window.status = "clearRowSelection: Gadget not found - " + gadgetId;
			return;
		}
		
		if(!findClass(gadgetRef, "select"))
		{
			return;
		}
		//window.alert("alternate");

		var tableList = gadgetRef.getElementsByTagName("table");
		if(tableList.length === 0)
		{
			//window.alert("Table list not found.");
			//window.status = "clearRowSelection: Table list not found.";
			return;
		}

		var tableRef = tableList[0];
		if(tableRef === null)
		{
			//window.alert("Table not found.");
			//window.status = "clearRowSelection: Table not found.";
			return;
		}
		
		var targetTbodyList = tableRef.getElementsByTagName("tbody");
		if(targetTbodyList.length === 0)
		{
			//window.alert("Table body list not found.");
			//window.status = "clearRowSelection: Table body list not found.";
			return;
		}
		
		var targetTbody = targetTbodyList[0];
		if(targetTbody === null)
		{
			//window.alert("Table body not found.");
			//window.status = "clearRowSelection: Table body not found.";
			return;
		}
		
		var targetTrs = targetTbody.getElementsByTagName("tr");
		if(targetTrs.length === 0)
		{
		    //window.alert = "Table has no rows.";
		    //window.status = "clearRowSelection: Table has no rows in gadget " + gadgetId;
		    return;
		}
		
		var selectedList = getElementsByClassName(targetTbody, "selected");
		for(var j = 0; j < selectedList.length; j++)
		{
		    removeClass(selectedList[j], "selected");
		}
    }, // end clearRowSelection : function (gadgetId)
	
	setRowHighlight : function (gadgetId)
	{
		var fxn = null;
		var fxn2 = null;
		var i = 0;
		var rowIndex = 0;
		var that = this;

		var gadgetRef = document.getElementById(gadgetId);
		if(gadgetRef === null)
		{
			//window.alert("Gadget not found.");
			//window.status = "setRowHighlight: Gadget not found - " + gadgetId;
			return;
		}
		
		if(!findClass(gadgetRef, "highlight"))
		{
			return;
		}
		//window.alert("highlight");

		var tableList = gadgetRef.getElementsByTagName("table");
		if(tableList.length === 0)
		{
			//window.alert("Table list not found.");
			//window.status = "setRowHighlight: Table list not found.";
			return;
		}

		var tableRef = tableList[0];
		if(tableRef === null)
		{
			//window.alert("Table not found.");
			//window.status = "setRowHighlight: Table not found.";
			return;
		}
		
		var targetTbodyList = tableRef.getElementsByTagName("tbody");
		if(targetTbodyList.length === 0)
		{
			//window.alert("Table body list not found.");
			//window.status = "setRowHighlight: Table body list not found.";
			return;
		}
		
		var targetTbody = targetTbodyList[0];
		if(targetTbody === null)
		{
			//window.alert("Table body not found.");
			//window.status = "setRowHighlight: Table body not found.";
			return;
		}
		
		var targetTrs = targetTbody.getElementsByTagName("tr");
		if(targetTrs.length === 0)
		{
		    //window.alert = "Table has no rows.";
		    //window.status = "setRowHighlight: Table has no rows in gadget " + gadgetId;
		    return;
		}

        // mouseover
		fxn = function (event)
		{
	        if(typeof event === "undefined")
	        {
	            event = window.event;
	        }
            var targetElement = getEventTarget(event);
			//document.title = "over: " + this.nodeName;
			addClass(this, "highlight");
		};
		// mouseout
		fxn2 = function (event)
		{
	        if(typeof event === "undefined")
	        {
	            event = window.event;
	        }
            var targetElement = getEventTarget(event);
	        
			//document.title = "out: " + this.nodeName;
			removeClass(this, "highlight");
		};
		var targetTrsLength = targetTrs.length;
		for(i = 0; i < targetTrsLength; i++)
		{
			rowIndex++;
			targetTrs[i].onmouseover = fxn;
			targetTrs[i].onmouseout = fxn2;
		}
		//that.clearAlternatingRows(gadgetId);
		//that.setAlternatingRows(gadgetId);
		
		fxn = null;
		fxn2 = null;
		gadgetRef = null;
		i = 0;
		rowIndex = 0;
		tableRef = null;
		targetTbody = null;
		targetTrs = null;
		that = null;
	}, // end setRowHighlight : function (gadgetId)
	
	setAlternatingRows : function (gadgetId)
	{
	    var that = this;
	    
		var gadgetRef = document.getElementById(gadgetId);
		if(gadgetRef === null)
		{
			//window.alert("Gadget not found.");
			//window.status = "setAlternatingRows: Gadget not found - " + gadgetId;
			return;
		}
		
		if(!findClass(gadgetRef, "alternate"))
		{
			return;
		}
		//window.alert("alternate");

		var tableList = gadgetRef.getElementsByTagName("table");
		if(tableList.length === 0)
		{
			//window.alert("Table list not found.");
			//window.status = "setAlternatingRows: Table list not found.";
			return;
		}

		var tableRef = tableList[0];
		if(tableRef === null)
		{
			//window.alert("Table not found.");
			//window.status = "setAlternatingRows: Table not found.";
			return;
		}
		
		var targetTbodyList = tableRef.getElementsByTagName("tbody");
		if(targetTbodyList.length === 0)
		{
			//window.alert("Table body list not found.");
			//window.status = "setAlternatingRows: Table body list not found.";
			return;
		}
		
		var targetTbody = targetTbodyList[0];
		if(targetTbody === null)
		{
			//window.alert("Table body not found.");
			//window.status = "setAlternatingRows: Table body not found.";
			return;
		}
		
		var targetTrs = targetTbody.getElementsByTagName("tr");
		if(targetTrs.length === 0)
		{
		    //window.alert = "Table has no rows.";
		    //window.status = "setAlternatingRows: Table has no rows in gadget " + gadgetId;
		    return;
		}
		
        that.clearRowSelection(gadgetId);
		
		var rowIndex = 0;
		var targetTrsLength = targetTrs.length;
		var targetTrsItem = null;
		for(var i = 0; i < targetTrsLength; i++)
		{
			rowIndex++;
			targetTrsItem = targetTrs[i];
			if(rowIndex % 2 === 0)
			{
				// even
				changeClass(targetTrsItem, "odd", "even");
			}
			else
			{
				// odd
				changeClass(targetTrsItem, "even", "odd");
			}
			/* roark 20090710 */
			//removeClass(targetTrsItem, "selected");
		} // end for(var i = 0; i < targetTrsLength; i++)
		
		that = null;
		gadgetRef = null;
		tableList = null;
		tableRef = null;
		targetTbodyList = null;
		targetTbody = null;
		targetTrs = null;
		rowIndex = 0;
		targetTrsLength = 0;
		targetTrsItem = null;
	}, // end setAlternatingRows : function (gadgetId)

	clearAlternatingRows : function (gadgetId)
	{
		var gadgetRef = document.getElementById(gadgetId);
		if(gadgetRef === null)
		{
			//window.alert("Gadget not found.");
			//window.status = "clearAlternatingRows: Gadget not found - " + gadgetId;
			return;
		}
		
		if(!findClass(gadgetRef, "alternate"))
		{
			return;
		}
		//window.alert("alternate");

		var tableList = gadgetRef.getElementsByTagName("table");
		if(tableList.length === 0)
		{
			//window.alert("Table list not found.");
			//window.status = "clearAlternatingRows: Table list not found.";
			return;
		}

		var tableRef = tableList[0];
		if(tableRef === null)
		{
			//window.alert("Table not found.");
			//window.status = "clearAlternatingRows: Table not found.";
			return;
		}
		
		var targetTbodyList = tableRef.getElementsByTagName("tbody");
		if(targetTbodyList.length === 0)
		{
			//window.alert("Table body list not found.");
			//window.status = "clearAlternatingRows: Table body list not found.";
			return;
		}
		
		var targetTbody = targetTbodyList[0];
		if(targetTbody === null)
		{
			//window.alert("Table body not found.");
			//window.status = "clearAlternatingRows: Table body not found.";
			return;
		}
		
		var targetTrs = targetTbody.getElementsByTagName("tr");
		if(targetTrs.length === 0)
		{
		    //window.alert = "Table has no rows.";
		    //window.status = "clearAlternatingRows: Table has no rows in gadget " + gadgetId;
		    return;
		}
		
		var rowIndex = 0;
		var targetTrsLength = targetTrs.length;
		var targetTrsItem = null;
		for(var i = 0; i < targetTrsLength; i++)
		{
		    targetTrsItem = targetTrs[i];
			removeClass(targetTrsItem, "odd");
			removeClass(targetTrsItem, "even");
			removeClass(targetTrsItem, "selected");
		}
		
		gadgetRef = null;
		tableList = null;
		tableRef = null;
		targetTbodyList = null;
		targetTbody = null;
		targetTrs = null;
		rowIndex = 0;
		targetTrsLength = 0;
		targetTrsItem = null;
	}, // end clearAlternatingRows : function (gadgetId)
	
	setTableClassNames : function (gadgetId)
	{
		var a = null;
		var colHeading = "";
		var eventHandlersOk = false;
		var fxn = null;
		var innerHTML = "";
		var text = null;
		var that = this;
		var toggleList = null;
		var tableSortList = null;

		var gadgetRef = document.getElementById(gadgetId);
		if(gadgetRef === null)
		{
			//window.alert("Invalid gadget id.");
			//window.status = "setTableClassNames: Invalid gadget id - " + gadgetId;
			return false;
		}

		var captionList = getElementsByClassName(gadgetRef, "tableGadgetCaption");
		if(captionList.length === 0)
		{
			//window.alert("Caption not found.");
			//window.status = "setTableClassNames: Caption not found in gadget " + gadgetId;
			return false;
		}

		var headerList = getElementsByClassName(gadgetRef, "tableGadgetHeader");
		if(headerList.length === 0)
		{
			//window.alert("Table gadget header not found.");
			//window.status = "setTableClassNames: Table gadget header not found in gadget " + gadgetId;
			return false;
		}

		var bodyList = getElementsByClassName(gadgetRef, "tableGadgetBody");
		if(bodyList.length === 0)
		{
			//window.alert("Table gadget body not found.");
			//window.status = "setTableClassNames: Table gadget body not found in gadget " + gadgetId;
			return false;
		}

		/*
		if(findClass(gadgetRef, "toggle"))
		{
			if(findClass(captionList[0], "tableGadgetToggleShow"))
			{
				addClass(bodyList[0], "tableGadgetBodyShow");
				changeClass(headerList[0], "tableGadgetHeaderHideBody", "tableGadgetHeaderShowBody");
				captionList[0].title = "Click to hide table. . .";
			}
			else if(findClass(captionList[0], "tableGadgetToggleHide"))
			{
				addClass(bodyList[0], "tableGadgetBodyHide");
				changeClass(headerList[0], "tableGadgetHeaderShowBody","tableGadgetHeaderHideBody");
				captionList[0].title = "Click to show table. . .";
			}
			else
			{
				window.alert("Unknown toggle state.");
				window.status = "Unknown toggle state.";
				return false;
			}
		}
		else
		{
			addClass(bodyList[0], "tableGadgetBodyShow");
			addClass(captionList[0], "tableGadgetToggleOff");
		}
		*/
		
		var tableList = gadgetRef.getElementsByTagName("table");
		if(tableList.length === 0)
		{
			//window.alert("Table list not found.");
			//window.status = "setTableClassNames: Table list not found in gadget " + gadgetId;
		    return false;
		}
		
		var tableRef = tableList[0];
		if(tableRef === null)
		{
			//window.alert("Table not found.");
			//window.status = "setTableClassNames: Table not found in gadget " + gadgetId;
			return false;
		}
		
		
		/*
		tableRef.onresize = function (event)
		{
		    window.alert("resize. . .");
		};
		*/


		var theadList = gadgetRef.getElementsByTagName("thead");
		if(theadList.length === 0)
		{
			//window.alert("Table head list not found.");
			//window.status = "setTableClassNames: Table head list not found in gadget " + gadgetId;
		    return false;
		}

		var theadRef = theadList[0];
		if(theadRef === null)
		{
			//window.alert("Table head not found.");
			//window.status = "setTableClassNames: Table head not found in gadget " + gadgetId;
			return false;
		}

		var thList = theadRef.getElementsByTagName("th");
		if(thList.length === 0)
		{
			//window.alert("Column names not found.");
			//window.status = "setTableClassNames: Column names not found in gadget " + gadgetId;
			return false;
		}



        /*
		var tbodyList = gadgetRef.getElementsByTagName("tbody");
		if(tbodyList.length === 0)
		{
			//window.alert("Table head list not found.");
			//window.status = "setTableClassNames: Table head list not found.";
		    //return false;
		}
		else
		{
		    var tbodyRef = tbodyList[0];
		    window.alert("got tbody. . .");
		    tbodyRef.onresize = function (event)
		    {
		        window.alert("resize. . .");
		    };
		}
        */
        
        
		
		// replace text within <th> tag with <a> tag
		/*
		for(var i = 0; i < thList.length; i++)
		{
			//if(findClass(thList[i], "sort"))
			if(findClass(thList[i], "sort") || 
				findClass(thList[i], "sortInitial") ||
				findClass(thList[i], "sortInitialAsc") ||
				findClass(thList[i], "sortInitialDesc")	)
			{
				colHeading = getInternalText(thList[i]);
				a = document.createElement("a");
				a.href = "#null";
				a.className = "tableSort tableSortOff";
				text = document.createTextNode(colHeading);
				a.title = "Click to sort. . .";
				a.appendChild(text);
				thList[i].replaceChild(a, thList[i].firstChild);
			}
		}
		*/
		for(var i = 0; i < thList.length; i++)
		{
			if(findClass(thList[i], "sort") || 
				findClass(thList[i], "sortInitial") ||
				findClass(thList[i], "sortInitialAsc") ||
				findClass(thList[i], "sortInitialDesc"))
			{
			    /*
				colHeading = getInternalText(thList[i]);
				a = document.createElement("a");
				a.href = "#null";
				a.className = "tableSort tableSortOff";
				text = document.createTextNode(colHeading);
				a.title = "Click to sort. . .";
				a.appendChild(text);
				thList[i].replaceChild(a, thList[i].firstChild);
				*/
				
				// test if <th> has been formatted
				tableSortList = getElementsByClassName(thList[i], "tableSort");
				if(tableSortList.length === 0)
				{
				    // <th> has not been formatted - do formatting
			        innerHTML = thList[i].innerHTML;
			        thList[i].innerHTML = "";
				    thList[i].innerHTML = "<a href='#null' class='tableSort tableSortOff' title='Click to sort. . .'>" + innerHTML + "</a>";
				}
				
				//a = null;
				innerHTML = "";
			} // end if(findClass(thList[i], "sort") || 
		} // end for(var i = 0; i < thList.length; i++)

        a = null;
        colHeading = "";
        eventHandlersOk = false;
        fxn = null;
        innerHTML = "";
        text = null;
        that = this;
        toggleList = null;
        gadgetRef = null;
        captionList = null;
        headerList = null;
        bodyList = null;
        tableList = null;
        tableRef = null;
        tableSortList = null;
        theadList = null;
        theadRef = null;
        thList = null;
		
		return true;
	}, // end setTableClassNames : function (gadgetId)
	
	createShowHideEventHandlers : function (gadgetId)
	{
		var captionList = null;
		var eventHandlersOk = false;
		var fxn = null;
		var gadgetRef = null;
		var that = this;
		var toggleList = null;

		// verify table gadget was created properly
		gadgetRef = document.getElementById(gadgetId);
		if(gadgetRef === null)
		{
			//window.alert("Invalid gadget id.");
			//window.status = "createShowHideEventHandlers: Invalid gadget id - " + gadgetId;
			return false;
		}
		
		if(!findClass(gadgetRef, "toggle"))
		{
			return true;
		}
		
		captionList = getElementsByClassName(gadgetRef, "tableGadgetCaption");
		if(captionList.length === 0)
		{
			//window.alert("Caption not found.");
			//window.status = "createShowHideEventHandlers: Caption not found in gadget " + gadgetId;
			return false;
		}
		
		// show/hide table
		fxn = function (event)
		{
			if(typeof event === "undefined")
			{
			    event = window.event;
			}
			var targetElement = getEventTarget(event);
		
			var bodyList = null;
			var headerList = null;
			var tableIdRef = null;
	        var toggleList = null;
            var tableList = null;
	        
			//alert("begin show hide");
			tableIdRef = document.getElementById(gadgetId);
			if(tableIdRef === null)
			{
				//window.alert("Table id not found.");
				//window.status = "Table id not found.";
				return false;
			}
			captionList = getElementsByClassName(tableIdRef, "tableGadgetCaption");
			if(captionList.length === 0)
			{
				//window.alert("Caption not found.");
				//window.status = "Caption not found.";
				return false;
			}
			headerList = getElementsByClassName(tableIdRef, "tableGadgetHeader");
			if(headerList.length === 0)
			{
				//window.alert("Table gadget header not found.");
				//window.status = "Table gadget header not found.";
				return false;
			}
			
			bodyList = getElementsByClassName(tableIdRef, "tableGadgetBody");
			if(bodyList.length === 0)
			{
				//window.alert("Table gadget body not found.");
				//window.status = "Table gadget body not found.";
				return false;
			}
			if(findClass(captionList[0], "tableGadgetToggleShow"))
			{
				changeClass(captionList[0], "tableGadgetToggleShow", "tableGadgetToggleHide");
				changeClass(bodyList[0], "tableGadgetBodyShow", "tableGadgetBodyHide");
				changeClass(headerList[0], "tableGadgetHeaderShowBody", "tableGadgetHeaderHideBody");
				captionList[0].title = "Click to show table. . .";
			}
			else if(findClass(captionList[0], "tableGadgetToggleHide"))
			{
				changeClass(captionList[0], "tableGadgetToggleHide", "tableGadgetToggleShow");
				changeClass(bodyList[0], "tableGadgetBodyHide", "tableGadgetBodyShow");
				changeClass(headerList[0], "tableGadgetHeaderHideBody", "tableGadgetHeaderShowBody");
				captionList[0].title = "Click to hide table. . .";
			}
			else if(findClass(captionList[0], "tableGadgetToggleOff"))
			{
				changeClass(captionList[0], "tableGadgetToggleHide", "tableGadgetToggleOff");
				changeClass(bodyList[0], "tableGadgetBodyHide", "tableGadgetBodyShow");
				changeClass(headerList[0], "tableGadgetHeaderHideBody", "tableGadgetHeaderShowBody");
			}
			else
			{
				window.alert("Unknown toggle state.");
			}
			//alert("end show hide");
			return false;
		}; // end fxn = function (event)
		captionList[0].onclick = fxn;

		// change cursor to pointer		
		fxn = function (event)
		{
			if(typeof event === "undefined")
			{
			    event = window.event;
			}
			var targetElement = getEventTarget(event);

			var tableIdRef = null;
	        var toggleList = null;
            var tableList = null;
	        

			tableIdRef = document.getElementById(gadgetId);
			if(tableIdRef === null)
			{
				//window.status = "Table id not found.";
				return false;
			}
			captionList = getElementsByClassName(tableIdRef, "tableGadgetCaption");
			if(captionList.length === 0)
			{
				//window.status = "Caption not found.";
				return false;
			}
			tableList = getElementsByClassName(tableIdRef, "tableGadgetBody");
			if(tableList.length === 0)
			{
				//window.status = "Table not found.";
				return false;
			}
			
			targetElement.style.cursor = "pointer";
			
			return false;
		}; // end fxn = function (event)
		captionList[0].onmouseover = fxn;
		
        return true;
	}, // end createShowHideEventHandlers : function (gadgetId)

	createSortEventHandlers : function (gadgetId)
	{
		var eventHandlersOk = false;
		var fxn = null;
		var gadgetRef = null;
		var i = 0;
		var sortList = null;
		var that = this;
		var toggleList = null;
		
		// verify table gadget was created properly
		gadgetRef = document.getElementById(gadgetId);
		if(gadgetRef === null)
		{
			//window.alert("Invalid table gadget id.");
			//window.status = "createSortEventHandlers: Invalid table gadget id - " + gadgetId;
			return false;
		}
		
		sortList = getElementsByClassName(gadgetRef, "tableSort");
		if(sortList.length === 0)
		{
			//window.alert("Sort elements not found.");
			//window.status = "Sort elements not found.";
			return true;
		}
		
		fxn = function (event)
		{
	        if(typeof event === "undefined")
	        {
	            event = window.event;
	        }
			var targetElement = getEventTarget(event);

			var columnIndex = 0;
			var columnText = "";
			var direction = "";
			var tableIdRef = null;
	        var toggleList = null;
	        var sortList = null;
	        var i = 0;
	        var innerHTML = "";
	        
			
			
	        //window.alert(targetElement.className + "||" + targetElement.nodeName + "||" + targetElement.innerHTML);
			
			
			tableIdRef = document.getElementById(gadgetId);
			if(tableIdRef === null)
			{
				//window.alert("Table id not found.");
				//window.status = "Table id not found.";
				return false;
			}
			sortList = getElementsByClassName(tableIdRef, "tableSort");
			if(sortList.length === 0)
			{
				//window.alert("Sort elements not found.");
				//window.status = "Sort elements not found.";
				return false;
			}
			
			for(i = 0; i < sortList.length; i++)
			{
				if(this === sortList[i])
				{
					//columnIndex = i;
					columnIndex = this.parentNode.cellIndex;
					continue;
				}
				changeClass(sortList[i], ["tableSortAsc","tableSortDesc"], "tableSortOff");
				sortList[i].title = "Click to sort. . .";
			}
			
			//columnText = targetElement.firstChild.nodeValue;
			innerHTML = this.innerHTML;
		
			if(findClass(this, "tableSortAsc"))
			{
				changeClass(this, "tableSortAsc", "tableSortDesc");
				direction = "DESC";
				this.title = "Click to sort ascending. . .";
			}
			else if(findClass(this, "tableSortDesc"))
			{
				changeClass(this, "tableSortDesc", "tableSortAsc");
				direction = "ASC";
				this.title = "Click to sort descending. . .";
			}
			else if(findClass(this, "tableSortOff"))
			{
				changeClass(this, "tableSortOff", "tableSortAsc");
				direction = "ASC";
				this.title = "Click to sort descending. . .";
			}
			that.sortTable(gadgetId, direction, innerHTML, columnIndex);
			
			
			columnIndex = 0;
			columnText = "";
			direction = "";
			tableIdRef = null;
	        targetElement = null;
	        toggleList = null;
	        sortList = null;
	        i = 0;
	        innerHTML = "";
			
			return false;
		}; // end fxn = function (event)
		
		for(i = 0; i < sortList.length; i++)
		{
			sortList[i].onclick = fxn;
		}
		
		eventHandlersOk = false;
		fxn = null;
		gadgetRef = null;
		i = 0;
		sortList = null;
		that = this;
		toggleList = null;
		
        return true;
	}, // end createSortEventHandlers : function (gadgetId)

	sortTable : function (gadgetId, direction, columnText, columnIndex)
	{
		var gadgetRef = null;
		var i = 0;
		var j = 0;
		var newTbody = null;
		var newTrs = null;
		var newValue = "";
		var newValueFmt = 0.0;
		var tableList = null;
		var tableRef = null;
		var targetTbodyList = null;
		var targetTbody = null;
		var targetTrs = null;
		var targetValue = "";
		var targetValueFmt = 0.0;
		var that = this;
		var tr = null;
		var newTrsLength = 0;
	
		gadgetRef = document.getElementById(gadgetId);
		if(gadgetRef === null)
		{
			//window.alert("Table gadget not found.");
			//window.status = "sortTable: Table gadget not found.";
			return;
		}

        /*
        var captionList = getElementsByClassName(gadgetRef, "tableGadgetCaption");
        if(captionList.length > 0)
        {
            captionList[0].innerHTML = "Sorting. . .";
        }
        */

        tableList = gadgetRef.getElementsByTagName("table");
        if(tableList.length === 0)
        {
			//window.alert("sortTable: Table list not found.");
			//window.status = "sortTable: Table list not found.";
			return;
        }
        
		tableRef = tableList[0];
		if(tableRef === null)
		{
			//window.alert("Table not found.");
			//window.status = "sortTable: Table not found.";
			return;
		}

		targetTbodyList = tableRef.getElementsByTagName("tbody");
		if(targetTbodyList.length === 0)
		{
			//window.alert("Table body list not found.");
			//window.status = "sortTable: Table body list not found.";
			return;
		}
		
		targetTbody = tableRef.getElementsByTagName("tbody");
		if(targetTbody.length === 0)
		{
			//window.alert("Table body not found.");
			//window.status = "sortTable: Table body not found.";
			return;
		}
		
		var node = null;
		targetTbody = targetTbodyList[0];
		
		newTbody = targetTbody.cloneNode(false);
		targetTrs = targetTbody.getElementsByTagName("tr");
		
		
		
		// ****************************************************************************************
		// ****************************************************************************************
		// ****************************************************************************************
		//var oldTbody = tableRef.removeChild(targetTbody);
		//targetTrs = oldTbody.getElementsByTagName("tr");
		//newTbody = oldTbody.cloneNode(false);
		// ****************************************************************************************
		// ****************************************************************************************
		// ****************************************************************************************
		
		
		
		while(targetTrs.length > 0)
		{
			newTrs = newTbody.childNodes;
			targetValue = getInternalText(targetTrs[0].getElementsByTagName("td")[columnIndex]);
			newTrsLength = newTrs.length;
			for(j = 0; j < newTrsLength; j++)
			{
				newValue = getInternalText(newTrs[j].getElementsByTagName("td")[columnIndex]);
				
				if(!isNaN(Date.parse(targetValue)) && !isNaN(Date.parse(newValue)))
				{
					targetValueFmt = Date.parse(targetValue);
					newValueFmt = Date.parse(newValue);
				}
				else if(!isNaN(parseInt(targetValue, 10)) && !isNaN(parseInt(newValue, 10)))
				{
					targetValueFmt = parseInt(targetValue, 10);
					newValueFmt = parseInt(newValue, 10);
				}
				else if(!isNaN(parseFloat(targetValue)) && !isNaN(parseFloat(newValue)))
				{
					targetValueFmt = parseFloat(targetValue);
					newValueFmt = parseFloat(newValue);
				}
				else
				{
					targetValueFmt = targetValue;
					newValueFmt = newValue;
				}
				if(direction === "DESC")
				{
					if(targetValueFmt >= newValueFmt)
					{
						break;
					}
				}
				else
				{
					if(targetValueFmt <= newValueFmt)
					{
						break;
					}
				}
			} // end for(j = 0; j < newTrsLength; j++)
			
			if(j >= newTrsLength)
			//if(j >= newTrs.length)
			{
				node = targetTrs[0];
				newTbody.appendChild(node);
			}
			else
			{
				node = targetTrs[0];
				newTbody.insertBefore(node, newTrs[j]);
			}
		} // end while(targetTrs.length > 0)
		
		tableRef.replaceChild(newTbody, targetTbody);

		
		// ****************************************************************************************
		// ****************************************************************************************
		//targetTbody.parentNode.removeChild(targetTbody);
		// ****************************************************************************************
		// ****************************************************************************************


		//that.clearAlternatingRows(gadgetId);
		that.setAlternatingRows(gadgetId);
		that.setRowHighlight(gadgetId);
		that.setRowSelection(gadgetId);
		
        /*
        if(captionList.length > 0)
        {
            captionList[0].innerHTML = "";
        }
        */
		
		gadgetRef = null;
		i = 0;
		j = 0;
		newTbody = null;
		newTrs = null;
		newValue = "";
		newValueFmt = 0.0;
		tableRef = null;
		targetTbody = null;
		targetTrs = null;
		targetValue = "";
		targetValueFmt = 0.0;
		that = this;
		tr = null;
		newTrsLength = 0;
	} // end sortTable : function (gadgetId, direction, columnText, columnIndex)
}; // end var BLK.EBIZ.Table =
BLK.EBIZ.Table.tableEmptyMessage = "No data found.";
var EBIZ_TABLE = BLK.EBIZ.Table;
// ************************************************************************************************
// end table.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2010/10/19 14:00:00 $
*       Filename:  $RCSfile: tabs.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin tabs.js
// ************************************************************************************************

/*global BLK, addClass, alert, document, randomBetween, findClass, getElementsByClassName, 
getEventTarget, removeClass, window, escape, unescape, getCookie, getSubCookie, setCookie, 
attachEventListener, getValueFromURL */

BLK.EBIZ.Tabs = function()
{
    var that = this;
    this.EXPIRE_DAYS = 90;

    this.setup = function()
    {
        var prompt = "";

        var tabGadgetList = getElementsByClassName(document.body, "tabGadget");
        var tabGadgetHeaderListLinkList = null;
        var tabGadgetBodyItemList = null;
        var tab = null;

        var rel = "";
        var id = "";
        var cookieRel = "";
        var cookieId = "";

        var tabGadgetBodyItemRef = null;
        //var found = false;
        //var node = null;
        var tabGadgetOn = false;
        var tabGadgetOnClick = true;
        var tabGadgetRandom = false;
        var tabGadgetRemember = false;
        var tabGadgetQueryString = false;

        var randomIndex = -1;
        var randomSelectArray = [];

        var rememberIndex = -1;
        var rememberSelectArray = [];

        var numberOfTopLevelLinks = 0;
        var currentIndex = -1;
        var item = null;
        var link = null;
        var body = null;

        // scan for each tab gadget
        for(var i = 0; i < tabGadgetList.length; i++)
        {
            //window.alert(tabGadgetList[i].className);

            tabGadgetOn = true;
            if(findClass(tabGadgetList[i], "tabGadgetOff"))
            {
                tabGadgetOn = false;
                // hide tab header
                // do not setup event handlers for tab header
                // show all tabs
            }
            tabGadgetOnClick = true;
            if(findClass(tabGadgetList[i], "tabGadgetOnMouseOver"))
            {
                tabGadgetOnClick = false;
                // hide tab header
                // do not setup event handlers for tab header
                // show all tabs
            }

            // set gadget type flags            
            // query string
            var qsTabName = getValueFromURL("tab");
            var qsTabNameRef = null;
            var qsTabNameFound = false;
            if(qsTabName === "")
            {
                prompt = "Tab gadget: query string tab name not specified. . .";
                BLK.EBIZ.trace(prompt);
                qsTabNameFound = false;
                tabGadgetQueryString = false;
            }
            else
            {
                prompt = "Tab gadget: query string tab name. . ." + qsTabName;
                // query string overrides remember and random
                tabGadgetQueryString = true;
            }

            // random
            tabGadgetRandom = false;
            randomSelectArray = [];
            if(findClass(tabGadgetList[i], "tabGadgetRandom"))
            {
                tabGadgetRandom = true;
            }

            // remember
            tabGadgetRemember = false;
            if(findClass(tabGadgetList[i], "tabGadgetRemember"))
            {
                tabGadgetRemember = true;
            }

            // set overrides
            if(tabGadgetQueryString)
            {
                tabGadgetRemember = false;
                tabGadgetRandom = false;
            }
            else if(tabGadgetRemember)
            {
                tabGadgetRandom = false;
            }


            // is <a>
            tabGadgetHeaderListLinkList = getElementsByClassName(tabGadgetList[i], "tabGadgetHeaderListLink");
            numberOfTopLevelLinks = tabGadgetHeaderListLinkList.length;
            currentIndex = -1;
            item = null;
            link = null;
            body = null;

            id = tabGadgetList[i].getAttribute("id");
            if(id === null || id === "")
            {
                id = "";
                if(tabGadgetRemember)
                {
				    prompt = "Tab gadget: id missing for tab " + (i + 1);
				    //window.alert(prompt);
                    BLK.EBIZ.trace(prompt);				        
                    tabGadgetRemember = false;
                }
            } // end if(id === null || id === "")

            var cookieFound = true;

            cookieRel = unescape(getSubCookie("tabGadgetRemember", id));


            if(cookieRel === "undefined" || cookieRel === "" || cookieRel === null)
            {
                cookieRel = "";
                cookieFound = false;
            }

            var cookieRelSet = false;
            var firstTab = true;
            var firstTabRef = null;
            var firstTabBodyRef = null;
            var foundQsTab = false;
            // scan for each tab with tab gadget

            for(var j = 0; j < tabGadgetHeaderListLinkList.length; j++)
            {
                // ********************************************************************************
                // begin skip nested tab controls
                // ********************************************************************************
                var node = tabGadgetHeaderListLinkList[j];
                var found = false;
                while(node !== null)
                {
                    if(findClass(node, "tabGadget"))
                    {
                        found = true;
                        break;
                    }
                    node = node.parentNode;
                }
                if(found)
                {
                    if(node !== tabGadgetList[i])
                    {
                        numberOfTopLevelLinks--;
                        continue;
                    }
                }
                // ********************************************************************************
                // end skip nested tab controls
                // ********************************************************************************


                // ********************************************************************************
                // ********************************************************************************
                if(!tabGadgetOn)
                {
                    //alert("tab gadget not on. . .");
                    tabGadgetBodyItemList = getElementsByClassName(tabGadgetHeaderListLinkList[j], "tabGadgetBodyItem");
                    for(var q = 0; q < tabGadgetBodyItemList.length; q++)
                    {
                        tabGadgetBodyItemList[q].style.display = "block";
                    }

                    node = tabGadgetHeaderListLinkList[j];
                    found = false;
                    while(node !== null)
                    {
                        if(findClass(node, "tabGadgetHeaderList"))
                        {
                            found = true;
                            break;
                        }
                        node = node.parentNode;
                    }
                    if(found)
                    {
                        node.style.display = "none";
                    }
                    continue;
                } // end if(!tabGadgetOn)
                // ********************************************************************************
                // ********************************************************************************

                // ********************************************************************************
                // ********************************************************************************
                rel = tabGadgetHeaderListLinkList[j].getAttribute("rel");
                if(rel === null || rel === "")
                {
                    rel = "";
				    prompt = "Tab gadget: rel missing for tab " + (i + 1);
				    //window.alert(prompt);
                    BLK.EBIZ.trace(prompt);				        
                    continue;
                }


                if(firstTab)
                {
                    firstTabRef = tabGadgetHeaderListLinkList[j];
                    firstTabBodyRef = document.getElementById(firstTabRef.rel);
                    firstTab = false;
                }


                if(tabGadgetRemember)
                {
                    if(!cookieFound)
                    {
                        if(!cookieRelSet)
                        {
                            cookieRelSet = true;
                            cookieRel = rel;
                        }
                    }
                } // end if(tabGadgetRemember)

                tabGadgetBodyItemRef = document.getElementById(rel);
                if(tabGadgetBodyItemRef === null)
                {
				    prompt = "Tab gadget: body missing for tab " + (i + 1);
				    //window.alert(prompt);
                    BLK.EBIZ.trace(prompt);				        
                    continue;
                } // end if(tabGadgetBodyItemRef === null)

                // begin find parent ul
                //var ul = tabGadgetHeaderListLinkList[j].parentNode.parentNode;
                node = tabGadgetHeaderListLinkList[j];
                while(node !== null)
                {
                    if(findClass(node, "tabGadgetHeaderList"))
                    {
                        found = true;
                        break;
                    }
                    node = node.parentNode;
                }
                if(!found)
                {
				    prompt = "Tab gadget: header list not well formed. . .";
                    //window.alert(prompt);
                    BLK.EBIZ.trace(prompt);				        
                    continue;
                }
                var ul = node;
                // end find parent ul

                // begin find parent li
                //var li = tabGadgetHeaderListLinkList[j].parentNode;
                node = tabGadgetHeaderListLinkList[j];
                while(node !== null)
                {
                    if(findClass(node, "tabGadgetHeaderListItem"))
                    {
                        found = true;
                        break;
                    }
                    node = node.parentNode;
                }
                if(!found)
                {
                    prompt = "Tab gadget: header list item not found. . .";
                    //window.alert(prompt);
                    BLK.EBIZ.trace(prompt);
                    continue;
                }
                var li = node;
                // end find parent li
                currentIndex++;

                if(tabGadgetQueryString)
                {
                    if(rel === qsTabName)
                    {
                        addClass(li, "On");
                        tabGadgetBodyItemRef.style.display = "block";
                        foundQsTab = true;
                    }
                    else
                    {
                        tabGadgetBodyItemRef.style.display = "none";
                        removeClass(li, "On");
                        //foundQsTab = false;
                    }
                }
                else if(tabGadgetRemember)
                {
                    if(rel === cookieRel)
                    {
                        addClass(li, "On");
                        tabGadgetBodyItemRef.style.display = "block";
                    }
                    else
                    {
                        tabGadgetBodyItemRef.style.display = "none";
                        removeClass(li, "On");
                    }
                }
                else if(tabGadgetRandom)
                {
                    tabGadgetBodyItemRef.style.display = "none";
                    removeClass(li, "On");

                    randomSelectArray[randomSelectArray.length] = 
                        { "item": li, "link": tabGadgetHeaderListLinkList[j], "body": tabGadgetBodyItemRef };
                }
                else
                {
                    if(findClass(li, "On"))
                    {
                        tabGadgetBodyItemRef.style.display = "block";
                    }
                    else
                    {
                        tabGadgetBodyItemRef.style.display = "none";
                    }
                } // end if(tabGadgetRemember)

                // ********************************************************************************
                // begin handle onclick or onmouseover
                // ********************************************************************************
                var fxn = (function(gadget, tab, remember, expireDays)
                {
                    return function(event)
                    {
                        if(typeof event === "undefined")
                        {
                            event = window.event;
                        }
                        var target = getEventTarget(event);
                        // this is <a>

                        var node = null;
                        var div = gadget;


                        // ************************************************************************
                        // ************************************************************************
                        //node = this;
                        node = target;
                        // ************************************************************************
                        // ************************************************************************

                        while(node !== null)
                        {
                            if(findClass(node, "tabGadgetHeaderList"))
                            {
                                found = true;
                                break;
                            }
                            node = node.parentNode;
                        }
                        if(!found)
                        {
                            prompt = "Tab gadget: header list not well formed. . .";
                            //window.alert(prompt);
                            BLK.EBIZ.trace(prompt);
                            return false;
                        }
                        var ul = node;
                        // end find parent ul

                        // begin find parent li

                        // ************************************************************************
                        // ************************************************************************
                        var li = target.parentNode;
                        node = target;
                        // ************************************************************************
                        // ************************************************************************

                        while(node !== null)
                        {
                            if(findClass(node, "tabGadgetHeaderListItem"))
                            {
                                found = true;
                                break;
                            }
                            node = node.parentNode;
                        }
                        if(!found)
                        {
                            prompt = "Cannot find tab gadget header list item. . .";
                            //window.alert(prompt);
                            BLK.EBIZ.trace(prompt);
                            return false;
                        }
                        li = node;
                        // end find parent li

                        // turn all links off
                        //var liList = getElementsByClassName(ul, "tabGadgetHeaderListItem");
                        var liList = getElementsByClassName(gadget, "tabGadgetHeaderListItem");
                        for(var i = 0; i < liList.length; i++)
                        {
                            // begin skip nested tab controls
                            node = liList[i];
                            found = false;
                            while(node !== null)
                            {
                                if(findClass(node, "tabGadget"))
                                {
                                    found = true;
                                    break;
                                }
                                node = node.parentNode;
                            }
                            if(found)
                            {
                                if(node !== gadget)
                                {
                                    //alert("(" + i + "," + j + ") - nested");
                                    continue;
                                }
                            }
                            // end skip nested tab controls
                            removeClass(liList[i], "On");
                        } // end for(var i = 0; i < liList.length; i++)
                        // turn current link on
                        addClass(li, "On");

                        // turn all tabs off
                        var divList = getElementsByClassName(div, "tabGadgetBodyItem");
                        for(var k = 0; k < divList.length; k++)
                        {
                            // begin skip nested tab controls
                            node = divList[k];
                            found = false;
                            while(node !== null)
                            {
                                if(findClass(node, "tabGadget"))
                                {
                                    found = true;
                                    break;
                                }
                                node = node.parentNode;
                            }
                            if(found)
                            {
                                if(node !== gadget)
                                {
                                    continue;
                                }
                            }
                            // end skip nested tab controls
                            divList[k].style.display = "none";
                        } // end for(var k = 0; k < divList.length; k++)

                        // turn associated tab on
                        tab.style.display = "block";

                        if(remember)
                        {
                            var rel = "";
                            // does work in ff,op,gc,ie6; does not work in ie7 - this is undefined
                            // rel = this.rel;
                            // does work in ff,op,gc,ie6,ie7
                            rel = target.rel;

                            var id = gadget.id;
                            var cookieVal = "";
                            var subCookieVal = "";
                            var tabInfo = "";
                            var re = null;
                            var result = "";

                            if(rel !== "" && id !== "")
                            {
                                cookieVal = unescape(getCookie("tabGadgetRemember"));

                                tabInfo = id + ":" + rel;
                                if(cookieVal === "")
                                {
                                    setCookie("tabGadgetRemember", tabInfo, expireDays);
                                }
                                else
                                {
                                    if(cookieVal.indexOf(id, 0) === -1)
                                    {
                                        // not found
                                        setCookie("tabGadgetRemember", cookieVal + "/" + tabInfo, expireDays);
                                    }
                                    else
                                    {
                                        // found
                                        subCookieVal = getSubCookie("tabGadgetRemember", id);
                                        re = new RegExp(id + ":" + subCookieVal);
                                        result = cookieVal.replace(re, tabInfo);
                                        setCookie("tabGadgetRemember", result, expireDays);
                                    } // end if(cookieVal.indexOf(id, 0) === -1)
                                } // end if(cookieVal === "")
                            } // end if(rel !== "" && id !== "")
                        } // end if(tabGadgetRemember)

                        // ************************************************************************************************						
                        // ************************************************************************************************	

                        for(k = 0; k < BLK.EBIZ.Tabs.eventHandlerQueue2.length; k++)
                        {
                            if(typeof BLK.EBIZ.Tabs.eventHandlerQueue2[k] !== "function")
                            {
                                continue;
                            }
                            BLK.EBIZ.Tabs.eventHandlerQueue2[k]();
                        } // end for(k = 0; k < BLK.EBIZ.Tabs.eventHandlerQueue2.length; k++)

                        // ************************************************************************************************						
                        // ************************************************************************************************						

                        return false;
                    }; // end return function (event)
                })(tabGadgetList[i], tabGadgetBodyItemRef, tabGadgetRemember, this.EXPIRE_DAYS); 
                // end var fxn = function (gadget, tab, remember, expireDays)


                var k = 0;
                //var holdFxn = tabGadgetHeaderListLinkList[j].onclick;
                //tabGadgetHeaderListLinkList[j].onclick = null;
                if(tabGadgetOnClick)
                {
                    // switch tab body
                    attachEventListener(tabGadgetHeaderListLinkList[j], "click", fxn, false);
                    // run designer specified function for given tab
                    //if(typeof holdFxn === "function")
                    //{
                    //    attachEventListener(tabGadgetHeaderListLinkList[j], "click", holdFxn, false);
                    //}
                    // run designer specified functions for all tabs
                    for(k = 0; k < BLK.EBIZ.Tabs.eventHandlerQueue.length; k++)
                    {
                        if(typeof BLK.EBIZ.Tabs.eventHandlerQueue[k] !== "function")
                        {
                            continue;
                        }
                        attachEventListener(tabGadgetHeaderListLinkList[j], "click", BLK.EBIZ.Tabs.eventHandlerQueue[k], false);
                    }
                }
                else
                {
                    // tab gadget on mouse over
                    // switch tab body
                    attachEventListener(tabGadgetHeaderListLinkList[j], "mouseover", fxn, false);
                    // run designer specified function for given tab
                    //if(typeof holdFxn === "function")
                    //{
                    //    attachEventListener(tabGadgetHeaderListLinkList[j], "mouseover", holdFxn, false);
                    //}
                    // run designer specified functions for all tabs
                    for(k = 0; k < BLK.EBIZ.Tabs.eventHandlerQueue.length; k++)
                    {
                        if(typeof BLK.EBIZ.Tabs.eventHandlerQueue[k] !== "function")
                        {
                            continue;
                        }
                        attachEventListener(tabGadgetHeaderListLinkList[j], "mouseover", BLK.EBIZ.Tabs.eventHandlerQueue[k], false);
                    }
                } // end if(tabGadgetOnClick)
                // ********************************************************************************
                // end handle onclick or onmouseover
                // ********************************************************************************
            } // end for(j = 0; j < tabGadgetHeaderListLinkList.length; j++);
            
            if(tabGadgetQueryString)
            {
                if(!foundQsTab)
                {
                    // query string tab not found
                    // display first tab instead
                    addClass(firstTabRef.parentNode, "On");
                    firstTabBodyRef.style.display = "block";
                }
            }
            if(tabGadgetRandom)
            {
                randomIndex = randomBetween(1, randomSelectArray.length) - 1;

                item = randomSelectArray[randomIndex]["item"];
                // = {"item":li,"link":tabGadgetHeaderListLinkList[j],"body":tabGadgetBodyItemRef};
                link = randomSelectArray[randomIndex]["link"];
                body = randomSelectArray[randomIndex]["body"];

                addClass(item, "On");
                body.style.display = "block";
            } // end if(tabGadgetRandom)
            
        } // end for(var i = 0; tabGadgetList[i]; i++)

    }; // end this.setup = function ()

    this.setup();
};                // end BLK.EBIZ.Tabs = function ()
BLK.EBIZ.Tabs.eventHandlerQueue = [];
BLK.EBIZ.Tabs.eventHandlerQueue2 = [];
// ************************************************************************************************
// end tabs.js
// ************************************************************************************************
// textOverImage.js

// ************************************************************************************************
// begin text over image
// requires common.js
// ************************************************************************************************

/*global BLK, document, findClass, getElementsByClassName, window */

BLK.EBIZ.TextOverImage = function ()
{
	this.setup = function ()
	{
		//window.alert("setup. . .");
		var textOverImageGadgetList = getElementsByClassName(document.body, "textOverImageGadget");
		var textOverImageGadgetTextWrapperList = null;
		var textOverImageGadgetImageWrapperList = null;
		var textOverImageGadgetImageList = null;
		var textOverImageGadgetOverlayList = null;
		var div = null;
		var offsetWidth = 0;
		var offsetHeight = 0;
		var fxn = null;

		for(var i = 0; i < textOverImageGadgetList.length; i++)
		{
			// validate
			if(textOverImageGadgetList[i].nodeName.toLowerCase() !== "div")
			{
				continue;
			}

			textOverImageGadgetTextWrapperList = getElementsByClassName(textOverImageGadgetList[i], "textOverImageGadgetTextWrapper");
			textOverImageGadgetImageWrapperList = getElementsByClassName(textOverImageGadgetList[i], "textOverImageGadgetImageWrapper");
			textOverImageGadgetImageList = getElementsByClassName(textOverImageGadgetList[i], "textOverImageGadgetImage");
			//textOverImageGadgetOverlayList = getElementsByClassName(textOverImageGadgetList[i], "textOverImageGadgetOverlay");

			if(textOverImageGadgetTextWrapperList.length !== 1)
			{
				continue;
			}
			if(textOverImageGadgetImageWrapperList.length !== 1)
			{
				continue;
			}
			if(textOverImageGadgetImageList.length !== 1)
			{
				continue;
			}
			/*
			if(textOverImageGadgetOverlayList.length !== 1)
			{
				continue;
			}
			*/

			// get dimensions of image
			offsetWidth = textOverImageGadgetImageList[0].offsetWidth;
			offsetHeight = textOverImageGadgetImageList[0].offsetHeight;

			// set dimensions of gadget
			textOverImageGadgetList[i].style.width = offsetWidth + "px";
			textOverImageGadgetList[i].style.height = offsetHeight + "px";

			// create overlay
			div = document.createElement("div");
			div.className = "textOverImageGadgetOverlay";
			div.style.width = offsetWidth + "px";
			div.style.height = offsetHeight + "px";
			textOverImageGadgetTextWrapperList[0].parentNode.insertBefore(div, textOverImageGadgetTextWrapperList[0]);
			
			// set dimensions of text
			textOverImageGadgetTextWrapperList[0].style.width = offsetWidth + "px";
			textOverImageGadgetTextWrapperList[0].style.height = offsetHeight + "px";

			textOverImageGadgetImageWrapperList[0].style.width = offsetWidth + "px";
			textOverImageGadgetImageWrapperList[0].style.height = offsetHeight + "px";

			// begin mouseover
			//textOverImageGadgetImageList[0].onmouseover = function (gadgetRef)
			//textOverImageGadgetImageWrapperList[0].onmouseover = function (gadgetRef)
			//textOverImageGadgetOverlayList[0].onmouseover = function (gadgetRef)
			fxn = function (gadgetRef)
			{
				return function (event)
				{
					if(typeof event === "undefined")
					{
						event = window.event;
					}
					//var targetElement = getEventTarget(event);

					var node = null;
					
                    var targetElement = null;
                    if(typeof event["srcElement"] !== "undefined")
                    {
                        targetElement = event.srcElement;
                    }
                    else if(typeof event["target"] !== "undefined")
                    {
                        targetElement = event.target;
                    }
                    else
                    {
                        //document.title = "unknown target element. . .";
                        window.status = "Text over image: unknown target element. . .";
                    }
                    
                    var relatedTarget = null;
                    if(typeof event["relatedTarget"] !== "undefined")
                    {
                        relatedTarget = event.relatedTarget;
                    }
                    else if(typeof event["fromElement"] !== "undefined")
                    {
                        relatedTarget = event.fromElement;
                    }
                    else
                    {
                        //document.title = "Unknown related target. . .";
                        window.status = "Text over image: unknown related target. . .";
                    }
                    
                    if(relatedTarget !== null)
                    {
	                    //document.title = "mouseover: " + targetElement.nodeName + "||||" + relatedTarget.nodeName;
	                    
						node = relatedTarget;
						while(node !== targetElement && 
						    !(node.nodeName.toLowerCase() === "body" || 
						    node.nodeName.toLowerCase() === "html"))
						{
						    node = node.parentNode;
						}
						if(node === targetElement)
						{
						    return false;
						}
                    } // end if(relatedTarget !== null)

					var overlay      = getElementsByClassName(gadgetRef, "textOverImageGadgetOverlay");
					var textWrapper  = getElementsByClassName(gadgetRef, "textOverImageGadgetTextWrapper");
					var imageWrapper = getElementsByClassName(gadgetRef, "textOverImageGadgetImageWrapper");
					
					overlay[0].style.display = "block";
					textWrapper[0].style.display = "block";
					
					//imageWrapper[0].style.display = "block";
					
					return false;
				};
			}(textOverImageGadgetList[i]);
			textOverImageGadgetList[i].onmouseover = fxn;
			//textOverImageGadgetImageList[0].onmouseover = fxn;
			//textOverImageGadgetImageWrapperList[0].onmouseover = fxn;
			//textOverImageGadgetOverlayList[0].onmouseover = fxn;
			// end mouseover
			
			
			// begin mouseout
			//textOverImageGadgetImageList[0].onmouseout = function (gadgetRef)
			//textOverImageGadgetImageWrapperList[0].onmouseout = function (gadgetRef)
			//textOverImageGadgetOverlayList[0].onmouseout = function (gadgetRef)
			fxn = function (gadgetRef)
			{
				return function (event)
				{
					if(typeof event === "undefined")
					{
						event = window.event;
					}
					//var targetElement = getEventTarget(event);

                    var node = null;

                    var targetElement = null;
                    if(typeof event["srcElement"] !== "undefined")
                    {
                        targetElement = event.srcElement;
                    }
                    else if(typeof event["target"] !== "undefined")
                    {
                        targetElement = event.target;
                    }
                    else
                    {
                        //document.title = "unknown target element. . .";
                        window.status = "Text over image: unknown target element. . .";
                    }
                    
                    var relatedTarget = null;
                    if(typeof event["relatedTarget"] !== "undefined")
                    {
                        relatedTarget = event.relatedTarget;
                    }
                    else if(typeof event["toElement"] !== "undefined")
                    {
                        relatedTarget = event.toElement;
                    }
                    else
                    {
                        //document.title = "unknown related target. . .";
                        window.status = "Text over image: unknown related target. . .";
                    }
					
					if(relatedTarget !== null)
					{
	                    //document.title = "mouseout: " + targetElement.nodeName + "||||" + relatedTarget.nodeName;
						node = relatedTarget;
						/*
						if(!(node.nodeName.toLowerCase() === "body" || node.nodeName.toLowerCase() === "html"))
						{
							alert("not body or html. . .");
							return false;
						}
						*/
						var found = false;
						while(node !== null)
						{
							if(findClass(node, "textOverImageGadget"))
							{
								found = true;
								break;
							}
							node = node.parentNode;
						}
						if(found)
						{
							return false;
						}
                    }

					var overlay      = getElementsByClassName(gadgetRef, "textOverImageGadgetOverlay");
					var textWrapper  = getElementsByClassName(gadgetRef, "textOverImageGadgetTextWrapper");
					var imageWrapper = getElementsByClassName(gadgetRef, "textOverImageGadgetImageWrapper");
					
					overlay[0].style.display = "none";
					textWrapper[0].style.display = "none";
					
					//imageWrapper[0].style.display = "none";
					
					return false;
				}; // end return function (event)
			}(textOverImageGadgetList[i]);
			textOverImageGadgetList[i].onmouseout = fxn;
			//textOverImageGadgetImageList[0].onmouseout = fxn;
			//textOverImageGadgetImageWrapperList[0].onmouseout = fxn;
			//textOverImageGadgetOverlayList[0].onmouseout = fxn;
			// end mouseout
			
		} // end for(var i = 0; i < textOverImageGadgetList.length; i++)
	}; // end this.setup = function ()
	this.setup();
}; // end BLK.EBIZ.TextOverImage = function ()
// ************************************************************************************************
// end text over image
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2008/11/28 15:00:00 $
*       Filename:  $RCSfile: textResize.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin textResize.js
// ************************************************************************************************

// textResize.js
/*global document */
function TextResize(decBtnClassNameIn, incBtnClassNameIn, textSizeIn)
{
    // private member variables
	var m_decBtnClassName = decBtnClassNameIn;
	var m_incBtnClassName = incBtnClassNameIn;
    var m_values = [TextResize.TEXT_SIZE.xSmall, 
        TextResize.TEXT_SIZE.small, 
        TextResize.TEXT_SIZE.medium, 
        TextResize.TEXT_SIZE.large, 
        TextResize.TEXT_SIZE.xLarge];

    //var m_size = m_values[Math.floor(m_values.length / 2)];
    var m_size = textSizeIn;
    var that = this;
	
	// public methods
	this.decrease = function ()
	{
	    var collOfTags = document.getElementsByTagName("*");
	    for(var i = 0; i < collOfTags.length; i++)
	    {
			if(!this.findClass(collOfTags[i], "resize"))
			{
				continue;
			}
			this.changeClass(collOfTags[i], m_size, this.getPrevious(m_size));
	    }
		m_size = this.getPrevious(m_size);
		this.setCookie(TextResize.COOKIE_NAME, m_size, TextResize.EXPIRE_DAYS);		
	}; // end this.decrease = function ()
	
	this.getNext = function (sizeIn)
	{
	    var found = false;
	    var j;
	    for(var i = 0; (i < m_values.length) && !found; i++)
	    {
	        if(sizeIn === m_values[i])
	        {
	            j = i + 1;
	            found = true;
	        }
	    }
	    return (j >= m_values.length) ? m_values[m_values.length - 1] : m_values[j];
	}; // end this.getNext = function (sizeIn)
	
	this.getPrevious = function (sizeIn)
	{
	    var found = false;
	    var j;
	    for(var i = 0; (i < m_values.length) && !found; i++)
	    {
	        if(sizeIn === m_values[i])
	        {
	            j = i - 1;
	            found = true;
	        }
	    }
	    return (j < 0) ? m_values[0] : m_values[j];
	}; // end this.getPrevious = function (sizeIn)
	
	this.getTextSize = function ()
	{
		return m_size;
	}; // end this.getTextSize = function ()
	
	this.increase = function ()
	{
	    var collOfTags = document.getElementsByTagName("*");
	    for(var i = 0; i < collOfTags.length; i++)
	    {
	    
			if(!this.findClass(collOfTags[i], "resize"))
			{
				continue;
			}
			this.changeClass(collOfTags[i], m_size, this.getNext(m_size));
		}
		m_size = this.getNext(m_size);
		this.setCookie(TextResize.COOKIE_NAME, m_size, TextResize.EXPIRE_DAYS);		
	}; // end this.increase = function ()
	
	this.setTextSize = function (sizeIn)
	{
	    var found = false;
        var i = 0;
	    m_size = m_values[Math.floor(m_values.length / 2)];
	    for(i = 0; i < m_values.length && !found; i++)
	    {
	        if(sizeIn === m_values[i])
	        {
	            m_size = sizeIn;
	            found = true;
	        }
	    }

	    var collOfTags = document.getElementsByTagName("*");
	    for(i = 0; i < collOfTags.length; i++)
	    {
			if(this.findClass(collOfTags[i], "noresize"))
			{
				continue;
			}
			if(!this.findClass(collOfTags[i], "resize"))
			{
				continue;
			}

	        for(var j = 0; j < m_values.length; j++)
	        {
	            if(this.findClass(collOfTags[i], m_values[j]))
	            {
			    	this.removeClass(collOfTags[i], m_values[j]);
			    	break;
	            }
	        }
			this.addClass(collOfTags[i], m_size);
	    }
	}; // end this.setTextSize = function (sizeIn)
	
    // private member functions
	this.addClass = function (target, classValue)
	{
		var pattern = new RegExp("(^| )" + classValue + "( |$)");
		var classWasAdded = false;

        if(typeof target.className !== "undefined")
        {
    		if(!pattern.test(target.className))
	    	{
		    	classWasAdded = true;
			    if(target.className === "")
    			{
	    			target.className = classValue;
		    	}
    			else
	    		{
		    		target.className += " " + classValue;
    			}
	    	}
        }
		pattern = null;
		return classWasAdded;
	}; // end var addClass = function(target, classValue)
	
	this.changeClass = function (target, fromClassValue, toClassValue)
	{
	    if(typeof fromClassValue === "object")
	    {
	        for(var i = 0; i < fromClassValue.length; i++)
	        {
	            this.removeClass(target, fromClassValue[i]);
	        }
	    }
	    else
	    {
	        this.removeClass(target, fromClassValue);
	    }
	    this.addClass(target, toClassValue);
	}; // end var changeClass = function(target, fromClassValue, toClassValue)
	
	this.findClass = function (target, classValue)
	{
		var pattern = new RegExp("(^| )" + classValue + "( |$)");
		var classWasFound = false;
        if(typeof target.className !== "undefined")
        {
    		if(pattern.test(target.className))
	    	{
		    	classWasFound = true;
		    }
        }
		pattern = null;
		return classWasFound;
	}; // end var findClass = function(target, classValue)
	
	this.getCookie = function (searchName)
	{
		var cookies = document.cookie.split(";");
		var found = false;
		var cookieCrumbs = [];
		var cookieName = "";
		var cookieValue = "";

		for(var i = 0; i < cookies.length && !found; i++)
		{
			cookieCrumbs = cookies[i].split("=");
			cookieName = cookieCrumbs[0];
			cookieValue = cookieCrumbs[1];
			if(cookieName === searchName)
			{
				found = true;
			}
		}
		return cookieValue;
	}; // end this.getCookie = function (searchName)
	
	this.getTextSize = function ()
	{
		var found = false;
		var size = this.getCookie(TextResize.COOKIE_NAME);
		if(size === "")
		{
	        this.setTextSize(m_size);
			this.setCookie(TextResize.COOKIE_NAME, m_size, TextResize.EXPIRE_DAYS);		
		}
		else
		{
			found = false;
			for(var i = 0; i < m_values.length; i++)
			{
				if(m_values[i] === size)
				{
					m_size = size;
			        that.setTextSize(m_size);
					found = true;
					break;
				}
			}
			if(!found)
			{
				this.setTextSize(TextResize.TEXT_SIZE.medium);
			}
		}
	}; // end var this.getTextSize = function ()
	
    this.initialize = function ()
    {
        if(decBtnClassNameIn === "" || decBtnClassNameIn === null)
        {
            return false;
        }
	    m_decBtnClassName = decBtnClassNameIn;
        if(incBtnClassNameIn === "" || incBtnClassNameIn === null)
        {
            return false;
        }
	    m_incBtnClassName = incBtnClassNameIn;
        if(textSizeIn === "" || textSizeIn === null)
        {
            return false;
        }
        var ok = false;
        for(var i = 0; i < m_values.length; i++)
        {
            if(m_values[i] === textSizeIn)
            {
                ok = true;
                break;
            }
        }
        if(!ok)
        {
            return false;
        }
        m_size = textSizeIn;

        return true;
    }; // end this.initialize = function ()
	
	this.removeClass = function (target, classValue)
	{
		var removedClass = target.className;
		var pattern = new RegExp("(^| )" + classValue + "( |$)");
		var classWasRemoved = false;
        if(typeof target.className !== "undefined")
        {
    		if(pattern.test(target.className))
	    	{
		    	classWasRemoved = true;
			    removedClass = removedClass.replace(pattern, "$1");
    			removedClass = removedClass.replace(/ $/, "");
	    		target.className = removedClass;
		    }
        }
		pattern = null;
		return classWasRemoved;
	}; // end var removeClass = function (target, classValue)
    
	this.setCookie = function (cookieName, value, expireDays)
	{
		var expDate = new Date();
		expDate.setDate(expDate.getDate() + expireDays);
		document.cookie = cookieName + "=" + 
			escape(value) + ((expireDays === null) ? "" : ";expires=" + expDate.toGMTString());
		expDate = null;
	}; // end this.setCookie = function (cookieName, value, expireDays)
    
	this.setupEventHandlers = function ()
	{
	    var collOfTags = document.getElementsByTagName("*");
	    for(var i = 0; i < collOfTags.length; i++)
	    {
			if(this.findClass(collOfTags[i], m_decBtnClassName))
			{
				collOfTags[i].onclick = function(event)
				{
					that.decrease();
					return false;
				};
			}
			if(this.findClass(collOfTags[i], m_incBtnClassName))
			{
				collOfTags[i].onclick = function(event)
				{
					that.increase();
					return false;
				};
			}
	    } // end for(var i = 0; i < collOfTags.length; i++)
	}; // end this.setupEventHandlers = function ()
	
    this.setupResizableTags = function ()
    {
        var h1 = document.getElementsByTagName("h1");
        var node = null;
        for(var i = 0; i < h1.length; i++)
        {
            node = getNextSibling(h1[i]);
            while(node)
            {
                if(node.nodeType === 1)
                {
					if(node.nodeName.toLowerCase() !== "h1")
					{
						if(node.id !== "textResize")
						{
							if(!findClass(node, "noresize"))
							{
								this.addClass(node, "resize");
						    }
						} // end if(node.id !== "textResize")
                    } // end if(node.nodeName.toLowerCase() !== "h1")
                } // end if(node.nodeType === 1)
                node = getNextSibling(node);
            } // end while(node)
        } // end for(var i = 0; i < h1.length; i++)
    }; // end this.setupResizableTags = function ()
    
    if(this.initialize())
    {
        this.setupResizableTags();
	    this.setupEventHandlers();
	    this.getTextSize();
        //this.setTextSize(m_size);
    } // end if(this.initialize())
} // end function TextResize()

TextResize.TEXT_SIZE = 
{
xSmall:"xSmall",
small:"small",
medium:"medium",
large:"large",
xLarge:"xLarge"
};
TextResize.EXPIRE_DAYS = 365;
TextResize.COOKIE_NAME = "ebizTextResize";

// ************************************************************************************************
// end textResize.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2008/11/28 15:00:00 $
*       Filename:  $RCSfile: treeControl.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin treeControl.js
// ************************************************************************************************

function TreeControl(gadgetIdNameIn, behavior)
{
/*global window, document, addClass, findClass, removeClass, changeClass, getEventTarget, getPreviousSibling, 
getNextSibling */

	this.m_gadgetIdName = null;
	this.m_gadgetIdRef = null;
	
	// begin behavior
	//1 == show all
	//2 == collapse all
	//3 == toggle
	//4 == by page
	//5 == manual - to be implemented
	//6 == first last - in progress
	//7 == text expand
	//8 == highlight
	//9 == check
	// end behavior
	this.m_showAll = false;
	this.m_toggle = false;
	this.m_byPage = false;
	this.m_manual = false;
	this.m_firstLast = false;
	this.m_textExpand = false;
	this.m_highlight = false;
	this.m_check = false;
	
	var that = this;
	this.setup = function (gadgetIdName, behavior)
	{
		if(gadgetIdName === "" || gadgetIdName === null)
		{
			//alert("Gadget name missing.");
			return;
		}
		this.m_gadgetIdName = gadgetIdName;
		this.m_gadgetIdRef = document.getElementById(this.m_gadgetIdName);
		if(this.m_gadgetIdRef === null)
		{
			//alert("Gadget does not exist.");
			return;
		}

		switch(behavior)
		{
		case 1:
			// show all
			this.m_showAll = true;
			this.m_toggle = false;
			this.m_byPage = false;
			this.m_manual = false;
			this.m_firstLast = false;
			this.m_textExpand = false;
			this.m_highlight = false;
			this.m_check = false;
			break;
		case 2:
			// collapse all
			this.m_showAll = false;
			this.m_toggle = false;
			this.m_byPage = false;
			this.m_manual = false;
			this.m_firstLast = false;
			this.m_textExpand = false;
			this.m_highlight = false;
			this.m_check = false;
			break;
		case 3:
			// toggle
			this.m_showAll = false;
			this.m_toggle = true;
			this.m_byPage = false;
			this.m_manual = false;
			this.m_firstLast = false;
			this.m_textExpand = false;
			this.m_highlight = false;
			this.m_check = false;
			break;
		case 4:
			// by page
			this.m_showAll = false;
			this.m_toggle = true;
			this.m_byPage = true;
			this.m_manual = false;
			this.m_firstLast = false;
			this.m_textExpand = false;
			this.m_highlight = false;
			this.m_check = false;
			break;
		case 5:
			// manual - to be implemented
			this.m_showAll = false;
			this.m_toggle = false;
			this.m_byPage = false;
			this.m_manual = true;
			this.m_firstLast = false;
			this.m_textExpand = false;
			this.m_highlight = false;
			this.m_check = false;
			break;
		case 6:
			// first last - in progress
			this.m_showAll = false;
			this.m_toggle = true;
			this.m_byPage = false;
			this.m_manual = false;
			this.m_firstLast = true;
			this.m_textExpand = false;
			this.m_highlight = false;
			this.m_check = false;
			break;
		case 7:
			// text expand
			this.m_showAll = false;
			this.m_toggle = true;
			this.m_byPage = false;
			this.m_manual = false;
			this.m_firstLast = false;
			this.m_textExpand = true;
			this.m_highlight = false;
			this.m_check = false;
			break;
		case 8:
			// highlight
			this.m_showAll = false;
			this.m_toggle = true;
			this.m_byPage = false;
			this.m_manual = false;
			this.m_firstLast = false;
			this.m_textExpand = true;
			this.m_highlight = true;
			this.m_check = false;
			break;
		case 9:
			// check
			this.m_showAll = false;
			this.m_toggle = false;
			this.m_byPage = false;
			this.m_manual = false;
			this.m_firstLast = false;
			this.m_textExpand = true;
			this.m_highlight = false;
			this.m_check = true;
			break;			
		default:
			this.m_showAll = true;
			this.m_toggle = false;
			this.m_byPage = false;
			this.m_manual = false;
			this.m_firstLast = false;
			this.m_textExpand = false;
			this.m_highlight = false;
			this.m_check = false;
			break;			
		}
	}; // end this.setup = function (gadgetIdName, behavior)
	this.highlight = function()
	{
		var spanList = document.getElementsByTagName("span");
		var parentLi = null;
		for(var i = 0; i < spanList.length; i++)
		{
			/*
			if(spanList[i].className == "checked")
			{
				parentLi = spanList[i].parentNode;
				parentLi.className = "highlight";
			}
			else if(spanList[i].className == "unchecked")
			{
				parentLi = spanList[i].parentNode;
				parentLi.className = "";
			}
			*/
			if(findClass(spanList[i], "checked"))
			{
				parentLi = spanList[i].parentNode;
				addClass(parentLi, "highlight");			
			}
			else if(findClass(spanList[i], "unchecked"))
			{
				parentLi = spanList[i].parentNode;
				removeClass(parentLi, "highlight");			
			}
		}
	};
	// ****************************************************************************************
	this.initTree = function (node)
	{
		// in order traversal
		var a;
		var bodyList;
		var cn;
		var fn;
		var fn2;
		var i;
		var li;
		var linkName;
		var node2;
		var pageId;
		var span;
		var span2;
		var text;
		var ulList;
		//var value;
		
		// traverse child nodes
		if(node.hasChildNodes())
		{
			this.initTree(node.childNodes[0]);
		}
		// begin visit node
		if(node.nodeType === 1)
		{
			// ************************************************************************************
			// is element node
			// ************************************************************************************
			if(node.nodeName.toLowerCase() === "li")
			{
				// ********************************************************************************
				// is li node
				// ********************************************************************************
				ulList = node.getElementsByTagName("ul");
				if(ulList.length === 0)
				{
					// ****************************************************************************
					// is leaf node
					// ****************************************************************************
					
					// ****************************************************************************
					if(this.m_check)
					{
						span = null;
						span = document.createElement("span");
		                span.className = "unchecked";
		                span.setAttribute("class", "unchecked");
		                span.onclick = function ()
		                {
							//var li = null;
							var span2 = null;
							var parentNode = this.parentNode;
							var node2 = null;
							var hLi = null;
							
							//parentNode = this.parentNode;
							//node2 = null;
							//span2 = null;
							
							if(this.className.toLowerCase() === "unchecked")
							{
								// is unchecked - change to checked
								this.className = "checked";
								this.title = "Checked. . .";
								
								// check parent elements if all child elements are checked
								var li = null;
								var allAreChecked = true;
								var spanList = null;
								var j = 0;
								//alert("leaf");
								parentNode = this.parentNode;
								while(parentNode !== null && allAreChecked)
								{
									if(parentNode.nodeName.toLowerCase() === "li")
									{
										li = parentNode;
										allAreChecked = true;
										spanList = li.getElementsByTagName("span");
										for(j = 0; j < spanList.length; j++)
										{
											//alert(spanList[j].className + "|" + spanList.length);
											if(spanList[j] === this)
											{
												continue;
											}
											if(spanList[j].parentNode === li)
											{
												continue;
											}
											if(spanList[j].className.toLowerCase() === "unchecked")
											{
												//alert("unchecked");
												allAreChecked = false;
												break;
											}
										}
										if(allAreChecked)
										{
											li.firstChild.nextSibling.className = "checked";
										}
									}
									parentNode = parentNode.parentNode;
								}								
								that.highlight();
							}
							else if(this.className.toLowerCase() === "checked")
							{
								// is checked - change to unchecked
								this.className = "unchecked";
								this.title = "Unchecked. . .";
								parentNode = this.parentNode;	
								while(parentNode !== null)
								{
									if(parentNode.nodeName.toLowerCase() === "li")
									{
										if(parentNode.firstChild !== null)
										{
											node2 = getNextSibling(parentNode.firstChild);
											if(node2 !== null)
											{
												if(node2.nodeName.toLowerCase() === "span")
												{
													if(node2 !== this)
													{
														span2 = node2;
														if(span2.className.toLowerCase() === "checked")
														{
															span2.className = "unchecked";
															span2.title = "Unchecked. . .";
														}
														else if(span2.className.toLowerCase() === "unchecked")
														{
															span2.className = "unchecked";
															span2.title = "Unchecked. . .";
														}
													} // end if(node2 !== this)
												} // end if(node2.nodeName.toLowerCase() === "span")
											} // end if(node2 !== null)
										} // end if(parentNode.firstChild !== null)
									} // end if(parentNode.nodeName.toLowerCase() === "li")
									parentNode = parentNode.parentNode;
								} // end while(parentNode !== null)
							} // end if(this.className.toLowerCase() === "unchecked")

							that.highlight();
							
							return false;
		                };
						span.title = "Unchecked. . .";
						node.insertBefore(span, node.firstChild);
						span = null;
					} // end if(this.m_check)						
					
					// ****************************************************************************
					span = null;
					span = document.createElement("span");
                    addClass(span, "hasNoSubtree");
					// ****************************************************************************

					if(this.m_textExpand)
					{
						if(node.hasChildNodes())
						{
							cn = node.firstChild;
							while(cn)
							{
								if(cn.nodeName.toLowerCase() === "a")
								{
									addClass(cn, "hasNoSubtree");
								}
								cn = getNextSibling(cn);
							}
						} // end if(node.hasChildNodes())
					} // end if(this.m_textExpand)
					// ****************************************************************************
					if(this.m_firstLast)
					{
						if(getPreviousSibling(node) === null && node.parentNode.id === this.m_gadgetIdName)
						{
							//span.className = "hasNoSubtree first";
							addClass(span, "hasNoSubtree");
							addClass(span, "first");
							addClass(node, "first");
						}					
						else if(getNextSibling(node) === null && node.parentNode.id === this.m_gadgetIdName)
						{
							//span.className = "hasNoSubtree last";
							addClass(span, "hasNoSubtree");
							addClass(span, "last");
							addClass(node, "last");
						}
						else
						{
							//span.className = "hasNoSubtree";
							addClass(span, "hasNoSubtree");
						}
					} // end if(this.m_firstLast)

					// ****************************************************************************
					span.title = "";
					node.insertBefore(span, node.firstChild);
					span = null;
					// ****************************************************************************
				}
				else
				{
					// ****************************************************************************
					// is not leaf node
					// ****************************************************************************

					// ****************************************************************************
					fn = function (event)
					{
						if(typeof event === "undefined")
						{
							event = window.event;
						}
						var target = getEventTarget(event);
						var hLi;
						var i;
						var j;
						var k;
						var li;
						var liList;
						var next;
						var prev;
						var spanList;
						var ulList;

						if(findClass(this, "hasSubtreeShow"))
						{
							// subtree showing -> hide
							changeClass(this, "hasSubtreeShow", "hasSubtreeHide");
							this.title = "Show. . .";
							ulList = this.parentNode.getElementsByTagName("ul");
							for(i = 0; i < ulList.length; i++)
							{
								ulList[i].style.display = "none";
								spanList = ulList[i].getElementsByTagName("span");
								for(j = 0; j < spanList.length; j++)
								{
									if(findClass(spanList[j], "checked") || findClass(spanList[j], "unchecked"))
									{
										continue;
									}
									if(findClass(spanList[j], "hasSubtreeShow"))
									{
										changeClass(spanList[j], "hasSubtreeShow", "hasSubtreeHide");
										spanList[j].title = "Show. . .";
									} // end if(findClass(spanList[j], "hasSubtreeShow"))
								} //end for(j = 0; j < spanList.length; j++)
							} // end for(i = 0; i < ulList.length; i++)
							// ********************************************************************
							if(that.m_highlight)
							{
								li = this.parentNode;
								hLi = document.getElementById(that.m_gadgetIdName).getElementsByTagName("li");
								for(i = 0; i < hLi.length; i++)
								{
									removeClass(hLi[i], "highlight");
								}
							}
							// ********************************************************************
						}
						else if(findClass(this, "hasSubtreeHide"))
						{
							// subtree hiding -> show
							changeClass(this, "hasSubtreeHide", "hasSubtreeShow");
							this.title = "Hide. . .";
							ulList = this.parentNode.getElementsByTagName("ul");
							for(i = 0; i < ulList.length; i++)
							{
								if(ulList[i].parentNode === this.parentNode)
								{
									ulList[i].style.display = "block";
									spanList = ulList[i].getElementsByTagName("span");
									for(j = 0; j < spanList.length; j++)
									{
										if(findClass(spanList[j], "checked") || findClass(spanList[j], "unchecked"))
										{
											continue;
										}
										if(findClass(spanList[j], "hasSubtreeShow"))
										{
											changeClass(spanList[j], "hasSubtreeShow", "hasSubtreeHide");
											spanList[j].title = "Show. . .";
										} // end if(findClass(spanList[j], "hasSubtreeShow"))
									} // end for(j = 0; j < spanList.length; j++)
								} // end if(ulList[i].parentNode === this.parentNode)
							} // end for(i = 0; i < ulList.length; i++)
							// ********************************************************************
							if(that.m_highlight)
							{
								li = this.parentNode;
								hLi = document.getElementById(that.m_gadgetIdName).getElementsByTagName("li");
								for(i = 0; i < hLi.length; i++)
								{
									removeClass(hLi[i], "highlight");
								}
								if(li.parentNode.id !== that.m_gadgetIdName)
								{
									addClass(li, "highlight");
								}					
							}
							// ********************************************************************
							if(that.m_toggle)
							{
								// begin hide previous siblings
								li = this.parentNode;
								li = getPreviousSibling(li);
								while(li !== null)
								{
									if(li.nodeName.toLowerCase() === "li")
									{
										ulList = li.getElementsByTagName("ul");
										for(k = 0; k < ulList.length; k++)
										{
											//alert("none previous");
											ulList[k].style.display = "none";
										}
										spanList = li.getElementsByTagName("span");
										for(k = 0; k < spanList.length; k++)
										{
											if(findClass(spanList[k], "checked") || findClass(spanList[k], "unchecked"))
											{
												continue;
											}
											changeClass(spanList[k], "hasSubtreeShow", "hasSubtreeHide");
											spanList[k].title = "Show. . .";
										}
									} // end if(li.nodeName.toLowerCase() === "li")
									li = getPreviousSibling(li);
								} // end while(li !== null)
								// end hide previous siblings
								
								// hide next siblings
								li = this.parentNode;
								li = getNextSibling(li);
								while(li !== null)
								{
									if(li.nodeName.toLowerCase() === "li")
									{
										ulList = li.getElementsByTagName("ul");
										for(k = 0; k < ulList.length; k++)
										{
											ulList[k].style.display = "none";
										}
										spanList = li.getElementsByTagName("span");
										for(k = 0; k < spanList.length; k++)
										{
											if(findClass(spanList[k], "checked") || findClass(spanList[k], "unchecked"))
											{
												continue;
											}
											changeClass(spanList[k], "hasSubtreeShow", "hasSubtreeHide");
											spanList[k].title = "Show. . .";
										}
									} // end if(li.nodeName.toLowerCase() === "li")
									li = getNextSibling(li);
								} // end while(li !== null)
							} // end if(this.m_toggle)
						}
						else
						{
							if(!(this.className === "checked" || this.className === "unchecked"))
							{
								changeClass(this, ["hasSubtreeHide","hasSubtreeShow","hasNoSubtree"], "hasNoSubtree");
							}
							this.title = "";
						} // end if(findClass(this, "hasSubtreeShow"))
						
						target = null;
						hLi = null;
						li = null;
						liList = null;
						next = null;
						prev = null;
						spanList = null;
						ulList = null;
						
						return false;
					}; // end fn = function (event)
					// ****************************************************************************
					// ****************************************************************************
					
					
					// ****************************************************************************
					// begin text expand - onclick for <a>
					// ****************************************************************************
					fn2 = function (event)
					{
						if(typeof event === "undefined")
						{
							event = window.event;
						}
						
						var target = getEventTarget(event);
						var hLi;
						var i;
						var j;
						var k;
						var li;
						var liList;
						var next;
						var prev;
						var spanList;
						var ulList;

						if(findClass(this, "hasSubtreeShow"))
						{
							// subtree showing -> hide
							changeClass(this, "hasSubtreeShow", "hasSubtreeHide");
							this.title = "Show. . .";
							ulList = this.parentNode.getElementsByTagName("ul");
							for(i = 0; i < ulList.length; i++)
							{
								ulList[i].style.display = "none";
								spanList = ulList[i].getElementsByTagName("a");
								for(j = 0; j < spanList.length; j++)
								{
									if(findClass(spanList[j], "checked") || findClass(spanList[j], "unchecked"))
									{
										continue;
									}
									if(findClass(spanList[j], "hasSubtreeShow"))
									{
										changeClass(spanList[j], "hasSubtreeShow", "hasSubtreeHide");
										spanList[j].title = "Show. . .";
									} // end if(findClass(spanList[j], "hasSubtreeShow"))
								} //end for(j = 0; j < spanList.length; j++)
							} // end for(i = 0; i < ulList.length; i++)
							//alert(this.parentNode.firstChild.nodeName);
							changeClass(this.parentNode.firstChild, "hasSubtreeShow", "hasSubtreeHide");
							this.parentNode.firstChild.title = "Show. . .";
							// ********************************************************************
							if(that.m_highlight)
							{
								li = this.parentNode;
								hLi = document.getElementById(that.m_gadgetIdName).getElementsByTagName("li");
								for(i = 0; i < hLi.length; i++)
								{
									removeClass(hLi[i], "highlight");
								}
							}
							// ********************************************************************
						}
						else if(findClass(this, "hasSubtreeHide"))
						{
							// subtree hiding -> show
							changeClass(this, "hasSubtreeHide", "hasSubtreeShow");
							this.title = "Hide. . .";
							ulList = this.parentNode.getElementsByTagName("ul");
							for(i = 0; i < ulList.length; i++)
							{
								if(ulList[i].parentNode === this.parentNode)
								{
									ulList[i].style.display = "block";
									spanList = ulList[i].getElementsByTagName("a");
									for(j = 0; j < spanList.length; j++)
									{
										if(findClass(spanList[j], "checked") || findClass(spanList[j], "unchecked"))
										{
											continue;
										}
										if(findClass(spanList[j], "hasSubtreeShow"))
										{
											changeClass(spanList[j], "hasSubtreeShow", "hasSubtreeHide");
											spanList[j].title = "Show. . .";
										} // end if(findClass(spanList[j], "hasSubtreeShow"))
									} // end for(j = 0; j < spanList.length; j++)
								} // end if(ulList[i].parentNode === this.parentNode)
							} // end for(i = 0; i < ulList.length; i++)
							//alert(this.parentNode.firstChild.nodeName);
							changeClass(this.parentNode.firstChild, "hasSubtreeHide", "hasSubtreeShow");
							this.parentNode.firstChild.title = "Hide. . .";
							// ********************************************************************
							if(that.m_highlight)
							{
								li = this.parentNode;
								hLi = document.getElementById(that.m_gadgetIdName).getElementsByTagName("li");
								for(i = 0; i < hLi.length; i++)
								{
									removeClass(hLi[i], "highlight");
								}
								if(li.parentNode.id !== that.m_gadgetIdName)
								{
									addClass(li, "highlight");
								}					
							}
							// ********************************************************************
							if(that.m_toggle)
							{
								// begin hide previous siblings
								li = this.parentNode;
								li = getPreviousSibling(li);
								while(li !== null)
								{
									if(li.nodeName.toLowerCase() === "li")
									{
										ulList = li.getElementsByTagName("ul");
										for(k = 0; k < ulList.length; k++)
										{
											//alert("none previous");
											ulList[k].style.display = "none";
										}
										spanList = li.getElementsByTagName("a");
										for(k = 0; k < spanList.length; k++)
										{
											if(findClass(spanList[k], "checked") || findClass(spanList[k], "unchecked"))
											{
												continue;
											}
											changeClass(spanList[k], "hasSubtreeShow", "hasSubtreeHide");
											spanList[k].title = "Show. . .";
											
											if(that.m_textExpand || that.m_highlight)
											{
												changeClass(spanList[k].parentNode.firstChild, 
													"hasSubtreeShow", "hasSubtreeHide");
												spanList[k].parentNode.firstChild.title = "Show. . .";
											}
										}
									} // end if(li.nodeName.toLowerCase() === "li")
									li = getPreviousSibling(li);
								} // end while(li !== null)
								// end hide previous siblings
								
								// hide next siblings
								li = this.parentNode;
								li = getNextSibling(li);
								while(li !== null)
								{
									if(li.nodeName.toLowerCase() === "li")
									{
										ulList = li.getElementsByTagName("ul");
										for(k = 0; k < ulList.length; k++)
										{
											ulList[k].style.display = "none";
										}
										spanList = li.getElementsByTagName("a");
										for(k = 0; k < spanList.length; k++)
										{
											if(findClass(spanList[k], "checked") || findClass(spanList[k], "unchecked"))
											{
												continue;
											}
											changeClass(spanList[k], "hasSubtreeShow", "hasSubtreeHide");
											spanList[k].title = "Show. . .";
											
											if(that.m_textExpand || that.m_highlight)
											{
												changeClass(spanList[k].parentNode.firstChild, 
													"hasSubtreeShow", "hasSubtreeHide");
												spanList[k].parentNode.firstChild.title = "Show. . .";
											}
										}
									} // end if(li.nodeName.toLowerCase() === "li")
									li = getNextSibling(li);
								} // end while(li !== null)
							} // end if(this.m_toggle)
						}
						else
						{
							if(!(this.className === "checked" || this.className === "unchecked"))
							{
								changeClass(this, ["hasSubtreeHide","hasSubtreeShow","hasNoSubtree"], "hasNoSubtree");
							}
							this.title = "";
						} // end if(findClass(this, "hasSubtreeShow"))
						
						target = null;
						hLi = null;
						li = null;
						liList = null;
						next = null;
						prev = null;
						spanList = null;
						ulList = null;
						
						return false;
					}; // end fn2 = function (event)
					// ****************************************************************************
					// end text expand - onclick for <a>
					// ****************************************************************************
					
					
					// ****************************************************************************
					if(this.m_check)
					{
						span2 = null;
						span2 = document.createElement("span");
		                //addClass(span, "hasSubtreeUnchecked");
		                span2.className = "unchecked";
		                span2.setAttribute("class", "unchecked");
		                
		                span2.onclick = function ()
		                {
							var spanList = null;
							var i = 0;
							var span2 = null;
							var parentNode = this.parentNode;
							var node2 = null;
							var hLi = null;
							
							if(this.className.toLowerCase() === "unchecked")
							{
								// is unchecked - change to checked
								spanList = this.parentNode.getElementsByTagName("span");
								for(i = 0; i < spanList.length; i++)
								{
									if(spanList[i] === this)
									{
										continue;
									}
									if(!(spanList[i].className.toLowerCase() === "unchecked" || 
										spanList[i].className.toLowerCase() === "checked"))
									{
										continue;
									}
									spanList[i].className = "checked";
									spanList[i].title = "Checked. . .";
								}
								this.className = "checked";
								this.title = "Checked. . .";
								
								
								// ****************************************************************
								// ****************************************************************
								// ****************************************************************
								// check parent elements if all child elements are checked
								var li = null;
								var allAreChecked = true;
								var j = 0;
								//alert("leaf");
								parentNode = this.parentNode;
								while(parentNode !== null && allAreChecked)
								{
									if(parentNode.nodeName.toLowerCase() === "li")
									{
										li = parentNode;
										allAreChecked = true;
										spanList = li.getElementsByTagName("span");
										for(j = 0; j < spanList.length; j++)
										{
											//alert(spanList[j].className + "|" + spanList.length);
											if(spanList[j] === this)
											{
												continue;
											}
											if(spanList[j].parentNode === li)
											{
												continue;
											}
											if(spanList[j].className.toLowerCase() === "unchecked")
											{
												//alert("unchecked");
												allAreChecked = false;
												break;
											}
										}
										if(allAreChecked)
										{
											li.firstChild.nextSibling.className = "checked";
										}
									}
									parentNode = parentNode.parentNode;
								}								
								// ****************************************************************
								// ****************************************************************
								// ****************************************************************
								
								that.highlight();
							}
							else if(this.className.toLowerCase() === "checked")
							{
								// is checked - change to unchecked
								spanList = this.parentNode.getElementsByTagName("span");
								for(i = 0; i < spanList.length; i++)
								{
									if(spanList[i] === this)
									{
										continue;
									}
									if(!(spanList[i].className.toLowerCase() === "unchecked" || 
										spanList[i].className.toLowerCase() === "checked"))
									{
										continue;
									}
									spanList[i].className = "unchecked";
									spanList[i].title = "Unchecked. . .";
								}
								this.className = "unchecked";
								this.title = "Unchecked";
								
								while(parentNode !== null)
								{
									if(parentNode.nodeName.toLowerCase() === "li")
									{
										if(parentNode.firstChild !== null)
										{
											node2 = getNextSibling(parentNode.firstChild);
											if(node2 !== null)
											{
												if(node2.nodeName.toLowerCase() === "span")
												{
													if(node2 !== this)
													{
														span2 = node2;
														if(span2.className.toLowerCase() === "checked" || 
															span2.className.toLowerCase() === "unchecked")
														{
															span2.className = "unchecked";
															span2.title = "Unchecked. . .";
														}
													} // end if(node2 !== this)
												} // end if(node2.nodeName.toLowerCase() === "span")
											} // end if(node2 !== null)
										} // end if(parentNode.firstChild !== null)
									} // end if(parentNode.nodeName.toLowerCase() === "li")
									parentNode = parentNode.parentNode;
								} // end while(parentNode !== null)

								that.highlight();
							}
							return false;
		                }; // end span2.onclick = function ()
		                
						span2.title = "Unchecked. . .";
						//alert(node.nodeName);
						//alert(node.firstChild.nodeName);
						node.insertBefore(span2, node.firstChild);
						//node.appendChild(span);
						span2 = null;
					} // end if(this.m_check)
					
					// ****************************************************************************
					
					//value = trim(this.getInnerText(node));
					span = null;
					span = document.createElement("span");
					//addClass(span, "hasSubtreeHide");
					if(that.m_showAll)
					{
						//span.className = "hasSubtreeShow";
						addClass(span, "hasSubtreeShow");
						// ************************************************************************
						if(this.m_firstLast)
						{
							if(getPreviousSibling(node) === null && node.parentNode.id === this.m_gadgetIdName)
							{
								//span.className = "hasSubtreeShow first";
								addClass(span, "hasSubtreeShow");
								addClass(span, "first");
								addClass(node, "first");
							}					
							else if(getNextSibling(node) === null && node.parentNode.id === this.m_gadgetIdName)
							{
								//span.className = "hasSubtreeShow last";
								addClass(span, "hasSubtreeShow");
								addClass(span, "last");
								addClass(node, "last");
							}
							else
							{
								//span.className = "hasSubtreeShow";
								addClass(span, "hasSubtreeShow");
							}
						} // end if(this.m_firstLast)
						// ************************************************************************
						for(i = 0; i < ulList.length; i++)
						{
							ulList[i].style.display = "block";
						}
						span.title = "Hide. . .";
					}
					else if(that.m_byPage)
					{
						bodyList = document.getElementsByTagName("body");
						if(bodyList[0].id !== null)
						{
							pageId = bodyList[0].id;
							if(node.className !== null)
							{
								linkName = node.className;
								if(findClass(node, pageId))
								{
									for(i = 0; i < node.childNodes.length; i++)
									{
										if(node.childNodes[i].nodeName.toLowerCase() === "ul")
										{
											node.childNodes[i].style.display = "block";
										}
									}
									addClass(span, "hasSubtreeShow");
									// ************************************************************
									if(this.m_firstLast)
									{
										if(getPreviousSibling(node) === null && node.parentNode.id === this.m_gadgetIdName)
										{
											//span.className = "hasSubtreeShow first";
											addClass(span, "hasSubtreeShow");
											addClass(span, "first");
											addClass(node, "first");
										}					
										else if(getNextSibling(node) === null && node.parentNode.id === this.m_gadgetIdName)
										{
											//span.className = "hasSubtreeShow last";
											addClass(span, "hasSubtreeShow");
											addClass(span, "last");
											addClass(node, "last");
										}
										else
										{
											//span.className = "hasSubtreeShow";
											addClass(span, "hasSubtreeShow");
										}
									} // end if(this.m_firstLast)
									// ************************************************************
									span.title = "Hide. . .";
								}
								else
								{
									addClass(span, "hasSubtreeHide");
									// ************************************************************
									if(this.m_firstLast)
									{
										if(getPreviousSibling(node) === null && node.parentNode.id === this.m_gadgetIdName)
										{
											//span.className = "hasSubtreeHide first";
											addClass(span, "hasSubtreeHide");
											addClass(span, "first");
											addClass(node, "first");
										}					
										else if(getNextSibling(node) === null && node.parentNode.id === this.m_gadgetIdName)
										{
											//span.className = "hasSubtreeHide last";
											addClass(span, "hasSubtreeHide");
											addClass(span, "last");
											addClass(node, "last");
										}
										else
										{
											//span.className = "hasSubtreeHide";
											addClass(span, "hasSubtreeHide");
										}
									} // end if(this.m_firstLast)
									// ************************************************************
									//span.className = "hasSubtreeHide";
									for(i = 0; i < ulList.length; i++)
									{
										ulList[i].style.display = "none";
									}
									span.title = "Show. . .";
								} // end if(linkName === pageId)
							} // end if(node.className !== null)
						} // end if(bodyList[0].id !== null)
					}
					else
					{
						addClass(span, "hasSubtreeHide");
					
						if(that.m_manual)
						{
							if(findClass(node, "on"))
							{
								var liNode = node;
								if(liNode.parentNode)
								{
									while(liNode.parentNode.nodeName.toLowerCase() !== "body")
									{
										if(liNode.parentNode.nodeName.toLowerCase() === "li")
										{
											addClass(liNode.parentNode, "on");
										}
										
										if(liNode.parentNode.nodeName.toLowerCase() === "ul")
										{
											liNode.parentNode.style.display = "block";
										}										
										liNode = liNode.parentNode;
									}
								}
							}						
						}
						// ************************************************************************
						if(this.m_textExpand)
						{
							if(node.hasChildNodes())
							{
								cn = node.firstChild;
								//alert(typeof cn);
								while(cn)
								{
									if(cn.nodeName.toLowerCase() === "a")
									{
										//alert(cn.nodeName);
										cn.href = "#nop";
										//alert(typeof fn2);
										cn.onclick = fn2;
										cn.setAttribute("title", "Show. . .");
										addClass(cn, "hasSubtreeHide");
									}
									cn = getNextSibling(cn);
								}
							}
						}
						// ************************************************************************
						if(this.m_firstLast)
						{
							if(getPreviousSibling(node) === null && node.parentNode.id === this.m_gadgetIdName)
							{
								//span.className = "hasSubtreeHide first";
								addClass(span, "hasSubtreeHide");
								addClass(span, "first");
								addClass(node, "first");
							}					
							else if(getNextSibling(node) === null && node.parentNode.id === this.m_gadgetIdName)
							{
								//span.className = "hasSubtreeHide last";
								addClass(span, "hasSubtreeHide");
								addClass(span, "last");
								addClass(node, "last");
							}
							else
							{
								//span.className = "hasSubtreeHide";
								addClass(span, "hasSubtreeHide");
							}
						} // end if(this.m_firstLast)
						// ************************************************************************
						for(i = 0; i < ulList.length; i++)
						{
							ulList[i].style.display = "none";
						}
						span.title = "Show. . .";
					} // end if(that.m_showAll)
					// ****************************************************************************
					// begin set event handlers
					span.onmouseover = function (event)
					{
						this.style.cursor = "pointer";
					};
					span.onmouseout = function (event)
					{
						this.style.cursor = "default";
					};
					
					
					
					span.onclick = fn;
					node.insertBefore(span, node.firstChild);
					span = null;
					
					
					if(this.m_textExpand)
					{
						if(node.hasChildNodes())
						{
							cn = node.firstChild;
							while(cn)
							{
								if(cn.nodeName.toLowerCase() === "a")
								{
									cn.href = "#nop";
									cn.onclick = fn2;
								}
								cn = getNextSibling(cn);
							}
						}
					} // end if(this.m_textExpand)
					// end event handlers
				}
			} // end if(node.nodeName.toLowerCase() === "li")
		} // end if(node.nodeType === 1)
		// end visit node
		
		// traverse sibling nodes
		if(node.nextSibling !== null)
		{
			this.initTree(node.nextSibling);
		}
				
		a = null;
		bodyList = null;
		i = null;
		linkName = null;
		pageId = null;
		span = null;
		text = null;
		ulList = null;
		//value = null;
	}; // end this.initTree = function (node)

	/*	
	this.traverseTree = function (node, fxn)
	{
		if(node.hasChildNodes())
		{
			this.traverseTree(node.childNodes[0], fxn);
		}
		// begin visit node
		fxn();
		// end visit node
		if(node.nextSibling !== null)
		{
			this.traverseTree(node.nextSibling, fxn);
		}
	}; // end this.traverseTree = function (node, fxn)

	this.visitNode = function ()
	{
		alert("visit");
	}; // end this.visitNode = function ()
	*/
	
	this.trim = function (stringIn)
	{
		if(stringIn === "" || stringIn === null)
		{
			return "";
		}
		else
		{
			return stringIn.replace(/^\s*/, "").replace(/\s*$/, "");
		}
	}; // end this.trim = function (stringIn)

	this.initialize = function ()
	{
		if(document.getElementById(gadgetIdNameIn) !== null)
		{
			this.setup(gadgetIdNameIn, behavior);
			this.initTree(this.m_gadgetIdRef);
			this.m_gadgetIdRef = null;
		}
	}; // end this.initialize = function ()
	
	this.initialize();
	
} // end function TreeControl(gadgetIdNameIn, behavior)

TreeControl.BEHAVIOR = 
{
showAll:1,
collapseAll:2,
toggle:3,
byPage:4,
manual:5,
firstLast:6,
textExpand:7,
highlight:8,
check:9
};

TreeControl.ARRAY = [];

// ************************************************************************************************
// end treeControl.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2009/03/10 16:30:00 $
*       Filename:  $RCSfile: popupMenu.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin popupMenu.js
// ************************************************************************************************

/*global BLK, changeClass, createIframeLayer, document, findClass, getElementsByClassName, removeIframeLayer, window, addLoadListener */

// ************************************************************************************************
// begin usage
// this initial markup is transformed. . .
// ************************************************************************************************
/*
<ul class="popupMenuGadget popupMenuGadgetOnMouseover">
<li><a href="#nop">Reports</a></li>
<li><a href="response.asp?value=Balance">Balance</a></li>
<li><a href="response.asp?value=Dividend">Dividend</a></li>
<li><a href="response.asp?value=Fund Factor">Fund Factor</a></li>
<li><a href="response.asp?value=Pending Orders">Pending Orders</a></li>
<li><a href="response.asp?value=Transactions">Transactions</a></li>
</ul>
*/
// ************************************************************************************************
// . . .into this final markup
// ************************************************************************************************
/*	
<div class="menuGadget popupMenuGadget popupMenuGadgetOnMouseover" style="z-index:10002;">
<ul class="popupMenuHeader">
<li class="popupMenuWrapper">
<a class="popupMenuLink" href="#nop">Reports</a>
<ul class="popupMenuBody hide">
<li><a href="response.asp?value=Balance">Balance</a></li>
<li><a href="response.asp?value=Dividend">Dividend</a></li>
<li><a href="response.asp?value=Fund+Factor">Fund Factor</a></li>
<li><a href="response.asp?value=Pending+Orders">Pending Orders</a></li>
<li><a href="response.asp?value=Transactions">Transactions</a></li>
</ul>
</li>
</ul>
</div>
*/	
/*
function popupMenuInit()
{
	if(typeof BLK.EBIZ.popupMenu !== "undefined")
	{
		BLK.EBIZ.popupMenu.setup();
	}
}
addLoadListener(popupMenuInit);
*/	
// ************************************************************************************************
// end usage
// ************************************************************************************************

BLK.EBIZ.popupMenu = 
{
	idIndex : 0,
	classType : "popupMenu",
	
	buildGadgetId : function (number)
	{
		return this.classType + "_" + String(number);
	}, // end buildMenuId : function (number)

	setup : function ()
	{
		this.buildPopupMenu();
		this.setZIndex();		
	}, // end setup : function ()

	setZIndex : function ()
	{
		var i = 0;
		var menuGadgetList = null;

		menuGadgetList = getElementsByClassName(document.body, "menuGadget");
		for(i = 0; i < menuGadgetList.length; i++)
		{
			menuGadgetList[i].style.zIndex = menuGadgetList.length - (i * 5) + 9999;
		}
	}, // end setZIndex : function ()

	buildPopupMenu : function ()
	{
		var a = null;
		var aList = null;
		var div = null;
		var div2 = null;
		var i = 0;
		var input = null;
		var j = 0;
		var k = 0;
		var label = null;
		var li1 = null;
		var li2 = null;
		var menuGadgetList = null;
		var menuId = "";
		var menuOk = false;
		var span = null;
		var text = null;
		var ul1 = null;
		var ul2 = null;
	
		menuGadgetList = getElementsByClassName(document.body, "popupMenuGadget");

        var displayOnMouseover = false;
		for(i = 0; i < menuGadgetList.length; i++)
		{
            displayOnMouseover = false;
		    if(findClass(menuGadgetList[i], "popupMenuGadgetOnMouseover"))
		    {
                displayOnMouseover = true;
		    }
		
			this.idIndex++;
			menuId = this.buildGadgetId(this.idIndex);
			
			div = document.createElement("div");
			div.id = menuId;
			if(displayOnMouseover)
			{
			    div.className = "menuGadget popupMenuGadget popupMenuGadgetOnMouseover";
			}
			else
			{
			    div.className = "menuGadget popupMenuGadget";
			}
			
			ul1 = document.createElement("ul");
			ul1.className = "popupMenuHeader";
			
			li1 = document.createElement("li");
			li1.className = "popupMenuWrapper";

			aList = menuGadgetList[i].getElementsByTagName("a");

			a = document.createElement("a");
			a.href = aList[0].href;
			a.className = "popupMenuLink";
			
			text = document.createTextNode(aList[0].firstChild.nodeValue);


			//span = document.createElement("span");
			//span.className = "popupMenuText";
			//span.appendChild(text);
			//a.appendChild(span);
			

			a.appendChild(text);


			//span = document.createElement("span");
			//span.className = "popupMenuDropdown";
			//a.appendChild(span);
			
			li1.appendChild(a);
			
			ul2 = document.createElement("ul");
			ul2.className = "popupMenuBody hide";

			for(k = 1; k < aList.length; k++)
			{
				li2 = document.createElement("li");
				a = document.createElement("a");
				
				a.href = aList[k].href;
                if(aList[k].target !== "")
                {				
				    a.target = aList[k].target;
				}
				if(typeof aList[k].onclick === "function")
				{
				    a.onclick = aList[k].onclick;
				}
				if(aList[k].title !== "")
				{
				    a.title = aList[k].title;
				}
				
				text = document.createTextNode(aList[k].firstChild.nodeValue);	
				
				a.appendChild(text);
				li2.appendChild(a);
				ul2.appendChild(li2);
			} // end for(k = 1; k < aList.length; k++)
			li1.appendChild(ul2);
			ul1.appendChild(li1);
			div.appendChild(ul1);
			
			menuGadgetList[i].parentNode.replaceChild(div, menuGadgetList[i]);
			this.createPopupEventHandlers(menuId);
		} // end for(i = 0; i < menuGadgetList.length; i++)
	}, // end buildPopupMenu : function ()

	createPopupEventHandlers : function (menuId)
	{
		var bodyRef = null;
		var dropdownRef = null;
		var eventHandlersOk = false;
		var fxn = null;
		var gadgetRef = null;
		var headerRef = null;
		var linkRef = null;
		var menuTextRef = null;
		var pageBodyRef = null;
		var wrapperRef = null;

		// verify control has been created properly
		gadgetRef = document.getElementById(menuId);
		if(gadgetRef === null)
		{
			window.status = "Invalid menu id.";
			return false;
		}
		headerRef = getElementsByClassName(gadgetRef, "popupMenuHeader");
		if(headerRef.length === 0)
		{
			window.status = "Menu header not found.";
			return false;
		}
		wrapperRef = getElementsByClassName(gadgetRef, "popupMenuWrapper");
		if(wrapperRef.length === 0)
		{
			window.status = "Menu wrapper not found.";
			return false;
		}
		linkRef = getElementsByClassName(gadgetRef, "popupMenuLink");
		if(linkRef.length === 0)
		{
			window.status = "Menu link not found.";
			return false;
		}
		bodyRef = getElementsByClassName(gadgetRef, "popupMenuBody");
		if(bodyRef.length === 0)
		{
			window.status = "Menu body not found.";
			return false;
		}


		var displayOnMouseover = false;
		if(findClass(gadgetRef, "popupMenuGadgetOnMouseover"))
		{
    		displayOnMouseover = true;
		}


        // ****************************************************************************************
		// begin on mouse over/on click
        // ****************************************************************************************
		fxn = function (event)
		{
			var bodyRef = null;
			var gadgetRef = null;
	        var targetElement = null;
	        var isIe = false;

	        if(typeof event === "undefined")
	        {
	            event = window.event;
	            isIe = true;
	        }
	        if(typeof event.target !== "undefined")
	        {
	            targetElement = event.target;
	        }
	        else
	        {
	            targetElement = event.srcElement;
	        }
			gadgetRef = document.getElementById(menuId);
			if(gadgetRef !== null)
			{
				bodyRef = getElementsByClassName(gadgetRef, "popupMenuBody");
				if(bodyRef.length !== 0)
				{
					var oldZIndex = gadgetRef.style.zIndex;
					var newZIndex = "999999";
					
					gadgetRef.style.zIndex = newZIndex;
					headerRef[0].style.zIndex = newZIndex - 1;
					wrapperRef[0].style.zIndex = newZIndex - 2;
					bodyRef[0].style.zIndex = newZIndex - 3;
					
					if(findClass(bodyRef[0], "hide"))
					{
						changeClass(bodyRef[0], "hide", "show");
					    //if(isIe)
					    //{
					    //    createIframeLayer(bodyRef[0]);
					    //}
					}

					gadgetRef.style.zIndex = oldZIndex;
					headerRef[0].style.zIndex = oldZIndex;
					wrapperRef[0].style.zIndex = oldZIndex;
					bodyRef[0].style.zIndex = oldZIndex;
				} // end if(bodyRef.length !== 0)
			} // end if(gadgetRef !== null)
			return false;
		}; // end fxn = function (event)
		if(displayOnMouseover)
		{
    		wrapperRef[0].onmouseover = fxn;
		}
		else
		{
    		wrapperRef[0].onclick = fxn;
		}
        // ****************************************************************************************
		// end on mouse over/on click
        // ****************************************************************************************

        // ****************************************************************************************
        // begin on mouse out
        // ****************************************************************************************
		fxn = function (event)
		{
			var bodyRef = null;
			var gadgetRef = null;
	        var targetElement = null;
	        var isIe = false;

	        if(typeof event === "undefined")
	        {
	            event = window.event;
	            isIe = true;
	        }
	        if(typeof event.target !== "undefined")
	        {
	            targetElement = event.target;
	        }
	        else
	        {
	            targetElement = event.srcElement;
	        }
			gadgetRef = document.getElementById(menuId);
			if(gadgetRef !== null)
			{
				bodyRef = getElementsByClassName(gadgetRef, "popupMenuBody");
				if(bodyRef.length !== 0)
				{
					if(findClass(bodyRef[0], "show"))
					{
						changeClass(bodyRef[0], "show", "hide");
						
					    //if(isIe)
					    //{
					    //    createIframeLayer(bodyRef[0]);
					    //}
					}
				} // end if(bodyRef.length !== 0)
			} // end if(gadgetRef !== null)
			return false;
		}; // end fxn = function (event)
		if(displayOnMouseover)
		{
    		wrapperRef[0].onmouseout = fxn;
		}
        // ****************************************************************************************
        // end on mouse out
        // ****************************************************************************************
		
        // ****************************************************************************************
		// begin hide menu when user clicks outside of control		
        // ****************************************************************************************
		pageBodyRef = document.getElementsByTagName("body")[0];
		//pageBodyRef = document.getElementsByTagName("html")[0];
		pageBodyRef = document;
		fxn = function(event)
		{
			var bodyRef = null;
			var found = false;
			var gadgetRef = null;
			var node = null;
			var targetElement = null;
            var isIe = false;
			
	        try
	        {
	            if(typeof event === "undefined")
	            {
	                event = window.event;
	                //alert("is ie. . .");
	                isIe = true;
	            }
				if(typeof event.target !== "undefined")
				{
					targetElement = event.target;
				}
				else
				{
					targetElement = event.srcElement;
				}
		    	
				gadgetRef = document.getElementById(menuId);
				
				if(gadgetRef !== null)
				{
					node = targetElement;
					found = false;
					while(node.parentNode !== null)
					{
						if(node === gadgetRef)
						{
							found = true;
							break;
						}
						node = node.parentNode;
					}
					if(!found)
					{
						bodyRef = getElementsByClassName(gadgetRef, "popupMenuBody");
						if(bodyRef.length !== 0)
						{
							if(findClass(bodyRef[0], "show"))
							{
								changeClass(bodyRef[0], "show", "hide");
								//if(isIe)
								//{
								//    removeIframeLayer(bodyRef[0]);
								//}
							}
						}
					} // end if(!found)
				} // end if(gadgetRef !== null)
	        }
	        catch(e)
	        {
	            var output = "Exception caught:\n";
	            output += e.message;
	            window.alert(output);
	        }
		}; // end fxn = function(event)
	    //attachEventListener(pageBodyRef, "click", fxn, false);
	    pageBodyRef.onclick = fxn;
        // ****************************************************************************************
		// end hide menu when user clicks outside of control		
        // ****************************************************************************************
        

        /*        
        // ****************************************************************************************
        // begin save cookie with selected tab
        // ****************************************************************************************
		fxn = function (event)
		{
		    window.alert("unload. . .");
		};
		//pageBodyRef.onunload = fxn;
		attachEventListener(pageBodyRef, "unload", fxn, false);
        // ****************************************************************************************
        // end save cookie with selected tab
        // ****************************************************************************************
        */

		eventHandlersOk = true;
		return eventHandlersOk;
	} // end createPopupEventHandlers : function (menuId)
	
}; // end BLK.EBIZ.popupMenu = 
// ************************************************************************************************
// end popupMenu.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2009/03/10 16:30:00 $
*       Filename:  $RCSfile: myPicks.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin myPicks.js
// ************************************************************************************************

/*global BLK, changeClass, createIframeLayer, document, addClass, findClass, getElementsByClassName, removeIframeLayer, window, addLoadListener */

// ************************************************************************************************
// begin usage
// ************************************************************************************************
/*
function myPicksInit()
{
	if(typeof BLK.EBIZ.myPicks !== "undefined")
	{
		BLK.EBIZ.myPicks.setup();
	}
}
addLoadListener(myPicksInit);
*/
// ************************************************************************************************
// end usage
// ************************************************************************************************

BLK.EBIZ.myPicks = 
{
	idIndex : 0,
	classType : "myPicksGadget",
	
	buildGadgetId : function (number)
	{
		return this.classType + "_" + String(number);
	}, // end buildMenuId : function (number)
	
	setup : function ()
	{
		this.buildMyPicks();
	}, // end setup : function ()

	buildMyPicks : function ()
	{
		var myPicksGadgetList = null;
		var myPicksGadgetId = "";
		var myPicksGadgetOk = false;
	
		myPicksGadgetList = getElementsByClassName(document.body, "myPicksGadget");

        var displayOnMouseover = false;
		for(var i = 0; i < myPicksGadgetList.length; i++)
		{
			//this.idIndex++;
			//myPicksGadgetId = this.buildGadgetId(this.idIndex);
			if(myPicksGadgetList[i].nodeName.toLowerCase() !== "a")
			{
			    window.status = "My picks tag not of correct type.";
			    continue;
			}
			
			this.createPopupEventHandlers(myPicksGadgetList[i]);
		} // end for(i = 0; i < myPicksGadgetList.length; i++)
	}, // end buildMyPicks : function ()

	createPopupEventHandlers : function (gadgetRef)
	{
		var bodyRef = null;
		var eventHandlersOk = false;
		var fxn = null;
		
   		gadgetRef.onclick = function (event)
		//fxn = function (event)
		{
			var bodyRef = null;
	        var targetElement = null;
	        var isIe = false;

	        if(typeof event === "undefined")
	        {
	            event = window.event;
	            isIe = true;
	        }
	        if(typeof event.target !== "undefined")
	        {
	            targetElement = event.target;
	        }
	        else
	        {
	            targetElement = event.srcElement;
	        }
			
			
			var myPicksIdName = this.rel;
			if(myPicksIdName === "")
			{
			    window.alert("My picks content not specified.");
			    window.status = "My picks content not specified.";
			    return false;
			}
			
			var myPicksIdRef = document.getElementById(myPicksIdName);
			if(myPicksIdRef === null)
			{
			    window.alert("My picks content not found.");
			    window.status = "My picks content not found.";
			    return false;
			}

			if(findClass(this, "myPicksExpanded"))
			{
			    changeClass(this, "myPicksExpanded", "myPicksCollapsed");
			}
			else if(findClass(this, "myPicksCollapsed"))
			{
			    changeClass(this, "myPicksCollapsed", "myPicksExpanded");
			}
			else
			{
			    changeClass(this, "myPicksExpanded", "myPicksCollapsed");
			}
			
			if(findClass(myPicksIdRef, "myPicksExpanded"))
			{
			    changeClass(myPicksIdRef, "myPicksExpanded", "myPicksCollapsed");
			}
			else if(findClass(myPicksIdRef, "myPicksCollapsed"))
			{
			    changeClass(myPicksIdRef, "myPicksCollapsed", "myPicksExpanded");
			}
			else
			{
			    changeClass(myPicksIdRef, "myPicksExpanded", "myPicksCollapsed");
			}
			
			return false;
		}; // end fxn = function (event)
		
   		//gadgetRef.onclick = fxn;
   		//attachEventListener(gadgetRef, "click", fxn, false);
		
		eventHandlersOk = true;
		return eventHandlersOk;
	} // end createPopupEventHandlers : function (gadgetRef)
}; // end BLK.EBIZ.myPicks = 

// ************************************************************************************************
// end myPicks.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2010/08/24 10:30:00 $
*       Filename:  $RCSfile: hideShow.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin hideShow.js
// ************************************************************************************************

/*global BLK, changeClass, createIframeLayer, document, addClass, findClass, getElementsByClassName, 
removeIframeLayer, window, addLoadListener, getEventTarget, unescape, getCookie, setCookie, 
getSubCookie, removeClass, attachEventListener */

// ************************************************************************************************
// begin usage
// ************************************************************************************************
/*
function hideShowInit()
{
	if(typeof BLK.EBIZ.hideShow !== "undefined")
	{
		BLK.EBIZ.hideShow.setup();
	}
}
addLoadListener(hideShowInit);
*/
// ************************************************************************************************
// end usage
// ************************************************************************************************

BLK.EBIZ.hideShow =
{
    idIndex: 0,
    classType: "hideShowGadget",

    buildGadgetId: function(number)
    {
        return this.classType + "_" + String(number);
    }, // end buildMenuId : function (number)

    setup: function()
    {
        //window.alert("setup. . .");
        this.buildMyPicks();
    }, // end setup : function ()

    buildMyPicks: function()
    {
        var hideShowGadgetList = null;
        var hideShowGadgetId = "";
        var hideShowGadgetOk = false;
        var hideShowInfo = "";
        var cookieVal = "";
        var re = {};

        hideShowGadgetList = getElementsByClassName(document.body, "hideShowGadget");

        var displayOnMouseover = false;

        //window.alert(hideShowGadgetList.length);

        for(var i = 0; i < hideShowGadgetList.length; i++)
        {
            //this.idIndex++;
            //hideShowGadgetId = this.buildGadgetId(this.idIndex);
            /*
            if(hideShowGadgetList[i].nodeName.toLowerCase() !== "a")
            {
            window.status = "Hide/Show tag not of correct type.";
            continue;
            }
            */

            //window.alert(hideShowGadgetList[i].nodeName.toLowerCase());

            // ************************************************************************************
            // ************************************************************************************
            // ************************************************************************************
            // get gadget type: <a>,<input type="radio">,<input type="checkbox">
            var gadgetType = "other";
            if(hideShowGadgetList[i].nodeName.toLowerCase() === "a")
            {
                gadgetType = "a";
            }
            else
            {
                if(hideShowGadgetList[i].nodeName.toLowerCase() === "input")
                {
                    if(hideShowGadgetList[i].type.toLowerCase() === "checkbox")
                    {
                        gadgetType = "checkbox";
                    }
                    else if(hideShowGadgetList[i].type.toLowerCase() === "radio")
                    {
                        gadgetType = "radio";
                    }
                    else
                    {
                        gadgetType = "other";
                    }
                }
                else
                {
                    gadgetType = "other";
                }
            } // end if(hideShowGadgetList[i].nodeName.toLowerCase() === "a")
            if(gadgetType === "other")
            {
                window.status = "Hide/Show tag not of correct type.";
                continue;
            } // end if(gadgetType === "other")
            // ************************************************************************************
            // ************************************************************************************
            // ************************************************************************************



            // ************************************************************************************
            // ************************************************************************************
            // ************************************************************************************
            //var hideShowIdName = hideShowGadgetList[i].rel;
            var hideShowIdName = "";
            if(gadgetType === "a")
            {
                hideShowIdName = hideShowGadgetList[i].rel;
            }
            else
            {
                //hideShowIdName = hideShowGadgetList[i].value;
                hideShowIdName = hideShowGadgetList[i].title;
            }
            if(hideShowIdName === "")
            {
                window.alert("Hide/Show content not specified.");
                window.status = "Hide/Show content not specified.";
                continue;
            }
            var hideShowIdRef = document.getElementById(hideShowIdName);
            if(hideShowIdRef === null)
            {
                window.alert("Hide/Show content not found.");
                window.status = "Hide/Show content not found.";
                continue;
            }

            // get hide/show state
            var hideShowState = "";
            if(findClass(hideShowGadgetList[i], "hideShowExpanded"))
            {
                if(gadgetType === "a")
                {
                    //changeClass(hideShowIdRef, "hideShowCollapsed", "hideShowExpanded");
                    removeClass(hideShowIdRef, "hideShowExpanded");
                    addClass(hideShowIdRef, "hideShowCollapsed");
                    hideShowState = "hideShowExpanded";
                }
                else if(gadgetType === "checkbox")
                {
                    hideShowGadgetList[i].checked = true;
                    changeClass(hideShowIdRef, "hideShowCollapsed", "hideShowExpanded");
                    hideShowState = "hideShowExpanded";
                }
                else if(gadgetType === "radio")
                {
                    if(hideShowGadgetList[i].checked === true)
                    {
                        changeClass(hideShowIdRef, "hideShowCollapsed", "hideShowExpanded");
                        hideShowState = "hideShowExpanded";
                    }
                }
            }
            else if(findClass(hideShowGadgetList[i], "hideShowCollapsed"))
            {
                if(gadgetType === "a")
                {
                    //changeClass(hideShowIdRef, "hideShowExpanded", "hideShowCollapsed");
                    removeClass(hideShowIdRef, "hideShowExpanded");
                    addClass(hideShowIdRef, "hideShowCollapsed");
                    hideShowState = "hideShowCollapsed";
                }
                else if(gadgetType === "checkbox")
                {
                    hideShowGadgetList[i].checked = false;
                    changeClass(hideShowIdRef, "hideShowExpanded", "hideShowCollapsed");
                    hideShowState = "hideShowCollapsed";
                }
                else if(gadgetType === "radio")
                {
                    if(hideShowGadgetList[i].checked === true)
                    {
                        changeClass(hideShowIdRef, "hideShowExpanded", "hideShowCollapsed");
                        hideShowState = "hideShowCollapsed";
                    }
                }
            }
            else
            {
                if(gadgetType === "a")
                {
                }
                else if(gadgetType === "checkbox")
                {
                    hideShowGadgetList[i].checked = false;
                }
                else if(gadgetType === "radio")
                {
                    hideShowGadgetList[i].checked = false;
                }
                changeClass(hideShowGadgetList[i], "hideShowExpanded", "hideShowCollapsed");
                changeClass(hideShowIdRef, "hideShowExpanded", "hideShowCollapsed");
                hideShowState = "hideShowCollapsed";
            } // end if(findClass(hideShowGadgetList[i], "hideShowExpanded"))


            //window.alert(hideShowIdRef.id + "||" + hideShowIdRef.className);


            // ************************************************************************************
            // ************************************************************************************
            // ************************************************************************************



            // ************************************************************************************
            // begin cookie detection code
            // ************************************************************************************
            var subCookieVal = "";
            if(hideShowGadgetList[i].nodeName.toLowerCase() === "a" &&
                findClass(hideShowGadgetList[i], "hideShowRemember"))
            {
                cookieVal = unescape(getCookie("hideShowRemember"));
                //window.alert(this.nodeName);
                if(cookieVal === "")
                {
                    // cookie does not exist
                    hideShowInfo = hideShowGadgetList[i].id + ":" + hideShowState;
                    setCookie("hideShowRemember", hideShowInfo, 90);
                }
                else
                {
                    // cookie does exist
                    if(cookieVal.indexOf(hideShowGadgetList[i].id, 0) === -1)
                    {
                        // cookie does exist, id not found
                        hideShowInfo = hideShowGadgetList[i].id + ":" + hideShowState;
                        setCookie("hideShowRemember", cookieVal + "/" + hideShowInfo, 90);
                    }
                    else
                    {
                        // cookie does exist, id found
                        subCookieVal = getSubCookie("hideShowRemember", hideShowGadgetList[i].id);

                        re = new RegExp(hideShowIdName + ":" + subCookieVal);
                        hideShowState = subCookieVal;
                        changeClass(hideShowGadgetList[i], ["hideShowExpanded", "hideShowCollapsed"], hideShowState);
                        changeClass(hideShowIdRef, ["hideShowExpanded", "hideShowCollapsed"], hideShowState);
                    } // end if(cookieVal.indexOf(id, 0) === -1)
                } // end if(cookieVal === "")
            } // end if(hideShowGadgetList[i].nodeName.toLowerCase() === "a" && 
            // ************************************************************************************
            // end cookie detection code
            // ************************************************************************************

            this.createHideShowEventHandlers(hideShowGadgetList[i]);
        } // end for(i = 0; i < hideShowGadgetList.length; i++)
    }, // end buildMyPicks : function ()

    createHideShowEventHandlers: function(gadgetRef)
    {
        var bodyRef = null;
        var eventHandlersOk = false;
        var fxn = null;

        //gadgetRef.onclick = function (event)
        fxn = function(event)
        {
            //window.alert("on click. . .");


            var that = this;
            var re = {};

            var bodyRef = null;
            var isIe = false;

            if(typeof event === "undefined")
            {
                event = window.event;
                isIe = true;
            }
            var target = getEventTarget(event);


            //BLK.EBIZ.trace("this:" + this.nodeName + "||" + "target:" + target.nodeName);


            if(typeof this.nodeName === "undefined")
            {
                that = target;
            }
            else
            {
                that = this;
            }

            // this = <a>
            // target = <img>


            //var hideShowIdName = that.rel;
            var hideShowIdName = "";
            var gadgetType = "other";
            if(that.nodeName.toLowerCase() === "a")
            {
                hideShowIdName = that.rel;
                gadgetType = "a";
            }
            else if(that.nodeName.toLowerCase() === "input")
            {
                if(that.type.toLowerCase() === "checkbox")
                {
                    //hideShowIdName = that.value;
                    hideShowIdName = that.title;
                    gadgetType = "checkbox";
                }
                else if(that.type.toLowerCase() === "radio")
                {
                    //hideShowIdName = that.value;
                    hideShowIdName = that.title;
                    gadgetType = "radio";
                }
                else
                {
                    hideShowIdName = "";
                    gadgetType = "other";
                }
            }
            else
            {
                hideShowIdName = "";
                gadgetType = "other";
            }

            if(hideShowIdName === "")
            {
                window.alert("Hide/Show content not specified.");
                window.status = "Hide/Show content not specified.";
                return false;
            }
            var hideShowIdRef = document.getElementById(hideShowIdName);

            if(hideShowIdRef === null)
            {
                window.alert("Hide/Show content not found.");
                window.status = "Hide/Show content not found.";
                return false;
            }


            //var rel = target.rel;
            var id = gadgetRef.id;
            var hideShowInfo = "";
            var cookieVal = "";
            var subCookieVal = "";
            var result = "";
            var hideShowState = "";


            if(gadgetType === "radio")
            {
                if(findClass(that, "hideShowExpanded"))
                {
                    changeClass(that, "hideShowCollapsed", "hideShowExpanded");
                    changeClass(hideShowIdRef, "hideShowCollapsed", "hideShowExpanded");
                    hideShowInfo = id + ":" + "hideShowExpanded";
                    hideShowState = "hideShowExpanded";
                }
                else if(findClass(that, "hideShowCollapsed"))
                {
                    changeClass(that, "hideShowExpanded", "hideShowCollapsed");
                    changeClass(hideShowIdRef, "hideShowExpanded", "hideShowCollapsed");
                    hideShowInfo = id + ":" + "hideShowCollapsed";
                    hideShowState = "hideShowCollapsed";
                }
                else
                {
                    changeClass(that, "hideShowCollapsed", "hideShowExpanded");
                    changeClass(hideShowIdRef, "hideShowCollapsed", "hideShowExpanded");
                    hideShowInfo = id + ":" + "hideShowExpanded";
                    hideShowState = "hideShowExpanded";
                }
            }
            else
            {
                if(findClass(that, "hideShowExpanded"))
                {
                    changeClass(that, "hideShowExpanded", "hideShowCollapsed");
                    changeClass(hideShowIdRef, "hideShowExpanded", "hideShowCollapsed");
                    hideShowInfo = id + ":" + "hideShowCollapsed";
                    hideShowState = "hideShowCollapsed";
                }
                else if(findClass(that, "hideShowCollapsed"))
                {
                    changeClass(that, "hideShowCollapsed", "hideShowExpanded");
                    changeClass(hideShowIdRef, "hideShowCollapsed", "hideShowExpanded");
                    hideShowInfo = id + ":" + "hideShowExpanded";
                    hideShowState = "hideShowExpanded";
                }
                else
                {
                    changeClass(that, "hideShowExpanded", "hideShowCollapsed");
                    changeClass(hideShowIdRef, "hideShowExpanded", "hideShowCollapsed");
                    hideShowInfo = id + ":" + "hideShowCollapsed";
                    hideShowState = "hideShowCollapsed";
                }
            } // end if(gadgetType === "radio")


            // ************************************************************************************
            // ************************************************************************************
            // to be done: implement remember functionality            
            // ************************************************************************************
            // ************************************************************************************



            // ************************************************************************************
            // begin cookie detection code
            // ************************************************************************************
            if(that.nodeName.toLowerCase() === "a")
            {
                if(findClass(that, "hideShowRemember"))
                {
                    cookieVal = unescape(getCookie("hideShowRemember"));
                    if(cookieVal === "")
                    {
                        // cookie does not exist
                        hideShowInfo = id + ":" + hideShowState;
                        setCookie("hideShowRemember", hideShowInfo, 90);
                    }
                    else
                    {
                        if(cookieVal.indexOf(id, 0) === -1)
                        {
                            // cookie does exist, id not found
                            hideShowInfo = id + ":" + hideShowState;
                            setCookie("hideShowRemember", cookieVal + "/" + hideShowInfo, 90);
                        }
                        else
                        {
                            // cookie does exist, id found
                            subCookieVal = getSubCookie("hideShowRemember", id);
                            re = new RegExp(id + ":" + subCookieVal);
                            hideShowInfo = id + ":" + hideShowState;
                            result = cookieVal.replace(re, hideShowInfo);
                            setCookie("hideShowRemember", result, 90);
                        } // end if(cookieVal.indexOf(id, 0) === -1)
                    } // end if(cookieVal === "")
                } // end if(findClass(that, "hideShowRemember"))
                //BLK.EBIZ.trace("cookie:" + unescape(getCookie("hideShowRemember")));
            } // end if(that.nodeName.toLowerCase() === "a")
            // ************************************************************************************
            // end cookie detection code
            // ************************************************************************************

            // ************************************************************************************
            // ************************************************************************************
            // to be done: implement remember functionality            
            // ************************************************************************************
            // ************************************************************************************

            if(gadgetType === "a")
            {
                return false;
            }
            else
            {
                // gadget type is checkbox or radio
                return true;
            }
        }; // end fxn = function (event)




        //gadgetRef.onclick = fxn;
        attachEventListener(gadgetRef, "click", fxn, false);

        eventHandlersOk = true;
        return eventHandlersOk;
    } // end createHideShowEventHandlers : function (gadgetRef)
};  // end BLK.EBIZ.hideShow = 

// ************************************************************************************************
// end hideShow.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2009/04/20 15:00:00 $
*       Filename:  $RCSfile: setConfigData.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin setConfigData.js
// ************************************************************************************************

BLK.setConfigData = function ()
{
    var configOK = false;
    // check for existence of environment data structures
    //alert(BLK.envConfig + "||" + typeof BLK.envConfig + "||" + BLK.envConfig.environment);
    if(typeof BLK.envConfig === "undefined")
    {
        configOK = false;
        return configOK;
    }
    if(typeof BLK.envSetting === "undefined")
    {
        configOK = false;
        return configOK;
    }
    var i = 0;
    // run functions that have subscribed to this event
    for(i = 0; i < BLK.setConfigData.fxnArray.length; i++)
    {
        BLK.setConfigData.fxnArray[i]();
    }
    configOK = true;
    return configOK;
} // end BLK.setConfigData = function ()
BLK.setConfigData.fxnArray = [];
// ************************************************************************************************
// end setConfigData.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2009/04/20 10:00:00 $
*       Filename:  $RCSfile: login.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin login.js
// ************************************************************************************************

/*global BLK, document, window, screen */

BLK.BRS.login = function (selLoginIdName)
{
    var selLoginIdRef = document.getElementById(selLoginIdName);
    if(selLoginIdRef === null)
    {
        window.alert("Login selection list not found. . ."); 
        return false;
    }
    var index = selLoginIdRef.selectedIndex;
    var value = selLoginIdRef.options[index].value;
    if(value === "")
    {
        window.alert("Please select an item from the login selection list. . .");
        selLoginIdRef.focus();
        return false;
    }
    
    var win = window.open(value, "loginWin", "status=1,scrollbars=1,resizable=1,titlebar=1");
    if(win)
    {
        win.resizeTo(screen.availWidth, screen.availHeight);
    }
    
    //var win = window.open(value);

    return false;
}; // end BLK.BRS.login = function (selLoginIdName)

// ************************************************************************************************
// end login.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2009/04/01 17:00:00 $
*       Filename:  $RCSfile: editButtons.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin editButtons.js
// ************************************************************************************************

/*global BLK, document, getCookie, getElementsByClassName, setCookie, window, PTPortalContext, getValueFromURL, trim, GetCookie */

// begin usage
/*
function editButtonsInit()
{
	if(typeof BLK.EBIZ.EditButtons === "function")
	{
	    // default: name=editButtonGadget, keystroke=CTRL+ALT+F10, expires=1 day
		BLK.EBIZ.EditButtons.editButtonCtrl = new BLK.EBIZ.EditButtons();
		// or 
		// user specified: name=editButtonCookie, keystroke=CTR+ALT+F9, expires=2 days
		BLK.EBIZ.EditButtons.editButtonCtrl = new BLK.EBIZ.EditButtons("editButtonCookie", "F9", 2);
	}
}
addLoadListener(editButtonsInit);
*/
// end usage

BLK.EBIZ.EditButtons = function (editButtonCookieNameIn, functionKeyIn, numberOfDaysToExpireIn)
{
	var that = this;
	this.numberOfArguments = arguments.length;
	this.showEditButton = true;
	this.editButtonCookieNameDefault = "editButtonGadget";
	this.editButtonCookieName = "editButtonGadget";
	this.numberOfDaysToExpireDefault = 1;
	this.numberOfDaysToExpire = 1;
    this.functionKeyMap = 
    {
    "F1" : 112,
    "F2" : 113,
    "F3" : 114,
    "F4" : 115,
    "F5" : 116,
    "F6" : 117,
    "F7" : 118,
    "F8" : 119,
    "F9" : 120,
    "F10": 121,
    "F11": 122,
    "F12": 123
    };
	this.functionKeyDefault = "F10";
	this.functionKey = "F10";

	this.initialize = function (editButtonCookieNameIn, functionKeyIn, numberOfDaysToExpireIn)
	{
	
	    
        if(this.numberOfArguments !== 3 && this.numberOfArguments !== 0)
	    {
	        //window.alert("bad number of args. . .");
        	this.functionKey = this.functionKeyDefault;
        	this.numberOfDaysToExpire = this.numberOfDaysToExpireDefault;
	        this.editButtonCookieName = this.editButtonCookieNameDefault;
	        return;
	    }
	    if(editButtonCookieNameIn === undefined || functionKeyIn === undefined || numberOfDaysToExpireIn === undefined)
	    {
	        //window.alert("undefined. . .");
        	this.functionKey = this.functionKeyDefault;
        	this.numberOfDaysToExpire = this.numberOfDaysToExpireDefault;
	        this.editButtonCookieName = this.editButtonCookieNameDefault;
	        return;
	    }
	    editButtonCookieNameIn = trim(editButtonCookieNameIn);
	    if(editButtonCookieNameIn === "")
	    {
	        //window.alert("name blank. . .");
        	this.functionKey = this.functionKeyDefault;
        	this.numberOfDaysToExpire = this.numberOfDaysToExpireDefault;
	        this.editButtonCookieName = this.editButtonCookieNameDefault;
	        return;
	    }
	    if(this.functionKeyMap[functionKeyIn] === undefined)
	    {
	        //window.alert("bad fxn key. . .");
        	this.functionKey = this.functionKeyDefault;
        	this.numberOfDaysToExpire = this.numberOfDaysToExpireDefault;
	        this.editButtonCookieName = this.editButtonCookieNameDefault;
	        return;
	    }
	    var isNumeric = !isNaN(numberOfDaysToExpireIn);
	    if(!(numberOfDaysToExpireIn === null || isNumeric))
	    {
	        //window.alert("bad number of days. . .");
        	this.functionKey = this.functionKeyDefault;
        	this.numberOfDaysToExpire = this.numberOfDaysToExpireDefault;
	        this.editButtonCookieName = this.editButtonCookieNameDefault;
	        return;
	    }
	    this.editButtonCookieName = editButtonCookieNameIn;
        this.functionKey = functionKeyIn;
        this.numberOfDaysToExpire = numberOfDaysToExpireIn;
	}; // end this.initialize = function (editButtonCookieNameIn, functionKeyIn, numberOfDaysToExpireIn)
	
	this.setup = function ()
	{
	    var value = "";
	    value = GetCookie('BAPPPERM');
	    if(value === "")
	    {
        	this.showEditButton = false;
        	return false;
	    }
	    /*
	    if(value.indexOf('PE_EBIZ') < 0)	
        {
        	this.showEditButton = false;
        	return false;
        }
        */
        value = getCookie(this.editButtonCookieName);

        if(value  === "")
        {
    	    this.showEditButton = true;
        }
        else if(value  === "show")
        {
    	    this.showEditButton = true;
        }
        else
        {
    	    this.showEditButton = false;
        }
/*        
<script language='javascript'>
if (GetCookie('BAPPPERM').indexOf('PE_EBIZ')>0)
{ 
document.write ("<div class='vbWrapper'><input name='btnAction' type='button' class='validateButton' onclick=\"javascript:fillAttributes('FPGADGET_MAINSTAGE','claasch');\" value='Edit'></div>")
}
</script>
<div class='hideID'>estudioId=FPGADGET_MAINSTAGE</div>
*/        
	    var editButtonsList = getElementsByClassName(document.body, "vbWrapper");
	    
	    var fxn = null;
	    var i = 0;

        // show or hide initially
        var visibility = "hide";
	    for(i = 0; i < editButtonsList.length; i++)
	    {
	        if(this.showEditButton)
	        {
	            editButtonsList[i].style.display = "block";
	            visibility = "show";
	        }
	        else
	        {
	            editButtonsList[i].style.display = "none";
	            visibility = "hide";
	        }
	        setCookie(this.editButtonCookieName, visibility, this.numberOfDaysToExpire);
        } // end for(var i = 0; i < editButtonsList.length; i++)
        
	    // set up function key handler
	    fxn = function ()
	    {
	        var editButtonList = getElementsByClassName(document.body, "vbWrapper");
	        var i = 0;
	        
            if(that.showEditButton)
            {
                for(i = 0; i < editButtonList.length; i++)
                {
                    editButtonList[i].style.display = "none";
                }
            }        
            else
            {
                for(i = 0; i < editButtonList.length; i++)
                {
                    editButtonList[i].style.display = "block";
                }
            }
            that.showEditButton = !that.showEditButton;
            setCookie(that.editButtonCookieName, (that.showEditButton ? "show" : "hide"), that.numberOfDaysToExpire);
	    };
	    this.stopEditKey.fxnArray[this.stopEditKey.fxnArray.length] = fxn;
	    
	    document.onkeydown = this.stopEditKey;
	
	    return true;    
	}; // end this.setup = function ()
	
	this.stopEditKey = function (event)
	{ 
		if(typeof event === "undefined")
		{
			event = window.event;
		}
		var key;
		if(typeof event.which !== "undefined")
		{
			key = event.which;
		}
		else
		{
			key = event.keyCode;
		}	
/*		
F1 : 112
F2 : 113
F3 : 114
F4 : 115
F5 : 116
F6 : 117
F7 : 118
F8 : 119
F9 : 120
F10: 121
F11: 122
F12: 123
*/		
        var searchKey = that.functionKeyMap[that.functionKey];
        //document.title = that.functionKey + "=" + searchKey + "|||" + key;
        if(searchKey === "undefined")
        {
            //searchKey = that.functionKeyMap["F10"];
            searchKey = that.functionKeyMap[that.functionKey];
        }
		if(key === searchKey)
		{
		    // user did press specified function key
		    if(event.ctrlKey && event.altKey)
		    {
		        // user did press CTRL key and ALT key
		        for(var i = 0; i < that.stopEditKey.fxnArray.length; i++)
		        {
		            that.stopEditKey.fxnArray[i]();
		        }
		        return false;
		    }
		    else
		    {
		        // user did not press CTRL key and ALT key
		        return true;
		    }
		}
		else
		{
		    // user did not press specified function key
		    return true;
		}
		return true;
	}; // end this.stopEditKey = function (event)
	this.stopEditKey.fxnArray = [];
	
	this.initialize(editButtonCookieNameIn, functionKeyIn, numberOfDaysToExpireIn);
	this.setup();
}; // end BLK.EBIZ.EditButtons = function (editButtonCookieNameIn, functionKeyIn, numberOfDaysToExpireIn)

// ************************************************************************************************
// end editButtons.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2009/05/12 10:30:00 $
*       Filename:  $RCSfile: getUrlValue.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin getUrlValue.js
// ************************************************************************************************

/*global BLK, location */

BLK.EBIZ.getUrlValue = function (urlNameIn, defaultValue)
{
	var trim = function (stringIn)
	{
		if(stringIn === "" || stringIn === null)
		{
			return "";
		}
		else
		{
			return stringIn.replace(/^\s*/, "").replace(/\s*$/, "");
		}
	}; // end var trim = function (stringIn)
	
	var readyForRegExp = function (textIn)
	{
		var textOut = "";
		var charIn = "";
		var regExpChar = "\\^$*+?.[]-{}()|";
		
		for(var i = 0; i < textIn.length; i++)
		{
			charIn = textIn.charAt(i);
			if(regExpChar.indexOf(charIn) !== -1)
			{
				textOut += "\\" + charIn;
			}
			else
			{
				textOut += charIn;
			}
		}
		return textOut;
	}; // end var readyForRegExp = function (textIn)
	
	var urlName = readyForRegExp(urlNameIn);
	//window.alert(urlName);
	
	//window.alert(typeof defaultValue + "||" + defaultValue);
	if(typeof defaultValue === "undefined")
	{
	    defaultValue = "";
	}
	
	// example search url
	//http://www.ssrtestlan.com/fp/server.pt?open=512&objID=203&PageID=272&cached=true&mode=2&eid=40863&Nav=3&subNav=1
	//https://www2.blackrock.com/fp/server.pt?cached=true&mode=2&Nav=1&subNav=1&appname=wsod&open=512&objID=206&PageID=233&appURL=https://www.blackrock.wallst.com/fund/profile.asp?symbol=MDDVX&user_tier=FP_GENERIC&INSTID=BLKFP
	var search = trim(location.search);
	if(search === "")
	{
		return defaultValue;
	}
    //window.alert(search);
	
	// for symbol
	// [&?]symbol=(\w{3}|\w{5})(&|\b)
	
	// for appurl
	// [&?]appurl=(.+)

	// for blkifrmurl
	// [&?]blkifrmurl=(.+)
	
	// for other names in the name/value pair
	// [&?]<url_name_substituted_here>=(.+?)(&|$)
	
	var urlValue = "";
	var pattern = null;

	if(urlName.toLowerCase() === "symbol")
	{
	    pattern = new RegExp("[&?]symbol=(\\w{3}|\\w{5})(&|\\b)","i");
    }
    else if(urlName.toLowerCase() === "appurl")
    {
        pattern = new RegExp("[&?]appurl=(.+)","i");
    }
    else if(urlName.toLowerCase() === "blkifrmurl")
    {
        pattern = new RegExp("[&?]blkifrmurl=(.+)","i");
    }
    else
    {
        // all other values
        pattern = new RegExp("[&?]" + urlName + "=(.+?)(&|\\b)","i");
    } // end if(urlName.toLowerCase() === "symbol")
    urlValue = "";
    if(pattern.test(search))
    {
	    urlValue = RegExp.$1;
    }
    else
    {
        urlValue = defaultValue;
    } // end if(pattern.test(search))
	
	return urlValue;
}; // end BLK.EBIZ.getUrlValue = function (urlNameIn, defaultValue)

// ************************************************************************************************
// end getUrlValue.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2009/08/12 10:00:00 $
*       Filename:  $RCSfile: search.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin search.js
// ************************************************************************************************

/*global BLK, window, getEventTarget, findClass, document */

BLK.EBIZ.SearchGadget = function (searchGadgetId, searchFxn, prompt, resetGadgetId, resetFxn)
{
    var that = this;
    
    this.defaultPrompt = "Enter a search value.";
    this.userPrompt = "";
    this.searchGadgetId = "";
    this.resetGadgetId = "";
    
    var searchOnKey = function (event)
    {
	    if(typeof event === "undefined")
	    {
		    event = window.event;
	    }
	    var target = getEventTarget(event);

        var key;
        if(typeof event.which !== "undefined")
        {
	        key = event.which;
        }
        else
        {
	        key = event.keyCode;
        }	

        //window.alert("Search. . .:" + key + "||" + this.nodeName + "||" + this.value);

    	var searchOnEveryKey = findClass(this, "searchGadgetOnEveryKey");
    	if(searchOnEveryKey)
    	{
    	    if(this.value.length === 1)
    	    {
    	        //window.alert(this.value);
           	    that.whenUserEntersText();
    	    }
    	    //window.alert("search on every key. . .");
       	    searchOnKey.searchFxn(this.value);
    	}
    	else
    	{
    	    if(key === 13)
    	    {
        	    //window.alert("search on enter key. . .");
        	    searchOnKey.searchFxn(this.value);
    	    }
    	}
    }; // end var searchOnKey = function (event)
    
    var stopEnterKey = function (event)
    { 
	    if(typeof event === "undefined")
	    {
		    event = window.event;
	    }
	    var key;
	    if(typeof event.which !== "undefined")
	    {
		    key = event.which;
	    }
	    else
	    {
		    key = event.keyCode;
	    }	
    	
	    stopEnterKey.key = key;
    	
	    if(key === 13)
	    {
		    // enter key
		    return false;
	    }
	    else if(key === 8)
	    {
	        // backspace key
	        return true;
	    }
	    else
	    {
		    // not enter key
		    return true;
	    } // end if(key === 13)
    }; // end var stopEnterKey = function (event)
    stopEnterKey.key = 0;

    this.setupResetEventHandler = function (searchGadgetRef, resetGadgetRef, resetFxn)
    {
        //resetGadgetRef.onclick = resetFxn;
        
        resetGadgetRef.onclick = function (resetFxnIn, searchGadgetRefIn, promptIn)
        {
            return function ()
            {
                //window.alert(searchGadgetRefIn.value);
                resetFxnIn();
                searchGadgetRefIn.value = promptIn;
            };
        }(resetFxn, searchGadgetRef, that.userPrompt);
    }; // end this.setupResetEventHandler = function (searchGadgetRef, resetGadgetRef, resetFxn)
    
    this.setupSearchEventHandler = function (searchGadgetRef, searchFxn)
    {
        var that = this;
        var fxn = null;
        
    	searchGadgetRef.onkeypress = stopEnterKey;
    	searchOnKey.searchFxn = searchFxn;
    	searchGadgetRef.onkeyup = searchOnKey;
    	
    	// remove prompt on click
    	fxn = function (event)
    	{
	        if(typeof event === "undefined")
	        {
		        event = window.event;
	        }
	        var target = getEventTarget(event);
   	    
    	    if(this.value === that.userPrompt)
    	    {
    	        this.value = "";
    	    }
    	    else if(this.value === "")
    	    {
    	        this.value = that.userPrompt;
    	    }
    	    
    	    return false;
    	};
    	searchGadgetRef.onclick = fxn;

        // restore prompt on blur
    	fxn = function (event)
    	{
	        if(typeof event === "undefined")
	        {
		        event = window.event;
	        }
	        var target = getEventTarget(event);
   	    
    	    if(this.value === "")
    	    {
    	        this.value = that.userPrompt;
    	    }
    	    
    	    return false;
    	};
    	searchGadgetRef.onblur = fxn;
    }; // end this.setupSearchEventHandler = function (searchGadgetRef, searchFxn)
    
    this.functionQueue = [];
    
    this.enrollFunction = function (fxnRef)
    {
        this.functionQueue[this.functionQueue.length] = fxnRef;
    }; // end this.enrollFunction = function (fxnRef)
    
    this.runFunction = function ()
    {
	    for(var i = 0; i < this.functionQueue.length; i++)
	    {
	        if(typeof this.functionQueue[i] !== "function")
	        {
	            continue;
	        }
	        this.functionQueue[i]();
	    }
    }; // end this.runFunction = function ()
    
    this.clear = function ()
    {
        //window.alert(that.searchGadgetId);
        var searchGadgetRef = document.getElementById(that.searchGadgetId);
        if(searchGadgetRef === null)
        {
            //window.alert("Search gadget NOT found. . .");
            window.status = "Search gadget NOT found. . .";
            return;
        }
        //window.alert("clear. . .");
        searchGadgetRef.value = that.userPrompt;
        //that.onClear();
    }; // end this.clear = function ()
    
    this.whenUserClicksClear = function () {};
    this.whenUserEntersText = function () {};
    
    this.setup = function (searchGadgetIdIn, searchFxnIn, promptIn, resetGadgetIdIn, resetFxnIn)
    {
        var searchGadgetRef = document.getElementById(searchGadgetIdIn);
        if(searchGadgetRef === null)
        {
            //window.alert("Search gadget NOT found. . .");
            window.status = "Search gadget NOT found. . .";
            return;
        }
        var resetGadgetRef = document.getElementById(resetGadgetIdIn);
        if(resetGadgetRef === null)
        {
            //window.alert("Reset gadget NOT found. . .");
            window.status = "Reset gadget NOT found. . .";
            return;
        }
        if(typeof searchFxnIn !== "function")
        {
            //window.alert("Search function not provided. . .");
            window.status = "Search function not provided. . .";
            return;
        }
        if(typeof resetFxnIn !== "function")
        {
            //window.alert("Reset function not provided. . .");
            window.status = "Reset function not provided. . .";
            return;
        }
        
        if(promptIn === "")
        {
            this.userPrompt = this.defaultPrompt;
            searchGadgetRef.value = this.defaultPrompt;
        }
        else
        {
            this.userPrompt = promptIn;
            searchGadgetRef.value = promptIn;
        }
        
        this.searchGadgetId = searchGadgetIdIn;
        this.resetGadgetId = resetGadgetIdIn;
        
        //this.setupEventHandler(gadgetRef, searchFxnIn, resetFxnIn);
        this.setupSearchEventHandler(searchGadgetRef, searchFxnIn);
        this.setupResetEventHandler(searchGadgetRef, resetGadgetRef, resetFxnIn);
    }; // end this.setup = function (searchGadgetIdIn, searchFxnIn, promptIn, resetGadgetIdIn, resetFxnIn)
    
    this.setup(searchGadgetId, searchFxn, prompt, resetGadgetId, resetFxn);
}; // end BLK.EBIZ.SearchGadget = function (gadgetId, searchFxn)

// ************************************************************************************************
// end search.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2009/08/12 10:00:00 $
*       Filename:  $RCSfile: checkBox.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin checkBox.js
// ************************************************************************************************

/*global BLK, document, window, getElementsByClassName, findClass, addClass, getEventTarget, 
changeClass, getInternalText, removeClass */

BLK.EBIZ.CheckboxGadget = function (gadgetId, userFxn)
{
    var that = this;
    this.gadgetId = "";
    
    this.setup = function (gadgetIdIn, userFxnIn)
    {
        var gadgetRef = document.getElementById(gadgetIdIn);
        if(gadgetRef === null)
        {
            //window.alert("Check box gadget NOT found. . .");
            window.status = "Check box gadget NOT found. . .";
            return;
        }
        if(typeof userFxnIn !== "function")
        {
            //window.alert("User function not provided. . .");
            window.status = "User function not provided. . .";
            return;
        }

        this.gadgetId = gadgetIdIn;
        //userFxnIn.userData = [];
        this.toggleHandler.userFxn = userFxnIn;
        this.itemHandler.userFxn = userFxnIn;
        this.turnGivenItemsOn.userFxn = userFxnIn;
        
        var i = 0;
        
        var checkboxGadgetItemList = getElementsByClassName(gadgetRef, "checkboxGadgetItem");
        for(i = 0; i < checkboxGadgetItemList.length; i++)
        {
            checkboxGadgetItemList[i].onclick = this.itemHandler;
            
            
            //addClass(checkboxGadgetItemList[i], "checkboxGadgetItemOn");
            //checkboxGadgetItemList[i].title = "Hide. . .";
            //addClass(checkboxGadgetItemList[i].parentNode, "checkboxGadgetItemOn");
            
            
            if(findClass(checkboxGadgetItemList[i], "checkboxGadgetItemOn"))
            {
                checkboxGadgetItemList[i].title = "Hide. . .";
                addClass(checkboxGadgetItemList[i].parentNode, "checkboxGadgetItemOn");
            }
            else if(findClass(checkboxGadgetItemList[i].parentNode, "checkboxGadgetItemOn"))
            {
                checkboxGadgetItemList[i].title = "Hide. . .";
                addClass(checkboxGadgetItemList[i], "checkboxGadgetItemOn");
            }
            else
            {
                checkboxGadgetItemList[i].title = "Show. . .";
            }
        }
        var checkboxGadgetToggleList = getElementsByClassName(gadgetRef, "checkboxGadgetToggle");
        //window.alert(checkboxGadgetToggleList.length);
        for(i = 0; i < checkboxGadgetToggleList.length; i++)
        {
            checkboxGadgetToggleList[i].onclick = this.toggleHandler;
        }
    }; // end this.setup = function (gadgetIdIn, userFxnIn)
    
    this.toggleHandler = function (event)
    {
	    if(typeof event === "undefined")
	    {
		    event = window.event;
	    }
	    var target = getEventTarget(event);
	    
        //window.alert("toggleHandler: " + this.nodeName);
        
        // get reference to checkbox gadget
        var gadgetRef = null;
        var node = this;
        var found = false;
        while(node !==  null)
        {
            if(findClass(node, "checkboxGadget"))
            {
                found = true;
                gadgetRef = node;
                break;
            }
            node = node.parentNode;
        }
        if(!found)
        {
            window.alert("check box gadget not found. . .");
            return false;
        }
        
        var userData = [];
        var checkboxGadgetItemList = null;
        var i = 0;
	    if(findClass(this, "checkboxGadgetToggleOn"))
	    {
	        changeClass(this, "checkboxGadgetToggleOn", "checkboxGadgetToggleOff");
	        
	        // turn all items off
            checkboxGadgetItemList = getElementsByClassName(gadgetRef, "checkboxGadgetItem");
            for(i = 0; i < checkboxGadgetItemList.length; i++)
            {
                changeClass(checkboxGadgetItemList[i], "checkboxGadgetItemOn", "checkboxGadgetItemOff");
                checkboxGadgetItemList[i].title = "Show. . .";


                //userData[userData.length] = getInternalText(checkboxGadgetItemList[i]);
            }
            
    	    userData = [];
	    }
	    else
	    {
	        changeClass(this, "checkboxGadgetToggleOff", "checkboxGadgetToggleOn");
            
            // turn all items on
            checkboxGadgetItemList = getElementsByClassName(gadgetRef, "checkboxGadgetItem");
            for(i = 0; i < checkboxGadgetItemList.length; i++)
            {
                changeClass(checkboxGadgetItemList[i], "checkboxGadgetItemOff", "checkboxGadgetItemOn");
                checkboxGadgetItemList[i].title = "Hide. . .";
                
                userData[userData.length] = getInternalText(checkboxGadgetItemList[i]);
            }
    	    //userData = [];
	    }
	    
	    that.toggleHandler.userFxn(userData);
	    
        return false;
    }; // end this.toggleHandler = function (event)

    this.turnAllItemsOn = function ()
    {
        var gadgetRef = document.getElementById(that.gadgetId);
        if(gadgetRef === null)
        {
            //window.alert("Check box gadget NOT found. . .");
            window.status = "Check box gadget NOT found. . .";
            return;
        }
        var checkboxGadgetItemList = getElementsByClassName(gadgetRef, "checkboxGadgetItem");
        for(var i = 0; i < checkboxGadgetItemList.length; i++)
        {
            checkboxGadgetItemList[i].title = "Hide. . .";
            removeClass(checkboxGadgetItemList[i], "checkboxGadgetItemOff");
            addClass(checkboxGadgetItemList[i], "checkboxGadgetItemOn");
            removeClass(checkboxGadgetItemList[i].parentNode, "checkboxGadgetItemOff");
            addClass(checkboxGadgetItemList[i].parentNode, "checkboxGadgetItemOn");
        }
    }; // end this.turnAllItemsOn = function ()
    
    this.turnAllItemsOff = function ()
    {
        var gadgetRef = document.getElementById(that.gadgetId);
        if(gadgetRef === null)
        {
            //window.alert("Check box gadget NOT found. . .");
            window.status = "Check box gadget NOT found. . .";
            return;
        }
        var checkboxGadgetItemList = getElementsByClassName(gadgetRef, "checkboxGadgetItem");
        for(var i = 0; i < checkboxGadgetItemList.length; i++)
        {
            checkboxGadgetItemList[i].title = "Show. . .";
            removeClass(checkboxGadgetItemList[i], "checkboxGadgetItemOn");
            addClass(checkboxGadgetItemList[i], "checkboxGadgetItemOff");
            removeClass(checkboxGadgetItemList[i].parentNode, "checkboxGadgetItemOn");
            addClass(checkboxGadgetItemList[i].parentNode, "checkboxGadgetItemOff");
        }
    }; // end this.turnAllItemsOff = function ()

    this.turnGivenItemsOn = function (userData)
    {
        //window.alert("in turn given items on:" + userData);
        var gadgetRef = document.getElementById(that.gadgetId);
        if(gadgetRef === null)
        {
            //window.alert("Check box gadget NOT found. . .");
            window.status = "Check box gadget NOT found. . .";
            return;
        }
        var match = false;
        var checkboxGadgetItemList = getElementsByClassName(gadgetRef, "checkboxGadgetItem");
        var datum = "";
        for(var i = 0; i < checkboxGadgetItemList.length; i++)
        {
            datum = getInternalText(checkboxGadgetItemList[i]);
            //window.alert(userData + "||||" + datum);
            match = false;
            for(var j = 0; j < userData.length; j++)
            {
                if(datum === userData[j])
                {
                    match = true;
                }
            }
            if(match)
            {
                //window.alert("match");
                checkboxGadgetItemList[i].title = "Hide. . .";
                removeClass(checkboxGadgetItemList[i], "checkboxGadgetItemOff");
                addClass(checkboxGadgetItemList[i], "checkboxGadgetItemOn");
                removeClass(checkboxGadgetItemList[i].parentNode, "checkboxGadgetItemOff");
                addClass(checkboxGadgetItemList[i].parentNode, "checkboxGadgetItemOn");
            }
            else
            {
                //window.alert("no match");
                checkboxGadgetItemList[i].title = "Show. . .";
                removeClass(checkboxGadgetItemList[i], "checkboxGadgetItemOn");
                addClass(checkboxGadgetItemList[i], "checkboxGadgetItemOff");
                removeClass(checkboxGadgetItemList[i].parentNode, "checkboxGadgetItemOn");
                addClass(checkboxGadgetItemList[i].parentNode, "checkboxGadgetItemOff");
            }
        }
        that.turnGivenItemsOn.userFxn(userData);
    }; // end this.turnGivenItemsOn = function (userData)
    
    this.itemHandler = function (event)
    {
	    if(typeof event === "undefined")
	    {
		    event = window.event;
	    }
	    var target = getEventTarget(event);
	    
        // get reference to parent checkbox gadget
        var gadgetRef = null;
        var node = this;
        var found = false;
        while(node !==  null)
        {
            if(findClass(node, "checkboxGadget"))
            {
                found = true;
                gadgetRef = node;
                break;
            }
            node = node.parentNode;
        }
        if(!found)
        {
            window.alert("check box gadget not found. . .");
            return false;
        }

        // set checkbox gadget item 
	    if(findClass(this, "checkboxGadgetItemOn"))
	    {
	        changeClass(this, "checkboxGadgetItemOn", "checkboxGadgetItemOff");
	        changeClass(this.parentNode, "checkboxGadgetItemOn", "checkboxGadgetItemOff");
	        this.title = "Show. . .";
	    }
	    else
	    {
	        changeClass(this, "checkboxGadgetItemOff", "checkboxGadgetItemOn");
	        changeClass(this.parentNode, "checkboxGadgetItemOff", "checkboxGadgetItemOn");
	        this.title = "Hide. . .";
	    }

        // see if items are all on or all off to update toggle
        var allAreOn = true;
        var allAreOff = true;
        var userData = [];
        var checkboxGadgetItemList = getElementsByClassName(gadgetRef, "checkboxGadgetItem");
        var i = 0;
        for(i = 0; i < checkboxGadgetItemList.length; i++)
        {
            if(findClass(checkboxGadgetItemList[i], "checkboxGadgetItemOff"))
            {
                allAreOn = false;
                
                //userData[userData.length] = getInternalText(checkboxGadgetItemList[i]);
            }
            if(findClass(checkboxGadgetItemList[i], "checkboxGadgetItemOn"))
            {
                allAreOff = false;
                
                userData[userData.length] = getInternalText(checkboxGadgetItemList[i]);
            }
        }

        // update toggle
        var checkboxGadgetToggleList = getElementsByClassName(gadgetRef, "checkboxGadgetToggle");
        for(i = 0; i < checkboxGadgetToggleList.length; i++)
        {
            if(allAreOn)
            {
                changeClass(checkboxGadgetToggleList[i], "checkboxGadgetToggleOff", "checkboxGadgetToggleOn");
            }
            else
            {
                changeClass(checkboxGadgetToggleList[i], "checkboxGadgetToggleOn", "checkboxGadgetToggleOff");
            }
        }
	    
	    that.toggleHandler.userFxn(userData);
	    that.runFunction();
	    
        return false;
    }; // end this.itemHandler = function (event)
    
    this.functionQueue = [];
    
    this.enrollFunction = function (fxnRef)
    {
        this.functionQueue[this.functionQueue.length] = fxnRef;
    }; // end this.enrollFunction = function (fxnRef)
    
    this.runFunction = function ()
    {
	    for(var i = 0; i < this.functionQueue.length; i++)
	    {
	        if(typeof this.functionQueue[i] !== "function")
	        {
	            continue;
	        }
	        this.functionQueue[i]();
	    }
    }; // end this.runFunction = function ()
    
    this.provideUserDataFxn = function ()
    {
        var userData = [];
        //window.alert(gadgetId);
        var gadgetRef = document.getElementById(gadgetId);
        if(gadgetRef === null)
        {
            //window.alert("Check box gadget NOT found. . .");
            window.status = "Check box gadget NOT found. . .";
            return userData;
        }
        
        var checkboxGadgetItemList = getElementsByClassName(gadgetRef, "checkboxGadgetItem");
        for(var i = 0; i < checkboxGadgetItemList.length; i++)
        {
            if(checkboxGadgetItemList[i].nodeName.toLowerCase() !== "a")
            {
                continue;
            }
        
            if(findClass(checkboxGadgetItemList[i], "checkboxGadgetItemOn"))
            {
                userData[userData.length] = getInternalText(checkboxGadgetItemList[i]);
            }
        } // end for(var i = 0; i < checkboxGadgetItemList.length; i++)
        
        //window.alert(userData);
        
        return userData;
    }; // end this.provideUserDataFxn = function ()
    
    this.setup(gadgetId, userFxn);
}; // end BLK.EBIZ.CheckboxGadget = function (gadgetId, userFxn)

// ************************************************************************************************
// end checkBox.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2010/06/23 16:00:00 $
*       Filename:  $RCSfile: radioButton.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin radioButton.js
// ************************************************************************************************

/*global BLK, document, window, getElementsByClassName, findClass, addClass, getEventTarget, 
changeClass, getInternalText, removeClass */

BLK.EBIZ.RadioButtonGadget = function(gadgetId, userFxn, promptIn)
{
    var that = this;
    this.gadgetId = "";
    this.initalSelection = [];
    //this.prompt = "Select Category";

    this.setup = function(gadgetIdIn, userFxnIn, promptIn)
    {
        //window.alert("type of radio button prompt:" + (typeof promptIn));

        if(typeof promptIn !== "undefined")
        {
            BLK.EBIZ.RadioButtonGadget.prompt = promptIn;
        }

        var gadgetRef = document.getElementById(gadgetIdIn);
        if(gadgetRef === null)
        {
            //window.alert("Radio button gadget NOT found. . .");
            window.status = "Radio button gadget NOT found. . .";
            return;
        }
        if(typeof userFxnIn !== "function")
        {
            //window.alert("User function not provided. . .");
            window.status = "User function not provided. . .";
            return;
        }

        this.gadgetId = gadgetIdIn;
        this.itemHandler.userFxn = userFxnIn;
        this.turnGivenItemOn.userFxn = userFxnIn;

        var firstFound = false;

        this.initialSelection = [];

        var radioButtonGadgetItemList = getElementsByClassName(gadgetRef, "radioButtonGadgetLink");
        for(var i = 0; i < radioButtonGadgetItemList.length; i++)
        {
            radioButtonGadgetItemList[i].onclick = this.itemHandler;

            if(findClass(radioButtonGadgetItemList[i], "radioButtonGadgetLinkOn"))
            {
                if(!firstFound)
                {
                    changeClass(radioButtonGadgetItemList[i].parentNode, "radioButtonGadgetItemOff", "radioButtonGadgetItemOn");
                    //radioButtonGadgetItemList[i].title = "Hide. . .";
                    radioButtonGadgetItemList[i].title = "";

                    this.initialSelection[this.initialSelection.length] = getInternalText(radioButtonGadgetItemList[i]);

                    firstFound = true;
                }
                else
                {
                    changeClass(radioButtonGadgetItemList[i], "radioButtonGadgetLinkOn", "radioButtonGadgetLinkOff");
                    changeClass(radioButtonGadgetItemList[i].parentNode, "radioButtonGadgetItemOn", "radioButtonGadgetItemOff");
                    //radioButtonGadgetItemList[i].title = "Show. . .";
                    //radioButtonGadgetItemList[i].title = "Select Category";
                    radioButtonGadgetItemList[i].title = BLK.EBIZ.RadioButtonGadget.prompt;
                }
            }
            else if(findClass(radioButtonGadgetItemList[i].parentNode, "radioButtonGadgetItemOn"))
            {
                if(!firstFound)
                {
                    changeClass(radioButtonGadgetItemList[i], "radioButtonGadgetLinkOff", "radioButtonGadgetLinkOn");
                    //radioButtonGadgetItemList[i].title = "Hide. . .";
                    radioButtonGadgetItemList[i].title = "";

                    this.initialSelection[this.initialSelection.length] = getInternalText(radioButtonGadgetItemList[i]);

                    firstFound = true;
                }
                else
                {
                    changeClass(radioButtonGadgetItemList[i], "radioButtonGadgetLinkOn", "radioButtonGadgetLinkOff");
                    changeClass(radioButtonGadgetItemList[i].parentNode, "radioButtonGadgetItemOn", "radioButtonGadgetItemOff");
                    //radioButtonGadgetItemList[i].title = "Show. . .";
                    radioButtonGadgetItemList[i].title = BLK.EBIZ.RadioButtonGadget.prompt;
                }
            }
            else
            {
                changeClass(radioButtonGadgetItemList[i], "radioButtonGadgetLinkOn", "radioButtonGadgetLinkOff");
                changeClass(radioButtonGadgetItemList[i].parentNode, "radioButtonGadgetItemOn", "radioButtonGadgetItemOff");
                //radioButtonGadgetItemList[i].title = "Show. . .";
                radioButtonGadgetItemList[i].title = BLK.EBIZ.RadioButtonGadget.prompt;
            }
        }
    }; // end this.setup = function (gadgetIdIn, userFxnIn)

    this.turnAllItemsOff = function()
    {
        var gadgetRef = document.getElementById(that.gadgetId);
        if(gadgetRef === null)
        {
            //window.alert("Radio button gadget NOT found. . .");
            window.status = "Radio button gadget NOT found. . .";
            return;
        }
        var radioButtonGadgetItemList = getElementsByClassName(gadgetRef, "radioButtonGadgetLink");
        for(var i = 0; i < radioButtonGadgetItemList.length; i++)
        {
            //radioButtonGadgetItemList[i].title = "Show. . .";
            radioButtonGadgetItemList[i].title = "Select Category";
            removeClass(radioButtonGadgetItemList[i], "radioButtonGadgetLinkOn");
            addClass(radioButtonGadgetItemList[i], "radioButtonGadgetLinkOff");
            removeClass(radioButtonGadgetItemList[i].parentNode, "radioButtonGadgetItemOn");
            addClass(radioButtonGadgetItemList[i].parentNode, "radioButtonGadgetItemOff");
        }
    }; // end this.turnAllItemsOff = function ()

    this.selectCategoryAll = function()
    {
        that.turnGivenItemOn(["All"]);
    }; // end this.selectCategoryAll = function ()

    this.turnGivenItemOn = function(userData)
    {
        var gadgetRef = document.getElementById(that.gadgetId);
        if(gadgetRef === null)
        {
            //window.alert("Radio button gadget NOT found. . .");
            window.status = "Radio button gadget NOT found. . .";
            return;
        }
        var match = false;
        var radioButtonGadgetItemList = getElementsByClassName(gadgetRef, "radioButtonGadgetLink");
        var datum = "";
        var foundFirst = false;

        for(var i = 0; i < radioButtonGadgetItemList.length; i++)
        {
            datum = getInternalText(radioButtonGadgetItemList[i]);
            //window.alert(userData + "||||" + datum);
            match = false;
            for(var j = 0; j < userData.length; j++)
            {
                if(datum.toLowerCase() === userData[j].toLowerCase())
                {
                    match = true;
                }
            }
            if(match)
            {
                if(!foundFirst)
                {
                    //window.alert("match");
                    //radioButtonGadgetItemList[i].title = "Hide. . .";
                    radioButtonGadgetItemList[i].title = "";
                    removeClass(radioButtonGadgetItemList[i], "radioButtonGadgetLinkOff");
                    addClass(radioButtonGadgetItemList[i], "radioButtonGadgetLinkOn");
                    removeClass(radioButtonGadgetItemList[i].parentNode, "radioButtonGadgetItemOff");
                    addClass(radioButtonGadgetItemList[i].parentNode, "radioButtonGadgetItemOn");
                    foundFirst = true;
                }
                else
                {
                    //window.alert("no match");
                    //radioButtonGadgetItemList[i].title = "Show. . .";
                    radioButtonGadgetItemList[i].title = "Select Category";
                    removeClass(radioButtonGadgetItemList[i], "radioButtonGadgetLinkOn");
                    addClass(radioButtonGadgetItemList[i], "radioButtonGadgetLinkOff");
                    removeClass(radioButtonGadgetItemList[i].parentNode, "radioButtonGadgetItemOn");
                    addClass(radioButtonGadgetItemList[i].parentNode, "radioButtonGadgetItemOff");
                }
            }
            else
            {
                //window.alert("no match");
                //radioButtonGadgetItemList[i].title = "Show. . .";
                radioButtonGadgetItemList[i].title = "Select Category";
                removeClass(radioButtonGadgetItemList[i], "radioButtonGadgetLinkOn");
                addClass(radioButtonGadgetItemList[i], "radioButtonGadgetLinkOff");
                removeClass(radioButtonGadgetItemList[i].parentNode, "radioButtonGadgetItemOn");
                addClass(radioButtonGadgetItemList[i].parentNode, "radioButtonGadgetItemOff");
            }
        }
    }; // end this.turnGivenItemOn = function (userData)

    this.itemHandler = function(event)
    {
        if(typeof event === "undefined")
        {
            event = window.event;
        }
        var target = getEventTarget(event);

        // get reference to parent radio button gadget
        var gadgetRef = null;
        var node = this;
        var found = false;
        while(node !== null)
        {
            if(findClass(node, "radioButtonGadget"))
            {
                found = true;
                gadgetRef = node;
                break;
            }
            node = node.parentNode;
        }
        if(!found)
        {
            window.alert("radio button gadget not found. . .");
            return false;
        }

        var userData = [];
        var radioButtonGadgetItemList = getElementsByClassName(gadgetRef, "radioButtonGadgetLink");
        var i = 0;

        // turn all items off
        for(i = 0; i < radioButtonGadgetItemList.length; i++)
        {
            changeClass(radioButtonGadgetItemList[i], "radioButtonGadgetLinkOn", "radioButtonGadgetLinkOff");
            changeClass(radioButtonGadgetItemList[i].parentNode, "radioButtonGadgetItemOn", "radioButtonGadgetItemOff");
            //radioButtonGadgetItemList[i].title = "Show. . .";
            radioButtonGadgetItemList[i].title = BLK.EBIZ.RadioButtonGadget.prompt;
        }

        // turn current item on
        changeClass(this, "radioButtonGadgetLinkOff", "radioButtonGadgetLinkOn");
        changeClass(this.parentNode, "radioButtonGadgetItemOff", "radioButtonGadgetItemOn");
        //this.title = "Hide. . .";
        this.title = "";
        userData[0] = getInternalText(this);


        that.runFunctionAfter();
        arguments.callee.userFxn(userData);


        return false;
    }; // end this.itemHandler = function (event)

    this.functionQueueBefore = [];
    this.enrollFunctionBefore = function(fxnRef)
    {
        this.functionQueueBefore[this.functionQueueBefore.length] = fxnRef;
    }; // end this.enrollFunctionBefore = function (fxnRef)
    this.runFunctionBefore = function()
    {
        //window.alert(this.functionQueueBefore.length);
        for(var i = 0; i < this.functionQueueBefore.length; i++)
        {
            if(typeof this.functionQueueBefore[i] !== "function")
            {
                continue;
            }
            this.functionQueueBefore[i]();
        }
    }; // end this.runFunctionBefore = function ()

    this.functionQueueAfter = [];
    this.enrollFunctionAfter = function(fxnRef)
    {
        this.functionQueueAfter[this.functionQueueAfter.length] = fxnRef;
    }; // end this.enrollFunctionAfter = function (fxnRef)
    this.runFunctionAfter = function()
    {
        //window.alert(this.functionQueueAfter.length);
        for(var i = 0; i < this.functionQueueAfter.length; i++)
        {
            if(typeof this.functionQueueAfter[i] !== "function")
            {
                continue;
            }
            this.functionQueueAfter[i]();
        }
    }; // end this.runFunctionAfter = function ()

    this.reset = function()
    {
        this.turnGivenItemOn(this.initialSelection);
    }; // end this.reset = function ()

    this.provideUserDataFxn = function()
    {
        var userData = [];
        var gadgetRef = document.getElementById(gadgetId);
        if(gadgetRef === null)
        {
            //window.alert("Radio button gadget NOT found. . .");
            window.status = "Radio button gadget NOT found. . .";
            return userData;
        }

        var radioButtonGadgetItemList = getElementsByClassName(gadgetRef, "radioButtonGadgetLink");
        for(var i = 0; i < radioButtonGadgetItemList.length; i++)
        {
            if(radioButtonGadgetItemList[i].nodeName.toLowerCase() !== "a")
            {
                continue;
            }

            if(findClass(radioButtonGadgetItemList[i], "radioButtonGadgetLinkOn"))
            {
                userData[userData.length] = getInternalText(radioButtonGadgetItemList[i]);
            }
        } // end for(var i = 0; i < radioButtonGadgetItemList.length; i++)

        //window.alert(userData);

        return userData;
    }; // end this.provideUserDataFxn = function ()

    this.setup(gadgetId, userFxn, promptIn);
};  // end BLK.EBIZ.RadioButtonGadget = function (gadgetId, userFxn)
BLK.EBIZ.RadioButtonGadget.prompt = "";
// ************************************************************************************************
// end radioButton.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2009/08/12 10:00:00 $
*       Filename:  $RCSfile: message.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin message.js
// ************************************************************************************************

/*global BLK, document, window, findClass, removeClass, addClass */

BLK.EBIZ.messageGadget = function (idName, message, messageType)
{
    var idRef = document.getElementById(idName);
    if(idRef === null)
    {
        if(message !== "")
        {
            window.alert(message);
        }
        return;
    }
    if(idRef.nodeName.toLowerCase() !== "div")
    {
        if(message !== "")
        {
            window.alert(message);
        }
        return;
    }
    if(!findClass(idRef, "messageGadget"))
    {
        if(message !== "")
        {
            window.alert(message);
        }
        return;
    }
    if(typeof BLK.EBIZ.messageGadget.type[messageType] === "undefined")
    {
        if(message !== "")
        {
            window.alert(message);
        }
        return;
    }
    idRef.innerHTML = "";
    if(message !== "")
    {
        idRef.innerHTML = message;
    }
    for(var i in BLK.EBIZ.messageGadget.type)
    {
        removeClass(idRef, BLK.EBIZ.messageGadget.type[i]);
    }
    addClass(idRef, BLK.EBIZ.messageGadget.type[messageType]);
}; // end BLK.EBIZ.messageGadget = function (idName, message, messageType)
BLK.EBIZ.messageGadget.type = {"alert":"messageGadgetAlert",
    "information":"messageGadgetInformation",
    "error":"messageGadgetError",
    "off":"messageGadgetOff"};
    
// ************************************************************************************************
// end message.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date:  2010/08/10 14:00:00 $
*       Filename:  $RCSfile: showDataInWindow.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin showDataInWindow.js
// ************************************************************************************************

/*global document, window, screen */
// #dataIsland,.dataIsland,#firmInfoPopup in portal.css
function showDataInWindow(dataId, title, width, height)
{
    var dataRef = document.getElementById(dataId);
    if(dataRef === null)
    {
        window.status = "Data not found.";
        return;
    }
    
    var innerHTML = dataRef.innerHTML;
    var dataWin = null;
    
    //var attributes = "toolbar=1,status=1,scrollbar=1,resizable=1,menubar=1,location=1";
    //var attributes = "toolbar=1,status=1,scrollbar=1,menubar=1,location=1";
    var attributes = "status=1,scrollbar=1,resizable=0";
    
    var top = 0;
    var left = 0;

    // size and position window
    if(typeof width === "undefined" || typeof height === "undefined")
    {
        dataWin = window.open("", "dw", attributes);
    }
    else
    {
        if(typeof width === "number" && typeof height === "number")
        {
            if(width > 0 && height > 0)
            {
                top = Math.round((screen.height - height) / 2);
                left = Math.round((screen.width - width) / 2);
                dataWin = window.open("", "dw", "top=" + top + ",left=" + left + ",width=" + width + ",height=" + height + "," + attributes);
            }
            else
            {
                dataWin = window.open("", "dw", attributes);
            }
        }
        else
        {
            dataWin = window.open("", "dw", attributes);
        }
    } // end if(typeof width === "undefined" || typeof height === "undefined")
    
    var linkList = document.getElementsByTagName("link");
    var scriptList = document.getElementsByTagName("script");
    var metaList = document.getElementsByTagName("meta");
    
    var linkTags = ""; 
    var scriptTags = "";
    var metaTags = "";
    
    var html = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>" +
        "<html xmlns='http://www.w3.org/1999/xhtml' lang='en' xml-lang='en' dir='ltr'><head><title>" + title + "</title>";
    var i = 0;
    
    // get meta tags from parent page
    for(i = 0; i < metaList.length; i++)
    {
        //<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
        metaTags += "<meta ";
        if(metaList[i].content !== "")
        {
            metaTags += "content='" + metaList[i].content + "' ";
        }
        if(metaList[i].httpEquiv !== "")
        {
            metaTags += "http-equiv='" + metaList[i].httpEquiv + "' ";
        }
        if(metaList[i].name !== "")
        {
            metaTags += "name='" + metaList[i].name + "' ";
        }
        if(metaList[i].scheme !== "")
        {
            metaTags += "scheme='" + metaList[i].scheme + "' ";
        }
        metaTags += "/>";
    }
    
    // get link tags from parent page
    for(i = 0; i < linkList.length; i++)
    {
        linkTags += "<link href='" + linkList[i].href + "' rel='stylesheet' type='text/css' media='screen' />";
    }
    
    // get script tags from parent page
    var src = "";
    for(i = 0; i < scriptList.length; i++)
    {
        if(scriptList[i].src !== "")
        {
            src = scriptList[i].src;
            src = src.toLowerCase();
            // exclude setting file
            if(src.indexOf("envsetting") >= 0)
            {
                continue;
            }
            // exclude config file
            if(src.indexOf("envconfig") >= 0)
            {
                continue;
            }
            scriptTags += "<script src='" + scriptList[i].src + "' type='text/javascript'><\/script>";
        }
        else if(scriptList[i].innerHTML !== "")
        {
            scriptTags += "<script type='text/javascript'>" + scriptList[i].innerHTML + "<\/script>";
        }
    } // end for(i = 0; i < scriptList.length; i++)
    
    html += metaTags + linkTags + scriptTags + "</head><body><div id='firmInfoPopup'>";
    html += innerHTML + "</div></body></html>";
    
    dataWin.document.write(html);
    dataWin.document.title = title;
    dataWin.document.close();
    dataWin.document.title = title;
    dataWin.focus();
} // end function showDataInWindow(dataId, title)

function showDataInWindow2(data, title, width, height)
{
    if(data === "")
    {
        window.status = "Data not found.";
        return;
    }
    
    var innerHTML = data;
    var dataWin = null;
    
    //var attributes = "toolbar=1,status=1,scrollbar=1,resizable=1,menubar=1,location=1";
    //var attributes = "toolbar=1,status=1,scrollbar=1,menubar=1,location=1";
    var attributes = "status=1,scrollbar=1,resizable=0";
    
    var top = 0;
    var left = 0;

    // size and position window
    if(typeof width === "undefined" || typeof height === "undefined")
    {
        dataWin = window.open("", "dw", attributes);
    }
    else
    {
        if(typeof width === "number" && typeof height === "number")
        {
            if(width > 0 && height > 0)
            {
                top = Math.round((screen.height - height) / 2);
                left = Math.round((screen.width - width) / 2);
                dataWin = window.open("", "dw", "top=" + top + ",left=" + left + ",width=" + width + ",height=" + height + "," + attributes);
            }
            else
            {
                dataWin = window.open("", "dw", attributes);
            }
        }
        else
        {
            dataWin = window.open("", "dw", attributes);
        }
    } // end if(typeof width === "undefined" || typeof height === "undefined")
    
    var linkList = document.getElementsByTagName("link");
    var scriptList = document.getElementsByTagName("script");
    var metaList = document.getElementsByTagName("meta");
    
    var linkTags = ""; 
    var scriptTags = "";
    var metaTags = "";
    
    var html = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>" +
        "<html xmlns='http://www.w3.org/1999/xhtml' lang='en' xml-lang='en' dir='ltr'><head><title>" + title + "</title>";
    var i = 0;
    
    // get meta tags from parent page
    for(i = 0; i < metaList.length; i++)
    {
        //<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
        metaTags += "<meta ";
        if(metaList[i].content !== "")
        {
            metaTags += "content='" + metaList[i].content + "' ";
        }
        if(metaList[i].httpEquiv !== "")
        {
            metaTags += "http-equiv='" + metaList[i].httpEquiv + "' ";
        }
        if(metaList[i].name !== "")
        {
            metaTags += "name='" + metaList[i].name + "' ";
        }
        if(metaList[i].scheme !== "")
        {
            metaTags += "scheme='" + metaList[i].scheme + "' ";
        }
        metaTags += "/>";
    }
    
    // get link tags from parent page
    for(i = 0; i < linkList.length; i++)
    {
        linkTags += "<link href='" + linkList[i].href + "' rel='stylesheet' type='text/css' media='screen' />";
    }
    
    // get script tags from parent page
    var src = "";
    for(i = 0; i < scriptList.length; i++)
    {
        if(scriptList[i].src !== "")
        {
            src = scriptList[i].src;
            src = src.toLowerCase();
            // exclude setting file
            if(src.indexOf("envsetting") >= 0)
            {
                continue;
            }
            // exclude config file
            if(src.indexOf("envconfig") >= 0)
            {
                continue;
            }
            scriptTags += "<script src='" + scriptList[i].src + "' type='text/javascript'><\/script>";
        }
        else if(scriptList[i].innerHTML !== "")
        {
            scriptTags += "<script type='text/javascript'>" + scriptList[i].innerHTML + "<\/script>";
        }
    } // end for(i = 0; i < scriptList.length; i++)
    
    html += metaTags + linkTags + scriptTags + "</head><body><div id='firmInfoPopup'>";
    html += innerHTML + "</div></body></html>";
    
    dataWin.document.write(html);
    dataWin.document.title = title;
    dataWin.document.close();
    dataWin.document.title = title;
    dataWin.focus();
} // end function showDataInWindow2(data, title)

// ************************************************************************************************
// end showDataInWindow.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2010/06/28 11:00:00 $
*       Filename:  $RCSfile: litListModule.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin litListModule.js
// ************************************************************************************************

/*global BLK, document, getElementsByClassName, buildDynamicScriptTag, window, addLoadListener, 
readyForRegExp, trim, location, escape, findClass, EBIZ */


BLK.EBIZ.litListModule = function ()
{
    var that = BLK.EBIZ.litListModule;
}; // end BLK.EBIZ.litListModule = function ()

// ************************************************************************************************
// begin meta data
// ************************************************************************************************

BLK.EBIZ.litListModule.debugWin = null;
BLK.EBIZ.litListModule.debugMode = false;
BLK.EBIZ.litListModule.message = 
    "We are experiencing a problem. We could not find any data and we are working to resolve this problem.";

BLK.EBIZ.litListModule.portal = "";
BLK.EBIZ.litListModule.noPortal = "";
BLK.EBIZ.litListModule.search = "";
BLK.EBIZ.litListModule.document = "";
BLK.EBIZ.litListModule.image = "";
BLK.EBIZ.litListModule.service = "";
BLK.EBIZ.litListModule.subscribe = "";
BLK.EBIZ.litListModule.apply = "";
BLK.EBIZ.litListModule.chartTitle = "";

BLK.EBIZ.litListModule.LEVEL = 
{
"dev" : "dev",
"test" : "test",
"uat" : "uat",
"prod" : "prod",
"err" : "err"
};

BLK.EBIZ.litListModule.SERVER_PROGRAM = "unknown";

BLK.EBIZ.litListModule.DISPLAY_TYPES = 
{
"litListModuleSmall":BLK.EBIZ.litListModule.buildSmall,
"litListModuleLarge":BLK.EBIZ.litListModule.buildLarge
};

BLK.EBIZ.litListModule.parameters = 
{
    "litListModuleType":"DocType",
    "litListModuleProd":"ProdGroup",
    "litListModuleRange":"range",
    "litListModuleKeyword":"Keyword",
    "litListModuleBeginDate":"beginDate",
    "litListModuleEndDate":"endDate",
    "litListModuleOrderBy":"orderBy"  // titleASC,titleDESC,dateASC,dateDESC
}; // end BLK.EBIZ.litListModule.parameters = 

BLK.EBIZ.litListModule.PROD_GROUP = 
{
"closed_end_funds":"10",
"money_markets":"25",
"mutual_funds":"29",
"separately_managed_accounts":"10053",
"variable_annuities":"36",
"liquidity_funds":"10000011"
}; // end BLK.EBIZ.litListModule.PROD_GROUP = 

BLK.EBIZ.litListModule.DOC_TYPE = 
{
"ad_article_reprint" : "1",
"advisor_fact_sheet" : "2",
"brochure" : "5",
"client_fact_sheet" : "6",
"client_reference_education" : "7",
"fp_reference_tools" : "10",
"forms" : "9",
"fund_analysis" : "11",
"market_commentary" : "14",
"newsletter" : "17",
"performance_update" : "20",
"policies" : "21",
"presentation" : "22",
"press_release" : "23",
"product_commentary" : "111", 
"product_profile" : "86", 
"prospecting_material" : "25",
"prospectus" : "26",
"proxy_statement" : "27", 
"sai" : "98",
"sales_idea" : "30", 
"sample_portfolio" : "31",
"shareholder_letters" : "109",
"shareholder_report" : "32",
"special_report" : "112",
"tax_information" : "34",
"training_literature" : "35",
"white_paper" : "68"
}; // end BLK.EBIZ.litListModule.DOC_TYPE = 
// ************************************************************************************************
// end meta data
// ************************************************************************************************

//var win = null;

BLK.EBIZ.litListModule.create = function(myJSONtext)
{
BLK.EBIZ.litListModule.create.counter++;
//BLK.EBIZ.trace("BLK.EBIZ.litListModule.create. . .begin#" + BLK.EBIZ.litListModule.create.counter);

    var that = BLK.EBIZ.litListModule;
    var prompt = "";
    
    try
    {
        that.runCode();
        that.setURIs();

        //window.alert(myJSONtext);
        
BLK.EBIZ.trace("BLK.EBIZ.litListModule.create. . .before JSON:" + BLK.EBIZ.litListModule.create.counter);
        var myJSONobj = eval("(" + myJSONtext + ")");
BLK.EBIZ.trace("BLK.EBIZ.litListModule.create. . .after JSON :" + BLK.EBIZ.litListModule.create.counter);

/*
win = window.open("", "dbgWin", "resizable=1,scrollbars=1");
if(win !== null)
{
    win.document.write("<p>" + myJSONtext + "</p>");
    //win.document.write("<p>" + myJSONtextFmt + "</p>");
    win.document.close();
}
else
{
    BLK.EBIZ.trace("debug window did not open. . .:" + site);
}
*/

        //for(var i = 0; i < myJSONobj["lit_list"]["records"].length; i++)
        //{
        //    window.alert(
        //        "date: " + myJSONobj["lit_list"]["records"][i]["date"] + "\n" + 
        //        "title: " + myJSONobj["lit_list"]["records"][i]["title"] + "\n" + 
        //        "filename: " + myJSONobj["lit_list"]["records"][i]["filename"] + "\n" + 
        //        "id: " + myJSONobj["lit_list"]["id"]);
        //}

        var idName = "";
        var idRef = null;
        var type = "";
        idName = myJSONobj["Header"]["ID"];
        idRef = document.getElementById(idName);
        if(idRef === null)
        {
            prompt = "Lit List Module: '" + idName + "' reference not found. . .";
            BLK.EBIZ.trace(prompt);
            return;
        }
        //window.alert(idRef.className);
        type = idRef.className;


        if(findClass(idRef, "litListModuleSmall"))
        {
            that.buildSmall(myJSONobj);
        }
        else if(findClass(idRef, "litListModuleLarge"))
        {
            that.buildLarge(myJSONobj);
        }
        else
        {
            prompt = "Lit List Module: unknown type. . ." + idName + "||" + type;
            BLK.EBIZ.trace(prompt);
        } // end if(findClass(idRef, "litListModuleSmall"))
    }
    catch(ex)
    {
        prompt = "";
        if(that.debugMode)
        {
            window.alert("Exception when creating data structure. . .\n\n" +
                "Name: " + ex.name + "\n" +
                "Message: " + ex.message);
        }
        prompt = "BLK.EBIZ.litListModule.create: EXCEPTION. . ." + ex.message;
        BLK.EBIZ.trace(prompt);
    }
    
//BLK.EBIZ.trace("BLK.EBIZ.litListModule.create. . .end#" + BLK.EBIZ.litListModule.create.counter);

}; // end BLK.EBIZ.litListModule.create = function (myJSONtext)
BLK.EBIZ.litListModule.create.counter = 0;

BLK.EBIZ.litListModule.site = "";
BLK.EBIZ.litListModule.getSite = function()
{
    var that = BLK.EBIZ.litListModule;
    // site:  PUBLIC, FAIC, FP
    var site = "";
    if(typeof EBIZ.thisSite !== "undefined")
    {
        site = EBIZ.thisSite;
    }
BLK.EBIZ.trace("this site: " + site);    
    return site;
};  // end BLK.EBIZ.litListModule.getSite = function()

BLK.EBIZ.litListModule.getData = function()
{
    var that = BLK.EBIZ.litListModule;

    var i = 0;
    var j = 0;
    var data = "";
    var parameter = "";
    var name = "";
    var value = "";
    var fmtValue = "";
    var nameValue = "";
    var inputList = null;
    var foundParams = false;
    var prompt = "";
    var message = "";

    // ********************************************************************************************
    // ********************************************************************************************
    that.runCode();
    // ********************************************************************************************
    // ********************************************************************************************

    // ********************************************************************************************
    // ********************************************************************************************
    var site = that.getSite();
    // ********************************************************************************************
    // ********************************************************************************************

    var venueIdValue = "UNKNOWN";

    // ********************************************************************************************
    // BEGIN if FP
    // ********************************************************************************************
    if(site === "FP")
    {
        var openName = "open";
        var openValue = that.getValue(openName);
        var objIdName = "objID";
        var objIdValue = that.getValue(objIdName);
        if(objIdValue === "")
        {
            if(that.debugMode)
            {
                prompt = "Lit List Module: object id parameter not found.";
                BLK.EBIZ.trace(prompt);
            }
            return;
        }
        var venueIdPageIdObj = that.mapObjId(objIdValue, false);
        venueIdValue = venueIdPageIdObj.venueId;
        if(venueIdValue === "")
        {
            if(that.debugMode)
            {
                prompt = "Lit List Module: venue id parameter not mapped.";
                BLK.EBIZ.trace(prompt);
            }
            return;
        }
        var pageIdValue = venueIdPageIdObj.pageId;
        if(pageIdValue === "")
        {
            if(that.debugMode)
            {
                prompt = "Lit List Module: page id parameter not mapped.";
                BLK.EBIZ.trace(prompt);
            }
            return;
        }
    } // end if(site === "FP")
    // ********************************************************************************************
    // END if FP
    // ********************************************************************************************

    var cmtyKey = "";
    var cmtyVal = "";
    var cmty = "";

    // ********************************************************************************************
    // BEGIN if PUBLIC
    // ********************************************************************************************
    if(site === "PUBLIC")
    {
        venueIdValue = that.getPublicVenueId();
    } // end if(site === "PUBLIC")
    // ********************************************************************************************
    // END if PUBLIC
    // ********************************************************************************************

    // ********************************************************************************************
    // BEGIN if FAIC
    // ********************************************************************************************
    if(site === "FAIC")
    {
        venueIdValue = that.getFaicVenueId();
    } // end if(site === "FAIC")
    // ********************************************************************************************
    // END if FAIC
    // ********************************************************************************************

    var gotProdGroup = false;
    var gotDocType = false;
    var gotKeyword = false;
    var gotOrderBy = false;

    var html = "";

    // small
    var litListModuleSmallList = getElementsByClassName(document.body, "litListModuleSmall");
    for(i = 0; i < litListModuleSmallList.length; i++)
    {
        data = "&id=" + litListModuleSmallList[i].id;

        foundParams = false;
        inputList = litListModuleSmallList[i].getElementsByTagName("input");

        if(inputList.length === 0)
        {
            litListModuleSmallList[i].innerHTML =
                "<span class='litListModuleMessage'>" + that.message + "</span>";
            continue;
        }

        gotProdGroup = false;
        gotDocType = false;
        gotOrderBy = false;
        for(j = 0; j < inputList.length; j++)
        {
            if(inputList[j].type !== "hidden")
            {
                continue;
            }
            parameter = inputList[j].className;
            fmtValue = inputList[j].value;
            if(typeof BLK.EBIZ.litListModule.parameters[parameter] === "undefined")
            {
                continue;
            }

            name = BLK.EBIZ.litListModule.parameters[parameter];
            if(name === BLK.EBIZ.litListModule.parameters["litListModuleType"])
            {
                // get doc type code
                value = BLK.EBIZ.litListModule.DOC_TYPE[fmtValue];
                gotDocType = true;
            }
            else if(name === BLK.EBIZ.litListModule.parameters["litListModuleProd"])
            {
                // get prod group code
                value = BLK.EBIZ.litListModule.PROD_GROUP[fmtValue];
                gotProdGroup = true;
            }
            else if(name === BLK.EBIZ.litListModule.parameters["litListModuleKeyword"])
            {
                // get keyword
                value = fmtValue;
                gotKeyword = true;
            }
            else if(name === BLK.EBIZ.litListModule.parameters["litListModuleOrderBy"])
            {
                // get order by
                value = fmtValue;
                gotOrderBy = true;
            }
            else
            {
                value = fmtValue;
            }
            if(typeof value === "undefined")
            {
                //window.alert("bad value");
                continue;
            }

            //nameValue = "&" + name + "=" + value;
            nameValue = "&" + name + "=" + encodeURIComponent(value);

            data += nameValue;
            foundParams = true;
        } // end for(j = 0; j < inputList.length; j++)

        /*        
        if(!foundParams)
        {
        data += "&range=all&" + 
        BLK.EBIZ.litListModule.parameters["litListModuleType"] + "=" + BLK.EBIZ.litListModule.DOC_TYPE["press_release"];
        }
        */
        //data += "&Venue=" + venueIdValue;
        //buildDynamicScriptTag(BLK.EBIZ.litListModule.SERVER_PROGRAM, data);

        if(!gotOrderBy)
        {
            data += "&orderBy=dateDESC";
        }

        data += "&Venue=" + venueIdValue;

        if(foundParams)
        {
            if(gotDocType || gotProdGroup || gotKeyword)
            {
                that.setURIs();
                buildDynamicScriptTag(BLK.EBIZ.litListModule.SERVER_PROGRAM, data);

                if(that.debugMode)
                {
                    var srcSmall = buildDynamicScriptTag.src;
                    if(typeof that.debugWin === "undefined" || that.debugWin === null || that.debugWin.closed)
                    {
                        debugWin = window.open("", "dbgWin", "resizable=1");
                    }
                    // check if popup is blocked
                    if(typeof that.debugWin !== "undefined")
                    {
                        html = debugWin.document.body.innerHTML;
                        debugWin.document.body.innerHTML = html + "<div>" + srcSmall + "</div>";
                        debugWin.document.close();
                    }
                }
            }
            else
            {
                litListModuleSmallList[i].innerHTML =
                    "<span class='litListModuleMessage'>" + that.message + "</span>";
            }
        }
        else
        {
            litListModuleSmallList[i].innerHTML =
                "<span class='litListModuleMessage'>" + that.message + "</span>";
        }
    } // end for(i = 0; i < litListModuleSmallList.length; i++)

    // large
    var litListModuleLargeList = getElementsByClassName(document.body, "litListModuleLarge");
    for(i = 0; i < litListModuleLargeList.length; i++)
    {
        data = "&id=" + litListModuleLargeList[i].id;

        foundParams = false;
        inputList = litListModuleLargeList[i].getElementsByTagName("input");

        if(inputList.length === 0)
        {
            litListModuleLargeList[i].innerHTML =
                "<span class='litListModuleMessage'>" + that.message + "</span>";
            continue;
        }

        gotProdGroup = false;
        gotDocType = false;
        gotOrderBy = false;
        for(j = 0; j < inputList.length; j++)
        {
            if(inputList[j].type !== "hidden")
            {
                continue;
            }
            parameter = inputList[j].className;
            fmtValue = inputList[j].value;
            if(typeof BLK.EBIZ.litListModule.parameters[parameter] === "undefined")
            {
                continue;
            }

            name = BLK.EBIZ.litListModule.parameters[parameter];
            if(name === BLK.EBIZ.litListModule.parameters["litListModuleType"])
            {
                // get doc type code
                value = BLK.EBIZ.litListModule.DOC_TYPE[fmtValue];
                gotDocType = true;
            }
            else if(name === BLK.EBIZ.litListModule.parameters["litListModuleProd"])
            {
                // get prod group code
                value = BLK.EBIZ.litListModule.PROD_GROUP[fmtValue];
                gotProdGroup = true;
            }
            else if(name === BLK.EBIZ.litListModule.parameters["litListModuleKeyword"])
            {
                // get keyword
                value = fmtValue;
                gotKeyword = true;
            }
            else if(name === BLK.EBIZ.litListModule.parameters["litListModuleOrderBy"])
            {
                // get order by
                value = fmtValue;
                gotOrderBy = true;
            }
            else
            {
                value = fmtValue;
            }
            if(typeof value === "undefined")
            {
                //window.alert("bad value");
                continue;
            }

            //nameValue = "&" + name + "=" + value;
            nameValue = "&" + name + "=" + encodeURIComponent(value);

            data += nameValue;
            foundParams = true;
        } // end for(j = 0; j < inputList.length; j++)

        /*
        if(!foundParams)
        {
        data += "&range=all&" + 
        BLK.EBIZ.litListModule.parameters["litListModuleType"] + "=" + BLK.EBIZ.litListModule.DOC_TYPE["press_release"];
        }
        */
        //data += "&venue=" + venueIdValue;
        //buildDynamicScriptTag(BLK.EBIZ.litListModule.SERVER_PROGRAM, data);

        if(!gotOrderBy)
        {
            data += "&orderBy=dateDESC";
        }

        data += "&Venue=" + venueIdValue;

        //if(foundParams && gotDocType && gotProdGroup)
        if(foundParams)
        {
            if(gotDocType || gotProdGroup || gotKeyword)
            {
                that.setURIs();
                buildDynamicScriptTag(BLK.EBIZ.litListModule.SERVER_PROGRAM, data);

                if(that.debugMode)
                {
                    var srcLarge = buildDynamicScriptTag.src;
                    if(typeof that.debugWin === "undefined" || that.debugWin === null || that.debugWin.closed)
                    {
                        that.debugWin = window.open("", "dbgWin", "resizable=1");
                    }
                    // check if popup is blocked
                    if(typeof that.debugWin !== "undefined")
                    {
                        html = that.debugWin.document.body.innerHTML;
                        that.debugWin.document.body.innerHTML = html + "<div>" + srcLarge + "</div>";
                        that.debugWin.document.close();
                    }
                }
            }
            else
            {
                litListModuleSmallList[i].innerHTML =
                    "<span class='litListModuleMessage'>" + that.message + "</span>";
            }
        }
        else
        {
            litListModuleLargeList[i].innerHTML =
                "<span class='litListModuleMessage'>" + that.message + "</span>";
        }
    } // end for(i = 0; i < litListModuleLargeList.length; i++)
};   // end BLK.EBIZ.litListModule.getData = function ()

BLK.EBIZ.litListModule.buildSmall = function(myJSONobj)
{
    var that = BLK.EBIZ.litListModule;

    var ul;
    var li;
    var h;
    var a;
    var text;
    var span;
    var img;
    var litListModuleRef;
    var ext;
    var prompt = "";

    // ********************************************************************************************
    // ********************************************************************************************
    var site = that.getSite();
    // ********************************************************************************************
    // ********************************************************************************************


    var venueIdValue = "UNKNOWN";

    // ********************************************************************************************
    // BEGIN if FP
    // ********************************************************************************************
    if(site === "FP")
    {
        var openName = "open";
        var openValue = that.getValue(openName);
        var objIdName = "objID";
        var objIdValue = that.getValue(objIdName);
        if(objIdValue === "")
        {
            if(that.debugMode)
            {
                prompt = "Lit List Module: object id parameter not found.";
                BLK.EBIZ.trace(prompt);
            }
            return;
        }
        var venueIdPageIdObj = that.mapObjId(objIdValue, false);
        venueIdValue = venueIdPageIdObj.venueId;
        if(venueIdValue === "")
        {
            if(that.debugMode)
            {
                prompt = "List List Module: venue id parameter not mapped.";
                BLK.EBIZ.trace(prompt);
            }
            return;
        }
        var pageIdValue = venueIdPageIdObj.pageId;
        if(pageIdValue === "")
        {
            if(that.debugMode)
            {
                prompt = "Lit List Module: page id parameter not mapped.";
                BLK.EBIZ.trace(prompt);
            }
            return;
        }
    } // end if(site === "FP")
    // ********************************************************************************************
    // END if FP
    // ********************************************************************************************

    var cmtyKey = "";
    var cmtyVal = "";
    var cmty = "";

    // ********************************************************************************************
    // BEGIN if PUBLIC
    // ********************************************************************************************
    if(site === "PUBLIC")
    {
        venueIdValue = that.getPublicVenueId();
    } // end if(site === "PUBLIC")
    // ********************************************************************************************
    // END if PUBLIC
    // ********************************************************************************************

    // ********************************************************************************************
    // BEGIN if FAIC
    // ********************************************************************************************
    if(site === "FAIC")
    {
        venueIdValue = that.getFaicVenueId();
    } // end if(site === "FAIC")
    // ********************************************************************************************
    // END if FAIC
    // ********************************************************************************************

    litListModuleRef = document.getElementById(myJSONobj["Header"]["ID"]);
    if(litListModuleRef === null)
    {
        prompt = "Lit List Module: id not valid. . .:" + myJSONobj["Header"]["ID"];
        BLK.EBIZ.trace(prompt);
        return;
    }

    //window.alert("small. . ." + myJSONobj["Header"]["ID"]);
    ul = document.createElement("ul");
    var found = false;

    var DATE_OFFSET = myJSONobj["Header"]["ColDef"]["date"]["ColOrder"];
    var TITLE_OFFSET = myJSONobj["Header"]["ColDef"]["title"]["ColOrder"];
    var FILENAME_OFFSET = myJSONobj["Header"]["ColDef"]["filename"]["ColOrder"];
    var APPROVED_FOR_OFFSET = myJSONobj["Header"]["ColDef"]["approvedFor"]["ColOrder"];
    var FILE_EXT_OFFSET = myJSONobj["Header"]["ColDef"]["fileExt"]["ColOrder"];

    for(var i = 0; i < myJSONobj["Content"].length; i++)
    {
        found = true;
        //window.alert(
        //    "date: " + myJSONobj["lit_list"]["records"][i]["date"] + "\n" + 
        //    "title: " + myJSONobj["lit_list"]["records"][i]["title"] + "\n" + 
        //    "filename: " + myJSONobj["lit_list"]["records"][i]["filename"] + "\n" + 
        //    "id: " + myJSONobj["lit_list"]["id"]);

        li = document.createElement("li");
        //h = document.createElement("h4");
        a = document.createElement("a");
        text = document.createTextNode(myJSONobj["Content"][i][TITLE_OFFSET][0]);
        a.appendChild(text);
        a.href = that.document + myJSONobj["Content"][i][FILENAME_OFFSET][0] + "&venue=" + venueIdValue;
        a.target = "_blank";
        ext = myJSONobj["Content"][i][FILE_EXT_OFFSET][0];
        ext = ext.toLowerCase();
        switch(ext)
        {
            case "pdf":
                li.className = "iconPDF";
                break;
            case "xls":
                li.className = "iconXLS";
                break;
            case "doc":
                li.className = "iconDOC";
                break;
            case "ppt":
                li.className = "iconPPT";
                break;
            default:
                //li.className = "iconBLANK";
                li.className = "iconArrow";
                break;
        }
        //h.appendChild(a);
        //li.appendChild(h);
        li.appendChild(a);


        span = document.createElement("span");
        text = document.createTextNode(" - " + myJSONobj["Content"][i][DATE_OFFSET][0]);
        span.appendChild(text);
        li.appendChild(span);

        ul.appendChild(li);
    }

    if(found)
    {
        litListModuleRef.innerHTML = "";
        litListModuleRef.appendChild(ul);
    }
    else
    {
        litListModuleRef.innerHTML = 
            "<span class='litListModuleMessage'>" + that.message + "</span>";
    }
}; // end BLK.EBIZ.litListModule.buildSmall = function (myJSONobj)

BLK.EBIZ.litListModule.buildLarge = function(myJSONobj)
{
    var that = BLK.EBIZ.litListModule;

    var div;
    var table;
    var thead;
    var tbody;
    var tr;
    var th;
    var td;
    var a;
    var text;
    var img;
    var litListModuleRef;
    var title;
    var ext;
    var prompt = "";

    // ********************************************************************************************
    // ********************************************************************************************
    var site = that.getSite();
    // ********************************************************************************************
    // ********************************************************************************************


    var venueIdValue = "UNKNOWN";

    // ********************************************************************************************
    // BEGIN if FP
    // ********************************************************************************************
    if(site === "FP")
    {
        var openName = "open";
        var openValue = that.getValue(openName);
        var objIdName = "objID";
        var objIdValue = that.getValue(objIdName);
        if(objIdValue === "")
        {
            if(that.debugMode)
            {
                prompt = "Lit List Module: object id parameter not found.";
                BLK.EBIZ.trace(prompt);
            }
            return;
        }
        var venueIdPageIdObj = that.mapObjId(objIdValue, false);
        venueIdValue = venueIdPageIdObj.venueId;
        if(venueIdValue === "")
        {
            if(that.debugMode)
            {
                prompt = "List List Module: venue id parameter not mapped.";
                BLK.EBIZ.trace(prompt);
            }
            return;
        }
        var pageIdValue = venueIdPageIdObj.pageId;
        if(pageIdValue === "")
        {
            if(that.debugMode)
            {
                prompt = "Lit List Module: page id parameter not mapped.";
                BLK.EBIZ.trace(prompt);
            }
            return;
        }
    } // end if(site === "FP")
    // ********************************************************************************************
    // END if FP
    // ********************************************************************************************

    var cmtyKey = "";
    var cmtyVal = "";

    // ********************************************************************************************
    // BEGIN if PUBLIC
    // ********************************************************************************************
    if(site === "PUBLIC")
    {
        venueIdValue = that.getPublicVenueId();
    } // end if(site === "PUBLIC")
    // ********************************************************************************************
    // END if PUBLIC
    // ********************************************************************************************

    // ********************************************************************************************
    // BEGIN if FAIC
    // ********************************************************************************************
    if(site === "FAIC")
    {
        venueIdValue = that.getFaicVenueId();
    } // end if(site === "FAIC")
    // ********************************************************************************************
    // END if FAIC
    // ********************************************************************************************

    //window.alert("large. . ." + myJSONobj["lit_list"]["id"]);

    litListModuleRef = document.getElementById(myJSONobj["Header"]["ID"]);
    if(litListModuleRef === null)
    {
        prompt = "Lit List Module: id not valid. . .:" + myJSONobj["Header"]["ID"];
        BLK.EBIZ.trace(prompt);
        return;
    }
    if(litListModuleRef.title !== "")
    {
        title = litListModuleRef.title;
    }
    else
    {
        title = "Documents";
    }

    var divGadget;
    var divGadgetHeader;
    var spanGadgetCaption;
    var divGadgetBody;

    divGadget = document.createElement("div");
    divGadget.className = "tableGadget highlight alternate select";

    divGadgetHeader = document.createElement("div");
    divGadgetHeader.className = "tableGadgetHeader";

    spanGadgetCaption = document.createElement("span");
    spanGadgetCaption.className = "tableGadgetCaption";
    divGadgetHeader.appendChild(spanGadgetCaption);

    divGadget.appendChild(divGadgetHeader);

    divGadgetBody = document.createElement("div");
    divGadgetBody.className = "tableGadgetBody";


    table = document.createElement("table");
    thead = document.createElement("thead");

    tr = document.createElement("tr");

    th = document.createElement("th");
    th.className = "sort sortableHeader";

    text = document.createTextNode("Date");
    th.appendChild(text);
    tr.appendChild(th);

    th = document.createElement("th");
    text = document.createTextNode(title);
    th.appendChild(text);
    tr.appendChild(th);

    thead.appendChild(tr);
    table.appendChild(thead);

    tbody = document.createElement("tbody");
    var found = false;

    var DATE_OFFSET = myJSONobj["Header"]["ColDef"]["date"]["ColOrder"];
    var TITLE_OFFSET = myJSONobj["Header"]["ColDef"]["title"]["ColOrder"];
    var FILENAME_OFFSET = myJSONobj["Header"]["ColDef"]["filename"]["ColOrder"];
    var APPROVED_FOR_OFFSET = myJSONobj["Header"]["ColDef"]["approvedFor"]["ColOrder"];
    var FILE_EXT_OFFSET = myJSONobj["Header"]["ColDef"]["fileExt"]["ColOrder"];

    for(var i = 0; i < myJSONobj["Content"].length; i++)
    {
        found = true;
        //window.alert(
        //    "date: " + myJSONobj["lit_list"]["records"][i]["date"] + "\n" + 
        //    "title: " + myJSONobj["lit_list"]["records"][i]["title"] + "\n" + 
        //    "filename: " + myJSONobj["lit_list"]["records"][i]["filename"] + "\n" + 
        //    "id: " + myJSONobj["lit_list"]["id"]);


        tr = document.createElement("tr");

        td = document.createElement("td");
        text = document.createTextNode(myJSONobj["Content"][i][DATE_OFFSET][0]);
        td.appendChild(text);
        tr.appendChild(td);

        td = document.createElement("td");
        a = document.createElement("a");
        text = document.createTextNode(myJSONobj["Content"][i][TITLE_OFFSET][0]);
        a.appendChild(text);

        a.href = that.document + myJSONobj["Content"][i][FILENAME_OFFSET][0] + "&venue=" + venueIdValue;
        a.target = "_blank";
        ext = myJSONobj["Content"][i][FILE_EXT_OFFSET][0];
        ext = ext.toLowerCase();
        switch(ext)
        {
            case "pdf":
                a.className = "iconPDF";
                break;
            case "xls":
                a.className = "iconXLS";
                break;
            case "doc":
                a.className = "iconDOC";
                break;
            case "ppt":
                a.className = "iconPPT";
                break;
            default:
                //a.className = "iconBLANK";
                a.className = "iconArrow";
                break;
        }
        td.appendChild(a);
        tr.appendChild(td);

        tbody.appendChild(tr);
    }
    table.appendChild(tbody);


    divGadgetBody.appendChild(table);
    divGadget.appendChild(divGadgetBody);


    if(found)
    {
        litListModuleRef.innerHTML = "";
        litListModuleRef.appendChild(divGadget);
        if(typeof BLK.EBIZ.Table !== "undefined")
        {
            BLK.EBIZ.Table.setup2();
        }
    }
    else
    {
        litListModuleRef.innerHTML =
            "<span class='litListModuleMessage'>" + that.message + "</span>";
    }

    //dataIslandRef.appendChild(divGadget);

};  // end BLK.EBIZ.litListModule.buildLarge = function (myJSONobj)


// ************************************************************************************************
// environment
// ************************************************************************************************

BLK.EBIZ.litListModule.setCurrentLevel = function()
{
    var that = BLK.EBIZ.litListModule;

    that.currentLevel = that.getEnvironment();

    var prompt = "";
    if(that.currentLevel === BLK.EBIZ.litListModule.LEVEL.err)
    {
        prompt = "Lit List Module: error in current level. . .";
        BLK.EBIZ.trace(prompt);
    }
};   // end that.setCurrentLevel = function ()

BLK.EBIZ.litListModule.setURIs = function()
{
    var that = BLK.EBIZ.litListModule;
    that.currentLevel = that.getEnvironment();
    var prompt = "";
    if(that.currentLevel === BLK.EBIZ.litListModule.LEVEL.err)
    {
        prompt = "Lit List Module: error in level when setting URIs. . .";
        BLK.EBIZ.trace(prompt);
        return;
    }

    that.portal = BLK.envSetting[that.currentLevel]["litListModule"]["portal"];
    that.noPortal = BLK.envSetting[that.currentLevel]["litListModule"]["noPortal"];
    that.search = BLK.envSetting[that.currentLevel]["litListModule"]["search"];
    that.document = BLK.envSetting[that.currentLevel]["litListModule"]["document"];

    that.image = BLK.envSetting[that.currentLevel]["litListModule"]["image"];

    that.service = BLK.envSetting[that.currentLevel]["litListModule"]["service"];
    that.subscribe = BLK.envSetting[that.currentLevel]["litListModule"]["subscribe"];
    that.app = BLK.envSetting[that.currentLevel]["litListModule"]["app"];

    that.dataFilePath = BLK.envSetting[that.currentLevel]["dataFilePath"];


    that.SERVER_PROGRAM = BLK.envSetting[that.currentLevel]["litListModule"]["serverProgram"];
    //window.alert(that.SERVER_PROGRAM);


    //window.alert(
    //    "level: " + that.currentLevel + "\n\n" +
    //    "portal: " + that.portal + "\n" +
    //    "no portal: " + that.noPortal + "\n" +
    //    "search: " + that.search + "\n" +
    //    "document: " + that.document + "\n" +
    //    "image: " + that.image + "\n" +
    //    "service: " + that.service + "\n" +
    //    "subscribe: " + that.subscribe + "\n" +
    //    "server program: " + that.SERVER_PROGRAM + "\n" + 
    //    "app: " + that.app);


    that = null;
};  // end BLK.EBIZ.litListModule.setURIs = function ()

BLK.EBIZ.litListModule.runCode = function ()
{
    var prompt = "";
    BLK.EBIZ.litListModule.runCode.attemptCount++;
    //window.status = "attempt count: " + BLK.EBIZ.litListModule.runCode.attemptCount;
    
    if(BLK.EBIZ.litListModule.runCode.dataSet === true)
    {
        window.clearTimeout(BLK.EBIZ.litListModule.runCode.timerId);
        return;
    }
    if(BLK.EBIZ.litListModule.runCode.attemptCount > BLK.EBIZ.litListModule.runCode.maxNumberOfTimes)
    {
        window.clearTimeout(BLK.EBIZ.litListModule.runCode.timerId);
        prompt = "Lit List Module: code timeout error. . .";
        BLK.EBIZ.trace(prompt);
        return;
    }

    var dataOK = BLK.EBIZ.litListModule.getEnvironment() === "err" ? false : true;

    if(dataOK)
    {
        window.clearTimeout(BLK.EBIZ.litListModule.runCode.timerId);
        BLK.EBIZ.litListModule.runCode.dataSet = true;
        
        BLK.EBIZ.litListModule.setURIs();
    }
    else
    {
        //BLK.EBIZ.litListModule.runCode.timerId = window.setTimeout("BLK.EBIZ.litListModule.runCode();", 100);
        BLK.EBIZ.litListModule.runCode.timerId = window.setTimeout(function() { BLK.EBIZ.litListModule.runCode(); }, 100);
    }
}; // end BLK.EBIZ.litListModule.runCode = function ()
BLK.EBIZ.litListModule.runCode.timerId = null;
BLK.EBIZ.litListModule.runCode.maxNumberOfTimes = 400;
BLK.EBIZ.litListModule.runCode.attemptCount = 0;
BLK.EBIZ.litListModule.runCode.dataSet = false;


BLK.EBIZ.litListModule.getEnvironment = function()
{
    var that = BLK.EBIZ.litListModule;
    var environment = that.LEVEL.err;
    var prompt = "";

    if(typeof BLK === "undefined")
    {
        if(that.debugMode)
        {
            prompt = "Lit List Module: BLK namespace undefined. . .";
            BLK.EBIZ.trace(prompt);
        }
        return BLK.EBIZ.litListModule.LEVEL.err;
    }
    if(typeof BLK.envConfig === "undefined")
    {
        if(that.debugMode)
        {
            prompt = "BLK.envConfig item undefined. . .";
            BLK.EBIZ.trace(prompt);
        }
        return BLK.EBIZ.litListModule.LEVEL.err;
    }
    if(typeof BLK.envConfig.environment === "undefined")
    {
        if(that.debugMode)
        {
            prompt = "BLK.envConfig.environment undefined. . .";
            BLK.EBIZ.trace(prompt);
        }
        return BLK.EBIZ.litListModule.LEVEL.err;
    }
    if(that.LEVEL[BLK.envConfig.environment] === "undefined")
    {
        if(that.debugMode)
        {
            prompt = "Promotion level undefined. . .";
            BLK.EBIZ.trace(prompt);
        }
        return BLK.EBIZ.litListModule.LEVEL.err;
    }

    environment = that.LEVEL[BLK.envConfig.environment];

    that.currentLevel = environment;

    return environment;
};     // end that.getEnvironment = function ()

// ************************************************************************************************
// lit module functionality
// ************************************************************************************************
BLK.EBIZ.litListModule.mapObjId = function (objId, contentPage)
{
    // 9 =  FP_SALES
    //11 =  FP_GENERIC 
    //10 =  FP_SERVICE
    if(typeof contentPage === "undefined")
    {
        contentPage = false;
    }
    if(typeof contentPage !== "boolean")
    {
        contentPage = false;
    }
    var venueIdPageId = {};
    //alert(venueIdPageId.length);
    switch(objId)
    {
    case "203":
	    // sales
	    if(contentPage)
	    {
	        venueIdPageId = {"venueId":"FP_SALES","pageId":"8030"};
	    }
	    else
	    {
	        venueIdPageId = {"venueId":"FP_SALES","pageId":"274"};
	    }
	    break;
    case "206":
	    // fp
	    if(contentPage)
	    {
	        venueIdPageId = {"venueId":"FP_GENERIC","pageId":"232"};
	    }
	    else
	    {
	        venueIdPageId = {"venueId":"FP_GENERIC","pageId":"233"};
	    }
	    break;
    case "207":
	    // service
	    if(contentPage)
	    {
	        venueIdPageId = {"venueId":"FP_SERVICE","pageId":"340"};
	    }
	    else
	    {
	        venueIdPageId = {"venueId":"FP_SERVICE","pageId":"237"};
	    }
	    break;
    default:
	    // error
	    if(contentPage)
	    {
	        venueIdPageId = {"venueId":"FP_GENERIC","pageId":"232"};
	    }
	    else
	    {
	        venueIdPageId = {"venueId":"FP_GENERIC","pageId":"233"};
	    }
	    break;		
    }
    return venueIdPageId;
}; // end BLK.EBIZ.litListModule.mapObjId = function (objId)

BLK.EBIZ.litListModule.getValue = function (urlNameIn)
{
    var urlValue = "";

	
    // 20090413
    //var urlName = readyForRegExp(urlNameIn);
    var urlName = readyForRegExp(urlNameIn);
	
	
    // 20090413
    //var search = trim(location.search);
    var search = trim(location.search);
	
	
    if(search === "")
    {
	    return "";
    }
	
    // [\?&]open=(\w+)&?
    var pattern = new RegExp("[\\?&]" + urlName + "=(\\w+)&?");
	
    urlValue = "";
    if(pattern.test(search))
    {
	    urlValue = RegExp.$1;
    }
    return urlValue;
}; // end BLK.EBIZ.litListModule.getValue = function (urlNameIn)

BLK.EBIZ.litListModule.getPublicVenueId = function ()
{
    var venueIdValue = "";
    var cmty = BLK.EBIZ.getUrlValue("cmty").toLowerCase();
    if(cmty === "ind")
    {
        venueIdValue = "PUB_IND";
    }
    else if(cmty === "inst")
    {
        venueIdValue = "PUB_INS";
    }
    else if(cmty === "brs")
    {
        venueIdValue = "PUB_INS";
    }
    else if(cmty === "ant")
    {
        venueIdValue = "PUB_INS";
    }
    else
    {
        venueIdValue = "PUB_IND";
    }
    return venueIdValue;
}; // end BLK.EBIZ.litListModule.getPublicVenueId = function ()

BLK.EBIZ.litListModule.getFaicVenueId = function ()
{
    var venueIdValue = "";
    var cmty = BLK.EBIZ.getUrlValue("cmty").toLowerCase();
    if(cmty === "off")
    {
        venueIdValue = "FP_MLOFSHR";
    }
    else
    {
        venueIdValue = "FP_ML";
    }
    return venueIdValue;
}; // end BLK.EBIZ.litListModule.getFaicVenueId = function ()

BLK.EBIZ.litListModule.buildUrl = function (urlType, contentId, needPortal, needRurl, needAppName)
{
    var that = BLK.EBIZ.litListModule;
    var openName = "open";
    
    // here
    //that.currentLevel = that.getEnvironment();
    that.runCode();
	
    // 20090413
    //var openValue = getValue(openName);
    var openValue = that.getValue(openName);
	
    //if(openValue === "")
    //{
        //alert("Open parameter not found.");
    //	window.status = "Open parameter not found.";
    //	return "";
    //}

    var objIdName = "objID";
	
    // 20090413
    //var objIdValue = getValue(objIdName);
    var objIdValue = that.getValue(objIdName);
	
    if(objIdValue === "")
    {
        //alert("Object id parameter not found.");
        //window.status = "Object id parameter not found.";
	    return "";
    }
	
    // 20090413
    //var venueIdPageIdObj = mapObjId(objIdValue);
    var venueIdPageIdObj = that.mapObjId(objIdValue, false); // is not content page
	
    var venueIdValue = venueIdPageIdObj.venueId;
    if(venueIdValue === "")
    {
        //alert("Venue id parameter not mapped.");
        //window.status = "Venue id parameter not mapped.";
	    return "";
    }
	
    var pageIdValue = venueIdPageIdObj.pageId;	
    if(pageIdValue === "")
    {
        //alert("Page id parameter not mapped.");
        //window.status = "Page id parameter not mapped.";
	    return "";
    }
	
    var rurl = escape(window.location.href);

    /*
    var litModuleDiv = document.getElementById(contentId);
    var litModuleTitle = "";
    if(litModuleDiv !== null)
    {
	    if(litModuleDiv.title)
	    {
		    litModuleTitle = litModuleDiv.title;
	    }
    }
    // 20090423 roark
    litModuleTitle = document.title;
	*/
	
    var url;
    if(needPortal === true)
    {
	    // 20090413
	    if(that.currentLevel === that.LEVEL["prod"])
	    //if(m_level === that.LEVEL["prod"])
	    {
		    // prod
		    //url = "https://www2.blackrock.com/fp/server.pt" + 
		    url = that.portal;
		    url += 
			    "&open=" + openValue +
			    "&objID=" + objIdValue + 
			    "&PageID=" + pageIdValue; 
		    if(needAppName)
		    {
			    url += "&appname=estudioSearch";
		    }	
		    //url += "&appurl=https://estudio.blackrock.com/PublicServices/CommonService.asp";
		    url += "&appurl=" + that.app;
	    }
	    else
	    {
		    // dev, test, uat
		    //url = "https://www.ssrtestlan.com/fp/server.pt" + 
		    url = that.portal;
		    url += 
			    "&open=" + openValue +
			    "&objID=" + objIdValue + 
			    "&PageID=" + pageIdValue;
		    if(needAppName)
		    {
			    url += "&appname=estudioSearch";
		    }					
		    //url += "&appurl=https://estudio.ssrtestlan.com/PublicServices/CommonService.asp";
		    url += "&appurl=" + that.app;
	    } // end if(m_level === that.LEVEL["prod"])
    }
    else
    {
	    // 20090413
	    if(that.currentLevel === that.LEVEL["prod"])
	    //if(m_level === that.LEVEL["prod"])
	    {
		    // prod
		    //url = "https://estudio.blackrock.com/PublicServices/CommonService.asp";
		    url = that.portal;
	    }
	    else
	    {
		    // dev, test, uat
		    //url = "https://estudio.ssrtestlan.com/PublicServices/CommonService.asp";
		    url = that.portal;
	    } // end if(m_level === that.LEVEL["prod"])
    } // end if(needPortal === true)
		
    var ok = false;
    var queryString = "";
	
    switch(urlType)
    {
    // subscription also depends on fp = 206 as *modal window*, no portal url needed
    // else replaces page w/url = portal + estudio appurl
    case "SUBSCRIPTION":
	    ok = true;
	    // asap venu id = 11 -- popup window
	    //if(venueIdValue === "11")
	    if(venueIdValue === "FP_GENERIC")
	    {
		    //queryString = "?ServiceName=SUBSCRIPTION&VenueID=" + venueIdValue + "&ContentID=" + contentId + "&fromsearch=2";
		    queryString = "?ServiceName=SUBSCRIPTION&Venue=" + venueIdValue + "&ContentID=" + contentId + "&fromsearch=2";
	    }
	    else
	    {
		    //queryString = "?ServiceName=SUBSCRIPTION&VenueID=" + venueIdValue + "&ContentID=" + contentId;
		    queryString = "?type=subscription&ServiceName=SUBSCRIPTION&Venue=" + venueIdValue + "&ContentID=" + contentId;
	    }
	    //rurl = escape(window.location.href);
	    break;
    case "MANAGESUBSCRIPTION":
	    ok = true;
	    //queryString = "?ServiceName=MANAGESUBSCRIPTION&VenueID=" + venueIdValue + "&ContentID=" + contentId;
	    queryString = "?ServiceName=MANAGESUBSCRIPTION&Venue=" + venueIdValue + "&ContentID=" + contentId;
	    break;
    case "EMAIL":
	    ok = true;
	    //queryString = "?ServiceName=EMAIL&VenueID=" + venueIdValue + "&ContentID=" + contentId;
	    queryString = "?type=email&ServiceName=EMAIL&Venue=" + venueIdValue + "&ContentID=" + contentId;
	    break;
    case "ORDER":
	    ok = true;
	    //queryString = "?ServiceName=FPSearch&ContentID=" + contentId + "&VenueID=" +  venueIdValue;
	    queryString = "?ServiceName=FPSearch&ContentID=" + contentId + "&Venue=" +  venueIdValue;
	    break;
    default:
	    ok = false;
	    break;
    }
	
    if(!ok)
    {
	    window.status = "Unknown common service type.";
	    return "";
    }
    //alert(rurl);
	
    if(needRurl)
    {
	    url += queryString + "&rurl=" + rurl + "&title=" + that.chartTitle;
    }
    else
    {
	    url += queryString;
    }
			
    //alert("Obj Id Name: " + objIdName + "\n" +
    //	"Obj Id Value: " + objIdValue + "\n" +
    //	"Venue Id Value: " + venueIdValue + "\n" +
    //	"Page Id Value: " + pageIdValue + "\n" +
    //	"Keyword: " + keyword + "\n" +
    //	"URL: " + url);
	
	that = null;
	
    return url;
}; // end BLK.EBIZ.litListModule.buildUrl = function (urlType, contentId, needPortal, needRurl, needAppName)

// ************************************************************************************************
// end litListModule.js
// ************************************************************************************************
/*
* Last edited by:  $Author: rhoward $
*             on:  $Date: 2010/08/09 16:30:00 $
*       Filename:  $RCSfile: wsodLoader.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin wsodLoader.js
// ************************************************************************************************

/*global document, wsod_init */

function wsodLoader()
{
    var wsodInput = document.getElementById("wsod_suggest");
    if(wsodInput)
    {
        if(typeof wsod_init === "function")
        {
            wsod_init();
            return true;
        }
        return false;
    }
    else
    {
        return false;
    }
} // end function wsodLoader()

// ************************************************************************************************
// end wsodLoader.js
// ************************************************************************************************

