/*
* Last edited by:  $Author: claasch $
*             on:  $Date: 2010/11/30 13:06:00 $
*       Filename:  $RCSfile: global_custom.js,v $
*       Revision:  $Revision: 1.0 $
*/

// start function selectLinks(targ,selObj,restore)
EBIZ.thisSite = "PUBLIC";


function selectLinks(targ,selObj,restore)
{
	//alert('hi');
	//selObj.options[selObj.selectedIndex].value += "&cmty=" + community;
	//alert(selObj.options[selObj.selectedIndex].value);
	var ddvalue = (selObj.options[selObj.selectedIndex].value);
	
	if (ddvalue == '') 
	{
		return;
	}
	else 
	{
	    if (targ=="self") 
	    {
		    window.open(selObj.options[selObj.selectedIndex].value);
        }
	    else 
	    {	
	        eval(targ+".location='"+selObj.options[selObj.selectedIndex].value + "'");
	        if (restore)
	        {
	            selObj.selectedIndex = 0;
	        }
	    }
	}
} // end function selectLinks(targ,selObj,restore)


/* Cookie Redirect functions */

function goBlkSite(siteName, setCookie)
{
    if(typeof setCookie != 'undefined' && setCookie != null) 
    {
        rememberLocation(siteName);
    }

    window.document.location.href=siteName;
} // end function goBlkSite(siteName, setCookie)

function doRedirect(okSendGlobal) 
{
    var knownSite = getCookie('globalRedirectSite');

    if(knownSite != null && knownSite != 'null')
        goBlkSite(knownSite, true);

    else if(okSendGlobal)
        window.document.location.href="/global/home/index.htm";
} // end function doRedirect(okSendGlobal)

function rememberLocation(siteName)
{
    if(siteName != null && siteName != '')
    {
        setCookie('globalRedirectSite', siteName, 364, '/');
    }
    return 1;
} // end function rememberLocation(siteName)

function setCookie( name, value, expires, path, domain, secure ) 
{
    var today = new Date();
    today.setTime(today.getTime());

    if(expires) 
    {
        expires = expires * 1000 * 60 * 60 * 24;
    }

    var expires_date = new Date( today.getTime() + (expires) );

    document.cookie = name + "=" +escape( value ) +
        (expires? ";expires=" + expires_date.toGMTString() : "" ) +
        (path? ";path=" + path : "" ) +
        (domain? ";domain=" + domain : "" ) +
        (secure? ";secure" : "" );
} // end function setCookie( name, value, expires, path, domain, secure ) 

function getCookie(name)
{
    var start = document.cookie.indexOf(name+"=");
    var len = start + name.length + 1;

    if(!start && name != document.cookie.substring(0,name.length))
        return null;

    if(start == -1)
        return null;

    var end = document.cookie.indexOf(";", len );

    if(end == -1)
        end = document.cookie.length;

    return unescape(document.cookie.substring(len, end));
} // end function getCookie(name)

/* End of Cookie Redirect function */
// ************************************************************************************************
// end custom functions and variables
// ************************************************************************************************

// ************************************************************************************************
// begin utility functions from common.js
// ************************************************************************************************
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 randomBetween(min, max)
{
	return min + Math.floor(Math.random() * (max - min + 1));
} // end function randomBetween(min, max)

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 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()

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)

// ************************************************************************************************
// end utility functions from common.js
// ************************************************************************************************

// ************************************************************************************************
// begin namespace
// ************************************************************************************************
if(typeof BLK === "undefined")
{
	var BLK = {};
	BLK.EBIZ = {};
	BLK.BRS = {};
}
// ************************************************************************************************
// end namespace
// ************************************************************************************************

// ************************************************************************************************
// begin modal dialog
// ************************************************************************************************

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

