// To handle all the elib search function
//
//-------------------------------------------------------------------
  function elibSearchPopUp( url ) {
    hdl = window.open( url, 'elibSearch', "resizable=yes,scrollbars=yes,height=600,width=500" );
    hdl.focus();
  }

//-------------------------------------------------------------------
  function elibClearSearch ( ) {
   if( document.frmBrowse.search ) {
     document.frmBrowse.search.value = "";
  }
    document.frmBrowse.submit();
  }

//-------------------------------------------------------------------
function elibSubmit( ) {
    // Get params
    var paramList = new String();

    // Set Params
    if( document.frmBrowse.params ) {
      for( i=0; i<arguments.length; i++ ) {
	if( i>0 ) {
	  paramList += ',';
	}
	paramList += arguments[i];
      }
      document.frmBrowse.params.value = paramList;
    }

    //Submit Form
    document.frmBrowse.submit();
  }

//-------------------------------------------------------------------
function changeConfYear( ) {
	document.frmBrowse.params.value = "";

	//Submit Form
    document.frmBrowse.submit();
}

//For conference abstracts-------------------------------------------
function elibClearSearchField ( catid ) {
   if( document.frmBrowse.search ) {
     document.frmBrowse.search.value = "";
  }
  if( document.frmBrowse.confID ) {
     document.frmBrowse.confID.value = catid;
  }
}

//For fast facts-------------------------------------------
function elibClearSearchFF ( ) {
  if( document.frmBrowse.search ) {
     document.frmBrowse.search.value = "";
  }
  if( document.frmBrowse.sortby ) {
     document.frmBrowse.sortby.value = 0;
  }
  document.frmBrowse.submit();
}

//For ROAR Profiles
function elibClearSearchRP () {
	if ( document.frmProfile.search ) {
		document.frmProfile.search.value = "";
	}
	if( document.frmProfile.location ) {
		document.frmProfile.location.value = "ALL";
	}
	if( document.frmProfile.elibid ) {
		document.frmProfile.elibid.value = 0;
	}
	document.frmProfile.submit();
}

function getPanelProject(profileID) {
    /**
     * Retrieve panel via ajax call
     */
	sendRequest('/roar/profile_related_projects.php?profileId=' + profileID, getPanelProject_Callback);
}

function getPanelProject_Callback(req) {
    /**
     * Handle callback data from the AJAX call
     */

    sProject = req.responseText;

    getObj('relatedProjects'); // this gets a reference to the DIV element as the global variable 'obj'
    obj.innerHTML = sProject; // replace contents of element
}

//For ROAR Browse page
function elibClearSearchRoarBrowse () {
	if ( document.frmBrowse.search ) {
		document.frmBrowse.search.value = "";
	}
	if( document.frmBrowse.location ) {
		document.frmBrowse.location.value = "";
	}
	if( document.frmBrowse.catid ) {
		document.frmBrowse.catid.value = "";
	}
	if( document.frmBrowse.phcred ) {
		document.frmBrowse.phcred.checked = false;
	}
	document.frmBrowse.submit();
}

//for ROAR index page
function elibClearSearchRoarIndex () {
	if ( document.frmBrowse.search ) {
		document.frmBrowse.search.value = "";
	}
	if ( document.frmBrowse.roarID ) {
		document.frmBrowse.roarID.value = "147";
	}
	if( document.frmBrowse.params ) {
		document.frmBrowse.params.value = "";
	}
}

