function Trim(str) {return str.replace(/(^\s*)|(\s*$)/g, "");  }   
function IsIE() {return document.all ? true : false;}
function E(id) {return document.getElementById(id);}
function V(id) {return document.getElementById(id).value;}
function ES(name) {return document.getElementsByName(name);}
function P(id) {return id + "=" + Encoder.EncodeParameter(document.getElementById(id).value);}
function VS(name) {var comps = ES(name);
var result = []
for (var i=0;i<comps.length;i++)
result[i] = comps.value;
return result;}
//--------------------------------------------------------------------------
function createXMLHttpRequest() {if (document.all) {try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {}
try { return new ActiveXObject("Msxml2.XMLHTTP");    } catch(e) {}} else {try { return new XMLHttpRequest();} catch(e) {}}
return null;}
Encoder = {__UTF8 : function(wide) {var c, s;
var enc = "";
var i = 0;
while(i<wide.length) {c= wide.charCodeAt(i++);
// handle UTF-16 surrogates
if (c>=0xDC00 && c<0xE000) continue;
if (c>=0xD800 && c<0xDC00) {if (i>=wide.length) continue;
s= wide.charCodeAt(i++);
if (s<0xDC00 || c>=0xDE00) continue;
c= ((c-0xD800)<<10)+(s-0xDC00)+0x10000;}
// output value
if (c<0x80) enc += String.fromCharCode(c);
else if (c<0x800) enc += String.fromCharCode(0xC0+(c>>6),0x80+(c&0x3F));
else if (c<0x10000) enc += String.fromCharCode(0xE0+(c>>12),0x80+(c>>6&0x3F),0x80+(c&0x3F));
else enc += String.fromCharCode(0xF0+(c>>18),0x80+(c>>12&0x3F),0x80+(c>>6&0x3F),0x80+(c&0x3F));}
return enc;},
__hex_chars : "0123456789ABCDEF",
_ok_uri_chars : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-",
__ToHex : function(n) {return Encoder.__hex_chars.charAt(n>>4) + Encoder.__hex_chars.charAt(n & 0xF);},
EncodeParameter : function(s) {var s = Encoder.__UTF8(s);
var c;
var enc = "";
for (var i= 0; i<s.length; i++) {if (Encoder._ok_uri_chars.indexOf(s.charAt(i))==-1)
enc += "%"+Encoder.__ToHex(s.charCodeAt(i));
else
enc += s.charAt(i);}
return enc;}};
function writehtml(html) {document.write(html);}