//Copyright Jeff Grimm 2005

var JSROOT="/";var JSPLATFORM="/jsplatform/";if(!window.Node){var Node={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_FRAGMENT_NODE:11};}
function GenLib()
{}
GenLib.initArray=new Array();GenLib.addInit=function(init)
{var n=GenLib.initArray.length;GenLib.initArray[n]=init;}
GenLib.init=function()
{var n=GenLib.initArray.length;for(var i=0;i<n;i++)
{var f=GenLib.initArray[i];f();}}
Doc.isCSS=false;Doc.isW3C=false;Doc.isIE4=false;Doc.isNN4=false;Doc.isIE6CSS=false;Doc.isOpera=navigator.userAgent.indexOf("Opera")>-1;if(Doc.isOpera)Doc.isIE4=false;Doc.isIE55=navigator.userAgent.indexOf("MSIE 5.5;")>-1;Doc.isIE60=navigator.userAgent.indexOf("MSIE 6.0;")>-1;Doc.isIE70=navigator.userAgent.indexOf("MSIE 7.0;")>-1;Doc.isFirefox=navigator.userAgent.indexOf("Firefox")>-1;Doc.isGecko=navigator.userAgent.indexOf("Gecko")>-1;Doc.isMac=navigator.userAgent.indexOf("Macintosh")>-1;Doc.isSafari=navigator.userAgent.indexOf("Safari")>-1;if(navigator.userAgent.indexOf("AppleWebKit")>-1)
Doc.isSafari=true;if(Doc.isMac||Doc.isSafari)Doc.isGecko=false;if(Doc.isIE55||Doc.isIE60)Doc.isIE4=true;Doc.isIE=false;if(Doc.isIE4||Doc.isIE55||Doc.isIE60||Doc.isIE70)
Doc.isIE=true;if(Doc.isOpera)Doc.isIE=false;Doc.init=function()
{var ua=navigator.userAgent;if(document.images)
{Doc.isCSS=(document.body&&document.body.style)?true:false;Doc.isW3C=(Doc.isCSS&&document.getElementById)?true:false;Doc.isIE4=(Doc.isCSS&&document.all)?true:false;Doc.isNN4=(document.layers)?true:false;Doc.isIE6CSS=(document.compatMode&&document.compatMode.indexOf("CSS1")>=0)?true:false;Doc.isOpera=ua.indexOf("Opera")>-1;if(Doc.isOpera)Doc.isIE4=false;Doc.isIE55=ua.indexOf("MSIE 5.5;")>-1;Doc.isIE60=ua.indexOf("MSIE 6.0;")>-1;Doc.isIE70=ua.indexOf("MSIE 7.0")>-1;}}
GenLib.addInit(Doc.init);function include_lib(file)
{include(JSPLATFORM+file);}
function include_root(file)
{include(JSROOT+file);}
function include(script_filename)
{include.include_once(script_filename);}
include.included_files=new Array();include._include_string="";include.include_once=function(script_filename)
{if(!in_array(script_filename,include.included_files))
{include.included_files[include.included_files.length]=script_filename;include.include_dom(script_filename);}
function in_array(name,arr)
{var i,n=arr.length;for(i=0;i<n;i++)
{if(name==arr[i])return true;}
return false;}}
include._include_write=function(script_filename)
{document.write('<'+'script');document.write(' language="javascript"');document.write(' type="text/javascript"');document.write(' src="'+script_filename+'">');document.write('</'+'script'+'>');}
include._include_write_css=function(script_filename)
{document.write('<'+'link');document.write(' rel="stylesheet"');document.write(' type="text/css"');document.write(' href="'+script_filename+'">');document.write('</'+'link'+'>');}
include.include_dom=function(script_filename)
{var html_doc=document.getElementsByTagName('head').item(0);var t=script_filename.substring(script_filename.lastIndexOf('.')+1);var file=null;var sel=2;if(Doc.isIE55||Doc.isIE)sel=2;if(Doc.isFirefox||Doc.isGecko||Doc.isOpera)sel=1;if(t=='js')
{if(sel==2)
{include._include_write(script_filename);include._include_string+="WRITE:"+script_filename+"\n";}
else
{file=document.createElement('script');file.setAttribute('language','javascript');file.setAttribute('type','text/javascript');file.setAttribute('src',script_filename);include._include_string+="DOM:"+script_filename+"\n";html_doc.appendChild(file);}}
else if(t=='css')
{if(sel==2)
{include._include_write_css(script_filename);include._include_string+="WRITE:"+script_filename+"\n";}
else
{file=document.createElement('link');file.setAttribute('rel','stylesheet');file.setAttribute('type','text/css');file.setAttribute('href',script_filename);html_doc.appendChild(file);}}
return false;}
function Ajax(file,callback)
{var req=ajax();if(req)
{req.onreadystatechange=function()
{if(req.readyState==4)
{callback(req.responseText);}};req.open('GET',file);req.send(null);}
function ajax()
{var r;var brow=navigator.userAgent.toLowerCase();if(brow.indexOf('opera')!=-1)
{r=new XMLHttpRequest();}
else if(document.all)
{r=new ActiveXObject("Microsoft.XMLHTTP");}
else
{r=new XMLHttpRequest();}
return r;}
function file_loaded(res)
{document.getElementById('container').innerHTML=res;}}
Ajax.eval=function(text)
{var v='('+text+')';return eval(v);}
if(1)
include_lib("inherit.js");else
{function Inherit(clsname,clsfunc,thisptr,parentname,clsparent,parentThis,doDelete)
{if(typeof doDelete=="undefined")doDelete=true;var o;for(o in parentThis)
{var t=typeof clsparent.prototype[o];if(t=="function")
{clsfunc.prototype[o]=parentThis[o];}
else
{thisptr[o]=parentThis[o];}}
if(doDelete)delete parentThis;return thisptr;}}
if(typeof document.getElementById=="undefined")
{document.getElementById=function(id)
{var elem;if(typeof id=="string")
{if(Doc.isW3C)
{elem=document.getElementById(id);}
else if(Doc.isIE4)
{elem=document.all(id);}
else if(Doc.isNN4)
{elem=Doc.NN4seekLayer(document,id);}}
else
{theObj=id;}
return elem;}}
document.rect=function(left,top,width,height)
{if(typeof left=="undefined")left=0;if(typeof top=="undefined")top=0;if(typeof width=="undefined")width=0;if(typeof height=="undefined")height=0;var r={left:left,top:top,width:width,height:height,right:left+width,bottom:top+height,toString:asString};return r;function asString(label)
{if(typeof label=="undefined")label="";s=label+" left="+r.left+" top="+r.top+" width="+r.width+" height="+r.height+" right="+r.right+" bottom="+r.bottom;return s;}}
document.prRect=function(label,r)
{mprint(label+r);}
document.setPosition=function(elemId,left,top,relative)
{var d=Doc.getElementById(elemId);if(d)
{Doc.setPositionElem(d,left,top,relative)}}
document.setPositionElem=function(d,left,top,relative)
{if(d)
{d.style.left=left+"px";d.style.top=top+"px";}}
document.getPosition=function(id,relative)
{var elem=document.getElementById(id);if(elem)
return document.getPositionElem(elem,relative);return false;}
document.getPositionElem=function(obj,relative)
{var left=0;var top=0;var height=obj.offsetHeight;var width=obj.offsetWidth;if(typeof relative=="undefined")relative=false;while(obj)
{left+=obj.offsetLeft;top+=obj.offsetTop;obj=obj.offsetParent;if(relative)break;}
if(navigator.userAgent.indexOf("Mac")!=-1&&typeof document.body.leftMargin!="undefined")
{left+=document.body.leftMargin;top+=document.body.topMargin;}
return document.rect(left,top,width,height);}
document._uniqueIdCnt=1149;document.uniqueId=function(base,cnt)
{function getnext()
{return document._uniqueIdCnt++;}
if(typeof cnt=="undefined")
cnt=1;if(typeof base=="undefined")
base="u";var id;if(cnt==1)
{id=getnext();return base+id;}
var i;var ret=new Array(cnt);for(i=0;i<cnt;i++)
{id=getnext();ret[i]=base+id;}
return ret;}
document.setStyleAttribute=function(obj,csstext)
{if(Doc.isIE4==false&&typeof obj.setAttribute!="undefined")
{obj.setAttribute("style",csstext);}
else if(Doc.isIE4)
{var s=obj.getAttribute("style");s.cssText=csstext;}}
function debugToMain(msg,doNewline)
{if(typeof msg=="undefined")msg="";doNewline=typeof doNewline=='undefined'?true:doNewline;if(!debugToMain.box)
{createBox();}
prt();function prt()
{msg=cnv(msg);var div;if(doNewline)div=document.createElement('div');else div=document.createElement('span');div.innerHTML=msg;debugToMain.box.appendChild(div);return;debugToMain.box.innerHTML+=msg;if(doNewline)
debugToMain.box.innerHTML+="<br>";}
function cnv(str)
{str=str.replace(/\n/g,"<br>");str=str.replace(/\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;");return str;}
function createBox()
{debugToMain.box=document.createElement("div");debugToMain.box.style.backgroundColor="white";debugToMain.box.style.fontFamily="monospace";debugToMain.box.style.border="solid red 3px";debugToMain.box.style.padding="10px";document.body.appendChild(debugToMain.box);var h1=document.createElement("h1");h1.style.textAlign="center";h1.style.backgroundColor="pink";h1.appendChild(document.createTextNode("Debugging Output"));debugToMain.box.appendChild(h1);}}
debugToMain.box=null;mprint_text=function(msg)
{mprintstr("");var d=document.createTextNode(msg);debugToMain.box.appendChild(d);mprint("");}
mprint=function(msg)
{debugToMain(msg,true);}
mprintstr=function(msg)
{debugToMain(msg,false);}
debugToMain.debug_errorbox=function(msg,url,linenumber)
{debugToMain("error msg="+msg,true);debugToMain("error url="+url,true);debugToMain("error linenumber="+linenumber,true);}
debugToMain.oldwindow_onerror=window.onerror;function Doc()
{}
document.showElem=function(elem)
{elem.style.visibility="visible";elem.style.display="block";}
document.hideElem=function(elem)
{elem.style.visibility="hidden";elem.style.display="none";}
include_lib("event.js");include_lib("math.js");function asInt(c)
{var t=typeof c;if(t=="number")return c;if(t=="boolean")return c==true?1:0;if(t=="string")
{if(c==''||c.length==0||c==' ')
return 0;return parseInt(c);}
return 0;}
function asFloat(c)
{var t=typeof c;if(t=="number")return c;if(t=="boolean")return c==true?1:0;if(t=="string")
{if(c==''||c.length==0||c==' ')
return 0;return parseFloat(c);}
return 0;}
