function hasMasterFrame(name)
{
	var found = false;
	var w = window;
	
	while(w != null && w.parent != null && w != w.parent)
	{
		if(typeof(w.parent.getMasterFrameName) == 'function' && w.parent.getMasterFrameName() == name)
		{
			found = true;
			break;
		}
		
		w = w.parent;
	}
	
	return found;
}

function popFrame(name, framePage)
{
    var search = window.location.search;

	if(search.indexOf("nopop") == -1 && hasMasterFrame(name) == false)
	{
		window.location = framePage + "?pop=" + escape(window.location);
	}
}

function setPopFrame(frame)
{
    var search = window.location.search;

    if(search != null && search.substring(0, 5) == '?pop=')
    {
        var url = unescape(search.substring(5));

        document.getElementById(frame).src = url;
    }
}
