function IsNumeric(sText){

   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

    try{

    for (i = 0; i < sText.length && IsNumber == true; i++){ 
        Char = sText.charAt(i); 
        if (ValidChars.indexOf(Char) == -1){IsNumber = false;}
    }

    return IsNumber;
   
   }catch(ex){return false;}
   
}

function request(name){return(Request(name));}
function Request(name)
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}


/** DICTIONARY COLLECTION **/
function DictionaryItem(ItemId, ItemName, ItemValue) {
    this.Id = ItemId;
    this.Name = ItemName;
    this.Value = ItemValue;
}
function Dictionary() {
    this.length = 0;
    this.Items = new Array();
    this.AddItem = addNewDictionaryItem;
    this.getItem = getItemByIdOrName;
}
function getItemByIdOrName(index) {
    if (IsNumeric(index)) {
        return this.Items[index];
    } else {
        for (var i = 0; i < this.length; i++) {
            if (this.Items[i].Name == index) {
                return (this.Items[i]);
            }
        }
    }
}
function addNewDictionaryItem(dictionaryItem) {
    var currentLength = this.Items.length;
    this.Items[currentLength] = dictionaryItem;
    this.length = (currentLength + 1);
}
/** END DICTIONARY COLLECTION **/



/*Decodes a string encoded in .NET with HttpUtility.UrlEncode*/
function HttpDecode(input) {
	try {
		var re = new RegExp('\\+', 'g');
		input = input.replace(re, ' ');
		return decodeURIComponent(input);
	} catch (ex) {
		//if(debug){throw ex;}
		return '';
	}
};
