function add_listener(obj,evType,fn) { if(obj.addEventListener){ obj.addEventListener(evType, fn, false); } else if (obj.attachEvent){ obj.attachEvent('on'+evType, fn); } } function queryString(obj) { var i=0,ar=new Array(); for (name in obj) { if (typeof(obj[name])=='string' || typeof(obj[name])=='number') ar[i++]=encodeURIComponent(name)+'='+encodeURIComponent(obj[name]); } return ar.join('&'); }; function $(id) { return (typeof(id)=="string")?document.getElementById(id): id; } function show(id,flg) { var el=$(id); if (el) el.style.display=flg?"block":"none"; } function toggle(id) { var el=$(id); el.style.display= el.style.display=="block"?"none":"block"; } function clear(obj) { while (obj.childNodes.length>0) obj.removeChild(obj.childNodes[0]); return obj; } function nostatus() { window.status="";return true; } function set_class(el,cls) { el.setAttribute("class",cls); el.setAttribute("className",cls); } function el(parent,tag,id,cls,content,attrs) { var i=document.createElement(tag); if (id) i.setAttribute("id",id); if (cls) set_class(i,cls); if (content) i.innerHTML=content; if (attrs) { for (var a in attrs) if (typeof(a)=="string") i.setAttribute(a,attrs[a]); } if (parent) parent.appendChild(i); return i; } function loading_on() { var loader=$("loader"); if (loader) loader.style.display="block"; document.body.style.cursor="wait"; } function loading_off() { var loader=$("loader"); if (loader) loader.style.display="none"; document.body.style.cursor="default"; } function flash(msg) { var flash=$("flash"); if (msg && flash) { flash.innerHTML=msg; set_class(flash,"flash_on"); } else if (msg) { alert(msg); } else if (flash) { flash.innerHTML=" "; set_class(flash,"flash_off"); } }