function urlencode(f){if((!f)||(f.length<1)){return null}var d=Array();var e;for(e in f){d.push(escape(e)+"="+escape(f[e]))}return d.join("&")}function ajax_request(e){if(!("loading" in e)){e.loading=function(a){}}if(!("onexception" in e)){e.onexception=e.onerror}function j(){try{if(i.readyState==4){var b=0;try{b=i.status}catch(a){}if(b==200){return e.onload(i,e)}else{return e.onerror(i,e)}}else{return e.loading(i,e)}}catch(a){return e.onexception(i,e)}}var i;if(window.XMLHttpRequest){try{i=new XMLHttpRequest()}catch(h){i=false}}else{if(window.ActiveXObject){try{i=new ActiveXObject("Msxml2.XMLHTTP")}catch(h){try{i=new ActiveXObject("Microsoft.XMLHTTP")}catch(h){i=false}}}}if(i){i.onreadystatechange=j;e.data=urlencode(e.data);if(e.method=="POST"){i.open("POST",e.url,true);i.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}else{var g=e.url+"?"+e.data;e.data=null;i.open("GET",g,true)}i.setRequestHeader("X-Requested-With","XMLHttpRequest");i.send(e.data);return false}else{return true}}function load_response_id(f,d){if(!("id" in d)){return}var e=f.responseHTML?f.responseHTML:f.responseText;document.getElementById(d.id).innerHTML=e}function loading_msg_id(c,d){if(!("id" in d)){return}document.getElementById(d.id).innerHTML="Loading (this may take a few seconds)..."}function error_msg_id(c,d){if(!("id" in d)){return}document.getElementById(d.id).innerHTML="The request failed, for the following reasons: <br/>"+c.responseText+"<br/> Please try again."};