var msie = navigator.userAgent.toLowerCase().indexOf('msie') > 0;
var $D = function(str) {
	if (msie)
	{
		Debug.writeln(str);
	}
	else
	{
		dump(str + "\n");
	}
}

addOnLoad = function(func)
{
	if (typeof(window.onload) == "function")
	{
		var oldfunc = window.onload;
		window.onload = function() { return func() && oldfunc(); };
	}
	else
		window.onload = func;
	
}

function loadNavigationIfVisible() 
{
	var e;
	try {
		loadNavigationState()
	} catch (e) { }
}

addOnLoad(loadNavigationIfVisible);

defaultButton = function(btn, e){
//alert('btn=' +btn);
	if (document.all){
		if (e.keyCode == 13)
		{
			e.returnValue=false;
			e.cancel = true;
			btn.click();
		}
	}
	else if (document.getElementById)
	{
		if (e.which == 13)
		{
			e.returnValue=false;
			e.cancel = true;
			btn.click();
		}
	}
	else if(document.layers)
	{
		if(e.which == 13)
		{
			e.returnValue=false;
			e.cancel = true;
			btn.click();
		}
	}
}
setDefaultFocus = function(textboxId) 
{
	var undefined;
	var textbox = document.getElementById(textboxId);
	if (textbox == undefined || textbox == null)
	{
		return;
	}
	textbox.focus();
	textbox.select();
}

