function tabOver (strTab) {
	document.getElementById(strTab).className = 'tab_sides_over';
}


function tabOut (strTab) {
	document.getElementById(strTab).className = 'tab_sides';
}


function GetXMLHttp()
{
    var xmlhttp=false;
    
    try 
    {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } 
    catch (e) 
    {
        try 
        {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (E)
        {
            xmlhttp = false;
        }
    }

    // Mozilla then?
    if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
       xmlhttp = new XMLHttpRequest();
    }
    return xmlhttp;
}


/*
 * Returns a function that waits for the specified XMLHttpRequest
 * to complete, then passes its XML response
 * to the given handler function.
 * req - The XMLHttpRequest whose state is changing
 * responseXmlHandler - Function to pass the XML response to
 */
function getReadyStateHandler(req, responseXmlHandler, type) {
	// Return an anonymous function that listens to the 
	// XMLHttpRequest instance
	return function () 
	{
		// If the request's status is "complete"
		if (req.readyState == 4) 
		{
			// Check that a successful server response was received
			if (req.status == 200) 
			{
				// Pass the XML payload of the response to the 
				// handler function
				switch (type)
				{
					case "xml":
						responseXmlHandler(req.responseXML);
						break;
					case "text":
						responseXmlHandler(req.responseText);
						break;
					default:
						responseXmlHandler(req.responseXML);
						break;
				}
			}	 
			else 
			{
				// An HTTP problem has occurred
				alert("HTTP error: "+req.status);
			}
		}
	}
}


function searchContent()
{
	var sterm = document.forms["search"].searchterm.value;
	var re = new RegExp("^[a-zA-Z]+");
	if (sterm.length > 0 && re.test(sterm))
	{
		document.forms["search"].submit();
	}
}

function openHelpDialog()
{
	var loc = "/Help/Default.ashx";
	var attributes = "menubar=no,resizable=no,toolbar=no,status=no,titlebar=no,width=600,height=490";
	window.open(loc, "help", attributes);
}

/* The following block provides cross-browser (Mozilla/IE) support
   for capturing enter event. */

document.onkeypress = function checkKeyPress(e)
{
	var key=document.layers?e.which:document.all?event.keyCode:e.keyCode;
	if (key == 13)
	{
		if (!handleKP())
		{
			return false;
		}
		else
		{
			document.forms[0].submit();
		}
	}
}

if (document.layers)
{
	document.captureEvents(Event.KEYPRESS);
}

if (! document.all && document.getElementById)
{
	document.addEventListener("keypress", checkKeyPress, true);
}

function handleKP()
{
	var sterm = (document.forms["search"] != null) ? document.forms["search"].searchterm.value : null;
	var re = new RegExp("^[a-zA-Z]+");
	if (sterm == null)
	{
		document.forms[0].submit();
	}
	else if (sterm.length > 0 && re.test(sterm))
	{
		searchContent();
	}
	return false;
}

String.prototype.trim = function() 
{
	// Strip leading and trailing white-space
    return this.replace(/^\s*|\s*$/g, "");
}


