//// Von der Dokumentanzeige zur Trefferliste
	function dokument_zu_trefferliste() {
	        top.seite.inhalt.location.href = "/XSearch?lType="+top.lType+"&lNumber="+top.lNumber+"&lPage="+top.lPage;
	} 		

	function trefferliste_markieren_alle() {
    var k = 0;
    while (k<top.dokumenteBuffer.length) {
      k++;
      if (!(top.dokumenteBuffer[k] == null)) {
        top.markedDokumente[k] = top.dokumenteBuffer[k];
      }
    }
	}
	
	function trefferliste_markieren_keine() {
    var k = 0;
    while (k<top.markedDokumente.length) {
      top.markedDokumente[k] = null;
      k++;
    }
	}
		  
////
//// Treffernavigation der Dokumentanzeige
////
var markedDokumente = new Array();
var dokumenteBuffer = new Array();
var aktButton = 1;
var dok2notiz = "";

	function treffer_vor() {
		i = parseInt(top.lRank);
	  if ( i < parseInt(top.m_sDocsFound) && i < 100 ) {
			do {
		    i++;
			} while ( (i < parseInt(top.m_sDocsFound) && i < 100)  && (!top.markedDokumente[i]) );
      top.umfeld[i] = 0;
			top.lRank = i;
	    top.seite.inhalt.document.location.href="/servlet/de.wmc.stv.xsearchips.bstbl.Servlet?page=XDocument&lType=" + top.lType + "&lNumber=" + top.lNumber + "&lRank=" + top.lRank + "#xdaref1";
	  }
	}
	
	function treffer_zurueck() {
		i = parseInt(top.lRank);
	  if ( i > 1 ) {
			do {
		    i--;
			} while ( i > 0  && (!top.markedDokumente[i]) );
      top.umfeld[i] = 0;
			top.lRank = i;
	    top.seite.inhalt.document.location.href="/servlet/de.wmc.stv.xsearchips.bstbl.Servlet?page=XDocument&lType=" + top.lType + "&lNumber=" + top.lNumber + "&lRank=" + top.lRank + "#xdaref1";
	  }
	}
 
////
//// Dokuanzeige: Treffernavigation - ausblendbare Pfeilbuttons
////

var treffer_zurueck_img_src = "/images/oben/gold.gif";
var treffer_vor_img_src = "/images/oben/gold.gif";

function treffer_navigation_suche_dokument() {
	if (treffer_wechseln_moeglich(-1)) {
		top.show_treffer_zurueck_img();
	} else {
		top.hide_treffer_zurueck_img();
	}
	
	if (treffer_wechseln_moeglich(1)) {
		top.show_treffer_vor_img();
	} else {
		top.hide_treffer_vor_img();
	}
	top.treffer_navigation_refresh();
}

function hide_treffer_zurueck_img() {
	top.treffer_zurueck_img_src = "/images/oben/gold.gif";
}

function hide_treffer_vor_img() {
	top.treffer_vor_img_src = "/images/oben/gold.gif";
}

function show_treffer_zurueck_img() {
	top.treffer_zurueck_img_src = "/images/oben/doku1prev.gif";
}

function show_treffer_vor_img() {
	top.treffer_vor_img_src = "images/oben/doku1next.gif";
}

function treffer_navigation_refresh() {
	if (top.nav.treffer_zurueck_img != null && top.nav.treffer_vor_img != null) {
		top.nav.treffer_zurueck_img.src = top.treffer_zurueck_img_src;
		top.nav.treffer_vor_img.src = top.treffer_vor_img_src;
	}
}

	function treffer_wechseln_moeglich(change) {
		var i = parseInt(top.lRank) + change;
		while (top.markedDokumente[i]==null && i<top.markedDokumente.length && i>1) {
	  	i = i + change;
		}
		if (top.markedDokumente[i]==null) {
			return false;
		} else {
			return true;
		}
		return false;
	}




////
//// vorheriges bzw. nächstes Dokument 
////

