/**
 * A collection of JavaScript functions that are provided to all pages (views)
 * created within the framework.
 * 
 * @package    Webster_Network_Framework
 * @subpackage Public
 * @version    $Id$
 * @author     Webster Network
 * @copyright  Copyright (c) 2002-2009, Webster Network
 * @link       http://www.webster-network.com/
 */

/**
 * Launches a popup window to the specified URI.
 * 
 * @param  uri		URI of the page to load in the popup window.
 * @param  name		Name of the popup window, can be used target based selection
 * 					on links.
 * @param  width	Width of the popup window.
 * @param  height	Height of the popup window.
 * @return 			Returns false to prevent the existing browser window from
 * 					following the link itself.
 */
function popupWindow(uri, name, width, height)
{
	newWindow = window.open(uri, name, 'height=' + height + ',width=' + width);
	
	if (window.focus)
	{
		newWindow.focus();
	}
	
	
	return false;
}

/**
 * Prompts the user with a dialog box.  Based on the users selection of 'Yes' or
 * 'No' an appropriate action can be taken.
 * 
 * @param  prompt
 * @param  url
 * @return void
 */
function decisionPrompt(prompt, url)
{
	if (confirm(prompt))
	{
		window.location.replace(url);
	}
	
	return;
}

/**
 * Hides the panel named <code>panelName</code>.
 * 
 * @param  panelName		Id of the panel to hide.
 * @return void
 */
function hidePanel(panelName)
{
	document.getElementById(panelName).style.display = 'none';
	
	return;
}

/**
 * Shows the panel named <code>panelName</code>.
 * 
 * @param  panelName		Id of the panel to show.
 * @return void
 */
function showPanel(panelName)
{
	document.getElementById(panelName).style.display = 'block';
	
	return;
}
