/* Removes focus from button after you click it. */
//$("a").each(function(){this.onmouseup = this.blur();});

function stringformat(str)
{
  for(i = 1; i < arguments.length; i++)
  {
    str = str.replace('{' + (i - 1) + '}', arguments[i]);
  }
  return str;
}

/* extensions for a string */
String.prototype.beginsWith = function(t, i) { if (i==false) { return
(t == this.substring(0, t.length)); } else { return (t.toLowerCase()
== this.substring(0, t.length).toLowerCase()); } }

String.prototype.endsWith = function(t, i) {if (i==false) { return (t
== this.substring(this.length - t.length)); } else { return
(t.toLowerCase() == this.substring(this.length -
t.length).toLowerCase()); } } 

function BE_SubmitSearch() {
	  var elem = document.getElementById("be_search");
	  var searchString = elem.value;
	  if (searchString.length > 0)
	  {
			Page_ValidationActive = false;
			window.location.href = "/CMS/Search.aspx?cx=000844109133971852894%3Alshznetchmw&cof=FORID%3A10%3BNB%3A1&ie=UTF-8&q=" + escape(searchString) + "&sa=Search";
			return false;
	  }
	  else {
	  }
}

function checkEnter(e){
	var characterCode;
	if(e && e.which){ //if which property of event object is supported (NN4)
		e = e;
		characterCode = e.which; //character code is contained in NN4's which property
	} else{
		e = event;
		characterCode = e.keyCode; //character code is contained in IE's keyCode property
	}
	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
		BE_SubmitSearch();
		return false;
	} else{
		return true;
	}
}