// ___________________________________________________________________________
//
// suchmaske_xopac
// ___________________________________________________________________________
//
// Skript zur 
// 1. Positionierung des Cursors in der Freitextsuche
// 2. Kennzeichung der gewaehlten Sucheinschraenkungen
//
function setfocus() {
   document.standard.simple_search.focus();
}

function mySubmit(action)
{
   // <BUTTON TYPE="button" style="width:100%;"  NAME="indexButton" VALUE="" ONCLICK="mySubmit('indexscan')" disabled>IndexScan<\/BUTTON>
   // <INPUT TYPE="HIDDEN" NAME="IndexScan" VALUE="1">
   if (action == "indexscan") {
      document.forms[0].indexscan.value=1;
   }
}
// -->

function toggleRestrictionNoticeVisibility(show)
{
  //var elementactive1=document.getElementById("td_restriction_active1_id");
  var elementactive2=document.getElementById("td_restriction_active2_id");
  var elementNotActive=document.getElementById("td_restriction_not_active_id");
  var elementTd=document.getElementById("td_restriction_id");
  if(show)
  {
    //elementactive1.style.display="inline";
    elementactive2.style.display="inline";
    elementNotActive.style.display="none";
    elementTd.style.backgroundColor="red";
  }
  else
  {
    //elementactive1.style.display="none";
    elementactive2.style.display="none";
    elementNotActive.style.display="inline";
    elementTd.style.backgroundColor="";
  }

}

function onSearchRestrictionChange()
{
  if(!searchRestrictionIsDefault())
    toggleRestrictionNoticeVisibility(true);
  else
    toggleRestrictionNoticeVisibility(false);
}

function disableSuche(suche){}

function disableSuche_nochnicht(suche)
{
  if(suche=="standard"){
    backgroundStandard='#cecece';
    colorStandard='#aeaeae';
    backgroundFreitext='white';
    colorFreitext='black';
    disableStandard=true;
    disableFreitext=false;
	}
  else{
    backgroundStandard='white';
    colorStandard='black';
    backgroundFreitext='#cecece';
    colorFreitext='#aeaeae';
    disableStandard=false;
    disableFreitext=true;
  }

  for(i=1;i<12;i++){
    element=document.getElementById("standard_suche_id_"+i);
    element.style.color=colorStandard;
    element.style.background=backgroundStandard;
    switch(i){
      case 1:
      case 2:
      case 4:
      case 5:
      case 11:
      case 7:
      case 8:
      case 9:
        element.disabled=disableStandard;
        break;
      default:
    }

  }
  for(i=1;i<3;i++){
    if(disableFreitext){
      element.name=element.name+"_disabled";
    }
    else{
      element.name=element.name.replace("_disabled","");
    }

    element=document.getElementById("freitext_suche_id_"+i);
    element.style.color=colorFreitext
    element.style.background=backgroundFreitext;
  }
}