BLK.EBIZ.ModalDialog3 = function ()
{
	var that = this;
	this.configuration = {"width":700, "height":300, "minWidth":128, "minHeight":128, "maxWidth":1024, "maxHeight":768};
	this.setup = function ()
	{
        var i = 0;
        var j = 0;
        var k = 0;
		var modalDialogDatumRef = null;
		var modalDialogLinkList = getElementsByClassName(document.body, "modalDialogLink");
		for(i = 0; i < modalDialogLinkList.length; i++)
		{
		    // validate links and associated data blocks
		    if(modalDialogLinkList[i].nodeName.toLowerCase() !== "a")
		    {
		        //window.alert("is not <a>");
		        continue;
		    }
		    if(modalDialogLinkList[i].rel === "")
		    {
		        //window.alert("rel is empty");
		        continue;
		    }
		    modalDialogDatumRef = document.getElementById(modalDialogLinkList[i].rel);
		    if(modalDialogDatumRef === null)
		    {
		        //window.alert("invalid rel");
		        continue;
		    }
		    if(modalDialogDatumRef.nodeName.toLowerCase() !== "div")
		    {
		        //window.alert("datum is not <div>");
		        continue;
		    }
		    if(!findClass(modalDialogDatumRef, "modalDialogDatum"))
		    {
		        //window.alert("datum is wrong class");
		        continue;
		    }
		    
		    // create modal dialog handler
		    modalDialogLinkList[i].onclick = function (modalDialogDatumRef, configuration)
		    {
		        return function (event)
		        {
				    var isIe = false;
				    if(typeof event === "undefined")
				    {
					    isIe = true;
					    event = window.event;
				    }
				    var targetElement = getEventTarget(event);

                    // validate dimensions
                    var width = 0;
                    var height = 0;
                    var dimensionArray = [];
                    if(this.rev === "")
                    {
                        //width = configuration.width;
                        //height = configuration.height;
                        width = -1;
                        height = -1;
                    }
                    else
                    {
                        dimensionArray = this.rev.split(",");
                        if(dimensionArray.length === 2)
                        {
                            if(isNaN(parseInt(dimensionArray[0], 10)) || isNaN(parseInt(dimensionArray[1], 10)))
                            {
                                //width = configuration.width;
                                //height = configuration.height;
                                width = -1;
                                height = -1;
                            }
                            else
                            {
                                width = parseInt(dimensionArray[0], 10);
                                height = parseInt(dimensionArray[1], 10);
                            
                                if(width < configuration.minWidth || height < configuration.minHeight)
                                {
                                    //width = configuration.width;
                                    //height = configuration.height;
                                    width = -1;
                                    height = -1;
                                }
                                else if(width > configuration.maxWidth || height > configuration.maxHeight)
                                {
                                    //width = configuration.width;
                                    //height = configuration.height;
                                    width = -1;
                                    height = -1;
                                }
                                else
                                {
                                    width = parseInt(dimensionArray[0], 10);
                                    height = parseInt(dimensionArray[1], 10);
                                }
                            }
                        }
                        else
                        {
                            //width = configuration.width;
                            //height = configuration.height;
                            width = -1;
                            height = -1;
                        }
                    }
                    var title = this.title;
                    
					that.createDialog(modalDialogDatumRef, isIe, width, height, title);
                    
                    return false;		    
		        }; // end return function (event)
		    }(modalDialogDatumRef, this.configuration);
		} // end for(i = 0; i < modalDialogLinkList.length; i++)
		
		// scroll/resize event handler
		var fxn = function (event)
		{
			if(typeof event === "undefined")
			{
				event = window.event;
			}

			try
			{
		        var containerList = getElementsByClassName(document.body, "modalDialogGadgetContainer");
		        var dropSheetRef = document.getElementById("modalDialogGadgetDropSheet");

		        if(containerList.length < 1)
		        {
		            return false;
		        }
		        if(dropSheetRef === null)
		        {
		            return false;
		        }

                var containerRef = containerList[0];
                var pageDimensions = getPageDimensions();
		        var viewportSize = getViewportSize();
		        var scrollingPosition = getScrollingPosition();
		        var containerHeight = containerRef.offsetHeight;
		        var containerWidth = containerRef.offsetWidth;

		        //document.title = getScrollingPosition() + "||" + getViewportSize() + "||" + "(" + containerWidth + "," + containerHeight + ")";

		        var offsetLeft = scrollingPosition[0] + (viewportSize[0] / 2) - (containerRef.offsetWidth / 2);
		        var offsetTop = scrollingPosition[1] + (viewportSize[1] / 2) - (containerRef.offsetHeight / 2);

		        // position popup
		        containerRef.style.left = offsetLeft + "px";
		        containerRef.style.top = offsetTop + "px";

                // resize drop sheet
                dropSheetRef.style.width = pageDimensions[0] + "px";
                dropSheetRef.style.height = pageDimensions[1] + "px";
		    }
		    catch(ex)
		    {
		        var message = "";
		        for(var i in ex)
		        {
		            message += i + ": " + ex[i]+ "\n";
		        }
		        //window.alert("An exception occurred.\n\n" + "Name: " + ex.name + "Message: " + ex.message);
		        window(message);
		    }
		    return true;
		}; // end var fxn = function (event)
		
	    var isIE = (typeof document.all !== "undefined" && typeof window.opera === "undefined" && navigator.vendor !== "KDE");
	    if(isIE)
	    {
	        // ie7
            document.body.onscroll = fxn;
            // ie6
            window.onscroll = fxn;
            
            document.body.onresize = fxn;
	    }
	    else
	    {
            window.onscroll = fxn;
            window.onresize = fxn;
	    }
		
		return true;
    }; // end this.setup = function ()
    
	this.createDialog = function (modalDialogGadgetRef, isIe, width, height, title)
	{
		var that = this;
		var bodyRef = document.getElementsByTagName("body")[0];

        var showTitle = findClass(modalDialogGadgetRef, "modalDialogGadgetShowTitle");
        var showCloseButton = findClass(modalDialogGadgetRef, "modalDialogGadgetShowCloseButton");
        var showFooter = findClass(modalDialogGadgetRef, "modalDialogGadgetShowFooter");

		// 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];
		}

        var MIN_ZINDEX = 99997;
		
		// ****************************************************************************************
		// 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;
		}; // end dropSheet.onclick = function (event)

		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;
			}
		}; // end dropSheet.onkeyup = function (event)

		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";
		
		dropSheet.style.zIndex = MIN_ZINDEX;
		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 button = 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 = MIN_ZINDEX + 1;
		// ****************************************************************************************
		// 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 = MIN_ZINDEX + 2;
		
		
        if(modalDialogGadgetRef.title !== "")
        {
            if(document.getElementById(modalDialogGadgetRef.title) !== null)
            {
                divContainer.id = modalDialogGadgetRef.title + "Container";
            }
        }
		
		//window.alert(width);
		// set width with css
		if(width > 0)
		{
		    divContainer.style.width = width + "px";
		}
		
		// ****************************************************************************************
		// header begin
		// ****************************************************************************************
		if(showTitle || showCloseButton)
		{
		    divHeader = document.createElement("div");
		    divHeader.className = "modalDialogGadgetContainerHeader";
		    
		    
            if(modalDialogGadgetRef.title !== "")
            {
                if(document.getElementById(modalDialogGadgetRef.title) !== null)
                {
                    divHeader.id = modalDialogGadgetRef.title + "ContainerHeader";
                }
            }
		    

            // title
            if(showTitle)
            {
		        divLeft = document.createElement("div");
		        divLeft.className = "modalDialogGadgetContainerHeaderLeft";

		        span = document.createElement("span");
		        span.className = "modalDialogGadgetContainerHeaderTitle";

	            text = document.createTextNode(title);
		        span.appendChild(text);

		        divLeft.appendChild(span);
		        divHeader.appendChild(divLeft);
		    } // end if(showTitle)
		    
		    // close button
		    if(showCloseButton)
		    {
		        divRight = document.createElement("div");
		        divRight.className = "modalDialogGadgetContainerHeaderRight";

		        a = document.createElement("a");
		        a.href = "#nogo";
		        a.className = "modalDialogGadgetContainerHeaderCloseButton";
		        a.title = "Close";
		        a.onclick = function (event)
		        {
			        if(typeof event === "undefined")
			        {
				        event = window.event;
			        }
			        var target = getEventTarget(event);
			
			        that.closeDialog();
			
			        return false;
                }; // end input.onclick = function (event)

		        divRight.appendChild(a);
		        divHeader.appendChild(divRight);
		    } // end if(showCloseButton)


		    divClear = document.createElement("div");
		    divClear.style.clear = "both";

		    divHeader.appendChild(divClear);
		} // end if(showTitle || showCloseButton)

		// ****************************************************************************************
		// header end
		// ****************************************************************************************

		// ****************************************************************************************
		// body begin
		// ****************************************************************************************
		divBody = document.createElement("div");
		divBody.className = "modalDialogGadgetContainerBody";
		
		
		// set height with css
		if(height > 0)
		{
		    divBody.style.height = height + "px";
		}
		
		
		var modalDialogGadgetBodyList = modalDialogGadgetRef;
		var innerHTML = "";
        
        innerHTML = modalDialogGadgetRef.innerHTML;
        
        //window.alert(modalDialogGadgetRef.title);
        if(modalDialogGadgetRef.title !== "")
        {
            if(document.getElementById(modalDialogGadgetRef.title) !== null)
            {
                divBody.id = modalDialogGadgetRef.title + "ContainerBody";
            }
        }
        
		divBody.innerHTML = innerHTML;
		// ****************************************************************************************
		// body end
		// ****************************************************************************************

		// ****************************************************************************************
		// footer begin
		// ****************************************************************************************
		if(showFooter)
		{
		    divFooter = document.createElement("div");
		    divFooter.className = "modalDialogGadgetContainerFooter";
		    //divFooter.cssFloat = "left";


            if(modalDialogGadgetRef.title !== "")
            {
                if(document.getElementById(modalDialogGadgetRef.title) !== null)
                {
                    divFooter.id = modalDialogGadgetRef.title + "ContainerFooter";
                }
            }


		    // 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");
		    input.title = "Close";
		    input.onclick = function (event)
		    {
			    if(typeof event === "undefined")
			    {
				    event = window.event;
			    }
			    var target = getEventTarget(event);
			
			    that.closeDialog();
			
			    return false;
		    };
		    divFooter.appendChild(input);
            */		    
		    
		    
		    a = document.createElement("a");
		    a.href = "#nogo";
		    text = document.createTextNode("Close");
		    a.appendChild(text);
		    a.className = "modalDialogGadgetContainerFooterCloseButton";
		    a.title = "Close";
		    a.onclick = function (event)
		    {
			    if(typeof event === "undefined")
			    {
				    event = window.event;
			    }
			    var target = getEventTarget(event);
			
			    that.closeDialog();
			
			    return false;
		    }; // end a.onclick = function (event)
		    divFooter.appendChild(a);
		} // end if(showFooter)
		// ****************************************************************************************
		// footer end
		// ****************************************************************************************
		
		if(showTitle || showCloseButton)
		{
		    divContainer.appendChild(divHeader);
		}
		divContainer.appendChild(divBody);
		if(showFooter)
		{
		    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 = "";
		//}
		
		//window.alert("on close. . .");
	};
    
	this.setup();
}; // end BLK.EBIZ.ModalDialog3 = function ()
function tabsInit()
{
	if(typeof BLK.EBIZ.Tabs === "function")
	{
	    //BLK.EBIZ.Tabs.eventHandlerQueue[BLK.EBIZ.Tabs.eventHandlerQueue.length] = handler1;
	    //BLK.EBIZ.Tabs.eventHandlerQueue[BLK.EBIZ.Tabs.eventHandlerQueue.length] = handler2;
		BLK.EBIZ.Tabs.tabCtrl = new BLK.EBIZ.Tabs();
	}
}
// addLoadListener(tabsInit);

