﻿if (typeof BWUIUtils == "undefined" || !BWUIUtils) {
    /**
     * The BRWIZ global namespace object.  If BRWIZ is already defined, the
     * existing BRWIZ object will not be overwritten so that defined
     * namespaces are preserved.
     * @class BRWIZ
     * @static
     */
    var BWUIUtils = {};
}

BWUIUtils.isIE6 = function() {
        if(navigator.appName == "Microsoft Internet Explorer" && navigator.userAgent.indexOf("MSIE 6.0") != -1) {
            return true;
        } else {
            return false;
        }
    }
    
BWUIUtils.isIE7 = function() {
        if(navigator.appName == "Microsoft Internet Explorer" && navigator.userAgent.indexOf("MSIE 7.0") != -1) {
            return true;
        } else {
            return false;
        }
    }


function insertInputCaps() {
                var inputElements = document.getElementsByTagName("input");

                for(i=0;i<inputElements.length;i++) {
                    //window.alert(beforeMe[i]);
                    if( inputElements[i].getAttribute("type")=="text" || inputElements[i].getAttribute("type")=="password") {
                    var emElement = document.createElement("em");

                    if(BWUIUtils.isIE7() || BWUIUtils.isIE6()) {
                    emElement.setAttribute("className","textInputCapLeft");
                    inputElements[i].setAttribute("className","textInput");
                    } else {
                    emElement.setAttribute("class","textInputCapLeft");
                    inputElements[i].setAttribute("class","textInput");
                    }
                    
                    
                    inputElements[i].parentNode.insertBefore(emElement, inputElements[i]);
                    }
                    
                }
                
            }
//Script for Overflow Scroll

        var scrolling = 0;	// Controls whether the layer is scrolling or not
		var yT = 5;	// Pixel position the top of the scrolling layer should be set to
		var lT = 5;	// Initial position for the top of the layer
		var yI = 10;	// Increment that the scrolling layer should move at
		var yH = 0;	// Hight of scrollling layer
		var object = null;	// Stores the generic DOM for the scrolling layer to access style properties


		function startScroll(objectID,direction) {
			object = document.getElementById(objectID);
			scrolling = 1;
			scroll(direction);
		}

		function scroll(direction) {
			if (scrolling == 1) {
				if(direction == 1)
				{
					yT = yT + yI;
					object.scrollTop = yT;
					if(object.scrollTop < yT)
					{
					  yT = object.scrollTop;
					  scolling = 0;
					}
			  }
				else
				{
					yT -= yI;
					object.scrollTop = yT;
					if(object.scrollTop > yT)
					{
					  yT = object.scrollTop;
					  scolling = 0;
					}
				}
				code2run = 'scroll('+ direction + ')';
				setTimeout(code2run,0);
			}
			return false;
		}

		function stopScroll() {
			scrolling = 0;
			return false;
		}

		function URB(objectID) {
			var object = document.getElementById(objectID);
			yH = 999999;
			object.scrollTop = yH;
		}

		function URT(objectID,frameName) {
			var object = document.getElementById(objectID);
			object.scrollTop = lT;
		}    
