function submitChar(buttonId,currChar,theForm) 
{
      var buttonId=buttonId;
      theForm.currentChar.value =currChar ;
      var check1=theForm.BrowseFor[4];
      var check2=theForm.BrowseFor[6];
      var check3=theForm.BrowseFor[3];
      if(check3 != null)
      {
        if(theForm.BrowseFor[0].checked || 
           theForm.BrowseFor[1].checked || 
           theForm.BrowseFor[3].checked || 
           theForm.BrowseFor[2].checked)
        setButtonId('browse');
      }
      else if(check1 != null && check2 != null)
      {
        if(theForm.BrowseFor[4].checked && 
           theForm.BrowseBy[6].checked)
        setButtonId('getsubjectList');
      }
      else if(buttonId != "")
      {
        setButtonId(buttonId);
      }
      
      if(check1 != null)
      {
      	if(theForm.BrowseFor[4].checked)
        setButtonId('getsubjectList');
      }	

      theForm.hdAction.value ="button_browse" ;
   
      theForm.submit();
}

function callOnLoad(browseFor,theForm)
{
  changeFlag(browseFor,theForm);
}

function getList(criteria,desc,theForm) {
  theForm.criteria.value =criteria ;
  theForm.description.value =desc ;
  setButtonId('getList');
  theForm.submit();
}

function contractList(criteria,theForm) {
  theForm.criteria.value =criteria ;
  setButtonId('browse');
  theForm.submit();
}

function getsubjectList(criteria,theForm)
{
  theForm.criteria.value =criteria;
  setButtonId('getsubjectList');
  theForm.submit();
}

function setSubjectCode(subjectCode,theForm)
{
   theForm.subjectCode.value=subjectCode;
}

function sethdAction(hdAction,theForm)
{
   theForm.hdAction.value=hdAction;
}

function setCriteria(criteria,theForm)
{
  theForm.criteria.value =criteria;
  theForm.submit();
}

function changeRadioFlag(flag,theForm)
{
  
  if (theForm.BrowseBy){
    var length=theForm.BrowseBy.length;
    for(var i=0;i<length;i++) 
    {
      theForm.BrowseBy[i].checked=false;
    }
    changeFlag(flag,theForm);
  }
}

function validate(theForm)
{
  var length=theForm.BrowseBy.length;
  var checkSelected=false;
  for(var i=0;i<length;i++) 
    {
      if(theForm.BrowseBy[i].checked)
      {
        checkSelected=true;
        break;
      }
    }
  if(!checkSelected) 
  { 
    alert("Please select a browseBy Option");
  }
  else
  {
    setButtonId('browse');
    theForm.hdAction.value="button_browse";
  }
}

function changeFlag(flag,theForm) {

  
  if (theForm.BrowseBy){
    var length=theForm.BrowseBy.length;
    theForm.BrowseBy[2].disabled = true;
    
    if(flag == "allJournals" || flag== "mySubsJournals")
    {
    	theForm.BrowseBy[0].disabled = false;
        theForm.BrowseBy[0].checked = true;
        theForm.BrowseBy[1].disabled = false;
        theForm.BrowseBy[1].checked = false;        
        
    }
    if(flag == "emeraldReviews" || flag== "emeraldAbstracts")
    {
        for(var i=0;i<length;i++) 
        {
            if(theForm.BrowseBy[i].value == "journalTitle" ||
            theForm.BrowseBy[i].value == "lcClassification" ||
            theForm.BrowseBy[i].value == "jSubject" ||
            theForm.BrowseBy[i].value == "subject")
            {
              theForm.BrowseBy[i].disabled = true;
              theForm.BrowseBy[i].checked = true;
              
              
            }
           else
             {
                theForm.BrowseBy[i].disabled = false;
                theForm.BrowseBy[i].checked = true;
             }  
       }
    }
    if(flag == "researchItems")
    {
        for(var i=0;i<length;i++) 
        {
            if(theForm.BrowseBy[i].value == "journalTitle" ||
            theForm.BrowseBy[i].value == "lcClassification" ||
            theForm.BrowseBy[i].value == "jSubject" ||
            theForm.BrowseBy[i].value == "Keyword" ||
            theForm.BrowseBy[i].value == "subjectClassification" ||
            theForm.BrowseBy[i].value == "jTitle")  {
              theForm.BrowseBy[i].disabled = true;
            }
            else
             {
                theForm.BrowseBy[i].disabled = false;
             }  
       }
    }
  }
}

function addList_search(buttonId,theForm)
{
  theForm.hdAction.value = "button_" + buttonId;
  theForm.submit();
}

function add_search(theForm)
{       
	if(null == theForm.slMarkedListId)
	{
		alert('To add articles to a marked list, you must be logged in as a registered user \n and have created a marked list.  Please go to the help menu ("Help" link at \n the top of the page) and select "My Profile" for more information.');
	 	return ;
	}
	addList_search('AddToList',theForm);
}


function addList(buttonId,theForm)
{
  theForm.hdContextURL.value = document.location;
  //alert(theForm.hdContextURL.value);
  theForm.hdAction.value = "button_" + buttonId;
  theForm.submit();
}

function add(theForm)
{
	if(null == theForm.slMarkedListId)
	{
		alert('To add articles to a marked list, you must be logged in as a registered user \n and have created a marked list.  Please go to the help menu ("Help" link at \n the top of the page) and select "My Profile" for more information.');
	 	return ;
	}
	addList('AddToList',theForm);
}

function submitRRChar(currChar,theForm) 
{
      theForm.currentChar.value =currChar ;
      theForm.hdAction.value = "Alphabet_" + currChar;
      theForm.submit();
}