function showAllFrameNames() {
	var frameNames="";
	if (top.frames[0])	frameNames += "frames[0].name = " + top.frames[0].name + "\r\n";
	if (top.frames[0].frames[0])	frameNames += "frames[0].frames[0].name = " + top.frames[0].frames[0].name + "\r\n";
	if (top.frames[0].frames[1])	frameNames += "frames[0].frames[1].name = " + top.frames[0].frames[1].name + "\r\n";
	if (top.frames[0].frames[2])	frameNames += "frames[0].frames[2].name = " + top.frames[0].frames[2].name + "\r\n";
	if (top.frames[0].frames[3])	frameNames += "frames[0].frames[3].name = " + top.frames[0].frames[3].name + "\r\n";
	if (top.frames[1])	frameNames += "frames[1].name = " + top.frames[1].name + "\r\n";
	if (top.frames[1].frames[0])	frameNames += "frames[1].frames[0].name = " + top.frames[1].frames[0].name + "\r\n";
	if (top.frames[1].frames[1])	frameNames += "frames[1].frames[1].name = " + top.frames[1].frames[1].name + "\r\n";
	if (top.frames[1].frames[2])	frameNames += "frames[1].frames[2].name = " + top.frames[1].frames[2].name + "\r\n";
	if (top.frames[1].frames[3])	frameNames += "frames[1].frames[3].name = " + top.frames[1].frames[3].name + "\r\n";
	if (top.frames[2])	frameNames += "frames[2].name = " + top.frames[2].name + "\r\n";
	if (top.frames[2].frames[0])	frameNames += "frames[2].frames[0].name = " + top.frames[2].frames[0].name + "\r\n";
	if (top.frames[2].frames[1])	frameNames += "frames[2].frames[1].name = " + top.frames[2].frames[1].name + "\r\n";
	if (top.frames[2].frames[2])	frameNames += "frames[2].frames[2].name = " + top.frames[2].frames[2].name + "\r\n";
	if (top.frames[2].frames[3])	frameNames += "frames[2].frames[3].name = " + top.frames[2].frames[3].name + "\r\n";
}

function dok_wechseln(doc_name) {
  bOnLoad = 1;
  var x=1;
	if (top.frames[2].frames[1].name != 'inhalt') x=2;
	top.frames[2].frames[x].document.suche.action = "/Xdocument?doc_name=" + doc_name;
	top.frames[2].frames[x].document.suche.submit();
}

function setDokName(docName) {
	top.currentDocName = docName;
}

//+++++++++++++++++++++++Funktionen und Variablen für das Notizmodul+++++++++++++++++++++++++++
var bilderPfad="/images/lupe.gif";;
var sichtbar = false;
var docTitel = "";
var docFstTitel = "";
var docId = 0;
var link = "";

//Parameter für die beiden Fenster Notiz anzeigen und verwalten -> nötig für die Servlets
var aktuelleDocId = 0;
var titel = "";
var link = "";



//setzt die variablen zum anzeigen oder verbergen des Notizanzeigebuttons
function showNotiz(existNote){	
  //Link zum "Notiz anzeigen" sichtbar
  if(existNote){
		sichtbar=true;  
	} else { 
  //Link zum "Notiz anzeigen" in Geisterschrift nicht anwählbar
   		sichtbar=false;
	}      
}

//Funktionen zum setzen der Parameter der Servlets
function setDocId(docid){
   top.aktuelleDocId=docid;
}

function setTitle(ptitel){
   top.titel=ptitel;
   //alert(top.title);
}	

function setLink(docLink){
   top.link=docLink;
}

function setFundstelle(fundStelle){
   top.fundStelle=fundStelle;
}


//Funktion ruft Notiz verwalten Fenster auf
function notiz_erstellen() {
  rem = window.open("","popUpWindowVerwalten","width=615,height=280,resizable=yes,left=200,top=200");
  rem.location.href = document.action ="/servlet/de.wmc.stv.xsearchips.bstbl.Servlet?page=notizstart?docId=" + top.aktuelleDocId + "&link=" + top.link + "&docTitel=" + top.titel + "&fundStelle=" + top.fundStelle;
	if (rem) rem.focus();
}

