function Browser()
{
	this.version	= navigator.appVersion;
	this.agent		= navigator.userAgent;
	this.dom		= document.getElementById?1:0;
	this.opera5		= this.agent.indexOf("Opera 5")>-1;
	this.ie5		= (this.version.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
	this.ie6		= (this.version.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie7		= (this.version.indexOf("MSIE 7")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4		= (document.all && !this.dom && !this.opera5)?1:0;
	this.ie			= this.ie4||this.ie5||this.ie6||this.ie7;
	this.mac		= this.agent.indexOf("Mac")>-1;
	this.ns6		= (this.dom && parseInt(this.version) >= 5) ?1:0;
	this.ns4		= (document.layers && !this.dom)?1:0;
	this.bw			= (this.ie7 || this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5);
	return this;
}

browser = new Browser();

function verify(msg)
{
	if (!confirm(msg))
	{
		if(browser.ie)
		{
			event.cancelBubble = true;
		}

		return false;
	}
	return true;
}

function pressButton(inName)
{
	document.getElementById(inName).click();
}

function keyPress(myCall, event)
{
	var myKeyCode = event.keyCode;

	if(document.all) // Internet Explorer
	{
		event.cancelBubble = true;

		if(myKeyCode == 13)
		{
			event.returnValue = false;
		}
	}
	else // All Others
	{
		if(myKeyCode == 13)
		{
			event.preventDefault(true);
		}
	}

	if(myKeyCode == 13)
	{
		eval(myCall);
	}
}

function openWindow(inURL, inWidth, inHeight, inWindowName)
{
	if(!inWindowName)
	{
		inWindowName = 'newwindow';
	}

	window.open(inURL, inWindowName, 'width=' + inWidth + ',height=' + inHeight + ',menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no');
}

function gotoPage(inURL)
{
	window.location = inURL;
}

function doPageFocus()
{
	if(document.forms[0])
	if(document.forms[0].elements["email"])
	{
		document.forms[0].elements["email"].focus();
	}
}

function focusElement(inElementID)
{
	var element = document.getElementById(inElementID);

	if(element)
	{
		element.focus();
	}
}

function showHelp(inCode)
{
	url = "/kb";

	if(inCode && inCode.length > 0)
	{
		url = inCode;
	}

	var newWindow = window.open(url, "oit_help", "width=760,height=650,scrollbars");
	
	if(window.focus)
	{
		newWindow.focus();
	}
}

function showHelpTopic(inCode)
{
	parent.content.location = "/kb";
}

function toggleElement(inTitleID, inContentID, inTitle, inHideCharacter, inShowCharacter)
{
	var titleSpan = document.getElementById(inTitleID);
	
	var contentBlock = document.getElementById(inContentID);

	if(!contentBlock || !titleSpan)
	{
		alert('cannot find stuff');
		
		return;
	}
	
	if(contentBlock.style.display=="none")
	{
		contentBlock.style.display="block";
		
		titleSpan.innerHTML = inShowCharacter + " " + inTitle;
	}
	else
	{
		contentBlock.style.display="none";
		
		titleSpan.innerHTML = inHideCharacter + " " + inTitle;
	}
	
	return;
}
