/**
* eGroupWare - API
* http://www.egroupware.org
*
* This file was originally created Tyamad, but their content is now completly removed!
* It still contains some commonly used javascript functions, always included by EGroupware.
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package api
* @subpackage jsapi
* @version $Id$
*/
/***********************************************\
* INITIALIZATION *
\***********************************************/
if (document.all)
{
navigator.userAgent.toLowerCase().indexOf('msie 5') != -1 ? is_ie5 = true : is_ie5 = false;
is_ie = true;
is_moz1_6 = false;
is_ns4 = false;
}
else if (document.getElementById)
{
navigator.userAgent.toLowerCase().match('mozilla.*rv[:]1\.6.*gecko') ? is_moz1_6 = true : is_moz1_6 = false;
is_ie = false;
is_ie5 = false;
is_ns4 = false;
}
else if (document.layers)
{
is_ie = false;
is_ie5 = false;
is_moz1_6 = false;
is_ns4 = true;
}
//console.log('is_ie='+is_ie+', is_ie5='+is_ie5+', is_mozilla='+is_mozilla+', is_moz1_6='+is_moz1_6+', is_ns4='+is_ns4);
/**
* Check whether the console object is defined - if not, define one
*/
if (typeof window.console == 'undefined')
{
window.console = {
'log': function() {
},
'warn': function() {
},
'error': function() {
},
'info': function() {
}
}
}
/**
* Seperates all script tags from the given html code and returns the seperately
*
* @param object _html object that the html code
* from which the script should be seperated
* The html code has to be stored in _html.html,
* the result js will be written to _html.js.
*/
egw_seperateJavaScript = function(_html)
{
var html = typeof _html.html == 'string'?_html.html:'';
var in_pos = html.search(/ tag */
var js_str = html.substring(in_pos, out_pos+9);
/*Remove the initial tag */
/*js_str = js_str.substring(js_str.search(/>/) + 1);*/
_html.js += js_str;
html = html.substring(0, in_pos) + html.substring(out_pos + 9);
var in_pos = html.search(/