//Funktion ruft Notiz verwalten Fenster auf
function notiz_bearbeiten(notizid) {
  rem = window.open("","popUpWindowVerwalten","width=615,height=280,resizable=yes,left=200,top=200");
  rem.location.href = document.action ="/servlet/de.wmc.stv.xsearchips.bstbl.Servlet?page=notizstart?docId=" + top.aktuelleDocId + "&link=" + top.link + "&docTitel=" + top.titel + "&notizid=" + notizid + "&fundStelle=" + top.fundStelle;
	if (rem) rem.focus();
}

//Funktion ruft Notiz anzeigen Fenster auf -> wenn hidden.gif angezeigt wird -> keine Funktion
function notiz_anzeigen() {
  if(sichtbar==true){
     rem1 = window.open("Notizliste","popUpWindowAnzeigen","width=615,height=280,resizable=yes,left=200,top=200");
     rem1.location.href = document.action ="/servlet/de.wmc.stv.xsearchips.bstbl.Servlet?page=notizAnzeigenFrame?docId=" + top.aktuelleDocId + "&link=" + top.link + "&docTitel=" + top.titel + "&fundStelle=" + top.fundStelle + "&listMode=single";
	 if (rem1) rem1.focus();
  }
}

//Funktion ruft Notiz anzeigen Fenster auf -> wenn hidden.gif angezeigt wird -> keine Funktion
function notizen_anzeigen() {
  rem1 = window.open("","popUpWindowAnzeigen","width=615,height=280,resizable=yes,left=200,top=200");
  rem1.location.href = document.action ="/servlet/de.wmc.stv.xsearchips.bstbl.Servlet?page=notizAnzeigenFrame?listMode=all";
  if (rem1) rem1.focus();
}

//Funktion ruft Notiz anzeigen Fenster auf -> wenn hidden.gif angezeigt wird -> keine Funktion
function notiz_aktivieren() {
  	Check = confirm("Die Notizverwaltung steht nur den registrierten Benutzern zur Verfügung.\r\n" +
  		 	"Bitte melden Sie sich zuerst mit Login am System an!\r\n\r\n");
	if (Check == true) top.window.location.href="/index.htm";
}

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

////
//// Detailsuche - Parameter speichern, löschen, wiederherstellen, ...
////

var treffer_gefunden = 0;
var currentDocNumber = 0;
var currentDocName = "";

var offset = "";
var linkoffset = "";
var zitierende_dokumente = "";
/*
var aojahr = "";
var aoausgabenr = "";
*/
var cd_ausgabenr = "";

var Version = "";
var Volltext = "";

var Fundtyp = "";
var Fundjahr = "";
var Fundseite = "";
var oFundstelle = "and";

var Fundtyp1 = true;
var Fundtyp2 = true;
var Fundtyp3 = true;
var Fundtyp4 = true;

var sortierung = "";

var Steuerart = "";
var oSteuerart = "and";

var Dokumentenart = "";
var oDokumentenart = "and";

var Normenkette = "";
var oNormenkette = "and";

var Datum = "";
var oDatum = "and";

var Aktenzeichen = "";
var oAktenzeichen = "and";

var Doknr = "";
var oDoknr = "and";

var Bundesland = "";
var oBundesland = "and";

var BetreffLeitsatz = "";
var oBetreffLeitsatz = "and";

var oFundstelle = "";
var Fundtyp = "";
var Fundjahr = "";
var Fundseite = "";

var vjahr = "";
var vmonat = "";
var vtag = "";
var bjahr = "";
var bmonat = "";
var btag = "";

var sortierung = "DatumRange desc";
// treffer pro seite:
var trefferanzahl = "20";

