


function ShowIndex(IndexID) {
	if (IndexID==3 && document.forms[1].AdvKeyword.value == "") {
		alert("Please, enter a keyword before to press Show context button.\nA list containing more specific items in which the keyword is contained will be displayed.");
	} else {
		document.forms[1].IndexID.value = IndexID;
		document.forms[1].SearchType.value = 1;		
		document.forms[1].submit();
	}
}

function ResetAuthorID() {
	document.forms[1].AuthorID.value = "";
}

function ResetForm() {
	document.forms[1].Title.value = "";
	document.forms[1].DomainID.value = "";
	document.forms[1].LanguageID.value = "";
	document.forms[1].ALastName.value = "";
	document.forms[1].AFirstName.value = "";
	document.forms[1].AdvKeyword.value = "";
	document.forms[1].AuthorID.value = "";
	document.forms[1].IndexID.value = 0;
	document.forms[1].RequestedPage.value = 1;	
	document.forms[1].articleID.value = "";
	document.forms[1].SearchType.value = 1;	
}

function ShowDetails(ArticleID, Type) {
	document.forms[1].articleID.value = ArticleID;
	document.forms[1].Type.value = Type;	
	document.forms[1].submit();
}

function ShowPage(RequestedPage) {
	document.forms[1].RequestedPage.value = RequestedPage;		 	
	document.forms[1].submit();
}

function SendKeyword(Keyw){
   rexp=/\"/g;	
   document.forms[1].AdvKeyword.value = "\"" + Keyw.replace(rexp, "\"\"") + "\""; 
   document.forms[1].AdvKeyword.focus();        
}

function SendLetter(Keyw, WhichName){
   document.forms[1].FirstLetter.value = Keyw;
   document.forms[1].IndexID.value = WhichName; 
   if (WhichName==1) {
		document.forms[1].AFirstName.value = "";
   } else {
		document.forms[1].ALastName.value = "";
   } 
   document.forms[1].submit();       
}

function SendAuthor(FirstName, LastName, AuthorID){
   document.forms[1].ALastName.value = LastName;
   document.forms[1].AFirstName.value = FirstName;   
   document.forms[1].AuthorID.value = AuthorID;
   document.forms[1].IndexID.value = 0;  
   document.forms[1].AFirstName.focus();
}

function DoAdvanced() {
	document.forms[1].TopKeyword.value = ""; 
	document.forms[1].submit();
}

function switchDiv(div_id)
{
  var style_sheet = getStyleObject(div_id);
  if (style_sheet)
  {
    hideAll();
    changeObjectVisibility(div_id,"visible");
  }
  else 
  {
    alert("sorry, this only works in browsers that do Dynamic HTML");
  }
}


function hideAll()
{
   changeObjectVisibility("ez","hidden");
   changeObjectVisibility("full","hidden");
   changeObjectVisibility("superduper","hidden");
}

function getStyleObject(objectId) {

  if(document.getElementById && document.getElementById(objectId)) {
	return document.getElementById(objectId).style;
   }
   else if (document.all && document.all(objectId)) {  
	return document.all(objectId).style;
   } 
   else if (document.layers && document.layers[objectId]) { 
	return document.layers[objectId];
   } else {
	return false;
   }
}

function changeObjectVisibility(objectId, newVisibility) {
   
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.visibility = newVisibility;
	return true;
    } else {
	return false;
    }
}
