function getChildNodeValue(parentNode,childNodeName){if(parentNode&&parentNode.getElementsByTagName(childNodeName)[0]&&parentNode.getElementsByTagName(childNodeName)[0].firstChild&&parentNode.getElementsByTagName(childNodeName)[0].firstChild.nodeValue){return parentNode.getElementsByTagName(childNodeName)[0].firstChild.nodeValue;}else{return'';}}
function templateReplace(item,str){str=unescape(str);var regex=/{REPLACE_(\w+)}/g;var matches=(str.match(regex))?str.match(regex):[];for(var i=0;i<matches.length;i++){var name=matches[i].replace(regex,"$1");var value=getChildNodeValue(item,name);str=str.replace(matches[i],value);}
str=str.replace(/pstyle/g,'style');return str;}
function getTarget(e){var targ;if(!e)var e=window.event;if(e.target)targ=e.target;else if(e.srcElement)targ=e.srcElement;if(targ.nodeType==3)
targ=targ.parentNode;return targ;}
function associateObjWithEvent(obj,methodName){return(function(e){e=e||window.event;return obj[methodName](e,this);});}
function findPos(obj){var curleft=curtop=0;if(obj.offsetParent){curleft=obj.offsetLeft;curtop=obj.offsetTop;while(obj=obj.offsetParent){curleft+=obj.offsetLeft;curtop+=obj.offsetTop;}}
return[curleft,curtop];}
function stringToXML(str){var xmlobject=null;str=str.replace(/^\<\!\-\-/,'').replace(/\-\-\>/,'')
if(document.all&&typeof DOMParser!='function'){xmlobject=new ActiveXObject("Microsoft.XMLDOM");xmlobject.async="false";xmlobject.loadXML(str);}else{var xmlstring='<?'+'xml version="1.0"?>'+str;xmlobject=(new DOMParser()).parseFromString(xmlstring,"text/xml");}
return xmlobject;}
function onImgErrorLoadImg(elem,newSrc){try{elem.src=newSrc;elem.onerror=null;}catch(e){}}