// +----------------------------------------------------------------------+
// | Panther Version 3                                                    |
// +----------------------------------------------------------------------+
// | Copyright (c) 2005 Webbtech.  All rights reserved.                   |
// +----------------------------------------------------------------------+
// | File: StdFuncs.php                                                   |
// | Created: 06/13/05                                                    |
// | Revised: 10/11/05                                                    |
// +----------------------------------------------------------------------+
// | Authors: Ron Dyck <rhd@webbtech.net>                                 |
// |                                                                      |
// | Maintainer: Ron Dyck <rhd@webbtech.net>                              |
// +----------------------------------------------------------------------+
// Version: $Revision: $
// CVS Author: $Author: $
// Last Revised: $Date: $

/**
 * Standard Javascript functions
 *
 * @package  Utility
 * @author   Ron Dyck <rhd@webbtech.net>
 */

// {{{ openPopup
/**
 * Open popup windows
 *
 *
 */
function openPopup( url, name, widgets, openerUrl )
{
	var host = location.hostname;
	var popupWin = window.open( url, name, widgets );

	if ( popupWin && popupWin.opener ) {
		if ( openerUrl )
		{
			popupWin.opener.location = openerUrl;
			popupWin.focus();
		}
		popupWin.opener.top.name = "opener";
	}
}
// }}}

// {{{ classChange
/**
 * Typically used to hide submit button after submitting form
 *
 */
function classChange(styleChange,item) {
    item.className = styleChange;
}
// }}}

// {{{ confirmLink
/**
 * Displays an confirmation box beforme to submit a "DROP/DELETE/ALTER" query.
 * This function is called while clicking links
 *
 * @param   object   the link
 * @param   object   tconfirmation message
 *
 * @return  boolean  whether to run the query or not
 */
function confirmLink(theLink, theMsg)
{
    var confirmMsg = "Are you sure you want to delete";
    // Confirmation is not required in the configuration file
    // or browser is Opera (crappy js implementation)
    if (confirmMsg == '' || typeof(window.opera) != 'undefined') {
        return true;
    }

    var is_confirmed = confirm(confirmMsg + ':\n' + theMsg);
    /*
    if (is_confirmed) {
        theLink.href += '&is_js_confirmed=1';
    }
    */
    return is_confirmed;
}
// }}}