function initLitListModule()
{
    if(typeof BLK.EBIZ.litListModule !== "undefined")
    {
        if(typeof BLK.EBIZ.litListModule.getData !== "undefined")
        {
            BLK.EBIZ.trace("initLitListModule. . .");
            BLK.EBIZ.litListModule.getData();
        }
    }
} // end function initLitListModule()

function initModalDialog()
{
    if(typeof BLK.EBIZ.ModalDialog3 !== "undefined")
    {
        var dlg = new BLK.EBIZ.ModalDialog3();
    }
} // end function initModalDialog()
//addLoadListener(initModalDialog);
// ************************************************************************************************
// end modal dialog
// ************************************************************************************************

function hideExpand(var1,var2) 
	{
			document.getElementById(var1).style.display = "none";
			document.getElementById(var2).style.display = "block";
	}

// ************************************************************************************************
// end custom.js
// ************************************************************************************************


/* Last edited by:  $Author: rhoward $
*             on:  $Date: 2010/08/06 15:00:00 $
*       Filename:  $RCSfile: flashVideo.js,v $
*       Revision:  $Revision: 1.0 $
*/

// ************************************************************************************************
// begin flashVideo.js
// ************************************************************************************************

/*global alert, document, location, navigator, window, ActiveXObject, clearInterval, jQuery, setInterval */

