// liteAPI (c)2007-2009 by CodeWizard Grafix LLC - All rights reserved.

/* Standard Helpers */
function $(){var es=new Array();for(var i=0;i<arguments.length;i++){var e=arguments[i];if(typeof e=='string')e=document.getElementById(e);if(arguments.length==1)return e;es.push(e);}return es;}
function addEvent(e,et,fn){if(typeof e=='string')e=$(e);if(e.addEventListener){e.addEventListener(et,fn,false);}else if(e.attachEvent){e.attachEvent('on'+et,fn);}}
function $byclass(sc,n,t){var ce=new Array();if(n==null)n=document;if(t==null)t='*';var e=n.getElementsByTagName(t);var el=e.length;var p=new RegExp('(^|\\\\s)'+sc+'(\\\\s|$)');for(i=0,j=0;i<el;i++){if(p.test(e[i].className)){ce[j]=e[i];j++;}}return ce;}
function toggle(e){if(typeof e=='string')e=$(e);if(e.style.display!='none'){e.style.display='none';}else{e.style.display='';}}
function $size(e){if(typeof e=='string'){e=$(e);}return[e.offsetWidth,e.offsetHeight];}
function $pos(e){if(typeof e=='string'){e=$(e);}var cl=ct=0;if(e.offsetParent){do{cl+=e.offsetLeft;ct+=e.offsetTop;}while(e=e.offsetParent);}return [cl,ct];}
function winSize(){var w=h=0;if(self.innerWidth){w=self.innerWidth;h=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientWidth){w=document.documentElement.clientWidth;h=document.documentElement.clientHeight;}else if(document.body){w=document.body.clientWidth;h=document.body.clientHeight;}return[w,h];}

function scrollOffset(){var iebody=(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body,l=document.all?iebody.scrollLeft:pageXOffset,t=document.all?iebody.scrollTop:pageYOffset;return [l,t];}
function pageSize(){var xw=yw=0;if(window.innerHeight&&window.scrollMaxY){yw=window.innerHeight+window.scrollMaxY;xw=window.innerWidth+window.scrollMaxX;}else if(document.body.scrollHeight>document.body.offsetHeight){yw=document.body.scrollHeight;xw=document.body.scrollWidth;}else{yw=document.body.offsetHeight;xw=document.body.offsetWidth;}return [xw,yw];}

/* Ajax is adapted from the miniajax code and reverted back to not be used with prototype */
function collect(a,f){var n=[];for(var i=0;i<a.length;i++){var v=f(a[i]);if(v!=null)n.push(v)}return n};
ajax={};
ajax.x=function(){try{return new ActiveXObject('Msxml2.XMLHTTP')}catch(e){try{return new ActiveXObject('Microsoft.XMLHTTP')}catch(e){return new XMLHttpRequest()}}};
ajax.send=function(u,f,m,a){var x=ajax.x();x.open(m,u,true);x.onreadystatechange=function(){if(x.readyState==4)f(x.responseText)};if(m=='POST')x.setRequestHeader('Content-type','application/x-www-form-urlencoded');x.send(a)};
ajax.sendxml=function(u,f,m,a){var x=ajax.x();x.open(m,u,true);x.onreadystatechange=function(){if(x.readyState==4)f(x.responseXML)};if(m=='POST')x.setRequestHeader('Content-type','application/x-www-form-urlencoded');x.send(a)};
ajax.get=function(url,func){ajax.send(url,func,'GET')};
ajax.getxml=function(url,func){ajax.sendxml(url,func,'GET')};
ajax.gets=function(url){var x=ajax.x();x.open('GET',url,false);x.send(null);return x.responseText};
ajax.post=function(url,func,args){ajax.send(url,func,'POST',args)};
ajax.postxml=function(url,func,args){ajax.sendxml(url,func,'POST',args)};
ajax.update=function(url,elm){var e=$(elm);var f=function(r){e.innerHTML=r};ajax.get(url,f)};
ajax.submit=function(url,elm,frm){var e=$(elm);var f=function(r){e.innerHTML=r};ajax.post(url,f,ajax.serialize(frm))};

function openLightbox(h){var o=$('lightbox'),s=winSize();p=pageSize(),o.innerHTML='<div class="lbclose" onClick="closeLightbox()">Close [X]</div><div id="lightboxcontent">-</div>';$('lightboxcontent').innerHTML=h;$('blackbox').style.width=((p[0]>s[0])?p[0]:s[0])+'px';$('blackbox').style.height=((p[1]>s[1])?p[1]:s[1])+'px';$('blackbox').style.display='block';o.style.display='block';o.style.width='auto';o.style.height='auto';o.style.left=(((s[0]-$size('lightbox')[0])/2)+scrollOffset()[0])+'px';o.style.top=(((s[1]-$size('lightbox')[1])/2)+scrollOffset()[1])+'px';document.body.className='noscroll';}
function refreshLightbox(h){$('lightboxcontent').innerHTML=h;var o=$('lightbox'),s=winSize();$('lightbox').style.left=(((s[0]-$size('lightbox')[0])/2)+scrollOffset()[0])+'px';$('lightbox').style.top=(((s[1]-$size('lightbox')[1])/2)+scrollOffset()[1])+'px';document.body.className='noscroll';}
function closeLightbox(){$('lightbox').style.display='none';$('blackbox').style.display='none';document.body.className='scroll';}

function gotoUrl(c){window.location=c;}
function popupWindow(u,w,h){window.open(u,'_window','width='+w+',height='+h+',scrollbars=yes');}
function isIE(){if((navigator.appVersion.indexOf('MSIE')>0)&&(navigator.appVersion.indexOf('MSIE 8')<1)){return true;}else{return false};}
function ShowTip(o,c){var t=document.createElement('div');t.id='tooltip';t.style.position='absolute';t.style.left=($pos(o)[0]+$size(o)[0]+6)+'px';t.innerHTML=c;document.body.appendChild(t);$('tooltip').style.top=(($pos(o)[1]-(($size('tooltip')[1]-$size(o)[1])/2))+1)+'px';addEvent(o,'keypress',function(){HideTip();});}
function HideTip(){if($('tooltip'))document.body.removeChild($('tooltip'));}

