var node=null;

function searchscroll(txtfield,updateid)
{

  if(document.getElementById(updateid).childNodes.length>0) {
    if(this.node==null) {
      this.node=document.getElementById(updateid).firstChild;
    }

    document.getElementById(txtfield).value=this.node.firstChild.innerHTML;
    this.node=this.node.nextSibling;
  }

}

function resetNode() {
  this.node=null;
}

function updatesearch(txtfield,updateid) {

  if ( updateid != '' ) {

      resetNode(); //

      if(this.node==null) {
        $( "#"+updateid ).load( "/ajax/updatesearch.php?string=" + encodeURI(txtfield.value) + "&update="+updateid );

        var content = document.getElementById(updateid).innerHTML;

        if ( content.length == 0)
        {
          document.getElementById(updateid).style.display = 'none';
        }
        else
        {
          document.getElementById(updateid).style.display = '';
        }
      }
      
  }
} 