/** 
 * flashembed 0.31. Adobe Flash embedding script
 * 
 * http://flowplayer.org/tools/flash-embed.html
 *
 * Copyright (c) 2008 Tero Piirainen (tipiirai@gmail.com)
 *
 * Released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 * 
 * >> Basically you can do anything you want but leave this header as is <<
 *
 * version 0.01 - 03/11/2008 
 * version 0.31 - Tue Jul 22 2008 06:30:34 GMT+0200 (GMT+02:00)
 */
function flashembed(root, userParams, flashvars) 
{
	function getHTML() 
	{
		
		var html = "";
		if (typeof flashvars == 'function') { flashvars = flashvars(); }
		
		
		// mozilla
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) 
		{  
			html = '<embed type="application/x-shockwave-flash" ';

			if (params.id) {
				extend(params, {name:params.id});
			}
			
			for (var key in params) { 
				if (params[key] !== null) { 
					html += [key] + '="' +params[key]+ '"\n\t';
				}
			}

			if (flashvars) {
				 html += 'flashvars=\'' + concatVars(flashvars) + '\'';
			}
			
			// thanks Tom Price (07/17/2008)
			html += '/>';
			
		// ie
		} 
		else 
		{ 

			html = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
			html += 'width="' + params.width + '" height="' + params.height + '"'; 
			
			// force id for IE. otherwise embedded Flash object cannot be returned
			if (!params.id && document.all) 
			{
				params.id = "_" + ("" + Math.random()).substring(5);
			} 
			
			if (params.id) {html += ' id="' + params.id + '"';} 
			
			html += '>';  
			html += '\n\t<param name="movie" value="'+ params.src +'" />';
			
			params.id = params.src = params.width = params.height = null;
			
			for (var k in params) 
			{
				if (params[k] !== null) 
				{
					html += '\n\t<param name="'+ k +'" value="'+ params[k] +'" />';
				}
			}
			
			if (flashvars) 
			{
				html += '\n\t<param name="flashvars" value=\'' + concatVars(flashvars) + '\' />';
			}
			 
			html += "</object>";
			if (debug) 
			{ 
				alert(html);
			}
		}  
		return html;
	}
	
	function init(name) 
	{
		var timer = setInterval(function() {
			var doc = document;
			var el = doc.getElementById(name); 
			
			if (el) {
				flashembed(el, userParams, flashvars);
				clearInterval(timer); 
				
			} else if (doc && doc.getElementsByTagName && doc.getElementById && doc.body) {
				clearInterval(timer);
			}
		}, 13);
		
		return true;
	}
	
	// override extend params function 
	function extend(to, from) 
	{
		if (from) 
		{
			for (key in from) 
			{
				if (from.hasOwnProperty(key)) 
				{
					to[key] = from[key];
				}
			}
		}
	}		
	
	// setup params
	var params = 
	{
		// very common params
		src: '#',
		width: '100%',
		height: '100%',		
		
		// flashembed specific options
		version:null,
		onFail:null,
		expressInstall:null,  
		debug: false,
		
		// flashembed defaults
		bgcolor: '#ffffff',
		allowfullscreen: true,
		allowscriptaccess: 'always',
		quality: 'high',
		type: 'application/x-shockwave-flash',
		pluginspage: 'http://www.adobe.com/go/getflashplayer'
	};
	
	
	if (typeof userParams == 'string') 
	{
		userParams = {src: userParams};	
	}
	
	extend(params, userParams);			 
		
	var version = flashembed.getVersion(); 
	var required = params.version; 
	var express = params.expressInstall;		 
	var debug = params.debug;

	
	if (typeof root == 'string') 
	{  
		var el = document.getElementById(root);
		if (el) 
		{
			root = el;	
		} 
		else 
		{
			return init(root);		
		} 
	}
	
	if (!root) { return; }
	
	
	// is supported 
	if (!required || flashembed.isSupported(required)) 
	{
		params.onFail = params.version = params.expressInstall = params.debug = null; 
		root.innerHTML = getHTML();	
		
		// return our API			
		return root.firstChild;
		
	// custom fail event
	} 
	else if (params.onFail) 
	{
		var ret = params.onFail.call(params, flashembed.getVersion(), flashvars);
		if (ret) { root.innerHTML = ret; }		
		

	// express install
	} 
	else if (required && express && flashembed.isSupported([6,65])) 
	{
		extend(params, {src: express});
		
		flashvars = {
			MMredirectURL: location.href,
			MMplayerType: 'PlugIn',
			MMdoctitle: document.title
		};
		
		root.innerHTML = getHTML();	
		
	// not supported
	} 
	else 
	{

		// minor bug fixed here 08.04.2008 (thanks JRodman)
		
		if (root.innerHTML.replace(/\s/g, '') !== '') 
		{
			// custom content was supplied
		
		} 
		else 
		{
			root.innerHTML = 
				"<h2>Flash version " + required + " or greater is required</h2>" + 
				"<h3>" + 
					(version[0] > 0 ? "Your version is " + version : "You have no flash plugin installed") +
				"</h3>" + 
				"<p>Download latest version from <a href='" + params.pluginspage + "'>here</a></p>";
		}
	}
	
	function concatVars(vars) 
	{		
		var out = "";
		
		for (var key in vars) 
		{ 
			if (vars[key]) 
			{
				out += [key] + '=' + asString(vars[key]) + '&';
			}
		}			
		return out.substring(0, out.length -1);				
	}  
	
	// JSON.asString() function
	function asString(obj) 
	{
		switch (typeOf(obj))
		{
			case 'string':
				return '"'+obj.replace(new RegExp('(["\\\\])', 'g'), '\\$1')+'"';
				
			case 'array':
				return '['+ map(obj, function(el) {
					return asString(el);
				}).join(',') +']'; 
				
			case 'function':
				return '"function()"';
				
			case 'object':
				var str = [];
				for (var prop in obj) {
					if (obj.hasOwnProperty(prop)) {
						str.push('"'+prop+'":'+ asString(obj[prop]));
					}
				}
				return '{'+str.join(',')+'}';
		}
		
		// replace ' --> "  and remove spaces
		return String(obj).replace(/\s/g, " ").replace(/\'/g, "\"");
	}
	
	// private functions
	function typeOf(obj) 
	{
		if (obj === null || obj === undefined) { return false; }
		var type = typeof obj;
		return (type == 'object' && obj.push) ? 'array' : type;
	}
	
	// version 9 bugfix: (http://blog.deconcept.com/2006/07/28/swfobject-143-released/)
	if (window.attachEvent) 
	{
		window.attachEvent("onbeforeunload", function() {
			__flash_unloadHandler = function() {};
			__flash_savedUnloadHandler = function() {};
		});
	}
	
	function map(arr, func) 
	{
		var newArr = []; 
		for (var i in arr) {
			if (arr.hasOwnProperty(i)) {
				newArr[i] = func(arr[i]);
			}
		}
		return newArr;
	}

	return root;
}

