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 winHeight() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return myHeight;
}

function fixHeight(el){
  var h_ = winHeight()-99;
  if (el.offsetHeight>h_)
		return;
  if (el.style.height<h_)
    el.style.height = h_ + "px";
}

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 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; }
}