function findDOM(objectId){if(document.getElementById){return(document.getElementById(objectId));}
else if(document.all){return(document.all[objectId]);}
else if(document.layers){return(document.layers[objectId]);}
else{return(document.getElementById(objectId));}}
function findParentDOM(objectId){if(window.opener.document.getElementById){return(window.opener.document.getElementById(objectId));}
else if(window.opener.document.all){return(window.opener.document.all[objectId]);}
else if(window.opener.document.layers){return(window.opener.document.layers[objectId]);}
else{return(window.opener.document.getElementById(objectId));}}
function $DOM(obj){if(typeof(obj)=="string")obj=findDOM(obj);return obj;}
function $Exists(obj){try{if(typeof(obj)=="string"){try{var obj=document.getElementById(obj);return true;}catch(e){return false;}}
return true;}catch(e){return false;}}
try{if(!HTMLElement.innerText&&HTMLElement.textContent){HTMLElement.prototype.__defineGetter__("innerText",function(){return(this.textContent);});HTMLElement.prototype.__defineSetter__("innerText",function(txt){this.textContent=txt;});}}catch(e){}
try{if(!HTMLElement.children&&HTMLElement.childNodes){HTMLElement.prototype.__defineGetter__("children",function(){return(this.childNodes);});}}catch(e){}
try{if(!HTMLElement.attachEvent){HTMLElement.prototype.attachEvent=function(eventName,functionHandler){functionHandler._wrapHandler=function(e){window.event=e;functionHandler();return(e.returnValue);};this.addEventListener(eventName.substr(2),functionHandler._wrapHandler,false);};}}catch(e){}
try{if(!HTMLElement.detachEvent){HTMLElement.prototype.detachEvent=function(eventName,functionHandler){if(functionHandler._wrapHandler!=null)
this.removeEventListener(eventName.substr(2),functionHandler._wrapHandler,false);};}}catch(e){}
try{if(!Event.srcElement){Event.prototype.__defineGetter__("srcElement",function(){var node=this.target;while(node.nodeType!=1)
node=node.parentNode;if(node!=this.target)alert("Unexpected event.target!")
return node;});}}catch(e){}
var _thepopupwindow;function openWindow(theURL,winName,features){_thepopupwindow=window.open(theURL,winName,features);TestTheNewPopupWindow();}
function TestTheNewPopupWindow(){if(hasPopupBocker()){alert("An ATM popup window has been blocked by your popup blocker."+"\n\nThe window is not an advertisement. Try pressing the "+"\n'Ctrl' key when clicking or disable your popup blocker."+"\nThank you.");}}
function hasPopupBocker(){var test=window.open("","test","width=1,height=1,scrollbars=no,left=5000,top=5000");if(test==null||typeof(test)=="undefined"||test.closed==true){return true;}
try{test.close();}catch(vEx){return true;}
return false;}
function AlreadyPopped(){try{if(opener)
return true
else
return false;}catch(e){return false}}
function GoTo(url){window.location.href=url;}
function createCookie(name,value,days){if(days)
{var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}
else var expires="";document.cookie=name+"="+value+expires+"; path=/";}
function readCookie(name,getex){var nameEQ=name+"=";var ca=document.cookie.split(';');if(getex=="yes"){return document.cookie;}
else
{for(var i=0;i<ca.length;i++)
{var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}}
return"";}
function eraseCookie(name)
{createCookie(name,"",-1);}
function numValidate(obj){var num;num=findDOM(obj);if(isNaN(num.value)==true){num.value="";if(!isEmpty(num.name))
alert("The value of "+num.name+" is not a valid number.")
else
alert("The value of "+num.id+" is not a valid number.");}}
function delConfirm(url){var answer;answer=confirm("Delete this record?")
if(answer)
window.location.href=url}
function getAJAXResult(url,obj,apf){if(typeof(obj)=="string")obj=$DOM(obj);var xmlHttp=GetXmlHttpObject();if(xmlHttp==null){alert("Your browser does not support this action.\nIf using IE, ActiveX Objects may not be allowed.");return;}
xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){obj.innerHTML="";obj.innerHTML=xmlHttp.responseText;if(apf)eval(apf);}};xmlHttp.open("GET",url,true);xmlHttp.send(null);}
function postAJAXResult(url,parms,obj,apf){if(typeof(obj)=="string")obj=$DOM(obj);var xmlHttp=GetXmlHttpObject();if(xmlHttp==null){alert("Your browser does not support this action.\nIf using IE, ActiveX Objects may not be allowed.");return;}
xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){obj.innerHTML="";obj.innerHTML=xmlHttp.responseText;if(apf)eval(apf);}};xmlHttp.open("POST",url,true);xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlHttp.setRequestHeader("Content-length",parms.length);xmlHttp.setRequestHeader("Connection","close");xmlHttp.send(parms);}
function GetXmlHttpObject(){var objXMLHttp=null;try{objXMLHttp=new XMLHttpRequest();}
catch(e){try{objXMLHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){try{objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){return null;}}}
return objXMLHttp;}
function BuildParamString(objList,delimiter){var poststr="";if(!delimiter)
objList=objList.split(",")
else
objList=objList.split(delimiter);for(var i=0;i<objList.length;i++){objList[i]=trim(objList[i]);poststr+=objList[i]+"="+encodeURIComponent(getDOMValue(objList[i]))+"&";}
return poststr;}
function QueryString(key,url){if(url)
var mainHREF=url.substring(url.indexOf("?")+1,url.length);else
var mainHREF=self.location.href.substring(self.location.href.indexOf("?")+1,self.location.href.length);if(mainHREF.length>1){var sets=mainHREF.split("&");for(x=0;x<sets.length;x++){if(sets[x].indexOf(key+"=")==0){var pair=sets[x].split("=");var str="";for(z=1;z<pair.length;z++){if(str==""){str=pair[z];}
else{str+="="+pair[z];}}
return unescape(str);}}}
return false;}
function adjust_popup(){var w,h,fixedW,fixedH,diffW,diffH;if(document.documentElement&&document.body.clientHeight==0){fixedW=document.documentElement.clientWidth;fixedH=document.documentElement.clientHeight;window.resizeTo(fixedW,fixedH);diffW=fixedW-document.documentElement.clientWidth;diffH=fixedH-document.documentElement.clientHeight;w=fixedW+diffW+16;h=fixedH+diffH;if(w>=screen.availWidth)h+=16;}else if(document.all){fixedW=document.body.clientWidth;fixedH=document.body.clientHeight;window.resizeTo(fixedW,fixedH);diffW=fixedW-document.body.clientWidth;diffH=fixedH-document.body.clientHeight;w=fixedW+diffW;h=fixedH+diffH;if(h>=screen.availHeight)w+=16;if(w>=screen.availWidth)h+=16;}else{fixedW=window.innerWidth;fixedH=window.innerHeight;window.resizeTo(fixedW,fixedH);diffW=fixedW-window.innerWidth;diffH=fixedH-window.innerHeight;w=fixedW+diffW;h=fixedH+diffH;if(w>=screen.availWidth)h+=16;if(h>=screen.availHeight)w+=16;}
w=Math.min(w,screen.availWidth);h=Math.min(h,screen.availHeight);window.resizeTo(w,h);window.moveTo((screen.availWidth-w)/2,(screen.availHeight-h)/2);}
function textCounter(field,element,maxlimit){if(typeof(field)=="string")field=findDOM(field);if(typeof(element)=="string")element=findDOM(element);if(field.value.length>maxlimit)
field.value=field.value.substring(0,maxlimit);else
$SetValue(element,maxlimit-field.value.length);}
function WindowSize(dimension){var x,y;if(self.innerHeight){x=self.innerWidth;y=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){x=document.documentElement.clientWidth;y=document.documentElement.clientHeight;}else if(document.body){x=document.body.clientWidth;y=document.body.clientHeight;}
if((dimension.toUpperCase()=="W")||(dimension.toUpperCase()=="WIDTH")){return x;}else if((dimension.toUpperCase()=="H")||(dimension.toUpperCase()=="HEIGHT")){return y;}}
function WindowSizeHeight(){return WindowSize("h")}
function WindowSizeWidth(){return WindowSize("w")}
function DocumentSize(dimension){var x,y;var test1=document.body.scrollHeight;var test2=document.body.offsetHeight
if(test1>test2){x=document.body.scrollWidth;y=document.body.scrollHeight;}else{x=document.body.offsetWidth;y=document.body.offsetHeight;}
if((dimension.toUpperCase()=="W")||(dimension.toUpperCase()=="WIDTH")){return x;}else if((dimension.toUpperCase()=="H")||(dimension.toUpperCase()=="HEIGHT")){return y;}}
function DocumentSizeHeight(){return DocumentSize("h")}
function DocumentSizeWidth(){return DocumentSize("w")}
function ScrollOffset(dimension){var x,y;if(self.pageYOffset){x=self.pageXOffset;y=self.pageYOffset;}else if(document.documentElement&&document.documentElement.scrollTop){x=document.documentElement.scrollLeft;y=document.documentElement.scrollTop;}else if(document.body){x=document.body.scrollLeft;y=document.body.scrollTop;}
if((dimension.toUpperCase()=="L")||(dimension.toUpperCase()=="LEFT")){return x;}else if((dimension.toUpperCase()=="T")||(dimension.toUpperCase()=="TOP")){return y;}}
function ScrollOffsetHorizontal(){return ScrollOffset("Left");}
function ScrollOffsetVertical(){return ScrollOffset("Top");}
function SetScrollPosition(val,LeftToRight){val=val*1;if(self.pageYOffset){if(LeftToRight)self.pageXOffset=val
else self.pageYOffset=val;}else if(document.documentElement&&document.documentElement.scrollTop){if(LeftToRight)document.documentElement.scrollLeft=val
else document.documentElement.scrollTop=val;}else if(document.body){if(LeftToRight)document.body.scrollLeft=val
else document.body.scrollTop=val;}}
function getXfromLeft(imgID){try{if(HTMLElement.x){return document.getElementById(imgID).x}else{return getRealLeft(imgID);}}catch(e){return getRealLeft(imgID);}}
function getYfromTop(imgID){try{if(HTMLElement.y){return document.getElementById(imgID).y;}else{return getRealTop(imgID);}}catch(e){return getRealTop(imgID);}}
function getRealLeft(imgElem){xPos=document.getElementById(imgElem).offsetLeft;tempEl=document.getElementById(imgElem).offsetParent;while(tempEl!=null){xPos+=tempEl.offsetLeft;tempEl=tempEl.offsetParent;}
return xPos;}
function getRealTop(imgElem){yPos=document.getElementById(imgElem).offsetTop;tempEl=document.getElementById(imgElem).offsetParent;while(tempEl!=null){yPos+=tempEl.offsetTop;tempEl=tempEl.offsetParent;}
return yPos;}
function eventTrigger(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;if((!targ.id)||(isEmpty(targ.id)))
return targ.name
else
return targ.id;}
function insertAtCursor(myField,myValue){var obj=findDOM(myField);if(document.selection){obj.focus();var sel=document.selection.createRange();sel.text=myValue;}
else if(obj.selectionStart||obj.selectionStart=="0"){var startPos=obj.selectionStart;var endPos=obj.selectionEnd;obj.value=obj.value.substring(0,startPos)+myValue+obj.value.substring(endPos,obj.value.length);}else{myField.value+=myValue;}}
function LTrim(value){var re=/\s*((\S+\s*)*)/;return value.replace(re,"$1");}
function RTrim(value){var re=/((\s*\S+)*)\s*/;return value.replace(re,"$1");}
function trim(value){if(value)
return LTrim(RTrim(value))
else
return"";}
function Copy(obj){var _t=findDOM(obj);var Copied=_t.createTextRange();Copied.execCommand("Copy");}
function Paste(obj){var _m=findDOM(obj);_m.value="";_m.focus();var PastedText=_m.createTextRange();PastedText.execCommand("Paste");}
function replaceAll(value,oldStr,newStr,matchCase){var options="g";if(matchCase)options+="i";var val=new RegExp(oldStr,options);return value.replace(val,newStr);}
function isEmpty(str){str=trim(str);if((!str)||(str=="")||(str=="undefined"))return true
else return false;}
function isEqual(str1,str2,cs){if(cs){if(str1==str2)return true
else return false;}else{if(str1.toUpperCase()==str2.toUpperCase())return true
else return false;}}
function StringValidator(_string,_customlist){this.string=(_string)?_string:"";this.customlist=_customlist;this.lettersonly=TestLettersOnly(this.string);this.lettersonlyError=TestLettersOnly(this.string,true);this.textonly=TestTextOnly(this.string);this.textonlyError=TestTextOnly(this.string,true);this.email=TestIfEmail(this.string);this.emailError=TestIfEmail(this.string,true);if(this.customlist){this.custom=TestCustom(this.string,this.customlist);this.customError=TestCustom(this.string,this.customlist,true);;}else{this.custom=false;this.customError="";}
if(this.string!="")this.nospace=(_string.indexOf(" ")==-1)
else this.nospace=true;this.numbersonly=(!isNaN(_string));if(this.string!="")this.length=this.string.length
else this.length=0;}
function TestLettersOnly(str,err){if(str==""){return(err)?"Value is empty":false;}
else{var list="`~!@#$%^&*()-_+=\\\t\"';:<,>.?/[{]}|0123456789";for(i=0;i<list.length;i++)
{if(str.indexOf(list.charAt(i))>-1){return(err)?"Value contains the invaild character \""+list.charAt(i)+"\"":false;}}}
return(err)?"":true;}
function TestTextOnly(str,err){if(str==""){return(err)?"Value is empty":false;}
else{var list="\\\t\"<>";for(i=0;i<list.length;i++){if(str.indexOf(list.charAt(i))>-1)
{return(err)?"Value contains the invaild character \""+list.charAt(i)+"\"":false;}}}
return(err)?"":true;}
function TestIfEmail(str,err){if(str==""){return(err)?"Value is empty":false;}else{var list=" `~!#$%^&*()+=\\\t\"';:<,>?/[{]}|";var _arr=str.split("@");if(str.length<6){return(err)?"Invalid email: not long enough.":false;}
if(_arr.length!=2){return(err)?"Invalid email address.":false;}
if((_arr[0].length<2)||(_arr[1].length<4)||(_arr[1].indexOf(".")==-1)||(_arr[1].indexOf(".")>=(_arr[1].length-2)))
{return(err)?"Invalid email address.":false;}
for(i=0;i<list.length;i++){if(str.indexOf(list.charAt(i))>-1){return(err)?"Value contains the invaild character \""+list.charAt(i)+"\"":false;}}}
return(err)?"":true;}
function TestCustom(str,list,err){if(str==""){return(err)?"Value is empty":false;}else{if(isArray(list)){for(i=0;i<list.length;i++){if(str.indexOf(list[i])>-1){return(err)?"Contains an invaild character => "+list[i]+" <=":false;}}}else{for(i=0;i<list.length;i++){if(str.indexOf(list.charAt(i))>-1){return(err)?"Contains an invaild character => "+list.charAt(i)+" <=":false;}}}}
return(err)?"":true;}
function isArray(obj){return(obj.constructor.toString().toLowerCase().indexOf("array")==-1)?false:true;}
function toProperCase(str){if(!isEmpty(str)){var i;var s=trim(str).split(" ");str="";for(i=0;i<s.length;i++){if(s[i].length==0){str+=" ";}else if(s[i].length==1){str+=s[i].toUpperCase()+" ";}else{str+=s[i].charAt(0).toUpperCase();str+=s[i].substring(1,s[i].length).toLowerCase()+" ";}}}
return str;}
String.prototype.replaceAll=function(s1,s2){return this.split(s1).join(s2)}
String.prototype.UCase=function(){return this.toUpperCase()}
String.prototype.LCase=function(){return this.toLowerCase()}
String.prototype.trim=function(){return(this.replace(/^[\s\xA0]+/,"").replace(/[\s\xA0]+$/,""))}
String.prototype.contains=function(s1){return this.toString().indexOf(s1)>-1}
String.prototype.empty=function(){return isEmpty(this)}
String.prototype.insertAfterIndex=function(index,txt){return this.substring(0,index+1)+txt+this.substring(index+1,this.length);}
function ApplyStyles(obj,styles){var x=0,pv;if($Exists(obj)){if(typeof(obj)=="string")obj=findDOM(obj);var sty=styles.split(";");for(x=0;x<sty.length;x++){if(trim(sty[x])!=""){pv=sty[x].split(":");try{eval("obj.style."+JStyle(trim(pv[0]))+" = \""+trim(pv[1])+"\"");}catch(e){}}}}}
function JStyle(_s){while(_s.indexOf("-")>0){_s=_s.substring(0,_s.indexOf("-"))+
_s.charAt(_s.indexOf("-")+1).toUpperCase()+
_s.substring(_s.indexOf("-")+2,_s.length);_s=_s.replace("-","");}
return _s;}
function changeBGColor(obj,from,to){if(typeof(obj)=="string")obj=findDOM(obj);if(obj.style){var bgc=obj.style.backgroundColor.replace("#","").toUpperCase();if(bgc.indexOf("RGB")>=0){if(RGB2HEX(bgc)==RGB2HEX(from)){obj.style.backgroundColor=HEX2RGB(to);}else{obj.style.backgroundColor=HEX2RGB(from);}}else{if(RGB2HEX(bgc)==RGB2HEX(from)){obj.style.backgroundColor=RGB2HEX(to);}else{obj.style.backgroundColor=RGB2HEX(from);}}}}
function RGB2HEX(rgb){if(rgb.toUpperCase().indexOf("RGB")>=0){var c=rgb.split(",");return d2h(parseInt(trim(c[0].replace("RGB(","")))).toString()+d2h(parseInt(c[1])).toString()+d2h(parseInt(c[2])).toString();}else{return rgb.replace("#","");}}
function HEX2RGB(hex){var c=hex.replace("#","");if(c.toUpperCase().indexOf("RGB")>=0){return c;}else{if(hex.length==3){var c1=c.substring(0,1);var c2=c.substring(1,1);var c3=c.substring(2,1);}else{var c1=c.substring(0,2);var c2=c.substring(2,4);var c3=c.substring(4,6);}
return"RGB("+h2d(c1)+","+h2d(c2)+","+h2d(c3)+")";}}
function d2h(d){return d.toString(16).toUpperCase();}
function h2d(h){return parseInt(trim(h),16);}
var _preloadImgFlag=false;function MM_preloadImages(){if(document.images){for(var i=0;i<MM_preloadImages.arguments.length;i++){eval("var plImg"+i+" = newImage(\""+MM_preloadImages.arguments[i]+"\")");}
_preloadImgFlag=true;}}
function newImage(arg){if(document.images){rslt=new Image();rslt.src=arg;return rslt;}}
function changeImages(){if(document.images&&(_preloadImgFlag==true)){for(var i=0;i<changeImages.arguments.length;i+=2){document[changeImages.arguments[i]].src=changeImages.arguments[i+1];}}}
function randomInt(lower,upper){if(upper){var ranNum=Math.floor((Math.random()*(upper-lower))+lower);}else{var ranNum=Math.floor(Math.random()*lower);}
return ranNum;}
function addfav(url,favname){if(document.all){if(isEmpty(url))url=window.location.href;if(url.toLowerCase().indexOf("http://")==-1)url="http://"+url;if(isEmpty(favname))favname=window.location.href;window.external.AddFavorite(url,favname);}else{alert("Your browser may not support this operation.");}}
function ToggleDisplay(obj){ShowOrHideObject(obj);}
function ShowOrHideObject(obj,onoff){var d="",v="";if(!onoff)var onoff="";obj=$DOM(obj);if(onoff=="on"){v="visible";d="block";}else if(onoff=="off"){v="hidden";d="none";}else{if((obj.style.display.toLowerCase()=="none")||(obj.style.visibility.toLowerCase()=="hidden")){v="visible";d="block";}else{v="hidden";d="none";}}
try{if(d=="block"){switch(obj.nodeName.toUpperCase()){case"TR":d="table-row";break;case"TD":d="table-cell";break;case"TABLE":d="table";break;}}}catch(e){}
obj.style.visibility=v;obj.style.display=d;}
function ShowObject(obj){ShowOrHideObject(obj,"on");}
function HideObject(obj){ShowOrHideObject(obj,"off");}
function isHidden(obj){obj=$DOM(obj);try{if(obj.style){if(obj.style.display.LCase().contains("none")||obj.style.visibility.LCase().contains("hidden")){return true;}}
return false;}catch(e){return false;}}
function alt(obj,txt,offsetX,offsetY){if(!txt)var txt="";if(!offsetX)var offsetX=20;if(!offsetY)var offsetY=12;if(!document.getElementById("alt_div")){var nme=document.createElement("div");nme.setAttribute("id","alt_div");document.body.appendChild(nme);var styles="position:absolute;width:8px;height:16px;display:none;visibility:hidden;"+"top:0px;left:0px;z-index:100;background-color:#FFFFE1;border:black 1px solid;"+"text-align:center;font-family:arial;font-size:11px;color:black;font-weight:400;"
ApplyStyles(nme,styles);}
if(!nme)var nme=findDOM("alt_div");if(nme.style.display=="none"){nme.style.width=((txt.length*7)+4)+"px";nme.style.left=(getXfromLeft(obj)+offsetX)+"px";nme.style.top=(getYfromTop(obj)+offsetY)+"px";nme.innerHTML=txt;nme.style.display="block";nme.style.visibility="visible";}else{nme.style.display="none";nme.style.visibility="hidden";}}
function SetParent(){if(top.location!=location)top.location.href=document.location.href;}
var _fadeForward;function fadeF(sr,sg,sb,er,eg,eb,step,obj,fstop,at){if(!at)var at=1;if(!fstop)var fstop=false;if(at==1)_fadeForward=true;if(at==step)_fadeForward=false;findDOM(obj).style.color="#"+
ConvertHex(Math.floor(sr*((step-at)/step)+er*(at/step)))+
ConvertHex(Math.floor(sg*((step-at)/step)+eg*(at/step)))+
ConvertHex(Math.floor(sb*((step-at)/step)+eb*(at/step)));if((at==step)&&(fstop)){}else{if(_fadeForward){at++;setTimeout("fadeF("+sr+","+sg+","+sb+","+er+","+eg+","+eb+","+step+",\""+obj+"\","+fstop+","+at+")",1);}else{at--;setTimeout("fadeF("+sr+","+sg+","+sb+","+er+","+eg+","+eb+","+step+",\""+obj+"\","+fstop+","+at+")",1);}}}
function fadeB(sr,sg,sb,er,eg,eb,step,obj,fstop,at){if(!at)var at=1;if(!fstop)var fstop=false;if(at==1)_fadeForward=true;if(at==step)_fadeForward=false;findDOM(obj).style.backgroundColor="#"+
ConvertHex(Math.floor(sr*((step-at)/step)+er*(at/step)))+
ConvertHex(Math.floor(sg*((step-at)/step)+eg*(at/step)))+
ConvertHex(Math.floor(sb*((step-at)/step)+eb*(at/step)));if((at==step)&&(fstop)){}else{if(_fadeForward){at++;setTimeout("fadeB("+sr+","+sg+","+sb+","+er+","+eg+","+eb+","+step+",\""+obj+"\","+fstop+","+at+")",1);}else{at--;setTimeout("fadeB("+sr+","+sg+","+sb+","+er+","+eg+","+eb+","+step+",\""+obj+"\","+fstop+","+at+")",1);}}}
function ConvertHex(i){if(i<0)return"00";else if(i>255)return"ff";else return""+d2h(Math.floor(i/16))+d2h(i%16);}
function Back(){history.back();}
function Forward(){history.forward();}
function $Value(obj){return getDOMValue(obj);}
function $SetValue(obj,value,UseIndexListForOptionSelect){setDOMValue(obj,value,UseIndexListForOptionSelect);}
function getDOMValue(obj){if(typeof(obj)=="string")
var valid=$Exists(obj)
else
var valid=true;if(valid){obj=$DOM(obj);if(getNodeName(obj)=="input"){if(getInputType(obj)=="checkbox"){if(!obj.checked){return false;}else{if(!isEmpty(obj.value))
return obj.value
else
return true;}}else if(getInputType(obj)=="radio"){return GetCheckedRadioValue(obj);}else{return obj.value;}}else{if(getNodeName(obj)=="select"){return GetSelectedOptionValues(obj);}else if(getNodeName(obj)=="textarea"){return obj.value;}else{if(obj.innerHTML)
return obj.innerHTML
else if(obj.innerText)
return obj.innerText
else if(obj.textContent)
return obj.textContent
else
return"";}}}
return"";}
function setDOMValue(obj,value,UseIndexListForOptionSelect){if(typeof(obj)=="string")
var valid=$Exists(obj)
else
var valid=true;if(valid){obj=$DOM(obj);if(getNodeName(obj)=="input"){if(getInputType(obj)=="checkbox"){if(value.toString().LCase()=="checked"||value.toString().LCase()=="selected"||value==true||value.toString().LCase()=="on"){obj.checked=true;}else{obj.checked=false;}}else if(getInputType(obj)=="radio"){SetCheckedRadioValue(obj,value);}else{obj.value=value;}}else{if(getNodeName(obj)=="select"){if(!UseIndexListForOptionSelect){value=GetOptionIndexByValue(obj,value);}
SetSelectedOptionValues(obj,value);}else if(getNodeName(obj)=="textarea"){obj.value=value;}else{obj.innerHTML=value;if(obj.innerHTML.empty()&&!value.empty()){obj.innerText=value;}}}}}
function GetSelectedOptionValues(obj){obj=$DOM(obj);var s="";if(obj.nodeName.toLowerCase()=="select"){if(obj.selectedIndex!=-1){for(var i=0;i<obj.options.length;i++){if(obj.options[i].selected){if(obj.options[i].value!="")
s+=obj.options[i].value+","
else if(obj.options[i].innerText)
s+=obj.options[i].innerText+","
else if(obj.options[i].text)
s+=obj.options[i].text+","
else
s+=",";}}
if(s.charAt(s.length-1)==",")s=s.substring(0,s.length-1);}}
return s;}
function GetSelectedOptionTexts(obj){obj=$DOM(obj);var s="";if(obj.nodeName.toLowerCase()=="select"){if(obj.selectedIndex!=-1){for(var i=0;i<obj.options.length;i++){if(obj.options[i].selected){if(obj.options[i].innerText)
s+=obj.options[i].innerText+","
else if(obj.options[i].text)
s+=obj.options[i].text+","
else
s+=obj.options[i].value+",";}}
if(s.charAt(s.length-1)==",")s=s.substring(0,s.length-1);}}
return s;}
function GetOptionIndexByValue(obj,value){obj=$DOM(obj);if(obj.nodeName.LCase()=="select"){for(var i=0;i<obj.options.length;i++){if(obj.options[i].value==value||obj.options[i].innerText==value){return i;}}}
return-1}
function SetSelectedOptionValues(obj,CommaSepIndices){obj=$DOM(obj);var s=CommaSepIndices.toString().split(",");var l=obj.options.length-1;if(obj.nodeName.LCase()=="select"){for(var i=0;i<s.length;i++){s[i]=s[i].trim();if(!s[i].empty()){if(!isNaN(s[i])){if((s[i].trim()*1)>-1&&(s[i].trim()*1)<=l){obj.options[s[i]*1].selected=true;}}}}}}
function GetCheckedRadioValue(obj){var radio_group,radio_checked,x;var val="";if(typeof(obj)!="string"){(obj.name=="")?obj=obj.id:obj=obj.name;}
if(!isEmpty(obj)){radio_checked=false;radio_group=document.getElementsByName(obj);for(x=0;x<radio_group.length;x++){if(radio_group[x].checked){val=radio_group[x].value;if(isEmpty(val))val=x*1;}}}
return val;}
function SetCheckedRadioValue(obj,value){obj=getObjName(obj);var els=document.getElementsByName(obj);for(var e=0;e<els.length;e++){if(els[e].value==value)els[e].checked=true;}}
function ClearRadioGroup(group_name){var radio_group=document.getElementsByName(group_name);for(var x=0;x<radio_group.length;x++){radio_group[x].checked=false;}}
function getNodeName(obj){if(typeof(obj)=="string")obj=findDOM(obj);if(!obj.nodeName)
return""
else
return obj.nodeName.toLowerCase();}
function getInputType(obj){if(typeof(obj)=="string")obj=findDOM(obj);if(!obj.type)
return""
else
return obj.type.toLowerCase();}
function getObjName(obj){if(typeof(obj)=="string"){return obj;}
if(obj.id){if(trim(obj.id)!="")return obj.id;}
if(obj.name){if(trim(obj.name)!="")return obj.name;}
return"";}
function ApplyClassName(obj,clsNm){if(document.createTextNode){$DOM(obj).className=clsNm;}}
function GetClassName(obj){if(document.createTextNode)
return $DOM(obj).className
else
return"";}
function AddClassName(obj,className){if(document.createTextNode){$DOM(obj).className=($DOM(obj).className+" "+className).trim().replaceAll("  "," ");}}
function RemoveClassName(obj,className){if(document.createTextNode){var classes=$DOM(obj).className.split(" ");var cname="";className=className.trim();for(var x=0;x<classes.length;x++){if(classes[x]!=""&&classes[x]!=className)
cname+=classes[x]+" ";}
$DOM(obj).className=cname.trim().replaceAll("  "," ");}}
function HasClassName(obj,className){if(document.createTextNode){var classes=$DOM(obj).className.split(" ");className=className.trim();for(var x=0;x<classes.length;x++){if(classes[x]==className)
return true;}}
return false;}
function SetCSSClassStyle(ClassName,JSStyleName,Value,ReplaceAll){var ss=document.styleSheets,s;var rules,r;for(s=0;s<ss.length;s++){rules=null;if(ss[s].cssRules)rules=ss[s].cssRules
else if(ss[s].rules)rules=ss[s].rules;if(rules){for(r=0;r<rules.length;r++){if(rules[r].selectorText.indexOf(ClassName)>=0){try{eval("rules[r].style."+JSStyleName+"= Value");if(!ReplaceAll)return true;}catch(e){}}}}}}
function appendOption(obj,txt,val,before){if(!val)var val=txt;if(typeof before=="undefined")var before=null;var elSel=$DOM(obj);var elOptNew=document.createElement('option');elOptNew.text=txt;elOptNew.value=val;if(isNaN(before)||(before>=elSel.options.length)||(before<0))
before=null
else
before=elSel.options[before];try{elSel.add(elOptNew,before);}
catch(ex){if(before==null)
elSel.add(elOptNew)
else
elSel.add(elOptNew,before);}}
function removeOption(obj,index){var elSel=$DOM(obj);if(typeof index=="undefined")var index=elSel.options.length-1;for(var i=elSel.options.length-1;i>=0;i--){if((i==index)||(index==-1)){elSel.remove(i);}}}
function removeAllOptions(obj){obj=$DOM(obj);if(obj.options){for(var i=obj.options.length-1;i>=0;i--){removeOption(obj,i);}}}
function selectAllOptions(obj){obj=$DOM(obj);obj.multiple="multiple";for(var i=0;i<obj.options.length;i++)obj.options[i].selected=true;}
function deselectAllOptions(obj){obj=$DOM(obj);for(var i=0;i<obj.options.length;i++)obj.options[i].selected=false;}
function selectedOptionIndex(obj){obj=$DOM(obj);for(var i=0;i<obj.options.length;i++){if(obj.options[i].selected)return i;}
return-1;}
function selectedOptionMove(obj,MoveNumber,ReSelect){try{if(typeof MoveNumber=="undefined")var MoveNumber=0;if(MoveNumber==0)return false;var obj=$DOM(obj);var index=selectedOptionIndex(obj);var count=obj.options.length-1
if(index>-1){var el=obj.options[index];removeOption(obj,index);if((index+(MoveNumber*-1))<0){MoveNumber=index;}else if((index+(MoveNumber*-1))>=count){appendOption(obj,el.value,el.innerText);if(ReSelect)
obj.options[count].selected=true;return true;}
appendOption(obj,el.value,el.innerText,index+(MoveNumber*-1));if(ReSelect)
obj.options[index+(MoveNumber*-1)].selected=true;}}catch(e){}}
function selectedOptionMoveUp(obj,ReSelect){selectedOptionMove(obj,1,ReSelect);}
function selectedOptionMoveDown(obj,ReSelect){selectedOptionMove(obj,-1,ReSelect);}
function isElement(obj,ElementType){obj=$DOM(obj);var type=getNodeName(obj).toString().LCase();if(type==ElementType.toString().LCase()){return true;}else if(type=="input"){type=obj.type;return(type==ElementType.LCase())}else{return false;}}
function GetAttributes(obj,delimiter){if(typeof(obj)=="string")obj=$DOM(obj);var res="";if(!delimiter)var delimiter="\n";for(var i=0;i<obj.attributes.length;i++){res+=obj.attributes[i].name+"="+obj.attributes[i].value+delimiter;}
return res;}
function PrintThisPage(){printArticle();}
function printArticle(){if(window.printPreview){setTimeout('window.printPreview();',200);}else if(window.print){setTimeout('window.print();',200);}else{alert("Print function not working. Click file, Print.")}}
function aE(){var str="";for(var i=0;i<aE.arguments.length;i++){str+="<"+aE.arguments[i]+">\n";}
alert(str)}
function isPage(page,useCase){var url=window.location.href;if(!useCase){page=page.LCase();url=url.LCase();}
return(url.contains(page));}
var BorderBlink_border_settings=[];var BorderBlink_Save_The_Border_Info=true;function BorderBlink(obj,count,speed,BlinkParent){var t,el;if(!BlinkParent)BlinkParent=false;if(BlinkParent)el=$DOM(obj).parentNode
else el=$DOM(obj);if(BorderBlink_Save_The_Border_Info){BorderBlink_border_settings[0]=el.style.borderBottomColor;BorderBlink_border_settings[1]=el.style.borderBottomStyle;BorderBlink_border_settings[2]=el.style.borderBottomWidth;BorderBlink_border_settings[3]=el.style.borderLeftColor;BorderBlink_border_settings[4]=el.style.borderLeftStyle;BorderBlink_border_settings[5]=el.style.borderLeftWidth;BorderBlink_border_settings[6]=el.style.borderRightColor;BorderBlink_border_settings[7]=el.style.borderRightStyle;BorderBlink_border_settings[8]=el.style.borderRightWidth;BorderBlink_border_settings[9]=el.style.borderTopColor;BorderBlink_border_settings[10]=el.style.borderTopStyle;BorderBlink_border_settings[11]=el.style.borderTopWidth;BorderBlink_Save_The_Border_Info=false;}
switch(speed.LCase()){case"slow":t=750;break;case"medium":t=500;break;case"fast":t=100;}
if(count==0){el.style.borderBottomColor=BorderBlink_border_settings[0];el.style.borderBottomStyle=BorderBlink_border_settings[1];el.style.borderBottomWidth=BorderBlink_border_settings[2];el.style.borderLeftColor=BorderBlink_border_settings[3];el.style.borderLeftStyle=BorderBlink_border_settings[4];el.style.borderLeftWidth=BorderBlink_border_settings[5];el.style.borderRightColor=BorderBlink_border_settings[6];el.style.borderRightStyle=BorderBlink_border_settings[7];el.style.borderRightWidth=BorderBlink_border_settings[8];el.style.borderTopColor=BorderBlink_border_settings[9];el.style.borderTopStyle=BorderBlink_border_settings[10];el.style.borderTopWidth=BorderBlink_border_settings[11];BorderBlink_Save_The_Border_Info=true;}else if((count%2)==0){count--;el.style.borderWidth="2px";el.style.borderColor="red";el.style.borderStyle="solid";setTimeout("BorderBlink(\""+obj+"\","+count+",\""+speed+"\","+BlinkParent+")",t);}else{count--;el.style.borderWidth="0px";el.style.borderColor="red";el.style.borderStyle="solid";setTimeout("BorderBlink(\""+obj+"\","+count+",\""+speed+"\","+BlinkParent+")",t);}}
function Collection(){var items=[];var keys=[];}
Collection.prototype.add=function(item,key){this.items.push(item);this.keys.push(key);}
Collection.prototype.count=function(){return items.length-1;}
Collection.prototype.item=function(index){if(typeof index=="integer"){return items[index];}else{for(var i=0;i<this.items.length;i++){if(this.items[i]==index)return this.items[i];}}
return null;}
function isTopPage(){return(self.parent.location.href==self.location.href)}
