<!--
//cd17.js
function stopErrors() {
 return true;
}
window.onerror = stopErrors;

function selectAll(theField) {
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
}

defaultStatus = "Level 1"  

/*
    The arrays are used to make encodeURI() and decodeURI() work like escape()
and unescape(), respectively.
    We use encodeURI() and decodeURI() in browsers that support them instead of
escape() and unescape() because the latter pair are deprecated in 
ECMAScript version 3, which is the standard for JavaScript.

    The encodeURIComponent() and decodeURIComponent() functions are available 
as well.

Note: escape() doesn't encode '@' in all older browsers.

*/
if(![].push) { // for browsers that don't natively support Array.push()
  Array.prototype.push = function() {
		for (var i = 0; i < arguments.length; i++) {
			this[this.length] = arguments[i];
		}
		return this.length;
  }
}
var specialChars = [':',';','?','@','&','=','$',',','#','~'];
var entities = ['%3A','%3B','%3F','%40','%26','%3D','%24','%2C','%23','%7E'];
var decodeOnlySpecialChars = [];
var decodeOnlyEntities = [];
for(var i=0;i<entities.length;i++) {
  decodeOnlyEntities.push(entities[i].replace(/%/,'\%'));
  decodeOnlySpecialChars.push(specialChars[i]);
}
decodeOnlySpecialChars.push('\+','\/');
decodeOnlyEntities.push('\%2B','\%2F');

function urlencode(str) {
  var re;
  if(typeof encodeURI == 'function') {
    str = encodeURI(str);
    for(var i=0;i<specialChars.length;i++) {
      re = new RegExp('\\'+specialChars[i],'g')
      str = str.replace(re,entities[i])
    }
  } else {
    str = escape(str);
  }
  return str;
}
function urldecode(str) {
  var re;
  if(typeof decodeURI == 'function') {
    str = decodeURI(str);
    for(var i=0;i<decodeOnlyEntities.length;i++) {
      re = new RegExp(decodeOnlyEntities[i],'g')
      str = str.replace(re,decodeOnlySpecialChars[i])
    }
  } else {
    str = unescape(str);
  }
  return str;
}

function dss_addLoadEvent(fn) {
  if(typeof(fn)!="function")return;
  var tempFunc=window.onload;
  window.onload=function() {
    if(typeof(tempFunc)=="function")tempFunc();
    fn();
  }
}
dss_addLoadEvent(function() {
  var f = document.form1;
  f.submit = function(){return false;}
  var temp = function(f,fn){return function(){
    f.results.value = fn(f.input.value);
  }}
  f.Encode.onclick = temp(f,urlencode);
  f.Decode.onclick = temp(f,urldecode);
});
//-->