function save_vars() {
  // Beim ausführen der Suche markierung zurücksetzen
  top.cntMarkedDokuments = 0;
  top.markedDokumente = new Array();
  // save_vars wird von echter Detailsuche ausgeführt, also offset und zitierende_dokumente zurücksetzen
  // top.offset = "";
  top.zitierende_dokumente = "";
  // und die CD-Suche Werte ebenfalls zurücksetzen
  top.cdsuche = 0;
  top.aojahr = "";
  top.aoausgabenr = "";
  top.cd_ausgabenr = "";
  // Die Werte der Suchmaske speichern
  if (top.seite.oben.document.suchform.Fundtyp1.type == "hidden")
		if (top.seite.oben.document.suchform.Fundtyp1.value == "") {
	  		top.Fundtyp1 = false;
		} else {
	  		top.Fundtyp1 = true;
		}
  else
  	top.Fundtyp1 = top.seite.oben.document.suchform.Fundtyp1.checked;

  if (top.seite.oben.document.suchform.Fundtyp2.type == "hidden")
		if (top.seite.oben.document.suchform.Fundtyp2.value == "") {
	  		top.Fundtyp2 = false;
		} else {
	  		top.Fundtyp2 = true;
		}
  else
  	top.Fundtyp2 = top.seite.oben.document.suchform.Fundtyp2.checked;

  if (top.seite.oben.document.suchform.Fundtyp3.type == "hidden")
		if (top.seite.oben.document.suchform.Fundtyp3.value == "") {
	  		top.Fundtyp3 = false;
		} else {
	  		top.Fundtyp3 = true;
		}
  else
  	top.Fundtyp3 = top.seite.oben.document.suchform.Fundtyp3.checked;

  if (top.seite.oben.document.suchform.Fundtyp4.type == "hidden")
		if (top.seite.oben.document.suchform.Fundtyp4.value == "") {
	  		top.Fundtyp4 = false;
		} else {
	  		top.Fundtyp4 = true;
		}
  else
  	top.Fundtyp4 = top.seite.oben.document.suchform.Fundtyp4.checked;

  top.sortierung = top.seite.oben.document.suchform.sortSpec.value;
  top.vjahr = top.seite.oben.document.suchform.vjahr.value;
  top.vmonat = top.seite.oben.document.suchform.vmonat.value;
  top.vtag = top.seite.oben.document.suchform.vtag.value;
  top.bjahr = top.seite.oben.document.suchform.bjahr.value;
  top.bmonat = top.seite.oben.document.suchform.bmonat.value;
  top.btag = top.seite.oben.document.suchform.btag.value;
  top.sortierung = top.seite.oben.document.suchform.sortSpec.value;
  top.Version = top.seite.oben.document.suchform.Version.value;
  top.Volltext = top.seite.oben.document.suchform.Volltext.value;
  top.trefferanzahl = top.seite.oben.document.suchform.hitspp.value;

	var docName = "suche"
	if (!top.seite.inhalt.document.suche) {
	  top.Aktenzeichen = top.seite.oben.document.suchform.Aktenzeichen.value;
	} else {
	  top.Steuerart = eval("top.seite.inhalt.document.suche.Steuerart.value;");
	  top.oSteuerart = eval("top.seite.inhalt.document.suche.oSteuerart.value;");
	  top.Dokumentenart = eval("top.seite.inhalt.document.suche.Dokumentenart.value;");
	  top.oDokumentenart = eval("top.seite.inhalt.document.suche.oDokumentenart.value;");
	  top.Normenkette = eval("top.seite.inhalt.document.suche.Normenkette.value;");
	  top.oNormenkette = eval("top.seite.inhalt.document.suche.oNormenkette.value;");
	  top.Datum = eval("top.seite.inhalt.document.suche.Datum.value;");
	  top.oDatum = eval("top.seite.inhalt.document.suche.oDatum.value;");
	  top.Aktenzeichen = eval("top.seite.inhalt.document.suche.Aktenzeichen.value;");
	  top.oAktenzeichen = eval("top.seite.inhalt.document.suche.oAktenzeichen.value;");
	  top.Doknr = eval("top.seite.inhalt.document.suche.Doknr.value;");
	  top.oDoknr = eval("top.seite.inhalt.document.suche.oDoknr.value;");
	  top.Bundesland = eval("top.seite.inhalt.document.suche.Bundesland.value;");
	  top.oBundesland = eval("top.seite.inhalt.document.suche.oBundesland.value;");
	  top.BetreffLeitsatz = eval("top.seite.inhalt.document.suche.BetreffLeitsatz.value;");
	  top.oBetreffLeitsatz = eval("top.seite.inhalt.document.suche.oBetreffLeitsatz.value;");
	  top.oFundstelle = eval("top.seite.inhalt.document.suche.oFundstelle.value;");
	  top.Fundtyp = eval("top.seite.inhalt.document.suche.Fundtyp.value;");
	  top.Fundjahr = eval("top.seite.inhalt.document.suche.Fundjahr.value;");
	  top.Fundseite = eval("top.seite.inhalt.document.suche.Fundseite.value;");
	}
  top.seite.oben.document.suchform.Steuerart.value = top.Steuerart;
  top.seite.oben.document.suchform.oSteuerart.value = top.oSteuerart;
  top.seite.oben.document.suchform.Dokumentenart.value = top.Dokumentenart;     
  top.seite.oben.document.suchform.oDokumentenart.value = top.oDokumentenart;   
  top.seite.oben.document.suchform.Normenkette.value = top.Normenkette;       
  top.seite.oben.document.suchform.oNormenkette.value = top.oNormenkette;     
  top.seite.oben.document.suchform.Datum.value = top.Datum;             
  top.seite.oben.document.suchform.oDatum.value = top.oDatum;           
  top.seite.oben.document.suchform.Aktenzeichen.value = top.Aktenzeichen;      
  top.seite.oben.document.suchform.oAktenzeichen.value = top.oAktenzeichen;    
  top.seite.oben.document.suchform.Doknr.value = top.Doknr;      
  top.seite.oben.document.suchform.oDoknr.value = top.oDoknr;    
  top.seite.oben.document.suchform.Bundesland.value = top.Bundesland;        
  top.seite.oben.document.suchform.oBundesland.value = top.oBundesland;      
  top.seite.oben.document.suchform.BetreffLeitsatz.value = top.BetreffLeitsatz;  
  top.seite.oben.document.suchform.oBetreffLeitsatz.value = top.oBetreffLeitsatz;
  top.seite.oben.document.suchform.oFundstelle.value = top.oFundstelle;
  top.seite.oben.document.suchform.Fundtyp.value = top.Fundtyp;
  top.seite.oben.document.suchform.Fundjahr.value = top.Fundjahr;
  top.seite.oben.document.suchform.Fundseite.value = top.Fundseite;         
}

