/*function $() {
  var elements = new Array();
  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);
    if (arguments.length == 1)
      return element;
    elements.push(element);
  }
  return elements;


function sf(id){
	window.open('/feature.aspx?id=' + id,'Feature','toolbar=no, width=400, height=300, resizable=no, scrollbars=yes, status=yes');
	return false;
}

function oi(link){
	window.open('/view.aspx?url=' + link.href,'Image','toolbar=no, width=800, height=600, resizable=no, scrollbars=yes, status=no');	
	return false;
}}*/

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	}
	else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}

function globalSearch(input_){
  if (input_.value.length>0)
    document.location.href = '/search.aspx?q=' + encodeURIComponent(input_.value);
  return false;
}

function checkEnter(e){
		var cc_;
		if(e && e.which){ e = e; cc_ = e.which; }
		else { e = event; cc_ = e.keyCode; }
		if(cc_ == 13) {
			//alert($('query').value);
			document.forms[0].action = '/search.aspx?q=' + encodeURIComponent($('q').value);
			document.location.href = '/search.aspx?q=' + encodeURIComponent($('q').value);
			return false;
			}
		else { return true; }
}

var win = null;
function openCenteredPopup(mypage,myname,w,h,features) {
  if (features=='default')
    features = 'resizable=yes,scrollbars=no';
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(mypage,myname,settings);
  win.window.focus();
}

String.prototype.replaceAll = function(strTarget, strSubString ) {
    var strText = this;
    var intIndexOfMatch = strText.indexOf(strTarget);
    
    while (intIndexOfMatch != -1){
      strText = strText.replace( strTarget, strSubString )
      intIndexOfMatch = strText.indexOf( strTarget );
    } 
    return( strText );
}
//
//