/* FILE: global.js.php PURPOSE: global functions */ // // global variables // var root = ''; function getEl(elementId) { // // Name: getEl // Purpose: shortcut for document.getElementById // Parameters: // elementId (string): id of the element to retrieve // Details: none // if (arguments.length > 1) { var top_parent = arguments[1]; return top_parent.document.getElementById(elementId); } else return document.getElementById(elementId); } function PreloadRolloverImages(arrImages) { // // Name: PreloadRolloverImages // Purpose: to preload images // Parameters: // arrImages (array): an array of path/image strings // Details: it is assumed that the format of the images to preload are: // Normal Image : imagename_n.gif // Hovered Image: imagename_o.gif // Pressed Image: imagename_d.gif // var i; // // Make sure the parameter passed in is an array // if (typeof(arrImages) != "object" || !arrImages.length) { alert('Usage: PrloadRolloverImages(array)'); return false; } for (i=0; i< images.length; i++) { eval('var imgo' + i + ' = new Image(); imgo' + i + '.src="' + images[i] + '_o.gif";'); eval('var imgd' + i + ' = new Image(); imgd' + i + '.src="' + images[i] + '_d.gif";'); } } function ImageChange(image, destination) { image.src = destination; } function printfire(message) { if (document.createEvent) { //console.debug(message); } } function PopUp(message) { // // Function: PopUp // Purpose: create a pop up with a message // Parameters: // message (string): message to be displayed in pop-up // // // retrieve location of mouse pointer // // // create box at pointer location // } function Message(title, message) { // // Function: Message // Purpose: show a message panel // Parameters: // title (string): title to be displayed at top of message // message (string): message to be displayed // // location.href = root + "/panels/pnlMessage.php?title=" + URLencode(title) + "&message=" + URLencode(message); getEl('pnlCenter', window.top).src = 'panels/pnlMessage.php?title=' + URLencode(title) + '&message=' + URLencode(message); } function URLencode(sStr) { return escape(sStr). replace(/\+/g, '%2B'). replace(/\"/g,'%22'). replace(/\'/g, '%27'). replace(/\//g,'%2F'); }