var util={shouldDebug:false,membersEqual:function(b,a){return util.describe(b)==util.describe(a)},describe:function(b){if(b==null){return null}switch(typeof(b)){case"object":var a="";for(key in b){a+=", ["+key+"]: ["+b[key]+"]"}if(a.length>0){a=a.substring(2)}return a;default:return""+b}},debug:function(a){if(this.shouldDebug){alert("AjaxJS Message:\n\n"+a)}},error:function(a){if(this.shouldDebug){alert("AjaxJS ERROR:\n\n"+a)}},trim:function(a){return a.replace(/(^\s+|\s+$)/g,"")},strip:function(a){return a.replace(/\s+/,"")}};function $(){var c=new Array();for(var b=0;b<arguments.length;b++){var a=arguments[b];if(typeof a=="string"){if(document.getElementById){a=document.getElementById(a)}else{if(document.all){a=document.all[a]}}}c.push(a)}if(arguments.length==1&&c.length>0){return c[0]}else{return c}}function $C(a){return document.createElement(a)}var Try={these:function(){var c;for(var b=0;b<arguments.length;b++){var a=arguments[b];try{c=a();break}catch(d){}}return c}};function getElementsByClassName(g){var b=[];var f=new RegExp("\\b"+g+"\\b");var e=document.getElementsByTagName("*");for(var d=0,c=e.length;d<c;d++){if(f.test(e[d].className)){b.push(e[d])}}return b}function extractIFrameBody(a){var b=null;if(a.contentDocument){b=a.contentDocument}else{if(a.contentWindow){b=a.contentWindow.document}else{if(a.document){b=a.document}else{alert("Error: could not find sumiFrame document");return null}}}return b.body}var DELAY=1000;var steps=0;function andThen(a){var b=(++steps*DELAY);setTimeout(a,b)}function log(a){$("log").innerHTML+=a+"<br/>"}function createXMLHttpRequest(){try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(a){}try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(a){}try{return new XMLHttpRequest()}catch(a){}alert("XMLHttpRequest not supported");return null}var ajaxCaller={shouldDebug:false,shouldEscapeVars:false,shouldMakeHeaderMap:true,calls:new Array(),pendingResponseCount:0,getXML:function(b,a){this.get(b,null,a,true,null)},getPlainText:function(b,a){this.get(b,null,a,false,null)},postForPlainText:function(b,c,a){this.postVars(b,c,null,a,false,null,"POST",null,null,null)},postForXML:function(b,c,a){this.postVars(b,c,null,a,true,null,"POST",null,null,null)},get:function(d,b,c,a,e){this._callServer(d,b,c,a,e,"GET",null,null,null)},postVars:function(c,e,d,b,a,f){this._callServer(c,d,b,a,f,"POST",e,null,null)},postBody:function(d,f,c,b,g,e,a){this._callServer(d,f,c,b,g,"POST",null,e,a)},putBody:function(d,f,c,b,g,e,a){this._callServer(d,f,c,b,g,"PUT",null,e,a)},options:function(d,f,c,b,g,e,a){this._callServer(d,f,c,b,g,"OPTIONS",null,e,a)},trace:function(d,f,c,b,g,e,a){this._debug("trace");this._callServer(d,f,c,b,g,"TRACE",null,e,a)},deleteIt:function(d,b,c,a,e){this._callServer(d,b,c,a,e,"DELETE",null,null,null)},head:function(d,b,c,a,e){this._callServer(d,b,c,a,e,"HEAD",null,null,null)},_callServer:function(a,l,f,k,j,e,h,b,g){if(l==null){l=new Array()}this._debug("_callServer() called. About to request URL\ncall key: ["+this.calls.length+"]\nurl: ["+a+"]\ncallback function: ["+f+"]\ntreat response as xml?: ["+k+"]\nRequest method?: ["+e+"]\ncalling context: ["+j+"]\nexplicit body type: ["+b+"]\nexplicit body: ["+g+"]\nurlVars: ["+util.describe(l)+"]\nbodyVars: ["+util.describe(h)+"]");var d=this._createXMLHttpRequest();d.onreadystatechange=function(){ajaxCaller._onResponseStateChange(m)};var m={xReq:d,callbackFunction:f,expectingXML:k,callingContext:j,url:a};if(l!=null){var c=this._createHTTPVarSpec(l);if(c.length>0){a+="?"+c}}d.open(e,a,true);if(e=="GET"||e=="HEAD"||e=="DELETE"){this._debug("Body-less request to URL "+a);d.send(null);return}if(e=="POST"||e=="PUT"||e=="OPTIONS"||e=="TRACE"){bodyType=null;body=null;if(b==null){bodyType="application/x-www-form-urlencoded; charset=UTF-8";body=this._createHTTPVarSpec(h)}else{bodyType=b;body=g}this._debug("Content-Type: ["+bodyType+"]\nBody: ["+body+"].");d.setRequestHeader("Content-Type",bodyType);d.send(body);return}this._debug("ERROR: Unknown Request Method: "+e)},_onResponseStateChange:function(a){xReq=a.xReq;if(xReq.readyState<4){return}if(xReq.readyState==4){this._debug("Call "+util.describe(a)+" with context ["+a.callingContext+"] to "+a.url+" has returned.");callbackFunction=a.callbackFunction;if(!callbackFunction){setTimeout(function(){_onResponseStateChange(a)},100)}var b=a.expectingXML?xReq.responseXML:xReq.responseText;responseHeaders=xReq.getAllResponseHeaders();headersForCaller=this.shouldMakeHeaderMap?this._createHeaderMap(responseHeaders):responseHeaders;callbackFunction(b,headersForCaller,a.callingContext)}a=null;this.pendingResponseCount--},_createXMLHttpRequest:function(){if(window.XMLHttpRequest){return new XMLHttpRequest()}else{if(window.ActiveXObject){return new ActiveXObject("Microsoft.XMLHTTP")}else{_error("Could not create XMLHttpRequest on this browser");return null}}},_createHTTPVarSpec:function(c){var a="";for(key in c){var b=c[key];if(this.shouldEscapeVars){escapePlusRE=new RegExp("\\+");b=b.replace(escapePlusRE,"%2B")}a+="&"+key+"="+b}if(a.length>0){a=a.substring(1)}this._debug("Built var String: "+a);return a},_createHeaderMap:function(a){extractedHeaders=a.split("\n");delete extractedHeaders[extractedHeaders.length];headerMap=new Array();for(i=0;i<extractedHeaders.length-2;i++){head=extractedHeaders[i];fieldNameEnding=head.indexOf(":");field=head.substring(0,fieldNameEnding);value=head.substring(fieldNameEnding+2,head.length);value=value.replace(/\s$/,"");headerMap[field]=value}return headerMap},_debug:function(a){if(this.shouldDebug){alert("AjaxJS Message:\n\n"+a)}},_error:function(a){if(this.shouldDebug){alert("AjaxJS ERROR:\n\n"+a)}}};ajaxCaller.shouldDebug=false;var timeURL1="rate.php?id=1";var timeURL2="rate.php?id=2";var timeURL3="rate.php?id=3";var timeURL4="rate.php?id=4";var timeURL5="rate.php?id=5";var timeURL6="rate.php?id=6";var timeURL7="rate.php?id=7";var timeURL8="rate.php?id=8";window.onload=function(){$("defaultTime").onclick=requestDefaultTime;$("customTime").onclick=requestCustomTime;$("customTime1").onclick=requestCustomTime1;$("customTime2").onclick=requestCustomTime2;$("customTime3").onclick=requestCustomTime3;$("customTime4").onclick=requestCustomTime4;$("customTime5").onclick=requestCustomTime5;$("customTime6").onclick=requestCustomTime6;requestBothTimes();setInterval(requestBothTimes,9000)};function requestBothTimes(){requestDefaultTime();requestCustomTime();requestCustomTime1();requestCustomTime2();requestCustomTime3();requestCustomTime4();requestCustomTime5();requestCustomTime6()}function requestDefaultTime(){ajaxCaller.getPlainText(timeURL1,showDefaultTime)}function showDefaultTime(b){var a=$("defaultTimeLabel");a.innerHTML=b}function requestCustomTime(){ajaxCaller.getPlainText(timeURL2,showCustomTime)}function showCustomTime(c,b){var a=$("customTimeLabel");a.innerHTML=c}function requestCustomTime1(){ajaxCaller.getPlainText(timeURL3,showCustomTime1)}function showCustomTime1(c,b){var a=$("customTimeLabel1");a.innerHTML=c}function requestCustomTime2(){ajaxCaller.getPlainText(timeURL4,showCustomTime2)}function showCustomTime2(c,b){var a=$("customTimeLabel2");a.innerHTML=c}function requestCustomTime3(){ajaxCaller.getPlainText(timeURL5,showCustomTime3)}function showCustomTime3(c,b){var a=$("customTimeLabel3");a.innerHTML=c}function requestCustomTime4(){ajaxCaller.getPlainText(timeURL6,showCustomTime4)}function showCustomTime4(c,b){var a=$("customTimeLabel4");a.innerHTML=c}function requestCustomTime5(){ajaxCaller.getPlainText(timeURL7,showCustomTime5)}function showCustomTime5(c,b){var a=$("customTimeLabel5");a.innerHTML=c}function requestCustomTime6(){ajaxCaller.getPlainText(timeURL8,showCustomTime6)}function showCustomTime6(c,b){var a=$("customTimeLabel6");a.innerHTML=c}
