    var MLX_ValidEmailRegExp = /^([a-zA-Z0-9_\.\-\'\=])([a-zA-Z0-9_\.\-\'\=])*\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    var MLX_ValidEmailCharacters = "letters, numbers, .'-_ or = (period, apostrophe, hyphen, underscore or equals sign)"
    function SE_ClickOnEnterKey(e, btn)
    {
        // causes a button press on enter key press
        // process only the Enter key
        if (!e) e = window.event;
        
        if (e.keyCode == 13)
        {
            // ingore the event if the source element is a textarea (where hitting the enter key produces a line break)
            if (!e.srcElement || (e.srcElement && e.srcElement.type != "textarea"))
            {
                // cancel the default submit
                SE_CancelEvent(e)
                // submit the form by programmatically clicking the specified button
                btn.click();
            }
            return false;
        }
    }
    
    function SE_CancelEnterKey(e)
    {
        if (!e) e = window.event;
        
        if (e.keyCode == 13)
            return !SE_CancelEvent(e);
        else
            return false;
    }
  
    function SE_CancelEvent(e)
	{
		if (!e)
			e = window.event;
		if (e)
		{
			if (e.stopPropagation)
				e.stopPropagation();
			
			if (e.preventDefault)
				e.preventDefault();

			e.returnValue = false;
			e.cancelBubble = true;
		}
		return false; 
	}
	
	function SE_JSDelay(count)
	{
		// sort of a DoEvents for Js - it allows the browser or other client threads to catch up
		if (!count)
			count = 1000;
		var msieVersion = SE_MSIEVersion() ;
		if (!msieVersion || parseInt(msieVersion) < 7)
			count = Math.round(count * 1.3);			
		// just loop creating a bigger and bigger text string
		var delayText = "";
		for(var i=0; i<count; i++)
			delayText += "delay";
	}
	
	function SE_SelectDefault(ctl, defaultValue)
	{
        if (ctl && ctl.value != '')
        {
            if(ctl.value == defaultValue
                || ctl.value == '0' 
                || ctl.value == '0.0' 
                || ctl.value == '$0' 
                || ctl.value == '$0.00')
            {
                ctl.select();
            }
        }
    }
	
	function SE_UserAgent(userAgentText)
	{
		var _userAgent = navigator.userAgent.toLowerCase();
		if (userAgentText == "msie")
			return (_userAgent.indexOf(userAgentText) != -1) && (_userAgent.indexOf('opera') == -1) ;
		else
			return _userAgent.indexOf(userAgentText) != -1;
	}
	
	function SE_MSIEVersion()
	{
		if (SE_UserAgent("msie"))
		{
			re = new RegExp(/MSIE (\d)/g)
			found = re.exec(navigator.userAgent);
			if (found.length > 1)
			{
				try
				{
					var ver = parseInt(found[0]);
					if (!isNaN(ver))
						return ver
					else
					{
						ver = parseInt(found[1]);
						if (!isNaN(ver))
							return ver
					}				
				}	
				catch(e){}
			}
		}
		return 0;
	}
	
	function SE_GetCookie(name)
	{
		return SE_GetDocumentCookie(document, name)
	}
	function SE_GetDocumentCookie(doc, name)
	{
		var cookieName = name + "=";
		var objCookie = doc.cookie;
		var cookieStart;
		var cookieEnd;
		if(objCookie.length > 0)
		{
			cookieStart = objCookie.indexOf(cookieName);
			if(cookieStart != -1)
			{
				cookieStart += cookieName.length;
				cookieEnd = objCookie.indexOf(";",cookieStart);
				if(cookieEnd == -1)
				{
					cookieEnd = objCookie.length;
				}
				return unescape(objCookie.substring(cookieStart,cookieEnd));
			}
		}
		return null;
	}
	
	function SE_SetCookie(name, value, expires)
	{
		document.cookie = name + "=" + escape(value) + "; path=/" + 
		((expires == null) ? "" : "; expires=" + expires.toGMTString());
	}
	
	function SE_SupportsCookies()
	{
	    SE_SetCookie('cookieTest', 'passed');
        return SE_GetCookie('cookieTest') == 'passed';
	}
	
	function SE_GetQueryArgs(s)
	{
		//returns name/value objects from a querystring
		var args = new Object()
		if(s.indexOf("?") == -1)
			var query = s;
		else
			var query = s.substring(s.indexOf("?")+1);
		var pairs = query.split("&");
		
		for(var i=0;i<pairs.length;i++)
		{
			var pos = pairs[i].indexOf("=");
			if (pos == -1) continue;
			var argname = pairs[i].substring(0,pos).toLowerCase();
			var value = pairs[i].substring(pos+1);
			args[argname] = unescape(value);
		}
		return args;
	}
	
	function SE_ExtractAttributeFromTag(tag, sText)
	{
	    reTest = new RegExp(tag + '=[\'"]?([^\'" ]*)[\'" ]', 'gi');
	    found = reTest.exec(sText);
		if (found && found.length > 1)
		{
		    return found[1];
	    }
	    return "";
	}
	function SE_StripDollarComma(test)
    {
        var s = "";
         if (test)
         {
            if (typeof(test) == "string")
                s = test;
            else if (typeof(test) == "object")
                s = test.value;
            if (s != "")
            { 
                re = new RegExp('[,\$]', 'gi');
                s = s.replace(re, "");
            }               
         }
         if (test && typeof(test) == "object")
            test.value = s;
         return s;
    }
	function SE_StripNonNumeric(test)
    {
         var s = "";
         if (test)
         {
            if (typeof(test) == "string")
                s = test;
            else if (typeof(test) == "object")
                s = test.value;
            if (s != "")
            { 
                re = new RegExp('[^0-9\.-]', 'gi');
                s = s.replace(re, "");
            }               
         }
         if (test && typeof(test) == "object")
            test.value = s;
         return s;
     }
     function SE_StripNonDigit(test) {
         var s = "";
         if (test) {
             if (typeof (test) == "string")
                 s = test;
             else if (typeof (test) == "object")
                 s = test.value;
             if (s != "") {
                 re = new RegExp('[^0-9]', 'gi');
                 s = s.replace(re, "");
             }
         }
         if (test && typeof (test) == "object")
             test.value = s;
         return s;
     }
	
	function SE_SetDropDown(dropDown, values)
	{
		var v = "[" + values.replace(",","],[") + "]";
		
		for(var i=0; i<dropDown.options.length; i++)
		{
			if(v.indexOf("[" + dropDown[i].value + "]")>-1)
			{
				dropDown[i].selected = true;
			}
		}
	}


	function SE_AppendEvent(origEvent, newMethod)
	{
		// we will actually format the tables in the onload event 			
		if (!origEvent)	
			origEvent = newMethod;
		else 
		{
			re = /function (\w*)/gi
			origname = re.exec(origEvent.toString())
			if (origname[1] && newMethod.toString().indexOf(origname[1]) == -1)
			{	
				var prev_onload = origEvent;
				origEvent = function() { prev_onload(); newMethod();}
			}
		};
		return origEvent;
	}	
	
	function SE_GetHttpText(url, returnHeaderName)
	{
		// synchronous request
		oHttpRequest = SE_GetXmlHttp();
		if (oHttpRequest)
		{
			oHttpRequest.open('GET', url, false);
			oHttpRequest.send(null);
			if (returnHeaderName)
				return oHttpRequest.getResponseHeader(returnHeaderName);
			else
				return oHttpRequest.responseText
		}
		return null;
	}
	
	function SE_LoadXML(txt)
	{
	    try //Internet Explorer
        {
            xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
            xmlDoc.async="false";
            xmlDoc.loadXML(txt);
            return xmlDoc; 
        }
        catch(e)
        {
            parser = new DOMParser();
            xmlDoc = parser.parseFromString(txt,"text/xml");
            return xmlDoc;
        }
    }
	
	function SE_PostHttpText(url, postData, returnHeaderName)
	{
		// synchronous request
		oHttpRequest = SE_GetXmlHttp();
		if (oHttpRequest)
		{
			oHttpRequest.open("POST", url, false);
			oHttpRequest.send(postData);
			
			if (returnHeaderName)
				return oHttpRequest.getResponseHeader(returnHeaderName);
			else
				return oHttpRequest.responseText
		}
		return null;
	}	
	
	function SE_AsyncHttpXml(serverURL, xml, callbackFunction)
	{
		var httpRequest = SE_GetXmlHttp();

		if(httpRequest != null)
		{
			try
			{
				httpRequest.open("POST", serverURL, true);
				httpRequest.setRequestHeader("Content-Type", "text/xml");
				if (callbackFunction)
				{
				    httpRequest.onreadystatechange = function(){
					    SE_WatchState(httpRequest, callbackFunction);
				    };
				}
				httpRequest.send(xml);
				return httpRequest;
			}
			catch(e)
			{
				return null;
			}
		}
		else
			return null;
	}
	
	function SE_AsyncHttp(serverURL, callbackFunction)
	{
		var httpRequest = SE_GetXmlHttp();

		if(httpRequest != null)
		{
			try
			{
				httpRequest.open("GET", serverURL, true);
				if (callbackFunction)
				{
				    httpRequest.onreadystatechange = function(){
					    SE_WatchState(httpRequest, callbackFunction);
				    };
				}
				httpRequest.send(null);
				return httpRequest;
			}
			catch(e)
			{
				return null;
			}
		}
		else
			return null;
	}
	
	function SE_WatchState(Response, callbackFunction)
	{
		if(Response.readyState == 4)
			callbackFunction(Response);
	} 
	
	function SE_GetXmlHttp()
	{
		var httpRequest = null;
	
		if (window.XMLHttpRequest)
			httpRequest = new XMLHttpRequest();
		else if (window.ActiveXObject)
			httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
		
		return httpRequest;
	}
	
	function SE_GetArgs(s)
	{
		//returns name/value objects from a querystring
		var args = new Object()
		if(s.indexOf("?") == -1)
			var query = s;
		else
			var query = s.substring(s.indexOf("?")+1);
		var pairs = query.split("&");

		for(var i=0;i<pairs.length;i++)
		{
			var pos = pairs[i].indexOf("=");
			if (pos == -1) continue;
			var argname = pairs[i].substring(0,pos).toLowerCase();
			var value = pairs[i].substring(pos+1);
			args[argname] = unescape(value);
		}
		args.count = pairs.length;
		return args;
	}
	
	function MLX_HandleCallback()
    {
        var args = SE_GetArgs(location.search);
        
        if (args["callback"] && args["callback"].length > 0)
        {
            var callbackMethod = args["callback"];
            
            if (opener && eval('opener.' + callbackMethod))
                eval('opener.' + callbackMethod + '(document)');
            else if (parent && eval('parent.' + callbackMethod))
                eval('parent.' + callbackMethod + '(document)');
        }
    }
	
	function SE_BuildQueryString(args, skipQ)
	{
		var queryString = "";
		var qm = "?";
		if (skipQ) qm = "";
		for(var arg in args)
		{
			if (arg != "count")
				queryString += (queryString == "" ? qm : "&") + arg + "=" + SE_URLEncode(args[arg]);
		}
		return queryString;
	}
	function SE_BuildQueryStringWithoutDups(oldQsArgs, newQsArgs) {
	    var qsOldArgs = SE_GetArgs(oldQsArgs);
	    var qsNewArgs = SE_GetArgs(newQsArgs);
	    for (var arg in qsNewArgs) {
	        if (!qsOldArgs[arg])
	            qsOldArgs[arg] = qsNewArgs[arg];
	    }
	    return SE_BuildQueryString(qsOldArgs);
	}
	
	function SE_URLEncode(plaintext)
	{
		return encodeURIComponent(plaintext);
	}
	
	function SE_FindChildNode(startNode, id, isLike)
	{
		if (startNode && startNode.childNodes)
		{
			var iCount = startNode.childNodes.length ;
			var childNode = null;
			for(var i=0; i<iCount; i++)
			{	
				thisNode = startNode.childNodes[i];
				if (thisNode.id && (thisNode.id.toUpperCase() == id.toUpperCase()))
					return thisNode;
				else if (isLike && thisNode.id && (thisNode.id.toUpperCase().indexOf(id.toUpperCase()) > -1))
					return thisNode;
				else
				{
					childNode = SE_FindChildNode(thisNode, id, isLike);
					if (childNode != null) 
					    return childNode;
				}
			}		
		} 
		return null;		
	}
	function SE_FindChildNodeByName(startNode, name)
	{
		if (startNode && startNode.childNodes)
		{
			var iCount = startNode.childNodes.length ;
			var childNode = null;
			for(var i=0; i<iCount; i++)
			{	
				thisNode = startNode.childNodes[i];
				if (
				    (
				        thisNode.nodeName && thisNode.nodeName.toUpperCase()  
				        && (thisNode.nodeName.toUpperCase() == name.toUpperCase())
				    )
				    || 
				    (
				        thisNode.name && thisNode.name.toUpperCase()  
				        && (thisNode.name.toUpperCase() == name.toUpperCase())
				    )
				)
					return thisNode;
				else
				{
					childNode = SE_FindChildNodeByName(thisNode, name);
					if (childNode != null) return childNode;
				}
			}		
		}
		return null;		
	}
	
	function SE_FindNextElement(currentNodeID, elementType)
	{
	    var elementNodes = new Array();
	    SE_FindAllNodes(document.documentElement, elementType, elementNodes);
	    var found = false;
	    
	    for (var i=0; i< elementNodes.length; i++)
	    {
	        if (found)
	            return elementNodes[i];
	        if (elementNodes[i].id == currentNodeID)
	            found = true;
	    }
	    
	}
	function SE_FindAllNodes(startNode, elementType, elementNodes, subType)
	{
	    if (startNode && startNode.childNodes)
		{
			var iCount = startNode.childNodes.length ;
			var childNode = null;
			for(var i=0; i<iCount; i++)
			{	
				thisNode = startNode.childNodes[i];
				if (thisNode.tagName 
				    && thisNode.tagName.toLowerCase() == elementType.toLowerCase()
				    && thisNode.style.display.toLowerCase() != "none"
				    && thisNode.type.toLowerCase() != "hidden"
				    && 
				    (
				        (!subType && thisNode.type.toLowerCase() != "radio")
				        || 
				        (subType && subType.toLowerCase() == 'radio' && thisNode.type.toLowerCase() == "radio")
				        || 
				        (subType && subType.toLowerCase() == 'checkbox' && thisNode.type.toLowerCase() == "checkbox")
				     )
				    )
				    elementNodes[elementNodes.length] = thisNode;
				SE_FindAllNodes(thisNode, elementType, elementNodes, subType);
			}
		}
	}
	
	function SE_FindChildNodeByValue(startNode, name, value)
	{
		if (startNode && startNode.childNodes)
		{
			var iCount = startNode.childNodes.length ;
			var childNode = null;
			for(var i=0; i<iCount; i++)
			{	
				thisNode = startNode.childNodes[i];
				if (thisNode.nodeName && thisNode.nodeName.toUpperCase() && (thisNode.nodeName.toUpperCase() == name.toUpperCase()))
				{
				    if (thisNode.value == value)
				        return thisNode;
				}
				else
				{
					childNode = SE_FindChildNodeByValue(thisNode, name, value);
					if (childNode != null) return childNode;
				}
			}		
		}
		return null;		
	}

	function SE_FindChildNodeByClass(startNode, className, fCloseMatch)
	{
		var fExactMatch = !fCloseMatch;
		if (startNode && startNode.childNodes)
		{
			var iCount = startNode.childNodes.length ;
			var childNode = null;
			for(var i=0; i<iCount; i++)
			{	
				thisNode = startNode.childNodes[i];
				if (thisNode.className && thisNode.className.toUpperCase &&
				        (
				            (fExactMatch && thisNode.className.toUpperCase() == className.toUpperCase())
				            || (!fExactMatch && thisNode.className.toUpperCase().indexOf(className.toUpperCase()) > -1)
				        )
				   )
					return thisNode;
				else
				{
					childNode = SE_FindChildNodeByClass(thisNode, className, fCloseMatch);
					if (childNode != null) return childNode;
				}
			}		
		} 
		return null;		
	}
	
	
	function SE_HideChildNode(startNode, id)
	{
	    SE_FindChildNode(startNode,id).style.display='none'
	}	
	function SE_ShowChildNode(startNode, id)
	{
	    SE_FindChildNode(startNode,id).style.display='block'
	}
	
	function MLX_RemoveChildNodes(parent)
	{
        while(parent.hasChildNodes()){
            parent.removeChild(parent.childNodes[0])
        }
    }  
    
    function MLX_FindParentNodeById(selectedElement, parentID)
    {
        var testElement = selectedElement;
        while (testElement)
        {
            if (testElement.id == parentID)
                return testElement;
            else
                testElement = testElement.parentElement;           
        }
        return null;
    }
    
    function MLX_GetBackgroundColor(element)
	{
        while (element)
        {
            if (element.currentStyle && element.currentStyle.backgroundColor != 'transparent')
                return element.currentStyle.backgroundColor;
            else
                element = element.parentElement;
        }
        return "white";
    }  
	
	
    function MLX_GetPreviousSibling(elem)
    {
        // cross browserver version of previsousibling
        var prevElem = elem.previousSibling;
        while (prevElem && prevElem.nodeName == '#text')
        {
            prevElem = prevElem.previousSibling;
        }
        return prevElem;
    }
			
	
	function SE_OpenWin(url, width, height, name, params)
	{
		return SE_OpenWin_base(url, width, height, name, params);	
	}
	
	function SE_OpenWin2(url, width, height, name, params)
	{
		SE_OpenWin_base(url, width, height, name, params)	
	}
	
	function SE_PrintWhenLoaded(delay)
	{
	    if (!delay)
	        delay = 1000;
	    if (document.readyState.indexOf("complete") != -1)
	        window.print();
	    else
	        setTimeout('SE_PrintWhenLoaded(' + delay + ')', delay);
	}
	
	function SE_OpenWin_base(url, width, height, name, params)
	{
		var sh = screen.availHeight;
		var sw = screen.availWidth;
		var options = "";
		if(!width) width = 525;
		if(!height) height = 657;
		if (!name) name = "_blank";
		if (params)
			options = params;
		else
			options =  'dependent=yes,fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,';
		options += 'width=' + width + ',height=' + height + ',top=' + (sh-height)/2 + ',left=' + (sw-width)/2;
		
		var win = window.open(url, name, options);
		if (!win)
			SE_PopupBlocked_Warning();
		else
			win.focus();	
		return win;	
	}
	
	function SE_PopupBlocked_Warning()
	{
		setTimeout("SE_OpenTooltip('A popup blocker prevented the page you requested from opening.')", 1000);
	}
	
	function SE_GetServerUrl()
	{
		return window.location.protocol + "//" + window.location.hostname 
	}
	
	function SE_CurrentFolderURL()
	{
	    return document.location.pathname.substring(0, document.location.pathname.lastIndexOf("/"))
	}
	
	function SE_PrepURL(url)
	{
		return url + (url.indexOf("?") > 0 ? "&" : "?") ;
	}
	
	function SE_WriteItemNum()
    {
        if (!document.itemNum || document.itemNum == "")
            document.itemNum = 1;
        document.write(document.itemNum);
        document.itemNum++;
    }
    
    function MLX_SetBodyHeightToContentHeight() 
    {
        document.body.style.height = 
            Math.max(document.documentElement.scrollHeight, document.body.scrollHeight) + "px";
    }
    
    function MLX_SetBodyWidthToContentWidth() 
    {
        var onlyChildIndex = -1;
        if (document.body && document.body.childNodes)
        {
            for(var i=0; i<document.body.childNodes.length; i++)
            {
                if (document.body.childNodes[i].tagName != "SCRIPT")
                {
                    if (onlyChildIndex == -1)
                        onlyChildIndex = i;
                    else
                    {
                        onlyChildIndex = -1;
                        break;
                    }
                }   
            }         
        }    
        if (onlyChildIndex != -1)
            document.body.style.width = 
                document.body.childNodes[onlyChildIndex].scrollWidth + "px";

        else
            document.body.style.width = 
                Math.max(document.documentElement.scrollWidth, document.body.scrollWidth) + "px";
    }
     
     function MLX_GetContentHeight(doc) 
     {
        if (!doc.body && doc.documentElement && doc.documentElement.scrollHeight)
            return doc.documentElement.scrollHeight;
        else if(doc.body.scrollHeight)
            return doc.body.scrollHeight;
        else
            return doc.documentElement.scrollHeight;
     }
    
    function SE_ResizeToFitBodyContent()
    {
        MLX_SetBodyHeightToContentHeight() ;
        MLX_SetBodyWidthToContentWidth() ;
        SE_ResizeToFitContent();
    }
    
    
    function SE_ResizeToFitContent(noRestriction)
    {
        if (document && document.body && document.body.offsetWidth)
        {
            var xHeight = Math.min(document.body.scrollHeight, .8 * screen.availHeight) - Math.max(MLX_GetClientHeight(), document.documentElement ? document.documentElement.offsetHeight : 0);
            var xWidth = Math.min(document.body.scrollWidth, .8 * screen.availWidth) - Math.max(MLX_GetClientWidth(), document.documentElement ? document.documentElement.offsetWidth : 0);
            if (noRestriction)
            {
                xHeight = document.body.scrollHeight - MLX_GetClientHeight();
                xWidth = document.body.scrollWidth - MLX_GetClientWidth();
            }
            window.resizeBy( xWidth,  xHeight);
            if (noRestriction)
            {
                xHeight = document.body.scrollHeight - MLX_GetClientHeight();
                xWidth = document.body.scrollWidth - MLX_GetClientWidth();
            }
            else
            {
                xHeight = Math.min(document.body.scrollHeight, .8 * screen.availHeight) - MLX_GetClientHeight();
                xWidth = Math.min(document.body.scrollWidth, .8 * screen.availWidth) - MLX_GetClientWidth();
            }
            window.resizeBy( xWidth,  xHeight);

        }
    }
    
    function MLX_ResizeImageElementToFit(originalImage, resizedImage, maxWidth, maxHeight)
    {
        if(originalImage.offsetWidth > maxWidth || originalImage.offsetHeight > maxHeight)
        {
            var ratioX = originalImage.offsetWidth/maxWidth;
            var ratioY = originalImage.offsetHeight/maxHeight;
            var ratio = ratioY > ratioX ? 1/ratioY : 1 / ratioX;
            resizedImage.width = parseInt(ratio * originalImage.offsetWidth);
            resizedImage.height = parseInt(ratio * originalImage.offsetHeight);
        }
        return resizedImage;
    }

	function SE_CenterElement(myElement)
	{
		if (myElement)
		{
			myElement.style.display = "";
			myElement.style.position = "absolute";
			myElement.style.left = MLX_GetClientWidth()/2 - myElement.offsetWidth/2 + MLX_GetScrollLeft();
			myElement.style.top = MLX_GetClientHeight()/2 - myElement.offsetHeight/2 + MLX_GetScrollTop();
		}
	}
	function SE_CenterElementOnElement(myElement, targetElement)
	{
		if (myElement && targetElement)
		{
			myElement.style.position = "absolute";
			myElement.style.left = SE_GetObjectLeft(targetElement) + targetElement.offsetWidth/2 - myElement.offsetWidth/2;
			myElement.style.top = SE_GetObjectTop(targetElement) + targetElement.offsetHeight/2 - myElement.offsetHeight/2;
		}
	}
	
	
	function MLX_IsClickInDiv(e, div)
	{
		if (!e) e = window.event;
		if (e && e.clientX)
	    {
		    var mousex = e.clientX + MLX_GetScrollLeft() ;
			var mousey = e.clientY + MLX_GetScrollTop() ;
    		return MLX_IsInDiv(mousex, mousey, div)
         }
	}
	function MLX_IsInDiv(x, y, div)
	{
		if (div)
	    {
		    var divLeft = SE_GetObjectLeft(div);
		    var divTop = SE_GetObjectTop(div);
		    
		    return (
			    (x < divLeft + div.offsetWidth)
			    && (x > divLeft)
			    && (y < divTop + div.offsetHeight)
			    && (y > divTop)
		    )	;
	    }
	    else
		    return true;
	}
	
	function MLX_SlideToFitOnScreen(divPopup, margin)
	{
		if (divPopup)
		{
			var _left = SE_GetObjectLeft(divPopup);
			var _clientHeight = MLX_GetClientHeight();
			if (!margin)
			    margin = 10;
			    
			var clientWidth = MLX_GetClientWidth();
			var rightOverlap = _left + divPopup.offsetWidth - MLX_GetScrollLeft() - clientWidth;
		    var leftExtraSpace = MLX_GetClientWidth() - divPopup.offsetWidth ;
		
		    if (rightOverlap > - margin )
		    {
			    // not enough room on right - is there room on the left?
			    if (leftExtraSpace > 0)
				    divPopup.style.left = Math.max(_left - rightOverlap - margin, 0);
			    else
			        divPopup.style.left = Math.max(MLX_GetScrollLeft() + margin, 0);
			}
			
			var _parentTop = SE_GetObjectTop(window.frameElement) - MLX_GetParentScrollTop();
			var _top = SE_GetObjectTop(divPopup) ;
			
			var clientHeight = MLX_GetClientHeight();
			var parentClientHeight = MLX_GetParentClientHeight();
			    
			if (clientHeight > parentClientHeight)
			   clientHeight = parentClientHeight;
			   
			var bottomOverlap = _top +  divPopup.offsetHeight + _parentTop - MLX_GetScrollTop() - clientHeight;
          
            var topExtraSpace = MLX_GetClientHeight() - divPopup.offsetHeight ;
			
		    if (bottomOverlap > - margin )
		    {
			    // not enough room on right - is there room on the left?
			    if (topExtraSpace > 0)
			    {
				    if (_top - bottomOverlap - margin > 0)
				        divPopup.style.top = _top - bottomOverlap - margin, 0;
				    else
				    {
				        var needToScroll = (_top - bottomOverlap - margin);
				        divPopup.style.top = "0px";
				        parent.scrollBy(0, -needToScroll);
				    }
				}
			    else
			        divPopup.style.top = Math.max(MLX_GetScrollTop()) ;
			}				
		 }
	}	
	
	var SE_PopupCenterOn = null;
	var SE_PopupTimeout = null;
	var SE_TooltipStart
	function SE_OpenTooltip(msg, divTip, centerOnElement, parentElement, startAfter, closeAfter)
	{
		if (centerOnElement)
		    SE_PopupCenterOn = centerOnElement;
		else
		    centerOnElement = SE_PopupCenterOn;		    
		if (parentElement)
	    {
	         parentElement.onmouseout=SE_CloseTooltip;
             parentElement.onmousedown=SE_CloseTooltip;
             parentElement.onkeydown=SE_CloseTooltip;
	    }
		if (startAfter)
		{
		    SE_PopupTimeout = setTimeout("SE_OpenTooltip('" + msg + "', null, null, null, null," + (closeAfter ? closeAfter : "null") + ")", startAfter);
		    return;
		}
		if (!divTip)
		    divTip = document.getElementById('divMessage');
		
		if (!divTip)
		{
			
			divTip = document.createElement("div");
			if (centerOnElement && centerOnElement.parentElement) 
			    centerOnElement.parentElement.appendChild(divTip);
			else if (document.body)
			    document.body.appendChild(divTip);
		    divTip.id = "divMessage";
		}
		
		
		divTip.style.position = "absolute";
		divTip.style.backgroundColor = "#FFFFCC";			
		divTip.style.filter = "alpha(opacity=90)";
		divTip.style.opacity = ".90";
		divTip.style.mozopacity = ".95";
		divTip.style.zIndex = "99999";
		divTip.style.border = "1px #444444 solid";
		divTip.style.padding = "2px";
		divTip.style.padding = "10px";
		divTip.style.whitespace = "nowrap";
		if (msg && msg != "")
		    divTip.innerHTML = msg;
		divTip.style.width = "170px";
		divTip.style.display = "block";
		if (centerOnElement)
		    SE_CenterElementOnElement(divTip, centerOnElement)
		else
		    SE_CenterElement(divTip);
		if (closeAfter)
		    setTimeout("SE_CloseTooltip()", closeAfter);
		SE_TooltipStart = new Date();
		return divTip;
	}
	
	function SE_CloseTooltip(divTip)
	{  
	    var now = new Date();
	    if (SE_TooltipStart && now.getTime() > (SE_TooltipStart.getTime() + 1000))
	    {
	        if (!divTip)
	            divTip = document.getElementById('divMessage')
	        if (divTip && divTip.parentElement)
	        {    
	            divTip.parentElement.onmouseout=null;
                divTip.parentElement.onmousedown=null;
                divTip.parentElement.onkeydown=null;
	            divTip.parentElement.removeChild(divTip);
	        }  
	        SE_PopupCenterOn = null;
	        if (SE_PopupTimeout)
	            clearTimeout(SE_PopupTimeout);
	        SE_PopupTimeout = null;
	    }
	}
	
	function SE_OpenBubbleTooltip(msg, nearElement, thisID, myHeight)
	{
		var isDontShow = SE_GetCookie(thisID);
		if (!isDontShow || isDontShow == "")
		{		
		    if (!myHeight)
		        myHeight = "118"
    		
		    var ttDiv = document.createElement("DIV")
		    ttDiv.id = thisID;
		    ttDiv.style.position = "absolute";
		    ttDiv.style.left = SE_GetObjectLeft(nearElement) + "px";
		    ttDiv.style.top = (SE_GetObjectTop(nearElement) - 30) + "px";
		    ttDiv.style.zIndex = 9999;
		    document.body.appendChild(ttDiv);
    		
            var imgLeft = new Image();
            imgLeft.src = "/image/tour/shortbubbleleft_leftflag.gif";
            imgLeft.style.width = "29px";
            imgLeft.style.height = myHeight + "px";
            imgLeft.style.position = "relative";
            ttDiv.appendChild(imgLeft);
            
            var content = document.createElement("span");
            content.style.borderTop = "black 1px solid";
            content.style.borderBottom = "black 1px solid";
            content.style.borderLeft = "none";
            content.style.borderRight = "none";
            content.className = "tooltip";
            content.innerHTML = msg;
            content.style.height = myHeight + "px";
            content.style.position = "relative";
            content.style.top = "-2px";
            content.style.padding = "15px";
            ttDiv.appendChild(content);
            
            var imgRight = new Image();
            imgRight.src = "/image/tour/shortbubbleright.gif";
            imgRight.style.width = "22px"; 
            imgRight.style.height = myHeight;
            imgRight.style.position = "relative";
            
            ttDiv.appendChild(imgRight);
            
            var closeFunction = "SE_CloseBubbleTooltip('" + ttDiv.id + "')";
            var ttDontShow = document.createElement("DIV");
            ttDontShow.style.left = "0px";
            ttDontShow.style.bottom = "10px"
            ttDontShow.style.position = "absolute";
            ttDontShow.innerHTML = "<input type=checkbox id=donotshow onclick=" + closeFunction + ">Do not show this again";
		    content.appendChild(ttDontShow);
            
            var ttDivClose = document.createElement("DIV");
            ttDivClose.style.bottom = "10px";
            ttDivClose.style.right = "20px"
            ttDivClose.style.position = "absolute";
            ttDivClose.innerHTML = "<a href=javascript:" + closeFunction + ">close</a>";
		    content.appendChild(ttDivClose);
		}
	}
	
	function SE_OpenBubbleTooltipBottom(msg, nearElement, thisID, myWidth)
	{
		var isDontShow = SE_GetCookie(thisID);
		if (!isDontShow || isDontShow == "")
		{		
		    if (!myWidth)
		        myWidth = "300"
    		
		    var ttDiv = document.createElement("DIV")
		    ttDiv.id = thisID;
		    ttDiv.style.position = "absolute";
		    ttDiv.style.zIndex = 9999;
		    document.body.appendChild(ttDiv);
    		
            var imgTop = new Image();
            imgTop.src = "/image/tour/widebubbletop.gif";
            imgTop.style.height = "22px";
            imgTop.style.width = myWidth + "px";
            imgTop.style.position = "relative";
            ttDiv.appendChild(imgTop);
            
            var content = document.createElement("div");
            content.style.borderLeft = "black 1px solid";
            content.style.borderRight = "black 1px solid";
            content.style.borderTop = "none";
            content.style.borderBottom = "none";
            content.className = "tooltip";
            content.innerHTML = msg;
            content.style.width = myWidth + "px";
            content.style.position = "relative";
            content.style.paddingLeft = "15px";
            content.style.paddingRight = "15px";
            content.style.paddingBottom = "30px";
            ttDiv.appendChild(content);
            
            var imgBottom= new Image();
            imgBottom.src = "/image/tour/widebubblebottomflag.gif";
            imgBottom.style.width = myWidth + "px"; 
            imgBottom.style.position = "relative";
            
            ttDiv.appendChild(imgBottom);
            
            var closeFunction = "SE_CloseBubbleTooltip('" + ttDiv.id + "')";
            var ttDontShow = document.createElement("DIV");
            ttDontShow.style.left = "10px";
            ttDontShow.style.bottom = "0px"
            ttDontShow.style.position = "absolute";
            ttDontShow.innerHTML = "<input type=checkbox id=donotshow onclick=" + closeFunction + ">Do not show this again";
		    ttDontShow.style.zIndex = 9999;
		    content.appendChild(ttDontShow);
            
            var ttDivClose = document.createElement("DIV");
            ttDivClose.style.bottom = "0px";
            ttDivClose.style.right = "20px"
            ttDivClose.style.position = "absolute";
            ttDivClose.innerHTML = "<a href=javascript:" + closeFunction + ">close</a>";
		    ttDivClose.style.zIndex = 9999;
		    content.appendChild(ttDivClose);
		    
		    ttDiv.style.left = (SE_GetObjectLeft(nearElement) + nearElement.offsetWidth - 70)/2 + "px";
		    ttDiv.style.top = (SE_GetObjectTop(nearElement) - ttDiv.offsetHeight) + "px";
		    
		}
	}
	
	function SE_CloseBubbleTooltip(thisID)
	{
	    var node = document.getElementById(thisID);
	    if (node)
	    {
	        var dontShow  = SE_FindChildNode(node,"donotshow");
    	    
	        if (dontShow)
	        {	  
		        if(dontShow.checked)
		        {
	                var expireTime = new Date();
	                expireTime.setTime(expireTime.getTime() + (1000 * 60 * 60 * 24 * 365));
	                setCookie(thisID,'DoNotShow', expireTime); 
	            }
	            else
	                setCookie(thisID,'DoNotShow');
	        }	    
	        node.parentElement.removeChild(node);
	    }
	}
	
	function MLX_IsVisible(obj)
	{    
	    if (obj == document) 
	        return true  ;   
	    if (!obj) 
	        return false;    
	    if (!obj.parentNode) 
	        return false;    
	    if (obj.style) 
	    {        
	        if (obj.style.display == 'none') 
	            return false;
	        if (obj.style.visibility == 'hidden') 
	            return false;
	     }     
	     //Try the computed style in a standard way    
	     if (window.getComputedStyle) 
	     {
	         var style = window.getComputedStyle(obj, "");
	         if (style.display == 'none') 
	            return false;
	         if (style.visibility == 'hidden') 
	            return false;
	     }     
	     //Or get the computed style using IE's silly proprietary way    
	     var style = obj.currentStyle;    
	     if (style) 
	     {        
	        if (style['display'] == 'none') 
	            return false;        
	        if (style['visibility'] == 'hidden') 
	            return false;
	      }     
	      return MLX_IsVisible(obj.parentNode);
	}
	
	function SE_SetFieldFocus(fieldID, goNow)
	{       
	    var focusField = document.getElementById(fieldID);
        if (focusField && focusField.focus)
        {
            if (goNow)
            {
                try {focusField.focus();}
                catch (e){}
            }
            else
	            setTimeout("SE_SetFieldFocus('" + fieldID + "', true)", 100); 
	    }  
	}
	
	
	function SE_SetSelectionRange(input, selectionStart, selectionEnd) 
	{
		if (input.setSelectionRange) 
		{
			input.focus();
			input.setSelectionRange(selectionStart, selectionEnd);
		}
		else if (input.createTextRange && input.type.toLowerCase() == 'text') 
		{
			var range = input.createTextRange();
			range.collapse(true);
			range.moveEnd('character', selectionEnd);
			range.moveStart('character', selectionStart);
			range.select();
		}
		else if (input.createRange ) 
		{
			var range = input.createRange();
			range.collapse(true);
			range.moveEnd('character', selectionEnd);
			range.moveStart('character', selectionStart);
			range.select();
		}
	}
	
	function SE_SetRepeaterRadioButton(nameregex, current)
    {
       var re = new RegExp(nameregex, "gi");
       for(i = 0; i < document.forms[0].elements.length; i++)
       {
          var elm = document.forms[0].elements[i]
          if (elm.type.toLowerCase() == 'radio')
          {
             if (elm.id.match(re))
                elm.checked = false;    
          }
       }
       current.checked = true;
    }


	
	function SE_SetCaretToEnd (input) 
	{
		SE_SetSelectionRange(input, input.value.length, input.value.length);
	}
	function SE_SetCaretToBegin (input) 
	{
		SE_SetSelectionRange(input, 0, 0);
	}
	function SE_SetCaretToPosition (input, start) 
	{
		SE_SetSelectionRange(input, start, 0);
	}
	
	function SE_GetCaretPosition(element)
	{
	    // believe it or not, this hack is the best way I could find to do this
	    if (element.selection.type != "Control")
	    {
	        var range = element.selection.createRange().duplicate();
	        range.collapse();
	        // we start with cursor at the beginning of the range 
	        // the move the start way to the left (it will stop at the beginning)
	        range.moveStart('character', -1000000);
	        // so the remaining text is the text before the start of the range
	        return range.text.length;
	    }
	    else
	        return -1;
	}
	
	function SE_CopyToClipBoard(elemId) 
    {
        var elem = document.getElementById(elemId);
        if (elem)
        {
            var holdText = document.createElement("TEXTAREA");
            holdText.innerText = elem.innerText;
            Copied = holdText.createTextRange();
            Copied.execCommand("Copy");
        }
    }

	
	
	function SE_GetSelectedValue(obj)
	{
		if (obj && obj.selectedIndex != -1)
		    return obj.options[obj.selectedIndex].value;
	    else
	        return "";
	}
	function SE_GetSelectedText(obj)
	{
		if (obj && obj.selectedIndex != -1)
		    return obj.options[obj.selectedIndex].text;
		else
		    return "";
	}
	function SE_SetSelectedValue(obj, selectedValue)
	{
		var fNotSelected = true;
		for (i=0; i< obj.options.length; i++)
		{
			obj.options[i].selected = false
		}
		for (i=0; i< obj.options.length; i++)
		{
			if (obj.options[i].value == selectedValue)
			{
				obj.options[i].selected = true;
				fNotSelected = false
				break;
			}
		}
		if (fNotSelected)
		{
		    obj.selectedIndex =-1
		    return "";
		}
		else
		    return obj.options[obj.selectedIndex].value;
	}
	
	function SE_GetSelectedValues(obj)
	{
	    
	    if (obj.options && (obj.options.length > 1)  || (obj.options[0] && obj.options[0].value != ""))
	    {
	        var ret = new Array();
	        for (var i=0; i< obj.options.length; i++)
	        {
	            if (obj.options[i].selected)
	                ret[ret.length] = obj.options[i].value;
	        }
	        return ret;
	    }
	}
	
	/*
	If you have multiple functions being called with a delay on a page, then do not use MLX_SetTimeout.  Instead create as many
	MLX_TimeoutManager instances as you need.  If you do use MLX_SetTimeout, it should really only be called once for a given 
	page's scope since the function relies on global variables.
	*/
	var _MLX_TimeoutRetried = 0;
	var _MLX_MaxTimeoutTries = 10;
	function MLX_SetTimeout(functionName, delay, isNotFirst)
	{
	   // replacement for setTimeout that waits for the function to exist before trying to run it
	   functionName = functionName.replace("()", "");
	   if (isNotFirst)
	        _MLX_TimeoutRetried++
	   else
	        _MLX_TimeoutRetried = 0;
	   
	   if (MLX_TraceInstanceExists())
	   {
	       _MLX_TraceInstance.addFunc("MLX_SetTimeout");
	       _MLX_TraceInstance.addArg("functionName", functionName);
	       _MLX_TraceInstance.addArg("isNotFirst", isNotFirst);
	       _MLX_TraceInstance.addInfo("_MLX_TimeoutRetried = " + _MLX_TimeoutRetried);
	   }
	   
	   if (_MLX_TimeoutRetried > _MLX_MaxTimeoutTries)
	        return;
	        
	   var func = null;
	   try {func = eval(functionName)}
	   catch(e){}
	   
	   if (typeof(func) == 'function' || (functionName.indexOf(".") != -1 && typeof(func) == 'object'))
	        setTimeout( functionName + '()', delay)
	   else
	        setTimeout("MLX_SetTimeout('" + functionName + "'," + delay + ", true)", delay);
	}
	
	// this method differs from MLX_SetTimeout in that it waits for a function to be ready
	// and then when it is it calls a different one (functionToCall).
	function MLX_WaitForFunction(functionName, delay, functionToCall, count)
	{
	   var MAX_COUNT = 60;
	   
	   functionName = functionName.replace("()", "");
	   functionToCall = functionToCall.replace("()", "");
	   
	   if(!count)
	     count = 0;
	     
	   count++;
	   
	   if (count > MAX_COUNT)
	     return;
	        
	   var func = null;
	   try {func = eval(functionName)}
	   catch(e){}
	   
	   if (typeof(func) == 'function' || (functionName.indexOf(".") != -1 && typeof(func) == 'object'))
	        setTimeout( functionToCall + '()', delay)
	   else
	   {	        
	        var method = "MLX_WaitForFunction('@functionName', @delay, '@functionToCall', @count)";
	        
	        method = method.replace("@functionName", functionName);
	        method = method.replace("@delay", delay);
	        method = method.replace("@functionToCall", functionToCall);
	        method = method.replace("@count", count);
	        
	        setTimeout(method, delay);
	   }
	}
	
    function MLX_TimeoutManager(myID, functionName)
    {
        //public fields
        this.id = myID;
        this.functionName = functionName;
        this.timeoutRetried = 0;
        this.maxTimeoutTries = 20;                
        this.requiredElements = new Array();    //Will test for the existence of these elements before calling the function
        
        //public functions
        this.setTimeout = function(delay, isNotFirst)
        {
            this.functionName = this.functionName.replace("()", "");
            if (isNotFirst)
                this.timeoutRetried++
            else
                this.timeoutRetried = 0;
	   
            if (this.timeoutRetried > this.maxTimeoutTries)
                return;
	   
	        //Trace info
            if (MLX_TraceInstanceExists())
            {
                _MLX_TraceInstance.addFunc(this.id + ".setTimeout");
                _MLX_TraceInstance.addArg("isNotFirst", isNotFirst);
                _MLX_TraceInstance.addInfo("timeoutRetried = " + this.timeoutRetried);
            }
	               
            delay += (this.timeoutRetried) * 100;
            if (this.isReady())
            {
                setTimeout(this.functionName + '()', delay)
            }
            else
                setTimeout(this.id + ".setTimeout(" + delay + ", true)", delay);
        }
        
        this.isReady = function()
        {
            //debugger;
            var func = null, el = null;
            try {func = eval(this.functionName)}
            catch(e){}
	   
            if (func
                &&
                (
                    typeof(func) == 'function' 
                    || 
                    (this.functionName.indexOf(".") != -1 && typeof(func) == 'object')
                ))
            {
                // Check if the required elements exist also
                for (var i = 0; i < this.requiredElements.length; i++)
                {
                    try {el = eval(this.requiredElements[i])}
                    catch(e){}
                    
                    if (typeof(el) == 'undefined' || !el)
                        return false;
                }
                
                //Trace info
                if (MLX_TraceInstanceExists())
                {
                    _MLX_TraceInstance.addFunc(this.id + ".setTimeout");
                    _MLX_TraceInstance.addInfo("<i>" + this.functionName + "</i> is ready");
                    _MLX_TraceInstance.addInfo("typeof(func) = " + typeof(func));
                }
                
                return true;
            }
            
            return false;
        }
    }
	
	function MLX_Trace()
	{
	    this.text = "";
	    this.addFunc = function(val){this.text += "<br/><span style=\"font-weight:bold;color:red;\">" + val + "</span><br/>";}
	    this.addArg = function(name, val){this.text += "<span style=\"color:red;padding-left:2em\">arg: " + name + " = " + val + "</span><br/>";}
	    this.addInfo = function(val){this.text += "<span style=\"padding-left:4em\">" + val + "</span><br/>";}
	}
	
	// The global object _MLX_TraceInstance SHOULD be instantiated by the containing page to avoid possible re-instantiations that
	// could occur from an included script.
	function MLX_TraceInstanceExists()
	{
	    return typeof(_MLX_TraceInstance) == "object";
	}
	
	function SE_GetOpenerDoc(myOpener)
	{
		var docOpener = null;
		try
		{
			if (myOpener)
				docOpener = myOpener.document;
			else
				docOpener = window.opener.document;
		}
		catch(e)
		{}
		return docOpener;
	}
	
    function SE_IsArray(obj) 
    {
       try
       {
            return (obj.constructor.toString().indexOf("Array") != -1);
       }
       catch(e)
       {
            return false;
       }
    }
    function SE_GetObjectTop(refobj) 
	{
		var y = 0;
		if (refobj)
		{
			if (refobj.offsetTop)
				y = refobj.offsetTop;
			var obj = refobj.offsetParent;
			while (obj != null) {
				y += obj.offsetTop;
				obj = obj.offsetParent;
			}
		}
		return y;
	}
	
	function SE_GetObjectLeft(refobj) 
	{
		var x = 0;
		if (refobj)
		{		
			if (refobj.offsetLeft)
				x = refobj.offsetLeft;
		    var obj = refobj.offsetParent;
		    while (obj != null) 
		    {
			    x += obj.offsetLeft;
			    obj = obj.offsetParent;
		    }
		}
		return x;
	}
       
   // the following browser independent functions for getting dimensions are from 
   // http://www.softcomplex.com/docs/get_window_size_and_scrollbar_position.html
   function MLX_GetClientWidth() 
   {
        return MLX_ChooseBestValue (
	        window.innerWidth ? window.innerWidth : 0,
	        document.documentElement ? document.documentElement.clientWidth : 0,
	        document.body ? document.body.clientWidth : 0
        );
    }
    function MLX_GetClientHeight() 
    {
        return MLX_ChooseBestValue (
		    window.innerHeight ? window.innerHeight : 0,
		    document.documentElement ? document.documentElement.clientHeight : 0,
		    document.body ? document.body.clientHeight : 0
	    );
    }
    function MLX_GetParentClientHeight() 
    {
        return MLX_ChooseBestValue (
		    parent.window.innerHeight ? parent.window.innerHeight : 0,
		    parent.window.document.documentElement ? parent.window.document.documentElement.clientHeight : 0,
		    parent.window.document.body ? parent.window.document.body.clientHeight : 0
	    );
    }
    function MLX_GetScrollLeft() 
    {
	    return MLX_ChooseBestValue (
		    window.pageXOffset ? window.pageXOffset : 0,
		    document.documentElement ? document.documentElement.scrollLeft : 0,
		    document.body ? document.body.scrollLeft : 0
	    );
    }
    function MLX_GetScrollTop() 
    {
	    return MLX_ChooseBestValue (
		    window.pageYOffset ? window.pageYOffset : 0,
		    document.documentElement ? document.documentElement.scrollTop : 0,
		    document.body ? document.body.scrollTop : 0
	    );
    }
    
    function MLX_SetScrollTop(scrollTop) 
    {
	    if(typeof(window.pageYOffset) != 'undefined')
	        window.pageYOffset = scrollTop;
	    else if (document.documentElement && typeof(document.documentElement.scrollTop) != 'undefined')
		    document.documentElement.scrollTop = scrollTop;
		else if(document.body && typeof(document.body.scrollTop) != 'undefined')
	        document.body.scrollTop = scrollTop
    }
    
    function MLX_GetParentScrollTop() 
    {
	    if (parent)
	    {
	        return MLX_ChooseBestValue (
		        parent.window.pageYOffset ? parent.window.pageYOffset : 0,
		        parent.window.document.documentElement ? parent.window.document.documentElement.scrollTop : 0,
		        parent.window.document.body ? parent.window.document.body.scrollTop : 0
	        );
	    }
	    else
	        return 0;
	}

	function MLX_GetScrollBarWidth() {
	    var div = $('<div style="width:50px;height:50px;overflow:hidden;position:absolute;top:-200px;left:-200px;"><div style="height:100px;"></div>');
	    // Append our div, do our calculation and then remove it 
	    $('body').append(div);
	    var w1 = $('div', div).innerWidth();
	    div.css('overflow-y', 'scroll');
	    var w2 = $('div', div).innerWidth();
	    $(div).remove();
	    return (w1 - w2);
	}
    
    function MLX_ChooseBestValue(fromWindow, fromDocumentElement, fromBody) 
    {
	    // goes through values from the
	    // window, document, and body objects 
	    // and returns the smallest non-zero value or zero
	    var result = fromWindow ? fromWindow : 0;
	    if (fromDocumentElement && (!result || (result > fromDocumentElement)))
		    result = fromDocumentElement;
	    return fromBody && (!result || (result > fromBody)) ? fromBody : result;
    }
    
    function MLX_ConvertToBool(input)
    {
        switch (typeof(input))
        {
            case "boolean":
                return input;
            case "string":
                if (input == "yes" || input == "y" || input == "true" || input == "1")
                    return true;
                else
                    return false;
            case "undefined":
                return false;
        }
    }

   
    function MLX_Timer(name)
    {
        this.name = name;
        this.timeoutID = 0;
        this.startTime  = null;
        this.timeDiff = MLX_TimerDiff;
        this.start = MLX_TimerStart;
        this.stop = MLX_TimerStop;
        this.reset = MLX_TimerReset;
    }

    function MLX_TimerDiff() 
    {
       if(this.timeoutID) {
          clearTimeout(this.timeoutID);
          this.timeoutID  = 0;
       }

       if(!this.startTime)
          this.startTime   = new Date();
       var tDate = new Date();
       var tDiff = tDate.getTime() - this.startTime.getTime();

       return tDate.setTime(tDiff);

    }

    function MLX_TimerStart() {
       this.startTime   = new Date();
    }

    function MLX_TimerStop() {
       if(this.timeoutID) 
       {
          clearTimeout(this.timeoutID);
          this.timeoutID  = 0;
       }
       this.startTime = null;
    }

    function MLX_TimerReset() 
    {
       this.startTime = null;
    }
    
    // more of a "drowsy" than sleep.
    // this keeps the js at the same line but delays until a method or object exists
    // or until a predetermined number of attempts 
    // at which point the code will continue and presumably throw an error
    // use this method only when necessary as it involved multiple server calls
    function MLX_SleepUntil(objectName, delayBetweenTries, maxTries)
    {
        
        for (var i=0; i<maxTries; i++)
        {
            try {testObject = eval(objectName);}
            catch(e){}
            if (typeof(testObject) == 'undefined'  || testObject == null)
                SE_GetHttpText('/Common/Utilities/sleep.aspx?delay=' + delayBetweenTries);
            else
                break;
        }
    }
    
    function MLX_IsDebug(debugTerm)
    {
     
        var args = SE_GetArgs(window.location.search)        
        if (!args["debug"] && top)
           args = SE_GetArgs(top.location.search)
           
	    if (args["debug"] && debugTerm )
	        return args["debug"] == debugTerm;
	    else if (args["debug"])
            return true;
        else
            return false;
    }
    
    function MLX_Debug_Alert(msg, debugTerm)
    {
        if (MLX_IsDebug(debugTerm))
            alert(msg)
    }
    
    function MLX_Debug_Eval(functionCall, debugTerm)
    {
         if (MLX_IsDebug(debugTerm))
        {
    	    eval(functionCall);
        }
    }

    function MLX_Debug_ShowCallStack() {
        var f = MLX_Debug_ShowCallStack;
        var result = "Call stack:\n";
var i=0
while ((f = f.caller) !== null && i< 20) {
    i++;
    
            var sFunctionName = f.toString().match(/^function (\w+)\(/)
            sFunctionName = (sFunctionName) ? sFunctionName[1] : 'anonymous function';
            result += sFunctionName;
            result += MLX_Debug_GetArguments(f.toString().substring(0,20), f.arguments);
            result += "\n";

        }
        alert(result);
    }

    function MLX_Debug_GetArguments(sFunction, a) {
        var i = sFunction.indexOf(' ');
        var ii = sFunction.indexOf('(');
        var iii = sFunction.indexOf(')');
        var aArgs = sFunction.substr(ii + 1, iii - ii - 1).split(',')
        var sArgs = '';
        for (var i = 0; i < a.length; i++) {
            var q = ('string' == typeof a[i]) ? '"' : '';
            sArgs += ((i > 0) ? ', ' : '') + (typeof a[i]) + ' ' + aArgs[i] + ':' + q + a[i] + q + '';
        }
        return '(' + sArgs + ')';
    } 

    
    function MLX_GetIDRoot(fullID, lastIDPart)
    {
        var idx = fullID.indexOf(lastIDPart);
        if (idx > 0)    //idx=0 indicates the fullID and lastIDPart are the same, so there is no root
        {
            return fullID.substring(0, idx);
        }
        else
            return "";
    }
    
    function MLX_Util_ValidateURLLocation(urlToTest, callbackFunction)
    {
        var testerURL = "/Common/Utilities/CheckURL.aspx?url=" + encodeURIComponent(urlToTest);
        return SE_AsyncHttp(testerURL, callbackFunction);
    }
    
    //
    // This is a generic version of SE_Post_ToURL from Common\Utilities\checkboxhandler.js
    //
    function MLX_Post_ToURL(formId, url, inputNames, inputValues, windowname, width, height)
	{
		if ((windowname) && (windowname != ""))
			SE_LN_OpenWin("", width, height, windowname);
		var _frm = document.getElementById(formId);
        var isNewForm = false;
		if (!_frm)
		{
			isNewForm = true;
			_frm = document.createElement("form");
			_frm.id = "MLX_Post_ToURL_Form";
			document.body.appendChild(_frm);
		}
		_frm.method = "POST";
		_frm.action = url;
		if ((windowname) && (windowname != ""))
			_frm.target = windowname;
    
        if (inputNames
         && inputValues 
         && inputNames.length > 0 
         && inputValues.length > 0)
        {
            var el;
            for (var i = 0; i < inputNames.length && i < inputValues.length; i++)
            {
                if (inputNames[i])
                {
                    el = document.createElement("input");
                    el.id = inputNames[i];
                    el.name = inputNames[i];
                    el.type = "hidden";
                    el.value = inputValues[i];
                    _frm.appendChild(el);
                }
            }
        }

		_frm.submit();
}

    function MLX_ShowSlowPageStatus(msgConfirm, msgStatus, dotDelay)
    {
        var delay = (dotDelay && dotDelay > 100) ? dotDelay : 1000;
        if(!msgConfirm || msgConfirm == "" || confirm(msgConfirm))
        {
            setTimeout("MLX_UpdateSlowPageStatus(" + delay + ",'" + msgStatus + "')", delay);
            return true;
        }
        return false
    }
    function MLX_UpdateSlowPageStatus(delay, msg)
    {
        var divStatus = document.getElementById("divStatus");
        var divStatusText = document.getElementById("divStatusText");
        if (!divStatus)
        {
            divStatus = document.createElement("div");
			document.body.appendChild(divStatus);
		    divStatus.id = "divStatus";
		    divStatus.className = "modalDialog";
		    divStatus.style.display = "none";
		    divStatus.style.display.width = "300px";
		    divStatus.style.display.height = "60px;";
		    divStatusText = document.createElement("div");
			divStatus.appendChild(divStatusText);
			divStatusText.id = "divStatusText";
        }
        
        if (divStatusText)
        {
            if (msg && msg != "")
            {
                divStatusText.innerHTML = msg;
                SE_CenterElement(document.getElementById('divStatus'));
                SE_Modal_ToggleDivModalCover();
            }
            else
                divStatusText.innerHTML += ". ";
            setTimeout('MLX_UpdateSlowPageStatus(' + delay + ', null)', delay);
        }
    }
    
    function SE_ValidateEmail(source, arguments)
	{
	    arguments.IsValid = SE_IsValidEmailAddress(arguments.Value);
	    if (!arguments.IsValid && arguments.Value.indexOf("@" == -1))
	        arguments.IsValid = SE_IsValidEmailAddress(arguments.Value + "@test.com");
	    if (!arguments.IsValid)
	        source.errormessage = "Please enter an email address containing only " 
	            + MLX_ValidEmailCharacters + ".";
	}
	
	function SE_IsValidEmailAddress(strAddress)
    {
	    strAddress = strAddress.replace(/^\s+/,'').replace(/\s+$/,'');
	    return (MLX_ValidEmailRegExp.test(strAddress));
	}

	function SE_GetBackgroundColor(styleName) {
	
	    var divColor = document.createElement("DIV");
	    divColor.className = styleName;
	    divColor.style.display = "none";
	    document.body.appendChild(divColor);
	    var color = ($("." + styleName).css('background-color'));
	    document.body.removeChild(divColor);
	    
	    
	    return color;
	}

	function MLX_ReplaceNodeText(node, text) {
	    if (node.hasChildNodes()) {
	        while (node.childNodes.length >= 1) {
	            node.removeChild(node.firstChild);
	        }
	    }
	    textNode = document.createTextNode(text);
	    node.appendChild(textNode);
	}

	function HexToR(h) { return parseInt((cutHex(h)).substring(0, 2), 16) }
	function HexToG(h) { return parseInt((cutHex(h)).substring(2, 4), 16) }
	function HexToB(h) { return parseInt((cutHex(h)).substring(4, 6), 16) }
	function cutHex(h) { return (h.charAt(0) == "#") ? h.substring(1, 7) : h }

	function SE_NOP() { }

	function MLX_LoadSMSCarriers(ctlID) {
	    var smsUrl = "/common/utilities/sms.aspx?action=listproviders";
	    $.getJSON(smsUrl,
            function(data) {
                if (data.options.length > 0) {
                    var options = document.getElementById(ctlID).options;
                    options.length = 0;
                    options[options.length] = new Option("-- Select your provider --", ""); ;
                    for (o in data.options) {
                        var opt = data.options[o];
                        options[options.length] = new Option(opt.provider, opt.smsdomain);
                    }
                }
            }
        )
        }
        function MLX_SendSMSMessage(txtPhoneID, cboCarriersID, successMessage, url) {
            var phone = SE_StripNonDigit($("#" + txtPhoneID).val());
            var carrier = $("#" + cboCarriersID).val();
            var postUrl = url;
            if (!url)
                postUrl = location.href;

            if (!SE_IsPossiblePhoneNumber_Accurate(phone)) {
                alert("Please enter a valid phone number.")
                $("#" + txtPhoneID).focus();
            }
            else if (carrier == "") {
                alert("Please select your mobile carrier from the list.");
                $("#" + cboCarriersID).focus();
            }
            else {
                $.post(postUrl, {
                    phone: phone,
                    carrier: carrier,
                    postaction: 'sendsms'
                },
                function(data) {
                    if (data == "Success") {
                        alert(successMessage);
                    }
                    else {
                        if (data.length < 500)
                            alert(data);
                        else
                            alert("We had a problem sending your message.");
                    }
                });
            }
        }
	