﻿function stopRKey(evt) {
    var evt = (evt) ? evt : ((event) ? event : null);
    var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
    if ((evt.keyCode == 13) && (node.type == "text" || node.type == "password")) { return false; }
}
document.onkeypress = stopRKey;

$(function() {
    setTimeout("hightlightSingleTab();", 800);
});

hightlightSingleTab = function() {
    $("div.stripNav").each(function(index, item) {
        var count = $("li", $(item)).length;
        if (count == 1) {
            $("li a", $(item)).removeClass("current");
        }

    });
}

decodeJsonText = function(s) {
	return $('<div></div>').html(s).text();
}

/* String Extensions */
String.prototype.trimEnd = function(c) {
	if (c)
		return this.replace(new RegExp(c.escapeRegExp() + "*$"), '');
	return this.replace(/\s+$/, '');
}

String.prototype.trimStart = function(c) {
	if (c)
		return this.replace(new RegExp("^" + c.escapeRegExp() + "*"), '');
	return this.replace(/^\s+/, '');
}

String.prototype.escapeRegExp = function() {
	return this.replace(/[.*+?^${}()|[\]\/\\]/g, "\\$0");
};
