// ----------------------------------------------------------------------
// STMicroelectronics - CCSF - eTechnology Team
//
// global.jscript - Global JavaScript utility functions
// ----------------------------------------------------------------------
var PARAM_EVT_CLASS = "_cl"; var PARAM_TYPE = "_ty";
var PARAM_TARGET = "_tg"; var PARAM_ACTION = "_ac";
var PARAM_PAGE_EVENT = "_pe"; var PARAM_SUBMIT = "_sb";
var PARAM_SERVER_VALIDATE = "_sv"; var PARAM_CONTROL_NAME = "_ct";
// ----------------------------------------------------------------------
// Browser checks
// ----------------------------------------------------------------------
function isIE() { return (document.all != null); }
function isNS4() { return (document.layers) && (!document.getElementById); }
function isNS6() { return (document.getElementById) && (!document.all); }
function isDOMBrowser() { return (document.getElementById != null); }
function isMac() { return navigator.userAgent.indexOf("Mac") > -1; }
function isNS7() { return isNS6() && (navigator.userAgent.indexOf("Netscape/7") > -1); }
// Return the current system time (in millisecs)
function getCurrentTime() { return (new Date()).getTime(); }
// ----------------------------------------------------------------------
// Transform special characters (<, >, &, ")
// in the related HTML entities (<, >, &, ")
// ----------------------------------------------------------------------
function encodeStringForHTML(value)
{
var tmp = "";
if(value)
{
var c;
for(var i = 0; i < value.length; i++)
{
c = value.charAt(i);
// Manage special/simple characters
if(c == '&') tmp += "&";
else if(c == '<') tmp += "<";
else if(c == '>') tmp += ">";
else if(c == '"') tmp += """;
else tmp += c;
} // for
} // if
return tmp;
} // func
// ----------------------------------------------------------------------
// The function encode a string as hex values
// ----------------------------------------------------------------------
function encodeStringToHex(value)
{
var result = '';
if(value)
{
var n = value.length;
for (var i = 0; i < n; i++)
{
var tmp = value.charCodeAt(i).toString(16);
if (tmp.length < 2) tmp = "0" + tmp;
result += tmp;
} // for
} // if
return result;
} // func
// ----------------------------------------------------------------------
// The function decode a string from hex values
// ----------------------------------------------------------------------
function decodeStringFromHex(value)
{
if(!value) return "";
var n = value.length / 2, result = '';
for (var i = 0; i < n; i++) result += String.fromCharCode(eval("0x" + value.substr(i*2, 2)));
return result;
}
// ----------------------------------------------------------------------
// Create a title bar (100% of width) applying the '.header' class style
//
// Parameters:
// - title: The title to be displayed
// ----------------------------------------------------------------------
function renderTitleBar(title)
{
document.write(isIE() ?
'
' :
'');
} // func
// ------------------------------------------------------------------------------------
// Display an icon graphic button with an optional hyperlink.
// The 'type' parameter must be one of available files in /liotrox/html/images/buttons
//
// Parameters:
// - type : The button icon type. Example: 'save', 'info', 'help', etc.
// See the 'html/images/buttons' for a complete list of icon types
// - label : The button text label
// - link : The triggered hyperlink. REQUIRED
// - target: An optional target frame for the hyperlink
// - width : The button width (0 = autosize)
// ------------------------------------------------------------------------------------
function renderIconButton(type, label, link, target, width)
{
lxRenderButton(type, label, link, null, target, width, null);
} // func
function renderButton(label, link, target, width)
{
lxRenderButton(null, label, link, null, target, width, null);
} // func
// ------------------------------------------------------------------------------------
// Display an icon graphic button with an optional hyperlink.
// The 'type' parameter must be one of available files in /liotrox/html/images/buttons
//
// Parameters:
// - icon : The button icon type.
// Example: 'save' for 'button_save.gif',
// 'info' for 'button_info.gif' etc.
// See the 'html/images/buttons' for a complete list of icon.
// - label: The button text label
// - link: The triggered hyperlink that will be used in the HREF attribute.
// If it is NULL the function will use the jsFunction parameter.
// - jsFunction: The triggered JavaScript name. This parameter is used
// only if the link parameter is NULL. It will put a '#'
// character in the HREF attribute and the jsFunction in
// the ONCLICK attribute.
// IT IS A MISTAKE TO USE BOTH 'link' AND 'jsFunction' ATTRIBUTES
// - target: An optional target frame for the hyperlink
// - width : The button width (0 = autosize)
// - tooltip: The tooltip displyed text
// ------------------------------------------------------------------------------------
var _lxDisplayButtonAsLink = false;
var _lxLeftLinkMarker = '[';
var _lxRightLinkMarker = ']';
// short function name for lxRenderButton function
// (used to reduce the generated HTML)
function lxRB(icon, label, link, jsFunction, target, width, tooltip)
{
lxRenderButton(icon, label, link, jsFunction, target, width, tooltip)
}
function lxRenderButton(icon, label, link, jsFunction, target, width, tooltip)
{
if(_lxDisplayButtonAsLink)
lxRenderButtonAsLink(icon, label, link, jsFunction, target, width, tooltip);
else
lxRenderButtonAsButton(icon, label, link, jsFunction, target, width, tooltip);
} // func
function lxRenderButtonAsButton(icon, label, link, jsFunction, target, width, tooltip)
{
var href = (link == null) ? 'href="#" onclick="' + jsFunction + '"'
: 'href="' + link + '"';
if(width == null) width = 0;
if("undefined" == tooltip || tooltip == null) tooltip = label;
var tmp = ''+
' | ';
if(icon != null && icon != '')
{
tmp += '' +
'' +
' ' +
' | ';
} // if
tmp += '' +
''+label+''+
' |  | ' +
' ';
document.write(tmp);
} // func
function lxRenderButtonAsLink(icon, label, link, jsFunction, target, width, tooltip)
{
var href = (link == null) ? 'href="#" onclick="' + jsFunction + '"'
: 'href="' + link + '"';
if("undefined" == tooltip || tooltip == null) tooltip = label;
var tmp = '';
document.write(tmp);
} // func
// ------------------------------------------------------------------------------------
// Display an icon with an optional hyperlink.
//
// Parameters:
// - iconName: The button icon type. See the 'html/images/icons' directory for complete list
// - link : The triggered hyperlink. REQUIRED
// - target: An optional target frame for the hyperlink
// ------------------------------------------------------------------------------------
function renderIcon(iconName, link, target)
{
if(link != null) document.write('');
document.write(' ');
if(link != null) document.write('');
} // func
// ----------------------------------------------------------------------
// Create the begin/end part tabbed panel structure
// ----------------------------------------------------------------------
function renderEndTabbedPanel() { document.write(' |
'); }
function renderBeginTabbedPanel() { document.write('