function getParentFormElement(elem) {
  form_obj = elem;
  while (form_obj.tagName!='FORM') {
    form_obj = form_obj.parentNode;
    if (!form_obj) {
      alert('Form not found! Please put the list control in a form!'); return 0;
    }
  }
  return form_obj;
}

function ADivButton(d){
  var col = d.getElementsByTagName('A');
  if(col.length>0){
    col[0].click();
  }
}

function getWinHeight() {
  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 [ scrOfX, scrOfY ];
  return myHeight;
}

function setLinks(obj1,obj2) {
	
	var d=document.getElementById(obj1);
	var l=document.getElementById(obj2);
	if(!l||l=='undefined') {
		d.style.display='none';
		return;
	}
	if((l.offsetTop+10)>getWinHeight()) {
		d.style.display='inline';
	}
	else {
		d.style.display='none';
	}
}