<!--
	function toggleSection(sectionName, img) {
		var section = document.getElementById(sectionName);
		if (section != null) {
			if (section.style.display == 'none') {
				section.style.display = 'block';
				if (img != null) img.src = 'images/icons/navigate_minus.png';
			}
			else {
				section.style.display = 'none';
				if (img != null) img.src = 'images/icons/navigate_plus.png';
			}
		}
	}

    function showMessageLogContent(contentType, messageLogId) 
    {
        var url = '/EdielPortal/MessageLog/ShowContent.aspx?messageLogId=' + messageLogId + '&contentType=' + contentType;
        var args = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=750,height=500";
        window.open(url, '_blank', args);
    }

    function replaceString(oldS,newS,fullS) {// Replaces oldS with newS in the string fullS
	    for (var i=0; i<fullS.length; i++) {
		    if (fullS.substring(i,i+oldS.length) == oldS) {
			    fullS = fullS.substring(0,i)+newS+fullS.substring(i+oldS.length,fullS.length)
		    }   
	    }   
	    return fullS;
    }
    
    function wraptext(ctrlId, checked){
	    var text;
        var ctrl = document.getElementById(ctrlId);
        if (ctrl != null) {
	        text = ctrl.value;
	        if (checked) {
		        text = replaceString("'","'\r",text);
	        }else{
		        text = replaceString("\r\n","",text);
	        }
    	    ctrl.value = text;
	    }
    }
     
    function showTestData(testCaseCode, testCaseStep) 
    {
        day = new Date();
		id = day.getTime();
		var url = 'TestCaseData.aspx?sTestCaseCode=' + testCaseCode + '&iSeqNo=' + testCaseStep;
		var winWidth = 600;
		var winHeight = 600;
		
		if (document.all)
		{
			w = document.body.clientWidth;
			h = document.body.clientHeight;
			y = window.screenTop;
			x = window.screenLeft;
		}
		else //if (document.layers)
		{
			w = window.innerWidth;
			h = window.innerHeight;
			x = window.screenX;
			y = window.screenY;
		}
		
		var xOffset = ((w-winWidth)/2)+x, yOffset = ((h-winHeight)/2)+y;
		
		eval("page" + id + " = window.open('" + url + "', '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=" + winWidth + ",height=" + winHeight + ",left=" + xOffset + ",top=" + yOffset + "');");
    }
    
    // tree view functions //
    
    // toggles a node in the tree between expanded and collapsed
    function ToggleTreeNode(nodeId, collapseIcon, expandIcon)
    {
		var node = document.getElementById(nodeId);
		ExpandTreeNode(nodeId, !IsNodeExpanded(node), collapseIcon, expandIcon);
    }
    
    // expands or collapses a node
    function ExpandTreeNode(nodeId, expand, collapseIcon, expandIcon)
    {
		var node = document.getElementById(nodeId);
		node.style.display = expand ? "" : "none";					// a display of "" will show an element, none hide it and remove the space it occupied
		
		var icon = document.getElementById(nodeId + "_icon");
		
		if (icon != null && collapseIcon != "" && expandIcon != "")
		{
			icon.src = expand ? collapseIcon : expandIcon;			// use icon opposite of the node's new state
		}
    }
    
    // checks for enter key while the search box is in focus, and performs the search if it is
    function CheckSearch(event, treeID, searchCSSClass, collapseIcon, expandIcon)
    {
		var characterCode;
		if (event && event.which)			// if which property of event object is supported (NN4)
			characterCode = event.which;	// character code is contained in NN4's which property
		else
			characterCode = event.keyCode;	// character code is contained in IE's keyCode property
		
		if (characterCode == 13)			// 13 == enter key
		{
			DoSearch(treeID, searchCSSClass, collapseIcon, expandIcon);
			
			return false;
		}
		return true;
    }
    
    // performs a search in the given tree's nodes
    function DoSearch(treeID, searchCSSClass, collapseIcon, expandIcon)
    {
		var searchString = document.getElementById(treeID + "_SearchBox").value.toLowerCase();
		
		var values = GetTagsByName("div", treeID + "_NodeValue");								// get all node values
		
		CollapseAll(treeID, collapseIcon, expandIcon);											// close all nodes to avoid clutter, typically from a previous search
		
		for (var i = 0; i < values.length; i++)													// clear previously marked nodes
			values[i].parentNode.parentNode.className = "";
		
		if (searchString != "")
		{
			for (var i = 0; i < values.length; i++)												// check all values
			{
				var nodeValue = values[i].innerHTML.toLowerCase().replace(/<\S[^><]*>/g,"");	// strip html tags
				
				if (nodeValue.indexOf(searchString) > -1)
				{
					var parent = values[i].parentNode;
					parent.parentNode.className = searchCSSClass;								// parent is a div tag, parent's parent is the row containing values
					while (parent != null)														// recursively expand all nodes above the found node (parents)
					{
						if (parent.id != null && parent.id.indexOf(treeID + "_Node_") == 0)		// if parent is a node in the current tree
						{
							if (!IsNodeExpanded(parent))
								ExpandTreeNode(parent.id, true, collapseIcon, expandIcon);		// expand parent if collapsed
							else
								break;															// otherwise the rest of its parents are already expanded
						}
						
						parent = parent.parentNode;
					}
				}
			}
		}
    }
    
    // collapses all nodes in a tree
    function CollapseAll(treeID, collapseIcon, expandIcon)
    {
		var root = document.getElementById(treeID + "_Tree");
		
		if (root != null)
			CollapseChildren(root, collapseIcon, expandIcon);
    }
    
    // collapses all nodes below a given node
    function CollapseChildren(node, collapseIcon, expandIcon)
    {
		if (!node.hasChildNodes) return;
		
		if (node.id != null && node.id.indexOf("_Node") > -1 && node.id.indexOf("_icon") == -1)	// if element is a tree node, and not an icon node
		{
			if (IsNodeExpanded(node))
				ExpandTreeNode(node.id, false, collapseIcon, expandIcon);						// collapse node if expanded
			else
				return;																			// if a node is collapsed, all nodes below will also be, so we can exit
		}
		
		for (var i = 0; i < node.childNodes.length; i++)
			CollapseChildren(node.childNodes[i], collapseIcon, expandIcon);						// recursively collapse children
    }
    
    // returns whether a given node is expanded or collapsed
    function IsNodeExpanded(node)
    {
		return node.style.display != "none";
    }
    
    // workaround for IE, as it doesn't support getElementsByName for the types of elements we want. according to the standard, it's not supposed to
    // but since FF supports it, we try it first anyway, as this is much faster than getting by tag and finding matching nodes from those
    function GetTagsByName(tag, name)
	{
		var values = document.getElementsByName(name);
		
		if (values.length > 0) return values;
		
		values = document.getElementsByTagName(tag);
		
		var arr = new Array();
		for (var i = 0; i < values.length; i++)
		{
			var value = values[i];
			
			if (value.getAttribute('name') == name)
			{
				arr.push(value);
			}
		}
		
		return arr;
	}
//-->
