//jrlib //2007
function getProp(ob,nm){
 ob=getObj(ob); if(ob!=null){ob=ob[nm];} //alert(""+ob);
 return(ob);
}
function setProp(ob,nv){
 var i,j; nv=nv.split(';'); ob=getObj(ob); //alert(objStr(nv)+"\n-\n"+objStr(ob));
 if(ob){for(i=0;i<nv.length;i++){j=nv[i].split(":"); if(j[0].length){ob[j[0]]=j[1];}}}
}
function getObj(ob){
 var i,a=""; i=ob.indexOf("."); if(i!=-1){a=ob.substring(i+1); ob=ob.substring(0,i);} ob=getElement(ob);
 if(ob && a.length){a=a.split("."); for(i=0;i<a.length;i++){ob=ob[a[i]]; if(ob==null){break;}}}
 return(ob);
}
function getElement(nm){
 var ob=null; if(nm=="window"){ob=window;}else if(nm=="document"){ob=document;}
 if(!ob){ob=window[nm];} if(!ob){ob=document[nm];} if(!ob){ob=document.getElementById(nm);} //alert(nm+": "+objStr(ob));
 return(ob);
}
function objStr(o){ var i,s;
 if(typeof(o)=="function"){s=o+"()";
 }else if(typeof(o)=="array"){s=o.length+"["+o.join(";")+"]";
 }else if(o==null || typeof(o)=="string" || typeof(o)=="number" || typeof(o)=="float" || typeof(o)=="int" || typeof(o)=="boolean"){s=""+o;
 }else{s="{"; for(i in o){s+=i+":"+(""+o[i]).substring(0,256)+"; ";} s+="}";} //(""+o[i]).substring(0,256)
 return(s);
}
function setReq(req,ctr,sep){
 var i,j; if(sep==null){sep='&';} if(ctr==null){ctr='';}else{ctr+='.';} if(req==null){req=location.search;}
 req=req.substring(req.indexOf("?")+1);
 if(req.length){
  req=req.split(sep); for(i=0;i<req.length;i++){j=req[i].split("="); gV=j[1]; void(eval(ctr+j[0]+'=gV;'));} gV=null;
 }
}
function toFlash(){
 var i,p=new Array(),f; for(i=0;i<arguments.length;i++){p.push(arguments[i]);}
 f=p.shift(); if(typeof(f)=="string"){f=getObj(f);} if(!f){f=flob;} //alert(""+objStr(f)+"\n"+objStr(p));
 i=f.toFlash(p); //alert("ret: "+i); // f.SetVariable("v",p);
 return(i);
} //toFlash("flob","v1","v2");
function writeTo(ref,tx,typ){
 if(typ==null){typ="txt";} if(typ=="txt" || typ=="html"){tx=webSrc(tx);} //if(window.dwEnd){tx+=dwEnd;}
 if(ref!=null){
  if(document.getElementById==null){ref.document.open("text/html"); ref.document.write(tx); ref.document.close();
  }else{ref.innerHTML=tx;} //.appendChild(tx);
 }
}
function webSrc(tx){
 tx+=""; //tx=tx.replace(/\n\n</g,"\n&lt;"); //s/h
 tx=tx.replace(/</g,"&lt;"); //tx=tx.replace(/>/g,"&gt;"); //h/s //"&lt;" "&lt|;" //"&gt;" "&gt|;"
 tx=tx.replace(/\n/g,"<br/>\n"); //def <br>,<br/>
 return(tx);
}
function strTrim(tx){
 var i,s,e; tx+=""; s=0; e=tx.length;
 for(i=0;i<e;i++){if(tx.charCodeAt(i)>32){s=i; break;}}
 for(i=e-1;i>s;i--){if(tx.charCodeAt(i)>32){e=i+1; break;}}
 if(s || e<tx.length){tx=tx.substring(s,e);}
 return(tx);
}
function dec2hex(d){
 var h=Math.abs(d); h%=16; if(h>9){h=String.fromCharCode(55+h);}
 if(arguments.length==1){
  if(d<0){d=-d; h+="-";}else{h+="+";}
 }else{h+=arguments[1];}
 d=parseInt(d/16,10);
 if(d<10){
  if(d==0){d="";}
  d+=h; h=d.charAt(d.length-1); if(h=="+"){h="";}
  d=h+d.substring(0,d.length-1);
 }else{d=dec2hex(d,h);}
 return(d);
}
