//|----------------------------------
//| DHTML Functions
//|----------------------------------
function ToggleObjectVisibility(objectId) {
var styleObject = GetStyleObject(objectId);
if (styleObject) {
if (styleObject.display == "block")
{ styleObject.display = "none"; }
else
{ styleObject.display = "block"; }
return true;
} else {
return false;
}
}
function ChangeObjectVisibility(objectId, newVisibility) {
var styleObject = GetStyleObject(objectId);
if (styleObject) {
styleObject.display = newVisibility;
return true;
} else {
return false;
}
}
function GetStyleObject(objectId) {
if(document.getElementById && document.getElementById(objectId)) {
return document.getElementById(objectId).style;
}
else if (document.all && document.all(objectId)) {
return document.all(objectId).style;
}
else if (document.layers && document.layers[objectId]) {
return document.layers[objectId];
} else {
return false;
}
}
function GetObject(objectId) {
if(document.getElementById && document.getElementById(objectId)) {
return document.getElementById(objectId);
}
else if (document.all && document.all(objectId)) {
return document.all(objectId);
}
else if (document.layers && document.layers[objectId]) {
return document.layers[objectId];
} else {
return false;
}
}
function initHighlight() {
if (!document.getElementsByTagName)
{ return; }
var arrInputFields = document.getElementsByTagName("input");
var arrTextAreas = document.getElementsByTagName("textarea");
for (var i=0; i
"';
sPopupThmFileURL = sThmFileURL;
PopupObject(event,"ThumbNailPopup");
}
}
function HideThumbNailPopup() {
bHidingThumbNailPopup = true;
setTimeout("if (bHidingThumbNailPopup) { ChangeObjectVisibility('ThumbNailPopup', 'none'); bHidingThumbNailPopup = false; sPopupThmFileURL = ''; }",100);
}
//|----------------------------------
//| Form Handling Functions
//|----------------------------------
function CheckTextArea(oTextArea, nMaxLength, sCharsLeftDiv) {
if (oTextArea.value.length > nMaxLength)
{
oTextArea.value = oTextArea.value.substring(0,nMaxLength);
alert('You have reached the maximum character limit.');
}
var CharsLeft = GetObject(sCharsLeftDiv);
if (CharsLeft)
{ CharsLeft.innerHTML = '(' + nMaxLength + ' characters maximum. ' + (nMaxLength-oTextArea.value.length) + ' characters left.'; }
}
function getCheckedValue(radioObj) {
if(!radioObj)
return "";
var radioLength = radioObj.length;
if(radioLength == undefined)
if(radioObj.checked)
return radioObj.value;
else
return "";
for(var i = 0; i < radioLength; i++) {
if(radioObj[i].checked) {
return radioObj[i].value;
}
}
return "";
}
function setCheckedValue(radioObj, newValue) {
if(!radioObj)
return;
var radioLength = radioObj.length;
if(radioLength == undefined) {
radioObj.checked = (radioObj.value == newValue.toString());
return;
}
for(var i = 0; i < radioLength; i++) {
radioObj[i].checked = false;
if(radioObj[i].value == newValue.toString()) {
radioObj[i].checked = true;
}
}
}
//|----------------------------------
//| Window Handling Functions
//|----------------------------------
function WindowReload(returnVal) {
window.document.reload();
}
function getViewportHeight() {
if (window.innerHeight!=window.undefined) return window.innerHeight;
if (document.compatMode=='CSS1Compat') return document.documentElement.clientHeight;
if (document.body) return document.body.clientHeight;
return window.undefined;
}
function getViewportWidth() {
var offset = 17;
var width = null;
if (window.innerWidth!=window.undefined) return window.innerWidth;
if (document.compatMode=='CSS1Compat') return document.documentElement.clientWidth;
if (document.body) return document.body.clientWidth;
}
function getScrollTop() {
if (self.pageYOffset) // all except Explorer
{
return self.pageYOffset;
}
else if (document.documentElement && document.documentElement.scrollTop)
// Explorer 6 Strict
{
return document.documentElement.scrollTop;
}
else if (document.body) // all other Explorers
{
return document.body.scrollTop;
}
}
function getScrollLeft() {
if (self.pageXOffset) // all except Explorer
{
return self.pageXOffset;
}
else if (document.documentElement && document.documentElement.scrollLeft)
// Explorer 6 Strict
{
return document.documentElement.scrollLeft;
}
else if (document.body) // all other Explorers
{
return document.body.scrollLeft;
}
}
function LaunchLink(sLink) {
this.open(Unscramble(sLink), "Win" + Math.floor(Math.random()*10000), "toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes,status=yes");
}
function BrowseToLink(sLink) {
var sUnscrambled = Unscramble(sLink);
window.status = "~" + sUnscrambled;
window.location.href = sUnscrambled;
window.status = "-" + window.location;
}
//|----------------------------------
//| AJAX Functions
//|----------------------------------
function GetXmlHttpObject() {
var xmlHttp=null;
try
{ xmlHttp=new XMLHttpRequest(); } // Firefox, Opera 8.0+, Safari
catch (e)
{
try
{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } // Internet Explorer
catch (e)
{ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }
}
return xmlHttp;
}
//|----------------------------------
//| String Formatting Functions
//|----------------------------------
function FilterString_ValidCharsOnly(sInput, sValidChars) {
var sChar, sOutput;
sOutput = "";
for (nChar = 0; nChar < sInput.length; nChar++)
{
sChar = sInput.charAt(nChar);
if (sValidChars.indexOf(sChar) >= 0)
{sOutput = sOutput + sChar;}
}
return sOutput;
}
function FilterString_ValidCharsOnly_WithGapChar(sInput, sValidChars, sGapChar) {
var sChar, sOutput;
sOutput = "";
for (nChar = 0; nChar < sInput.length; nChar++)
{
sChar = sInput.charAt(nChar);
if (sValidChars.indexOf(sChar) >= 0)
{sOutput = sOutput + sChar;}
else
{sOutput = sOutput + sGapChar;}
}
while (sOutput.indexOf(sGapChar + sGapChar) >= 0)
{ sOutput = ReplaceAll(sOutput, sGapChar + sGapChar, sGapChar); }
return sOutput;
}
function ReplaceAll(sStringToSearch, sStringToFind, sReplaceWith) {
var sOutput;
// var nIteration = 1;
// var nFoundAtIndex = sOutput.indexOf(sStringToFind);
sOutput = sStringToSearch.replace(eval("/" + sStringToFind + "/gi"), sReplaceWith);
/*
while (nFoundAtIndex != -1 && nIteration < 1000){
sOutput = sOutput.replace(sStringToFind, sReplaceWith);
nFoundAtIndex = sOutput.indexOf(sStringToFind);
nIteration++;
if (nIteration = 997)
{ alert("hit 1000 iterations replacing " + sStringToFind +
" with " + sReplaceWith +
" in " + sStringToSearch) }
}
*/
return( sOutput );
}
function PadString(sStringToPad, nLength, sPadChars, bPadOnLeft) {
var sOutput = "";
sOutput = sStringToPad;
while (sOutput.length < nLength)
{
if (bPadOnLeft)
{ sOutput = sPadChars + sOutput; }
else
{ sOutput = sOutput + sPadChars; }
}
return sOutput;
}
function USW(sScrambled) {
document.write(Unscramble(sScrambled));
}
function Unscramble(sScrambled) {
var sUnscrambled = "";
for (var i=0; i" + Unscramble(sScrambledEmail) + "");
}
function FixFileName(sFileName) {
var sOutput, sValidChars;
sValidChars = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-."
sOutput = ReplaceAll(sFileName, "&", "and");
sOutput = FilterString_ValidCharsOnly_WithGapChar(sOutput, sValidChars, "_");
while (sOutput.indexOf("--") >= 0) { sOutput = ReplaceAll(sOutput, "--", "-"); }
while (sOutput.indexOf("..") >= 0) { sOutput = ReplaceAll(sOutput, "..", "."); }
return sOutput;
}
function EscapeHTML(sInput) {
var sOutput = "";
sOutput = sInput.toString();
sOutput = ReplaceAll(sOutput, "&", "&");
sOutput = ReplaceAll(sOutput, "<", "<");
sOutput = ReplaceAll(sOutput, ">", ">");
sOutput = ReplaceAll(sOutput, "\"", """);
sOutput = ReplaceAll(sOutput, "'", "'");
return sOutput;
}
function GetThumbNailPath(sThmFile) {
var sOutput = "";
n_Pos = sThmFile.indexOf("_");
if (sThmFile.substring(0,3).toLowerCase() == "thm")
{
if ( n_Pos >= 4 )
{
sThmID = sThmFile.substring(3, n_Pos);
if (!isNaN(sThmID))
{
nThmID = parseInt(sThmID);
sThousand = (Math.floor(nThmID/1000)*1000).toString();
sOutput = "" + PadString(sThousand, 9, "0", true) + "/";
}
}
}
return sOutput;
}
//|----------------------------------
//| String Trimming
//|--------------------------------
function Trim(sInput) {
var sOutput, sCharactersToTrim;
sCharactersToTrim = " "
sOutput = TrimChars(sInput, sCharactersToTrim);
return sOutput;
}
function TrimChars(sInput, sCharactersToTrim) {
var sOutput;
sOutput = TrimCharsRight(TrimCharsLeft(sInput, sCharactersToTrim), sCharactersToTrim);
return sOutput;
}
function TrimCharsLeft(sInput, sCharactersToTrim) {
var sOutput;
sOutput = GetStr(sInput);
while (sCharactersToTrim.indexOf(sOutput.substring(0,1)) >= 0)
{ sOutput = sOutput.substring(1); }
return sOutput;
}
function TrimCharsRight(sInput, sCharactersToTrim) {
var sOutput;
sOutput = GetStr(sInput);
while (sCharactersToTrim.indexOf(sOutput.substring(sOutput.length-2,sOutput.length-1)) >= 0)
{ sOutput = sOutput.substring(0,sOutput.length-2); }
return sOutput;
}
function TrimString(sInput, sStringToTrim) {
var sOutput;
sOutput = TrimStringRight(TrimStringLeft(sInput, sStringToTrim), sStringToTrim);
return sOutput;
}
function TrimStringLeft(sInput, sStringToTrim) {
var sOutput;
sOutput = GetStr(sInput);
while ( sOutput.substring(0,sStringToTrim.length).toLowerCase() == sStringToTrim.toLowerCase() )
{ sOutput = sOutput.substring(sStringToTrim.length); }
return sOutput;
}
function TrimStringRight(sInput, sStringToTrim) {
var sOutput;
sOutput = GetStr(sInput);
while ( sOutput.substring(sOutput.length-sStringToTrim.length-1,sOutput.length-1).toLowerCase() == sStringToTrim.toLowerCase() )
{ sOutput = sOutput.substring(0, sOutput.length-sStringToTrim.length-1); }
return sOutput;
}
//|---------------------------------------------------------------------------
//| Type Conversion Functions
//|---------------------------------------------------------------------------
function GetNumeric(vInput) {
var nOutput = 0;
if (!isNaN(vInput))
{
try { nOutput = parseFloat(vInput); }
catch (e) { nOutput = 0; }
}
return nOutput;
}
function GetStr(vInput) {
var sOutput = "";
try { sOutput = vInput.toString(); }
catch (e) { sOutput = ""; }
return sOutput;
}
function GetInt(vInput) {
var nOutput = 0;
if (!isNaN(vInput))
{
try { nOutput = vInput.toInt(); }
catch (e) { nOutput = 0; }
}
return nOutput;
}
function GetBit(vInput) {
var nOutput;
nOutput = GetInt(vInput);
if (nOutput > 0) { nOutput = 1; }
return nOutput;
}
//|----------------------------------
//| Event Handling Functions
//|----------------------------------
function addEvent(oObject, sEventType, oListenerFunction) {
if (oObject.addEventListener)
{
oObject.addEventListener(sEventType, oListenerFunction, false);
return true;
}
else if (oObject.attachEvent)
{
var r = oObject.attachEvent("on"+sEventType, oListenerFunction);
return r;
}
else
{ return false; }
}
function removeEvent(oObject, sEventType, oListenerFunction, useCapture) {
if (oObject.removeEventListener)
{
oObject.removeEventListener(sEventType, oListenerFunction, useCapture);
return true;
}
else if (oObject.detachEvent)
{
var r = oObject.detachEvent("on" + sEventType, oListenerFunction);
return r;
}
}
function addEventWithCache( oObject, sEventType, oListenerFunction ) {
if (oObject.addEventListener)
{
oObject.addEventListener( sEventType, oListenerFunction, false );
EventCache.add(oObject, sEventType, oListenerFunction);
}
else if (oObject.attachEvent)
{
oObject["e" + sEventType + oListenerFunction] = oListenerFunction;
oObject[sEventType + oListenerFunction] = function() { oObject["e" + sEventType + oListenerFunction]( window.event ); }
oObject.attachEvent( "on" + sEventType, oObject[sEventType + oListenerFunction] );
EventCache.add(oObject, sEventType, oListenerFunction);
}
else
{
oObject["on" + sEventType] = oObject["e" + sEventType + oListenerFunction];
}
}
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function'){
window.onload = func;
} else {
window.onload = function(){
oldonload();
func();
}
}
}
//|----------------------------------
//| Global Page Init
//|----------------------------------
addLoadEvent(initHighlight);
var EventCache = function(){
var listEvents = [];
return {
listEvents : listEvents,
add : function(node, sEventName, fHandler){
listEvents.push(arguments);
},
flush : function(){
var i, item;
for(i = listEvents.length - 1; i >= 0; i = i - 1){
item = listEvents[i];
if(item[0].removeEventListener){
item[0].removeEventListener(item[1], item[2], item[3]);
};
if(item[1].substring(0, 2) != "on"){
item[1] = "on" + item[1];
};
if(item[0].detachEvent){
item[0].detachEvent(item[1], item[2]);
};
item[0][item[1]] = null;
};
}
};
}();
addEventWithCache(window,'unload',EventCache.flush);
bHidingThumbNailPopup = false;
sPopupThmFileURL = "";