/** * * PortalCE(tm) - The Portal Builder * Copyright © Comrax Ltd. All rights reserved. * Unauthorized duplication and modification prohibited. * * END-USER LICENSE AND AGREEMENT >>> * * THIS SOFTWARE IS PROVIDED BY "COMRAX LTD." ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL "COMRAX LTD." BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ /** * Make sure that this script is only included once in the HTML code. */ if( !_PCE_DHTML_CODE_LOADED || _PCE_DHTML_CODE_LOADED != 'PortalCE' ) { var _PCE_DHTML_CODE_LOADED = 'PortalCE'; /** * Debugging variable. Set in your script to enable 'alert()' debugging mode. */ if( !SYS_DEBUG_MODE ) { var SYS_DEBUG_MODE = false; } /** * Global constants */ var POS_TOP_LEFT = "TL"; var POS_TOP_RIGHT = "TR"; var POS_BOTTOM_LEFT = "BL"; var POS_BOTTOM_RIGHT = "BR"; var POS_CENTRALIZE = "CM"; var AUTOMATIC = -1; var CSS_POSITION_ABSOLUTE = "absolute"; var CSS_POSITION_RELATIVE = "relative"; var ELM_HIDE = 'hidden'; var ELM_SHOW = 'visible'; /** * Browser detection variables. */ var AGT_BROWSER_NAME = navigator.appName.toLowerCase( ); var AGT_BROWSER_VER = navigator.appVersion.toLowerCase( ); var AGT_BROWSER = navigator.userAgent.toLowerCase( ); var AGT_IEXPLORER_4 = ( AGT_BROWSER.indexOf( 'msie 4' ) >= 0 )? true: false; var AGT_IEXPLORER_5 = ( AGT_BROWSER.indexOf( 'msie 5' ) >= 0 )? true: false; var AGT_IEXPLORER_6 = ( AGT_BROWSER.indexOf( 'msie 6' ) >= 0 )? true: false; var AGT_MSNEXPLORER_5 = ( AGT_BROWSER.indexOf( 'msn 5' ) >= 0 )? true: false; var AGT_MSNEXPLORER_6 = ( AGT_BROWSER.indexOf( 'msn 6' ) >= 0 )? true: false; var AGT_IEXPLORER = ( AGT_BROWSER_NAME.indexOf( 'internet explorer' ) >= 0 )? true: false; var AGT_NETSCAPE = ( AGT_BROWSER_NAME.indexOf( 'netscape' ) >= 0 )? true: false; var AGT_IEXPLOREROLD = ( AGT_IEXPLORER_4 )? true: false; var AGT_IEXPLORERNEW = ( AGT_IEXPLORER_5 || AGT_IEXPLORER_6 || AGT_MSNEXPLORER_5 || AGT_MSNEXPLORER_6 )? true: false; var AGT_BROWSER_DOM = ( document.getElementById )? true: false; var AGT_NNAVIGATOR = ( document.all )? true: false; var AGT_NNAVIGATOR_4 = ( document.layers )? true: false; var AGT_NNAVIGATOR_6 = ( AGT_BROWSER.indexOf( 'netscape6' ) >= 0 )? true: false; /** * CSS variables. */ var CSS_VISIBILITY_HIDE = ( AGT_IEXPLORER || AGT_BROWSER_DOM )? "hidden": "hide"; var CSS_VISIBILITY_SHOW = ( AGT_IEXPLORER || AGT_BROWSER_DOM )? "visible": "show"; /** * Block JavaScript errors. * This can be useful for sources other than your own that may contain errors * (i.e. ad banners or automated news feeds) */ function pce_disable_errors( ) { window.onerror = _my_disable_js_error; } /** * OBJECT: pceBrowserWindow */ function pceBrowserWindow( ) { this.width = ( AGT_NETSCAPE )? window.innerWidth: ( document.body )? document.body.clientWidth: -1; this.height = ( AGT_NETSCAPE )? window.innerHeight: ( document.body )? document.body.clientHeight: -1; } /** * OBJECT: pmeMimeType * * Get details about MIME types installed in the browser. * Note: Function must be called from within the BODY of the HTML document. */ function pceMimeType( ) { this.PCE_MIME_TYPE = 0; this.PCE_MIME_DESCRIPTION = 1; this.PCE_MIME_SUFFIXES = 2; /** * Define functions in the object */ this.list = _pce_mime_types_list; this.exists = _pce_mime_types_exists; } function _pce_mime_types_list( ) { if( navigator.mimeTypes.length ) { this.arr_mime_types = new Array( ); for( this.i = 0; this.i < navigator.mimeTypes.length; this.i++ ) { this.arr_mime_types[ this.i ] = new Array( 3 ); this.arr_mime_types[ this.i ][ this.PCE_MIME_TYPE ] = navigator.mimeTypes[i].type; this.arr_mime_types[ this.i ][ this.PCE_MIME_DESCRIPTION ] = navigator.mimeTypes[i].description; this.arr_mime_types[ this.i ][ this.PCE_MIME_SUFFIXES ] = navigator.mimeTypes[i].suffixes; } return this.arr_mime_types; } return false; } function _pce_mime_types_exists( mime_type ) { if( navigator.mimeTypes ) { for( this.i = 0; this.i < navigator.mimeTypes.length; this.i++ ) { if( navigator.mimeTypes[i].type == mime_type ) { return true; } } } return false; } /** * OBJECT: pceScrollBar * * Controls the scroll bar appearance in browser. */ function pceScrollBar( layer_id ) { this.layer_id = ( !layer_id )? top: layer_id; this.show = _pce_show_scrollbars; this.hide = _pce_hide_scrollbars; } function _pce_show_scrollbars( ) { layer_id = this.layer_id; if( layer_id.scrollbars && layer_id.scrollbars.visible ) { layer_id.scrollbars.visible = true; } else if( document.body.style ) { document.body.style.overflow = ""; } } function _pce_hide_scrollbars( ) { if( top.scrollbars && top.scrollbars.visible ) { top.scrollbars.visible = false; } else if( document.body.style ) { document.body.style.overflow = CSS_VISIBILITY_HIDE; } } /** * OBJECT: pceDynamicCookie * * Use and manipulate cookies in JavaScript from your programs. */ function pceDynamicCookie( name, path, domain, secure ) { this.valid = false; if( !name ) { return; } this.path = ( !path )? "/": path; this.name = name; this.path = path; this.domain = domain; this.secure = secure; this.cookie = document.cookie; this.valid = true; /** * Define functions */ this.set = _pce_cookies_set this.get = _pce_cookies_get this.erase = _pce_cookies_erase this.del = _pce_cookies_erase } /** * Set a cookie. * * value = value of the cookie * expire = number of minutes for expiration (this is NOW + expire minutes) * a value of expire=0 means that the cookie is valid till end of session */ function _pce_cookies_set( value, expire ) { if( !this.valid || !value ) { /** * if no value is present, delete the cookie. */ return this.erase( ); } if( !expire || expire < 0 ) { expire = 0; } str_cookie = this.name + '=' + escape( value ); if( expire > 0 ) { var today = new Date( ); /** * 60000 = 60 secs * 1000 msec. */ var exp = new Date( today.getTime() + 60000 * expire ); str_cookie += '; expires=' + exp.toGMTString( ); } str_cookie += '; path=' + escape( this.path ); if( this.domain ) { str_cookie += '; domain=' + escape( this.domain ); } if( this.secure ) { str_cookie += '; secure'; } document.cookie = str_cookie; this.cookie = document.cookie; return; } function _pce_cookies_get( ) { if( !this.valid ) { return ""; } var pos = this.cookie.indexOf( this.name + "=" ); if( pos == -1 ) { return ""; } pos = this.cookie.indexOf( "=", pos ) + 1; var end = this.cookie.indexOf( ";", pos ); if( end == -1 ) { end = this.cookie.length; } return unescape( this.cookie.substring( pos, end ) ); } function _pce_cookies_erase( ) { if( !this.valid ) { return ""; } y2k = new Date( 946684800000 ); old = this.get( ); str_cookie = this.name + '=null; expires=' + y2k.toGMTString( ); document.cookie = str_cookie; this.cookie = document.cookie; return old; } /** * OBJECT: pceLayersObject * * Use layers to add live and dynamic pages to any browser */ function pceLayersObject( layer_name, showhide, position ) { this.autowrite = true; this.layer_autoid = ( layer_name )? layer_name + "_": "PCE_LAYER_ID_"; this.layer_list = new Array( ); this.layer_contents = new Array( ); this.layer_dims = new Array( ); this.layer_count = 0; this.layer_events = new Array( ); this.layer_ev_count = 0; this.layer_last = ""; this.layer_class = ""; this.layer_styles = ""; this.layer_autohide = ( showhide == CSS_VISIBILITY_HIDE || showhide == CSS_VISIBILITY_HIDE || showhide == CSS_VISIBILITY_SHOW || showhide == CSS_VISIBILITY_SHOW )? showhide: ""; this.position = CSS_POSITION_ABSOLUTE; this.relativeness = POS_TOP_LEFT; this.x = 0; this.y = 0; /** * Define functions */ this.stealth = _pce_layers_stealth; this.classid = _pce_layers_classid; this.styles = _pce_layers_styles; this.corner = _pce_layers_corner; this.id = _pce_layers_id; this.s2id = _pce_layers_s2id; this.tag = _pce_layers_event; this.event = _pce_layers_event; this.clear = _pce_layers_clear; this.define = _pce_layers_define; this.write = _pce_layers_write; this.contents = _pce_layers_contents; this.raise = _pce_layers_raise; this.hide = _pce_layers_hide; this.show = _pce_layers_show; this.hideall = _pce_layers_hide_all; this.showall = _pce_layers_show_all; this.move = _pce_layers_move; /** * Define position as an event; this is a hack but it works :) */ if( position && ( position == CSS_POSITION_ABSOLUTE || position == CSS_POSITION_RELATIVE ) ) { if( AGT_NNAVIGATOR_4 ) { this.event( "position", position ); } else { this.event( "style", "position:" + position ); } } } /** * Switch ON/OFF the auto output variable. */ function _pce_layers_stealth( stealth ) { if( stealth == false ) { this.autowrite = true; } else if( stealth == true ) { this.autowrite = false; } } /** * Define internal CSS class name of new defined layers. */ function _pce_layers_classid( class_id ) { if( class_id ) { this.layer_class = class_id; } } /** * Define internal CSS sryles for new defined layers. * WARNING: NEVER PASS "VISIBILITY:HIDE" TO NETSCAPE NAVIGATOR 4.X AS IT'LL * FREEZE. THE CURRENT IMPLEMENTATION AUTOMATICALLY FIXES THIS USING THE * INTERNAL "LAYER_AUTOHIDE" VARIABLE. */ function _pce_layers_styles( styles ) { if( styles ) { this.layer_styles = styles; } } /** * Define internal CSS sryles for new defined layers. */ function _pce_layers_corner( corner ) { if( corner && ( corner == POS_TOP_LEFT || corner == POS_TOP_RIGHT || corner == POS_BOTTOM_LEFT || corner == POS_BOTTOM_RIGHT || corner == POS_CENTRALIZE ) ) { this.relativeness = corner; } } /** * Given an unknown layer_id (INT or STRING), this will get always its name. */ function _pce_layers_id( layer_id ) { if( layer_id != 0 && !layer_id ) { layer_id = this.layer_last; } if( parseInt( layer_id ) >= 0 ) { layer_id = this.layer_list[ layer_id ]; } return layer_id; } /** * Given an unknown layer_id (INT or STRING), this will get always its number. */ function _pce_layers_s2id( layer_id ) { if( layer_id != 0 && !layer_id ) { layer_id = this.layer_last; } if( parseInt( layer_id ) >= 0 ) { return parseInt( layer_id ); } for( i = 0; i < this.layer_count; i++ ) { if( layer_id == this.layer_list[ i ] ) { return i; } } return layer_id; } /** * Define an event to be incorporated into new defined layers. */ function _pce_layers_event( event, todo ) { if( !event || !todo ) { return; } this.layer_events[ this.layer_ev_count ] = new Array( 2 ); this.layer_events[ this.layer_ev_count ][ 0 ] = event; this.layer_events[ this.layer_ev_count ][ 1 ] = todo; this.layer_ev_count++; return; } /** * Clears previously defined events for new layers. */ function _pce_layers_clear( ) { this.layer_ev_count = 0; } /** * Define a new layer. 'HTML' includes any output to be written to page. */ function _pce_layers_define( HTML, layer_id, width, height ) { /** * If no ID was given for this layer, stamp it with a pre-defined name. */ if( !( layer_id > 0 ) ) { layer_id = this.layer_autoid + this.layer_count; } /** * If no width or height were reported, use -1 as default. */ if( !( width && width > 0 ) ) { width = -1; } if( !( height && height > 0 ) ) { height = -1; } /** * Add this later to an array that holds names of defined layers. */ this.layer_list[ this.layer_count ] = layer_id; this.layer_contents[ this.layer_count ] = HTML; /** * Save layer dimenstions as sent by user. */ this.layer_dims[ this.layer_count ] = new Array( 2 ); this.layer_dims[ this.layer_count ][ 0 ] = width; this.layer_dims[ this.layer_count ][ 1 ] = height; this.layer_count++; str_layer = ( AGT_NNAVIGATOR_4 )? "layer": "div"; str_html = '' + "\n"; str_html += '<' + str_layer; if( layer_id ) { str_html += ' id="' + layer_id + '"'; } if( this.layer_class ) { str_html += ' class="' + this.layer_class + '"'; } if( this.layer_styles ) { str_html += ' style="clip(auto);' + this.layer_styles + '"'; } if( this.layer_ev_count > 0 ) { for( var i = 0; i < this.layer_ev_count; i++ ) { str_html += ' ' + this.layer_events[ i ][ 0 ].toLowerCase( ) + '="' + this.layer_events[ i ][ 1 ] + '"'; } } /** * In Netscape 6.2, the visibility MUST be last in the chain of styles, * else output will be incorrect. */ if( this.layer_autohide == CSS_VISIBILITY_HIDE ) { str_html += ( AGT_NNAVIGATOR_4 )? ' visibility="': ' style="visibility:'; str_html += CSS_VISIBILITY_HIDE + '"'; } str_html += '>
| ' + HTML + ' |