// setup jquery support
if (typeof jQuery == 'function') 
{
	(function($) { 
		$.fn.extend({
			flashembed: function(params, flashvars) {  
				return this.each(function() { 
					flashembed(this, params, flashvars);
				});
			}		
		}); 
	})(jQuery);
}

flashembed = flashembed || {};

// arr[major, minor, fix]
flashembed.getVersion = function() 
{
	var version = [0, 0];
	
	if (navigator.plugins && typeof navigator.plugins["Shockwave Flash"] == "object") 
	{
		var _d = navigator.plugins["Shockwave Flash"].description;
		if (typeof _d != "undefined") 
		{
			_d = _d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
			var _m = parseInt(_d.replace(/^(.*)\..*$/, "$1"), 10);
			var _r = /r/.test(_d) ? parseInt(_d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
			version = [_m, _r];
		}
	} 
	else if (window.ActiveXObject) 
	{
		try 
		{ 
		    // avoid fp 6 crashes
			var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		} 
		catch(e) 
		{
			try 
			{ 
				_a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				version = [6, 0];
				_a.AllowScriptAccess = "always"; // throws if fp < 6.47 
			} 
			catch(ee) 
			{
				if (version[0] == 6) { return; }
			}
			try 
			{
				_a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			} 
			catch(eee) 
			{
			
			}
		}
		if (typeof _a == "object") 
		{
			_d = _a.GetVariable("$version"); // bugs in fp 6.21 / 6.23
			if (typeof _d != "undefined") 
			{
				_d = _d.replace(/^\S+\s+(.*)$/, "$1").split(",");
				version = [parseInt(_d[0], 10), parseInt(_d[2], 10)];
			}
		}
	} 
	
	return version;
};

flashembed.isSupported = function(version) 
{
	var now = flashembed.getVersion();
	var ret = (now[0] > version[0]) || (now[0] == version[0] && now[1] >= version[1]);			
	return ret;
};

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

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

BLK.EBIZ.FLASHPLAYER = 
{
	winObj : null,
	className : "flashObject",
	classNameGroup : "flashObjectGroup",
	
	//style : {"CLASSIC":"http://estudio.blackrock.com/eStudioContent/GENERIC/flash/flowplayer/FlowPlayerClassic.swf", 
	//	"DARK":"http://estudio.blackrock.com/eStudioContent/GENERIC/flash/flowplayer/FlowPlayerDark.swf",
	//	"LIGHT":"http://estudio.blackrock.com/eStudioContent/GENERIC/flash/flowplayer/FlowPlayerLight.swf",
	//	"LP":"http://estudio.blackrock.com/eStudioContent/GENERIC/flash/flowplayer/FlowPlayerLP.swf"},
		
	//style : {"CLASSIC":"http://www2.blackrock.com/content/groups/public/documents/image/flowplayerclassic.swf", 
	//	"DARK":"http://www2.blackrock.com/content/groups/public/documents/image/flowplayerdark.swf",
	//	"LIGHT":"http://www2.blackrock.com/content/groups/public/documents/image/flowplayerlight.swf",
	//	"LP":"http://www2.blackrock.com/content/groups/public/documents/image/flowplayerlp.swf"},

	style : {"CLASSIC":"https://www2.blackrock.com/content/groups/public/documents/image/flowplayerclassic.swf", 
		"DARK":"https://www2.blackrock.com/content/groups/public/documents/image/flowplayerdark.swf",
		"LIGHT":"https://www2.blackrock.com/content/groups/public/documents/image/flowplayerlight.swf",
		"LP":"https://www2.blackrock.com/content/groups/public/documents/image/flowplayerlp.swf"},
		
	autoPlay : {"TRUE":true,
		"FALSE":false},
	initialScale : {"FIT":"fit",
		"HALF":"half",
		"ORIG":"orig",
		"SCALE":"scale"},
	loop : {"TRUE":true,
		"FALSE":false},
		
	//streamingServerURL : "rtmp://flashcast.streamlogics.com/ondemand/blackrock",
	//streamingServerURL : "rtmpt://blackrockmedia.flash.internapcdn.net/blackrockmedia_vitalstream_com/_definst_/",
	streamingServerURL : "rtmpt://cp19723.edgefcs.net/ondemand/blackrock/",
	
	
	//splashImageURL : "https://literature.blackrock.com/eStudioContent/GENERIC/IMAGES/MEDIA_REPLAYS/",
  	//splashImageURL : "http://www2.blackrock.com/content/groups/public/documents/image/",
  	splashImageURL : "https://www2.blackrock.com/content/groups/public/documents/image/",
	
	//noVideoImageURL : "https://literature.blackrock.com/eStudioContent/GENERIC/IMAGES/MEDIA_REPLAYS/camera.jpg",
	//noVideoImageURL : "http://www2.blackrock.com/content/groups/public/documents/image/blk058003.gif",
	noVideoImageURL : "https://www2.blackrock.com/content/groups/public/documents/image/blk058003.gif",
	
	setup : function (idIn, styleIn, widthIn, heightIn, initialScaleIn, autoPlayIn, loopIn)
	{
		//window.alert("setup");
		var flashObjectRef = document.getElementById(idIn);
		var videoFile = "";
		if(flashObjectRef === null)
		{
			return;
		}
		if(!findClass(flashObjectRef, this.className))
		{
			return;
		}
		if(flashObjectRef.nodeName.toLowerCase() !== "div")
		{
			return;
		}
		videoFile = flashObjectRef.id;
		
		// roark 20100122
		// get server url from environment file
        if(BLK.envSetting["streamingServerURL"] !== "undefined")
        {
            this.streamingServerURL = BLK.envSetting["streamingServerURL"];
        }
		this.installFlashPlayer(videoFile, this.streamingServerURL, styleIn, 
			widthIn, heightIn, initialScaleIn, autoPlayIn, loopIn, this.className);
	},
	setupAll : function (styleIn, widthIn, heightIn, initialScaleIn, autoPlayIn, loopIn)
	{
		var flashObjectList = getElementsByClassName(document.body, this.classNameGroup);
		var videoFile = "";
		
		for(var i = 0; i < flashObjectList.length; i++)
		{
			if(flashObjectList[i].nodeName.toLowerCase() !== "div")
			{
				continue;
			}
			if(flashObjectList[i].id === "")
			{
				continue;
			}
			videoFile = flashObjectList[i].id;
			
    		// roark 20100122
	    	// get server url from environment file
	    	//window.alert(BLK.envSetting["streamingServerURL"]);
            if(BLK.envSetting["streamingServerURL"] !== "undefined")
            {
                this.streamingServerURL = BLK.envSetting["streamingServerURL"];
            }
			this.installFlashPlayer(videoFile, this.streamingServerURL, styleIn, 
				widthIn, heightIn, initialScaleIn, autoPlayIn, loopIn, this.classNameGroup);
		}
	},
	setupEach : function (styleIn, initialScaleIn, autoPlayIn, loopIn)
	{
        var flashObjectGroupList = getElementsByClassName(document.body, "flashObject");
        var flashObjectGroupRef = null;
        var dimensionIn = "";
        var dimensionArray = [];
        var width = 0;
        var height = 0;
        var widthIn = "";
        var heightIn = "";
        var DEFAULT_WIDTH = 320;
        var DEFAULT_HEIGHT = 264;
		for(var i = 0; i < flashObjectGroupList.length; i++)
		{
            flashObjectGroupRef = flashObjectGroupList[i];
            dimensionIn = flashObjectGroupRef.title;
            
            if(dimensionIn === "")
            {
                width = DEFAULT_WIDTH;
                height = DEFAULT_HEIGHT;
            }
            else
            {
                dimensionArray = dimensionIn.split(",");
                if(dimensionArray.length === 2)
                {
                    widthIn = parseInt(dimensionArray[0], 10);
                    heightIn = parseInt(dimensionArray[1], 10);
                    if(isNaN(widthIn) || isNaN(heightIn))
                    {
                        width = DEFAULT_WIDTH;
                        height = DEFAULT_HEIGHT;
                    }
                    else
                    {
                        width = widthIn;
                        height = heightIn;
                        if(width <= 0 || height <= 0)
                        {
                            width = DEFAULT_WIDTH;
                            height = DEFAULT_HEIGHT;
                        }
                    } // end if(isNaN(widthIn) || isNaN(heightIn))
                }
                else
                {
                    width = DEFAULT_WIDTH;
                    height = DEFAULT_HEIGHT;
                } // end if(dimensionArray.length === 2)
            } //end if(dimension === "")
            
            //window.alert("width:" + width + "\nheight:" + height);
		    BLK.EBIZ.FLASHPLAYER.setup(
		        flashObjectGroupRef.id,
			    styleIn, // src
			    width, // width
			    height, // height
			    initialScaleIn, // initialScale
			    autoPlayIn, // autoPlay
			    loopIn); // loop
		} // end for(var i = 0; i < flashObjectGroupList.length; i++)
	},
	installFlashPlayer : 
		function (videoFileIn, serverURLIn, srcIn, widthIn, heightIn, initialScaleIn, autoPlayIn, loopIn, classNameIn)
	{
		// use flashembed to place flowplayer into HTML element 
		// whose id is "example" (below this script tag)
		/*
		var msg = 
			"<ul>" + 
			"<li>className: " + classNameIn + "</li>" + 
			"<li>videoFile: " + videoFileIn + "</li>" +  
			"<li>serverURL: " + serverURLIn + "</li>" +  
			"<li>baseURL: " + baseURLIn + "</li>" +  
			"<li>src: " + srcIn + "</li>" +  
			"<li>width: " + widthIn + "</li>" +  
			"<li>height: " + heightIn + "</li>" +  
			"<li>initialScale: " + initialScaleIn + "</li>" +  
			"<li>autoPlay: " + autoPlayIn + "</li>" +  
			"<li>loop: " + loopIn + "</li>" +
			"</ul>";
		if(this.winObj)
		{
			this.winObj.document.close();
		}
		this.winObj = window.open("", "winName", "width=672,height=384,scrollbars=1,status=1,resizable=1");
		if(this.winObj)
		{
			this.winObj.document.open();
			this.winObj.document.write(msg);
			this.winObj.document.close();
		}
		*/
		
		var splashImageIn = this.splashImageURL + videoFileIn + ".jpg";
		var noVideoClipIn = this.noVideoImageURL;
		
		this.thisFlashembed(videoFileIn, 
			//	first argument supplies standard Flash parameters. See full list:
			//	http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_12701
			{
				//src:'../FlowPlayerDark.swf',
				src : srcIn,
				width : widthIn, 
				height : heightIn,
				allowscriptaccess : "always",
				allowfullscreen : true,
				quality : "high",
				pluginspage : "http://www.adobe.com/go/getflashplayer",
				type : "application/x-shockwave-flash"
			},
			//	second argument is Flowplayer specific configuration. See full list:
			//	http://flowplayer.org/player/configuration.html
			{config: {   
				videoFile : videoFileIn,
				streamingServerURL : serverURLIn,
				initialScale : initialScaleIn,
				autoPlay : autoPlayIn,
				useNativeFullScreen : true,
				loop : loopIn,
				showMenu : false,
				noVideoClip: { url : noVideoClipIn, duration : 10 },
				splashImageFile : splashImageIn,
				autoRewind : true
			}} 
		);
	},
	// flashembed function found in file flashembed.min.js
	thisFlashembed : flashembed
}; // end BLK.EBIZ.FLASHPLAYER = 

// ************************************************************************************************
// end flashVideo.js
// ************************************************************************************************

function initFlashVideo()
{
	if(typeof BLK.EBIZ.FLASHPLAYER.setupAll === "function")
	{
		try
		{
            BLK.EBIZ.trace("initFlashVideo. . .");
		
			BLK.EBIZ.FLASHPLAYER.setupAll(
				BLK.EBIZ.FLASHPLAYER.style.CLASSIC, // style
				320, // width
				264, // height
				BLK.EBIZ.FLASHPLAYER.initialScale.SCALE, // initialScale
				BLK.EBIZ.FLASHPLAYER.autoPlay.FALSE, // autoPlay
				BLK.EBIZ.FLASHPLAYER.loop.FALSE); // loop 

			BLK.EBIZ.FLASHPLAYER.setupEach(
				BLK.EBIZ.FLASHPLAYER.style.CLASSIC, // style
				BLK.EBIZ.FLASHPLAYER.initialScale.SCALE, // initialScale
				BLK.EBIZ.FLASHPLAYER.autoPlay.FALSE, // autoPlay
				BLK.EBIZ.FLASHPLAYER.loop.FALSE); // loop
		}
		catch(ex)
		{
            BLK.EBIZ.trace("initFlashVideo exception-name:" + ex.name + ",message:" + ex.message);
		}
	}
} // end function initFlashVideo()

function initAll()
{
    BLK.EBIZ.trace("initAll. . .");
    initLitListModule();
	initModalDialog();
	tabsInit();
    initFlashVideo();
}

addLoadListener(initAll);

