/********1*********2*********3*********4*********5*********6*********7*********8
 * Module:   klUtilities.js Version 1.0
 *******************************************************************************
 * Description: Set of utilities common to K&L Scripts.
 *******************************************************************************
 * Requirements: DOM Compliant browser with enabled Javascript.
 *******************************************************************************
 * Copyright (c) 2002, K&L Design Productions, All Rights Reserved.
 *
 * You may not use the code contained in this file without the express written
 * permission of K&L Productions.
 * You may not redistribute, sell, or offer this file for download, in any form
 * or on any medium, without the express written permission of K&L Productions.
 * This includes, but is not limited to, adding it to script archives or
 * bundling and distributing it with other scripts/software.
 * You agree to retain the credits and copyright notice in the source code when
 * including it in your own pages.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHOR OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 ******************************************************************************/
var browser='';var version=0.0;var str='';var navSummary='';function testBrowser(){if(!navigator){browser='nc';return;}if(navigator.userAgent.indexOf('Opera')>0){browser='op';return;}if(navigator.appName=='Netscape'){version=parseFloat(navigator.appVersion);if(version < 5.0){browser='ns';return;}}if(navigator.appName=='Microsoft Internet Explorer'){browser='ie';str=navigator.appVersion;str=str.substring(str.indexOf('MSIE')+4,str.length);version=parseFloat(str);return;}if(navigator.product){if(navigator.product=='Gecko'){browser='gecko';releasedate=navigator.productSub;version=parseFloat(releasedate.replace(/(\d{4})(\d{2})(\d{2})/,'$1.$2$3'));}else{browser='??';}return;}browser='??';return;}testBrowser();function getStyle(name){for(i=0;i<document.styleSheets.length;i++){for(j=0;j<document.styleSheets[i].cssRules.length;j++){if(document.styleSheets[i].cssRules[j].selectorText==name)return document.styleSheets[i].cssRules[j].style;}}return null;}APF_WIDTH=2;APF_HEIGHT=4;function fixIEAbsPos(divID,dir){if(typeof divID=='string')div=document.getElementById(divID);else div=divID;if(div.parentElement.tagName=='BODY'){parentWidth=document.body.clientWidth;parentHeight=document.body.clientHeight;}else{parentWidth=div.parentElement.offsetWidth;parentHeight=div.parentElement.offsetHeight;}if((dir & APF_WIDTH)> 0){divWidth=parentWidth-div.offsetLeft-parseInt(div.currentStyle.right);div.style.width=divWidth>0?divWidth:'1'+'px';}if((dir & APF_HEIGHT)> 0){divHeight=parentHeight-div.offsetTop-parseInt(div.currentStyle.bottom);div.style.height=divHeight>0?divHeight:'1'+'px';}return;}function fixIEXHTMLAbsPos(divID,dir){if(typeof divID=='string')div=document.getElementById(divID);else div=divID;if(version<6.0){if(div.parentElement.tagName=='BODY'){parentWidth=document.body.clientWidth;parentHeight=document.body.clientHeight;}else{parentWidth=div.offsetParent.clientWidth;parentHeight=div.offsetParent.clientHeight;}}else{if(div.parentElement.tagName=='BODY'){parentWidth=document.documentElement.clientWidth;parentHeight=document.documentElement.clientHeight;}else{parentWidth=div.offsetParent.clientWidth;parentHeight=div.offsetParent.clientHeight;}}if((dir & APF_WIDTH)> 0){divWidth=parentWidth-div.offsetLeft-parseInt(div.currentStyle.right);div.style.width=divWidth>0?divWidth:'1'+'px';}if((dir & APF_HEIGHT)> 0){divHeight=parentHeight-div.offsetTop-parseInt(div.currentStyle.bottom);div.style.height=divHeight>0?divHeight:'1'+'px';}}function installEventHandler(element,event,handler){if(element.addEventListener){element.addEventListener(event,handler,true);return true;}else{if(element.attachEvent){event='on'+event;element.attachEvent(event,handler);return true;}else{return false;}}}function getTarget(e){return e.currentTarget ? e.currentTarget :(e.srcElement ? e.srcElement : null);}function parseParameters(object,definitions,parameters){paramEntries=parameters.split(';');for(var i=0;i<paramEntries.length;i++){paramEntry=paramEntries[i].split(':');if(paramEntry.length==2){paramName=paramEntry[0].replace(/^\s*([\w-]+)\s*$/,'$1');if(definitions[paramName]){res=definitions[paramName].exec(paramEntry[1]);if(res && res[1])object[convertCSSName(paramName)]=res[1];}}}return;}function convertCSSName(cssName){sn=cssName.split('-');rs=sn[0];for(var i=1;i<sn.length;i++)rs+=sn[i].replace(/^(\w)(\w*)$/,function(str,p1,p2,offset,s){return p1.toUpperCase()+p2;});return rs;}document.getElementsByClassName=function(clName){elements=document.body.getElementsByTagName('div');classElements=new Array();for(var i=0;i<elements.length;i++)if(elements[i].className==clName)classElements.push(elements[i]);return classElements;};function trim(str){return str.replace(/^\s+/,'').replace(/\s+$/,'');}function statusPrompt(text,duration){if(window.status!=null){window.status=text;if(duration >=0)setTimeout('window.status=""',duration);}}function getClientPosition(element,isDescendant){var pos=[0,0];if((isDescendant && element.currentStyle && element.currentStyle.position=='absolute')||(isDescendant && !element.currentStyle)|| !isDescendant){pos[0]=element.offsetTop;pos[1]=element.offsetLeft;}if(element.parentNode !=document.body){var pnpos=getClientPosition(element.offsetParent?element.offsetParent:element.parentNode,true);pos[0]+=pnpos[0];pos[1]+=pnpos[1];}return pos;}
