//fix flicker of BG image in IE
try {
  document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}

linkHandler = {
    initialize:function(linkId, functionCall){
        document.getElementById(linkId).onclick = functionCall;
    }
};

/*Function.prototype.bind = function(){
	var __method = this, args = $A(arguments), object = args.shift();
	return function() {
		return __method.apply(object, args.concat($A(arguments)));
	};
};*/

function URLDecode(encodedString) {
  var output = encodedString;
  var binVal, thisString;
  var myregexp = /(%[^%]{2})/;
  while ((match = myregexp.exec(output)) != null
             && match.length > 1
             && match[1] != '') {
    binVal = parseInt(match[1].substr(1),16);
    thisString = String.fromCharCode(binVal);
    output = output.replace(match[1], thisString);
  }
  return output;
};

/* formats address for results table */
function line(start, end, input)
{
    var output = "";
    for(n = start; n < end; n++){
        output    += input[n];
        output    += n < end - 1 ? "," : "" ;
    }
    return output;
};

String.prototype.getQueryParams = function(){
	var myQueryParams = this.split("?")[1].split("&");
	var myQueryObj = {};

	for(i=0;i<myQueryParams.length;i++){
    	var queryObj = myQueryParams[i].split("=");
    	myQueryObj[queryObj[0]] = queryObj[1];
	}
	
	return myQueryObj;
};