function AddEvent(obj, type, fn)
{
    // Mozilla/W3C listeners?
    if (obj.addEventListener)
    {
        obj.addEventListener(type, fn, true);
        return true;
    }

    // IE-style listeners?
    if (obj.attachEvent)
        return obj.attachEvent('on' + type, fn);

    return false;
}
function hideElem(id)
{
	document.getElementById(id).style.display = "none";
}
function showElem(id)
{
	document.getElementById(id).style.display = "block";
}
function openWin( loc, width, height, bResize, sHandle, bLockOpen, bScrollbars )
{
	if( arguments.length < 1 ) return;
	if( arguments.length < 2 ) width = 800;
	if( arguments.length < 3 ) height = 600;
	if( arguments.length < 4 ) bResize = false;
	if( arguments.length < 5 ) sHandle = false;
	if( arguments.length < 6 ) bLockOpen = false;
	if( arguments.length < 7 ) bScrollbars = false;

	var sLeft=(screen.width-width)/2, sTop=(screen.height-height)/2;
	var params = "height=" + height + ", width=" + width + ", top=" + sTop + ", left=" + sLeft + ", scrollbars=" + (bScrollbars?"yes":"no")+ ", resizable=" + (bResize?"yes":"no");
	window.open( loc, sHandle, params );
}
//ToDO - come up with a sexier way to display confirms
function twConfirm( confirmTitle, confirmTxt )
{
	return confirm( confirmTxt );
}
//ToDO - come up with a sexier way to display alerts
function twAlert( alertTitle, alertTxt, icon )
{
	if( arguments.length < 3 ) icon = "default.gif">
	alert( alertTxt );
}
//This remembers if the current widow is a pop-up
var winIsPopup = window.opener?true:parent.winIsPopup?true:false;
