function DEBUG()
{ var a=DEBUG.arguments; for(i=0;i<a.length;i++)
{ ei("DEBUG").innerHTML = a[i].toSource();}
}
function isDef()
{ for(var i=0;i<arguments.length;i++)
{ if('undefined' == typeof(arguments[i]))
return false; if(null == arguments[i])
return false;}
return true;}
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
var dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1
var ie=(document.all)?1:0; var ns6=(document.getElementById&&!document.all)?1:0; function getPageX(e)
{ var x = 0; while (e)
{ if( e.offsetLeft )
x += e.offsetLeft; e = e.offsetParent ? e.offsetParent: null;}
return x;}
function getPageY(e)
{ var y = 0; while (e)
{ if( e.offsetTop )
y += e.offsetTop; e = e.offsetParent ? e.offsetParent: null;}
return y;}
function getOffsetX(a_e)
{ var offsetX, pageX; var oe; var e = a_e || window.event; if(!e) return null; if(e.target)
{ oe = e.target;}
else if(e.srcElement)
{ oe = e.srcElement;}
if(e.pageX)
{ pageX = e.pageX;}
else if(e.clientX)
{ pageX = e.clientX + e.scrollLeft;}
if(e.offsetX)
{ offsetX = e.offsetX;}
else if(e.layerX)
{ offsetX = e.layerX;}
else
{ offsetX = pageX - getPageX(oe);}
return offsetX;}
function getOffsetY(a_e)
{ var offsetY, pageY; var oe; var e = a_e || window.event; if(!e) return null; if(e.target)
{ oe = e.target;}
else if(e.srcElement)
{ oe = e.srcElement;}
if(e.pageX)
{ pageX = e.pageX;}
else if(e.clientX)
{ pageX = e.clientY + e.scrollTop;}
if(e.offsetX)
{ offsetY = e.offsetY;}
else if(e.layerY)
{ offsetY = e.layerY;}
else
{ offsetY = pageY - getPageY(oe);}
return offsetY;}
function ei(a_szId)
{ if(a_szId == null)
{ return null;}
if('string' != typeof(a_szId))
{ return a_szId;}
if(document.getElementById && document.getElementById(a_szId))
{ return document.getElementById(a_szId);}
else if (document.all && document.all(a_szId))
{ return document.all(a_szId);}
else if (document.layers && document.layers[a_szId])
{ return document.layers[a_szId];}
else
{ return null;}
}
function en(a_szName)
{ if(name == null)
{ return null;}
if('string' != typeof(a_szName))
{ return a_szName;}
if(document.getElementsByName && document.getElementsByName(a_szName))
{ return document.getElementsByName(a_szName);}
else if (document.all && document.all(a_szName))
{ return document.all(a_szName);}
else if (document.layers && document.layers[a_szName])
{ return document.layers[a_szName];}
else
{ return null;}
}
function et(a_szTag)
{ return document.getElementsByTagName(a_szTag)
}
function etn(a_szTag, a_szName)
{ var oe = et(a_szTag); var oCollection = new Array(); var szNameValue, iCollection; for(i = 0,iCollection = 0; i < elem.length; i++)
{ szNameValue = oe[i].getAttribute("name"); if(szNameValue == a_szName)
{ oCollection[iCollection] = oe[i]; iCollection++;}
}
return oCollection;}
function etc(a_szTag, a_szClassName)
{ var oElements = et(a_szTag); var oCollection = new Array(); var szClassName, iCollection; for(var i = 0, iCollection = 0; i < oElements.length; i++)
{ szClassName = oElements[i].className; if(szClassName == a_szClassName)
{ oCollection[iCollection] = oElements[i]; iCollection++;}
}
return oCollection;}
function eta(a_szTag, a_szAttribute, a_szValue)
{ var oElements = et(a_szTag); var oCollection = new Array(); var iCollection, szValue; for(var i = 0,iCollection = 0; i < oElements.length; i++)
{ szValue = oElements[i].getAttribute(a_szAttribute); if(szValue == a_szValue)
{ oCollection[iCollection] = oElements[i]; iCollection++;}
}
return oCollection;}
function createAnElement(a_szTag, a_arrTagAttr)
{ var oe = document.createElement(a_szTag); for(oTagAttr in a_arrTagAttr)
{ oe.setAttribute(oTagAttr,a_arrTagAttr[oTagAttr]); if(oTagAttr == "style")
{ var aStyles = String(a_arrTagAttr[oTagAttr]).split(";"); for(var i = 0; i < aStyles.length; i++)
{ var aParts = String(aStyles[i]).split(':'); try
{ oe.style.setAttribute(aParts[0],aParts[1],0); oe.style[aParts[0]] = aParts[1];}
catch(e)
{ }
}
}
}
return oe;}
function appendAnElement(a_oContainer, a_szTag, a_arrTagAttr)
{ if(!a_oContainer) return null; if(!a_szTag) return null; var oe = createAnElement(a_szTag, a_arrTagAttr); a_oContainer.appendChild(oe); return oe;}
function insertAnElementBefore(a_oElement, a_szTag, a_arrTagAttr)
{ if(!a_oElement) return null; var oe = createAnElement(a_szTag, a_arrTagAttr); if(a_oElement.firstChild)
{ a_oElement.insertBefore(oe, a_oElement.firstChild);}
else
{ a_oElement.appendChild(oe);}
return oe;}
function getElementFromEvent(a_e)
{ a_e = a_e || window.event; if('undefined' != typeof(a_e.srcElement))
{ return a_e.srcElement;}
else if('undefined' != typeof(a_e.target))
{ return a_e.target;}
return null;}
function preloadImage(a_szImageSrc)
{ return preloadImages(a_szImageSrc);}
function preloadImages()
{ var d=document; var arrIndex = null; if(d.images)
{ if(!d.preloadedImages)
{ d.preloadedImages = new Array();}
arrIndex = d.preloadedImages.length; var a = arguments; for(var i=0; i < a.length; i++)
{ d.preloadedImages[arrIndex] = new Image(); d.preloadedImages[arrIndex].src = a[i].toLowerCase(); arrIndex++;}
}
return arrIndex;}
function arePreloadedImagesLoaded()
{ var d=document; if(d.preloadedImages)
{ for(var i = 0; i < d.preloadedImages.length; i++)
{ if(!d.preloadedImages[i].complete)
{ return false;}
}
}
return true;}
function getPreloadedImage(a_szImageSrc)
{ var d=document; if(d.images)
{ if(!d.preloadedImages)
{ return null;}
for(var i=0; i < d.preloadedImages.length; i++)
{ if(a_szImageSrc.toLowerCase() == d.preloadedImages[j].src)
{ return d.preloadedImages[j];}
}
}
return null;}
function getAlpha(a_oElement)
{ if(!a_oElement) return null; var iAlpha = null; if(a_oElement.filters && a_oElement.filters.alpha)
{ iAlpha = a_oElement.filters.alpha.opacity;}
else
{ if(a_oElement.style.MozOpacity)
{ iAlpha = parseInt(a_oElement.style.MozOpacity * 100);}
}
if(iAlpha)
{ if(iAlpha < 0)
{ iAlpha = 0;}
if(iAlpha > 100)
{ iAlpha = 100;}
}
return iAlpha;}
function setAlpha(a_oElement,a_iNewAlpha)
{ if(!a_oElement) return false; if(a_iNewAlpha > 100)
{ a_iNewAlpha = 100;}
else if(a_iNewAlpha < 0)
{ a_iNewAlpha = 0;}
if(a_oElement.filters && a_oElement.filters.alpha)
{ a_oElement.filters.alpha.opacity = a_iNewAlpha; return true;}
else if(a_oElement.style.MozOpacity)
{ a_oElement.style.MozOpacity = a_iNewAlpha/100; return true;}
return false;}
function getMouseX(a_e)
{ var e = a_e || window.event; if(!e) return null; if(e.clientX)
{ return e.clientX + document.body.scrollLeft;}
else
{ return e.pageX;}
}
function getMouseY(a_e)
{ var e = a_e || window.event; if(!e) return null; if(e.clientY)
{ return e.clientY + document.body.scrollTop;}
else
{ return e.pageY;}
}
function trimLeft(a_szString, a_szSubString, a_optCount)
{ if(a_szString)
{ if(null == a_szSubString)
{ a_szSubString = ' ';}
var iCount = 0; while(0 == a_szString.indexOf(a_szSubString))
{ a_szString = a_szString.substring(a_szSubString.length,a_szString.length); iCount++; if(a_optCount)
{ if(iCount >= a_optCount)
{ break;}
}
}
}
return a_szString;}
function trimRight(a_szString, a_szSubString, a_optCount)
{ if(a_szString)
{ if(null == a_szSubString)
{ a_szSubString = ' ';}
var iDiff = a_szString.length - a_szSubString.length; var iCount = 0; while(a_szString.lastIndexOf(a_szSubString) == iDiff)
{ a_szString = a_szString.substring(0,a_szString.length-a_szSubString.length); iDiff = a_szString.length - a_szSubString.length; iCount++; if(a_optCount)
{ if(iCount >= a_optCount)
{ break;}
}
}
}
return a_szString;}
function trim(a_szString, a_szSubString)
{ a_szString = trimLeft(a_szString, a_szSubString); return trimRight(a_szString, a_szSubString);}
function toggleCheckbox(a_szCheckboxID)
{ var oe = ei(a_szCheckboxID); if(oe && (null != oe.checked) )
{ oe.checked = !oe.checked;}
}
function selectRadio(a_szRadioID)
{ var oe = ei(a_szRadioID); if(oe && (null != oe.checked) )
{ oe.checked = true;}
}
function getPathInfo(a_szFullPath)
{ if(!a_szFullPath) return null; var pathInfo = new Object(); pathInfo.fullpath = a_szFullPath; pathInfo.ext = a_szFullPath.toString().match(/.\w{1,5}$/).toString(); pathInfo.basename = a_szFullPath.toString().match(/\w+.\w{1,5}$/).toString(); pathInfo.filename = trimRight(pathInfo.basename,pathInfo.ext,1); pathInfo.ext = trimLeft(pathInfo.ext,'.'); pathInfo.dirname = trimRight(a_szFullPath,pathInfo.basename,1); return pathInfo;}
function getParent(a_oe)
{ if(!a_oe) return null; if(a_oe.parentNode)
{ return a_oe.parentNode;}
else if(a_oe.parentElement)
{ return a_oe.parentElement;}
return null;}
function getClientWidth()
{ var iWidth = 0; if(document.compatMode == 'CSS1Compat' && !window.opera && document.documentElement && document.documentElement.clientWidth)
{ iWidth = document.documentElement.clientWidth;}
else if(document.body && document.body.clientWidth)
{ iWidth = document.body.clientWidth;}
else if(isDef(window.innerWidth,window.innerHeight,document.height))
{ iWidth = window.innerWidth; if(document.height > window.innerHeight)
{ iWidth -= 16;}
}
return iWidth;}
function getClientHeight()
{ var iHeight = 0; if(document.compatMode == 'CSS1Compat' && !window.opera && document.documentElement && document.documentElement.clientHeight)
{ iHeight = document.documentElement.clientHeight;}
else if(document.body && document.body.clientHeight)
{ iHeight = document.body.clientHeight;}
else if( isDef(window.innerWidth,window.innerHeight,document.width) )
{ iHeight = window.innerHeight; if(document.width > window.innerWidth)
{ iHeight -=16;}
}
return iHeight;}
function getStyle(a_oe, a_szCssPropertyName, a_emType)
{ if(!a_oe) return null; if(!a_szCssPropertyName) return null; var oStyle, szPropertyValue = 'undefined'; if(document.defaultView && document.defaultView.getComputedStyle)
{ oStyle = document.defaultView.getComputedStyle(a_oe,null); if(oStyle)
{ szPropertyValue = oStyle.getPropertyValue(a_szCssPropertyName);}
}
else if(a_oe.currentStyle)
{ var arrCssPropertyName = a_szCssPropertyName.split('-'); var szCssPropertyName = arrCssPropertyName[0]; for(var i = 1; i < arrCssPropertyName.length; i++)
{ chFirstChar = arrCssPropertyName[i].charAt(0); szCssPropertyName += arrCssPropertyName[i].replace(chFirstChar, chFirstChar.toUpperCase());}
szPropertyValue = a_oe.currentStyle[szCssPropertyName];}
else
{ return null;}
if(a_emType)
{ switch(a_emType.toLowerCase())
{ case 'int':
return parseInt(szPropertyValue); break; case 'float':
return parseInt(szPropertyValue);}
}
return szPropertyValue;}
