var debug_mode=false;var request_type="GET";var request_uri="/members/";var pwInterval;function debug(A){if(debug_mode){alert("RSD: "+A)}}function init_xmlhttp(){debug("init_xmlhttp() called..");var B;try{B=new ActiveXObject("Msxml2.XMLHTTP")}catch(D){try{B=new ActiveXObject("Microsoft.XMLHTTP")}catch(C){B=null}}if(!B&&typeof XMLHttpRequest!="undefined"){B=new XMLHttpRequest()}if(!B){debug("Could not create connection object.")}return B}function show_wait_cursor(){create_please_wait();show_please_wait();document.body.style.cursor="progress"}function show_default_cursor(){hide_please_wait();document.body.style.cursor="default"}function rand_str(){var D="0123456789abcdefghiklmnopqrstuvwxyz";var E=8;var C="";for(var B=0;B<E;B++){var A=Math.floor(Math.random()*D.length);C+=D.substring(A,A+1)}return C}function call_remote(I,F,H,J){var D,G,B;var A;var E;var C;show_wait_cursor();if(J){C=J}else{C=request_type}A=request_uri+escape(I);if(C=="GET"){if(F!=null){A=A+"?";for(D=0;D<F.length;D++){argvar=F[D].substring(0,F[D].indexOf("="));argval=F[D].substring(F[D].indexOf("=")+1);A=A+"&"+argvar+"="+encodeURIParam(argval)}}E=null}else{if(F!=null){for(D=0;D<F.length;D++){argvar=F[D].substring(0,F[D].indexOf("="));argval=F[D].substring(F[D].indexOf("=")+1);E=E!=null?E+"&":"";E=E+argvar+"="+encodeURIParam(argval)}}}if(A.indexOf("?")==-1){A=A+"?rstr="+rand_str()}else{A=A+"&rstr="+rand_str()}G=init_xmlhttp();G.open(C,A+"&ajax_request=yes",true);if(C=="POST"){G.setRequestHeader("Method","POST "+A+" HTTP/1.1");G.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=utf-8")}G.onreadystatechange=function(){if(G.readyState!=4){return }debug("received "+G.responseText);var K;K=G.responseText;show_default_cursor();if(K==""){}else{H(K,F)}};G.send(E);debug(I+" uri = "+A+"/post = "+E);debug(I+" waiting..");delete G}function set_div(B,A){if(document.getElementById){document.getElementById(B).innerHTML=A}else{if(document.layers){document.divid.innerHTML=A}else{document.all.divid.innerHTML=A}}}function show_div(A){if(document.getElementById){document.getElementById(A).style.visibility="visible"}else{if(document.layers){document.divid.style.visibility="visible"}else{document.all.divid.style.visibility="visible"}}}function hide_div(A){if(document.getElementById){document.getElementById(A).style.visibility="hidden"}else{if(document.layers){document.divid.style.visibility="hidden"}else{document.all.divid.style.visibility="hidden"}}}function debug_array(A){alertTxt="Array has "+A.length+" elements:\n";for(i=0;i<A.length;i++){alertTxt+=" - "+A[i]+"\n"}alert(alertTxt)}function process_form(A){args=Array();for(i=0;i<A.elements.length;i++){element=A.elements[i];if(element.type=="select-one"){args.push(element.name+"="+element.options[element.selectedIndex].value)}else{if(element.type=="checkbox"||element.type=="radio"){if(element.checked){args.push(element.name+"="+element.value)}}else{args.push(element.name+"="+element.value)}}}return args}function create_please_wait(){if(!document.getElementById("please_wait")){var A=document.createElement("span");A.id="please_wait";A.innerHTML=" "+language.please_wait;A.style.position="absolute";A.style.visibility="hidden";A.style.backgroundColor="#FF0000";A.style.color="#FFFFFF";A.style.border="1px #000000 solid";A.style.padding="1px";A.style.fontWeight="bold";document.body.appendChild(A);position_please_wait()}}function position_please_wait(){var B=1;var C=4;var D=document.getElementById("please_wait");var F=(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body;var A=document.all?F.scrollLeft:pageXOffset;var E=document.all?F.scrollTop:pageYOffset;if(document.all||document.getElementById){D.style.left=parseInt(A)+C+"px";D.style.top=E+B+"px"}}function show_please_wait(){position_please_wait();pwInterval=setInterval("position_please_wait()",100);document.getElementById("please_wait").style.visibility="visible"}function hide_please_wait(){position_please_wait();clearInterval(pwInterval);document.getElementById("please_wait").style.visibility="hidden"}function utf8(B){var E,D;var A="";var C=0;while(C<B.length){E=B.charCodeAt(C++);if(E>=56320&&E<57344){continue}if(E>=55296&&E<56320){if(C>=B.length){continue}D=B.charCodeAt(C++);if(D<56320||E>=56832){continue}E=((E-55296)<<10)+(D-56320)+65536}if(E<128){A+=String.fromCharCode(E)}else{if(E<2048){A+=String.fromCharCode(192+(E>>6),128+(E&63))}else{if(E<65536){A+=String.fromCharCode(224+(E>>12),128+(E>>6&63),128+(E&63))}else{A+=String.fromCharCode(240+(E>>18),128+(E>>12&63),128+(E>>6&63),128+(E&63))}}}}return A}var hexchars="0123456789ABCDEF";function toHex(A){return hexchars.charAt(A>>4)+hexchars.charAt(A&15)}var okURIchars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";function encodeURIComponentNew(C){var C=utf8(C);var D;var A="";for(var B=0;B<C.length;B++){if(okURIchars.indexOf(C.charAt(B))==-1){A+="%"+toHex(C.charCodeAt(B))}else{A+=C.charAt(B)}}return A}function encodeURIParam(B){if(B==""){return""}var A="";var C=B;if(typeof encodeURIComponent=="function"){A=encodeURIComponent(C)}else{A=encodeURIComponentNew(C)}return A}function refresh_city_suggestions(A){set_div("city_suggestions",A)}function show_city_suggestions(D,B){if(D.length>2&&document.getElementById("position").value!="-1"){var A=document.getElementById("position").value;var E=$j("#location_id").offset();var C=$j("#location_id").height();$j("#city_suggestions").css({left:(E.left)+"px",top:(E.top+C+7)+"px"});document.getElementById("city_suggestions").style.display="block";if(document.getElementById("backframe")){document.getElementById("backframe").style.display="block"}args=new Array("location_name="+D,"country_code="+B,"i="+A);call_remote("geo/suggest_city/",args,refresh_city_suggestions)}else{document.getElementById("position").value="0"}}function hide_city_suggestions(){var A=document.getElementById("city_suggestions");if(A){A.style.display="none";if(document.getElementById("backframe")){document.getElementById("backframe").style.display="none"}}}function select_city(A,B){A=A.replace(/(, [a-z]+)?/ig,"");document.getElementById("location_id").value=A;hide_city_suggestions()}document.onmousedown=function(A){if(document.getElementById("is_active")){if(document.getElementById("is_active").value!="1"){hide_city_suggestions()}}};function doOver(B){var A=(document.getElementById("position").value*1);if(A<1){A=1}document.getElementById(A).style.backgroundColor="";document.getElementById(A).style.color="";document.getElementById("position").value=B;document.getElementById(B).style.backgroundColor="#2B62D0";document.getElementById(B).style.color="#FFFFFF";document.getElementById("is_active").value="1"}function doOut(A){document.getElementById(A).style.backgroundColor="";document.getElementById(A).style.color="";document.getElementById("is_active").value="0"}function checkEnter(B,A,C){var D=A.keyCode?A.keyCode:A.which?A.which:A.charCode;if(D==13){return false}if(D==9){if(document.getElementById("city_suggestions").style.display=="block"){hide_city_suggestions();document.getElementById("position").value="-1";document.getElementById(C).focus();return false}}}function handler(I,B,A){var F=document.getElementById("location_id").value;F=F.replace(/(, [a-z]+)? \(\d+\)/ig,"");if(F.length<3){document.getElementById("city_suggestions").style.display="none";return false}var J=B.keyCode?B.keyCode:B.which?B.which:B.charCode;if(J==13){var G=(document.getElementById("position").value*1);if(document.getElementById("new_desc["+G+"]")){var H=document.getElementById("new_desc["+G+"]").value}var C=document.getElementById("new_id["+G+"]").value;select_city(H,C);document.getElementById("position").value="-1";document.getElementById(A).focus();return false}if(J==27){hide_city_suggestions();document.getElementById("position").value="-1";document.getElementById(A).focus();return false}if(J==38){var G=(document.getElementById("position").value*1);if(G<1){var G=1}var E=G-1;if(G>0){document.getElementById(G).style.backgroundColor="";document.getElementById(G).style.color=""}if(E>0){document.getElementById(E).style.backgroundColor="#2B62D0";document.getElementById(E).style.color="#FFFFFF";if(E>8){var D=document.getElementById(E).offsetTop-120;document.getElementById("city_suggestions").scrollTop=D}else{document.getElementById("city_suggestions").scrollTop=0}}document.getElementById("position").value=G-1;return }if(J==40){var G=(document.getElementById("position").value*1);var E=G+1;if(G>0){document.getElementById(G).style.backgroundColor="";document.getElementById(G).style.color=""}document.getElementById(E).style.backgroundColor="#2B62D0";document.getElementById(E).style.color="#FFFFFF";if(E>8){var D=document.getElementById(E).offsetTop-120;document.getElementById("city_suggestions").scrollTop=D}else{document.getElementById("city_suggestions").scrollTop=0}document.getElementById("position").value=G+1;return }document.getElementById("position").value=0;show_city_suggestions(F,document.getElementById("country_code").value)};