function clear_vars_without_restore() {
  top.markedDokumente = new Array();
	top.treffer_gefunden = "0";
	top.currentDocNumber = "0";
	top.currentDocName = "";
  top.offset = "";
  top.linkoffset = "";
  top.zitierende_dokumente = "";

  top.cdsuche = 0;
  top.cd_ausgabenr = "";

  top.Fundtyp1 = true;
  top.Fundtyp2 = true;
  top.Fundtyp3 = true;
  top.Fundtyp4 = true;
  top.sortierung = "";
  top.vjahr = "";
  top.vmonat = "";
  top.vtag = "";
  top.bjahr = "";
  top.bmonat = "";
  top.btag = "";
  top.Version = "";
  top.Volltext = "";
  top.trefferanzahl = "20";

  
  top.Steuerart = "";
  top.oSteuerart = "and";
  top.Dokumentenart = "";
  top.oDokumentenart = "and";
  top.Normenkette = "";
  top.oNormenkette = "and";
  top.Datum = "";
  top.oDatum = "and";
  top.Aktenzeichen = "";
  top.oAktenzeichen = "and";
  top.Doknr = "";
  top.oDoknr = "and";
  top.Bundesland = "";
  top.oBundesland = "and";
  top.BetreffLeitsatz = "";
  top.oBetreffLeitsatz = "and";
  top.Fundtyp = "";
  top.Fundjahr = "";
  top.Fundseite = "";
  top.oFundstelle = "and";
}

