/* Written by Burt Petrescue 2007. May have copyrighted material but used with permission. */ function mt(x){ if (x==null || x=='') return true; return false; } function denull(x,def){ if (mt(x)){ if (mt(def)) return ''; else return def; } return x; } function qfix(xu){ if (mt(xu)) return 0; var x=xu.replace(/[^0123456789\.\-]/g,''); if (mt(x)) return 0; return x*1; } function isonlynumeric(x){//empty does not count as numeric if (qfix(x)+''==x+'') return true; return false; } function limitstring(x,maxlen){ if (mt(x)) return ''; if (x.length>maxlen){ return x.substring(0,maxlen-3)+'...'; } return x; } function trim(x){ return x.replace(/^\s+|\s+$/g,'') } function isobject(x){ return (typeof x == 'object' && !!x); } function getobj(objname){ return document.getElementById?document.getElementById(objname):document.all?document.all[objname]:document.layers[objname]; } function changetext(objectid,text) { var obj; if (isobject(objectid)) obj=objectid; else obj=getobj(objectid); if (obj!=null){ obj.innerHTML=text; } } function prepjs(x){ return x.replace(/\'/g,'\\\''); } function prepinput(x){ return x.replace(/\"/g,'\&\;'); } function gettext(objectid) { var obj; if (isobject(objectid)) obj=objectid; else obj=getobj(objectid); return obj.innerHTML; } var windowWidth = 0, windowHeight = 0; function getWindowSize() { if( typeof( window.innerWidth ) == 'number' ) { windowWidth = window.innerWidth; windowHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; } } getWindowSize(); var scrollOffsetX = 0, scrollOffsetY = 0; function getScrollXY() { if( typeof( window.pageYOffset ) == 'number' ) { scrollOffsetY = window.pageYOffset; scrollOffsetX = window.pageXOffset; } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { scrollOffsetY = document.body.scrollTop; scrollOffsetX = document.body.scrollLeft; } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) { scrollOffsetY = document.documentElement.scrollTop; scrollOffsetX = document.documentElement.scrollLeft; } } getScrollXY(); function getpagewidth() { return document.body.scrollWidth; } function getpageheight() { return document.body.scrollHeight; } function getwidth(obj){ if (document.all) return obj.offsetWidth; return obj.offsetWidth; } function getheight(obj){ if (typeof(obj).type=='string') return obj.offsetHeight; if (document.all) return obj.scrollHeight; return obj.scrollHeight; } function moveit(obj,thisx,thisy){ obj.style.x=thisx; obj.style.y=thisy; obj.style.left=thisx; obj.style.top=thisy; } 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 findrect(obj) {//returns Left, Top, Width, Height var coords=findpos(obj); return [coords[0],coords[1],getwidth(obj),getheight(obj)]; } function setrect(obj, rect) { moveit(obj,rect[0],rect[1]); obj.style.width=rect[2]+'px'; obj.style.height=rect[3]+'px'; } function setopacity(obj,perc){//perc - 0 to 100 if (document.getElementById && document.all){ if (perc==100) obj.style.filter=''; else{ obj.style.filter='alpha(opacity='+perc+')';} } else { obj.style.MozOpacity=perc/100; } } function getopacity(obj){ var op=0; if (document.getElementById && document.all){ var x=obj.style.filter; var pos1=x.indexOf('='); var pos2=x.indexOf(')'); if(pos1<0 || pos2<0) return 0; op=x.substring(pos1+1,pos2); } else { op=obj.style.MozOpacity*100; } return op*1; } function showobj(obj) { obj.style.display='block'; } function hideobj(obj) { obj.style.display='none'; } function inarray(ar,value){ //returns array index. returns -1 if not found. keep data type in mind for (var i=0;i0) obj.options[0] = null; } function dropdown_populate(obj,data,rdelim,fdelim){ var ltildapos=-1,tildapos; var optsarray=data.split(rdelim); for (var i=0;i=0) obj.selectedIndex=seli; } else { obj.value=matchvalue; } } function selectedvalue(x){ if (!x) return ''; if (document.all) { return x.options[x.selectedIndex].value; } else { return x.value; } } function selectedtext(x){ return x.options[x.selectedIndex].text; } function getselectradio(obj){ if (!obj) return ''; for (var i=0; i