// Copyright 2000-09 Jeff Fox

function UtilityObj(){this.popUpWindow=popUpWindow;this.leaveAlert=leaveAlert;this.getCookie=getCookie;this.setCookie=setCookie;this.deleteCookie=deleteCookie;this.getLastVisit=getLastVisit;this.validateVarTypeOf=validateVarTypeOf;this.arrayPush=arrayPush;this.jsFilter=jsFilter;function popUpWindow(url,w,h,menubar,windowName){if(!w)w=500;if(!h)h=350;if(!menubar)menubar="";newWindow=window.open(url,windowName,menubar+',width='+w+',height='+h);self.name="main";newWindow.focus();}function leaveAlert(url){if(confirm("You are leaving this web site.  To remain at our site, click \"Cancel\".  To leave our site for the link you selected, click \"Ok\".  Thank you for visiting.")){document.location.href=url;}}function getCookie(name){var start=document.cookie.indexOf(name+"=");var len=start+name.length+1;if((!start)&&(name!=document.cookie.substring(0,name.length)))return null;if(start==-1)return null;var end=document.cookie.indexOf(";",len);if(end==-1)end=document.cookie.length;return unescape(document.cookie.substring(len,end));}function setCookie(name,value,expires){var curCookie=name+"="+escape(value);if(expires)curCookie+=";expires="+expires;document.cookie=curCookie;}function deleteCookie(name){if(this.getCookie(name)){var curCookie=name+';expires=Thu, 01-Jan-1970 00:00:01 GMT';document.cookie=curCookie;}}function getLastVisit(){var todays_date=new DateObj();var expires_date=new DateObj('','','','',todays_date.getTimeUForm()+(14*86400000));var lastHere=this.getCookie('lastVisit');if(!lastHere){visitCounter=1;this.setCookie('lastVisit',todays_date.formatDate('%YY%mm%dd')+'0001',expires_date);return todays_date.formatDate('%YY%mm%dd');}else{var last_date=lastHere.substring(0,8);visitCounter=lastHere.substring(8,12)*1;if(todays_date.formatDate('%YY%mm%dd')!=last_date){visitCounter+=1;this.setCookie('lastVisit',todays_date.formatDate('%YY%mm%dd')+display(visitCounter),expires_date);}return last_date;}}function display(count){return(count<10)?'000'+count:val=((count<100)?'00'+count:val=((count<1000)?'0'+count:val=count));}function validateVarTypeOf(thisVar,type){return(typeof thisVar==type);}function arrayPush(extArray,newVal,obj){var browVar=new Browser();if(!obj)obj="this";if(browVar!=null&&browVar.isDOM==true&&browVar.isIE==false){thisArray=eval(obj+"."+extArray);thisArray.push(newVal);}else{var thisArray=eval(obj+"."+extArray);var thisLen=thisArray.length;thisArray[thisLen]=newVal;}}function jsFilter(dataIn,sType){if(dataIn==''){return'';}else{dataIn=dataIn.replace(/\;/g,"");dataIn=sType=="1"?dataIn.replace(/\&/g,"&amp;"):dataIn.replace(/\&/g,"");dataIn=sType=="1"?dataIn.replace(/\</g,"&lt;"):dataIn.replace(/\</g,"");dataIn=sType=="1"?dataIn.replace(/\>/g,"&gt;"):dataIn.replace(/\>/g,"");dataIn=sType=="1"?dataIn.replace(/\"/g,"&quot;"):dataIn.replace(/\"/g,"");dataIn=sType=="1"?dataIn.replace(/\'/g,"&#039;"):dataIn.replace(/\//g,"");dataIn=sType=="1"?dataIn.replace(/\%/g,"&#037;"):dataIn.replace(/\%/g,"");dataIn=sType=="1"?dataIn.replace(/\(/g,"&#040;"):dataIn.replace(/\(/g,"");dataIn=sType=="1"?dataIn.replace(/\)/g,"&#041;"):dataIn.replace(/\)/g,"");dataIn=sType=="1"?dataIn.replace(/\+/g,"&#043;"):dataIn.replace(/\+/g,"");dataIn=sType=="1"?dataIn.replace(/\//g,"&#092;"):dataIn.replace(/\//g,"");dataIn=sType=="1"?dataIn.replace(/\\/g,"&#092;"):dataIn.replace(/\\/g,"");dataIn=sType=="1"?dataIn.replace(/\~/g,"&#126;"):dataIn.replace(/\~/g,"");dataIn=sType=="1"?dataIn.replace(/\:/g,"&#058;"):dataIn.replace(/\:/g,"");return dataIn;}}}