function clear_vars() {
  top.clear_vars_without_restore();
}

function restore_vars() {
	top.seite.oben.document.suchform.vjahr.value = top.vjahr;
	top.seite.oben.document.suchform.vmonat.value = top.vmonat;
	top.seite.oben.document.suchform.vtag.value = top.vtag;
	top.seite.oben.document.suchform.bjahr.value = top.bjahr;
	top.seite.oben.document.suchform.bmonat.value = top.bmonat;
	top.seite.oben.document.suchform.btag.value = top.btag;
	top.seite.oben.document.suchform.sortSpec.value = top.sortierung;
	top.seite.oben.document.suchform.Version.value = top.Version;
	top.seite.oben.document.suchform.Volltext.value = top.Volltext;
	top.seite.oben.document.suchform.hitspp.value = top.trefferanzahl;

	if (top.frames[2].frames[2].document.suche) {
		top.frames[2].frames[2].document.suche.Dokumentenart.value = top.Dokumentenart;
		top.frames[2].frames[2].document.suche.oDokumentenart.value = top.oDokumentenart;
		top.frames[2].frames[2].document.suche.Steuerart.value = top.Steuerart;
		top.frames[2].frames[2].document.suche.oSteuerart.value = top.oSteuerart;
		top.frames[2].frames[2].document.suche.Normenkette.value = top.Normenkette;
		top.frames[2].frames[2].document.suche.oNormenkette.value = top.oNormenkette;
		top.frames[2].frames[2].document.suche.Datum.value = top.Datum;
		top.frames[2].frames[2].document.suche.oDatum.value = top.oDatum;
		top.frames[2].frames[2].document.suche.Aktenzeichen.value = top.Aktenzeichen;
		top.frames[2].frames[2].document.suche.oAktenzeichen.value = top.oAktenzeichen;
		top.frames[2].frames[2].document.suche.Doknr.value = top.Doknr;
		top.frames[2].frames[2].document.suche.oDoknr.value = top.oDoknr;
		top.frames[2].frames[2].document.suche.Bundesland.value =top.Bundesland;
		top.frames[2].frames[2].document.suche.oBundesland.value = top.oBundesland;
		top.frames[2].frames[2].document.suche.BetreffLeitsatz.value = top.BetreffLeitsatz;
		top.frames[2].frames[2].document.suche.oBetreffLeitsatz.value = top.oBetreffLeitsatz;
		top.frames[2].frames[2].document.suche.oFundstelle.value = top.oFundstelle;
		top.frames[2].frames[2].document.suche.Fundtyp.value = top.Fundtyp;
		top.frames[2].frames[2].document.suche.Fundjahr.value = top.Fundjahr;
		top.frames[2].frames[2].document.suche.Fundseite.value = top.Fundseite;
	}
	if (top.seite.oben.document.suchform.Fundtyp1.type == "hidden") {
		if (! top.Fundtyp1 ) {
			top.seite.oben.document.suchform.Fundtyp1.value = "";
		}
	} else {
		top.seite.oben.document.suchform.Fundtyp1.checked = top.Fundtyp1;
	}
	if (top.seite.oben.document.suchform.Fundtyp2.type == "hidden") {
		if (! top.Fundtyp2 ) {
			top.seite.oben.document.suchform.Fundtyp2.value = "";
		}
	} else {
		top.seite.oben.document.suchform.Fundtyp2.checked = top.Fundtyp2;
	}
	if (top.seite.oben.document.suchform.Fundtyp3.type == "hidden") {
		if (! top.Fundtyp3 ) {
			top.seite.oben.document.suchform.Fundtyp3.value = "";
		}
	} else {
		top.seite.oben.document.suchform.Fundtyp3.checked = top.Fundtyp3;
	}
	if (top.seite.oben.document.suchform.Fundtyp4.type == "hidden") {
		if (! top.Fundtyp4 ) {
			top.seite.oben.document.suchform.Fundtyp4.value = "";
		}
	} else {
		top.seite.oben.document.suchform.Fundtyp4.checked = top.Fundtyp4;
	}
}
