window.status = "Zeeb Druck Dornstetten";

function show(page,start) {

	switch(start) {

		case "top":
		self.location.href = "all/" + page + "/" + page + "_main01.html";
		break;
		
		case "top1":
		self.location.href = "../all/" + page + "/" + page + "_main01.html";
		break;
		
		case "top2":
		self.location.href = "../../all/" + page + "/" + page + "_main01.html";
		break;		

		case "index":
		self.location.href = page + "/" + page + "_main01.html";
		break;
		
		case "1":
		self.location.href = "../" + page + "/" + page + "_main01.html";
		break;
		
		case "2":
		self.location.href = "../../" + page + "/" + page + "_main01.html";
		break;		

	}

}

function showIndex(start) {

	switch(start) {

		case "1":
		self.location.href = "../index.html";
		break;
		
		case "2":
		self.location.href = "../../index.html";
		break;		

	}

}

function glossar(start) {

	switch(start) {
	
		case "top":
		self.location.href = "all/glossar/glossar_main01.html?page=0&term=0";
		break;
		
		case "1":
		self.location.href = "../all/glossar/glossar_main01.html?page=0&term=0";
		break;
		
		case "2":
		self.location.href = "../../all/glossar/glossar_main01.html?page=0&term=0";
		break;
		
	}
}

function joboptions(level) {
	
	Check = confirm("Hier erhalten Sie die PDF-Voreinstellungen.\nKlicken Sie auf OK, um die Datei herunterzuladen.");
	
	if(Check == true) {
		
		switch(level) {
		
			case "top":
			top.location.href = "all/downloads/ZEEB Druck.zip";
			break;
			
			case "top1":
			top.location.href = "../all/downloads/ZEEB Druck.zip";
			break;
			
			case "top2":
			top.location.href = "../../all/downloads/ZEEB Druck.zip";
			break;			
			
		}
	}
}

function ZeebInfos(level) {
	
	switch(level) {
	
		case "top":
		self.location.href = "all/infos/infos_main01.html?id=0";
		break;
		
		case "top1":
		self.location.href = "../all/infos/infos_main01.html?id=0";
		break;
		
		case "top2":
		self.location.href = "../../all/infos/infos_main01.html?id=0";
		break;
		
	}
}

function showKontakt(ebene) {
	win = window.open("", "Kontakt", "width=200,height=130");
	
	win.document.open("text/html");
	win.document.write("<html>");
	win.document.write("<head><title>Kontakt zu Zeeb Druck</title></head>");
	win.document.write("<body><center>");
	win.document.write("<span style='font-family:arial,sans-serif,geneva;font-size:11px;color:rgb(1,47,71);'>Zeeb Druck<br>Inh. Rolf Trück e.Kfm.<br>Steiningstraße 4-6<br>72280 Dornstetten<br>&nbsp;<br>Telefon 0 74 43 / 62 28<br>Telefax 0 74 43 / 40 28<br><a href='mailto:info@zeeb-druck.de'><img src='"+ebene+"all/img/all_img04.gif' alt='' width='98' height='12' border='0'></a></span>");
	win.document.write("</center></body></html>");
	win.focus();

}

// ---------------------------------------
// Auslesen der Werte aus der URI.
// Speichern in Variablen.
// page = Buchstabe.
// term = Begriff.
// ---------------------------------------
var pfad = location.href;

// Feststellen des Ausdrucks zwischen " ?page= " und " &term= " bedeutet Buchstabenangabe.
var pageanf = location.href.indexOf('?page=');
var pageend = location.href.indexOf('&term=');
var page = pfad.substring(pageanf+6,pageend);

// Feststellen des Ausdrucks nach " &term= " bedeutet Begriffsangabe.
var term = pfad.substr(pageend + 6)


// ---------------------------------------
// Pfadangabe für Buchstabe (= var page).
// Wenn var page identisch mit uebergebener var id, zuklappen.
// Ansonsten Begriffe zu Buchstabe zeigen.
// ---------------------------------------
function showBegriffe(id) {
	if(page == id) {
		self.location.href = "glossar_main01.html?page=0&term=0";
	} else {
		self.location.href = "glossar_main01.html?page=" + id + "&term=0";
	}

}

// ---------------------------------------
// Zeige Erklaerung zu angeklicktem Begriff.
// Uebergabe der entsprechenden Variablen an Pfadangabe.
// Auslesen.
// ---------------------------------------
function showErklaerung(a) {
	self.location.href = "glossar_main01.html?page="+page+"&term="+a;
}

// ---------------------------------------
// Zeige erste(n) Buchstabe(n)
// ---------------------------------------
function showFirst() {

	var first = parseInt(page)+1;
	
	for(i = 1; i < first; i++) {

		var ausg = "<tr>";
		ausg += "<td width='157' bgcolor='#BAD3ED' style='background-image:url(../img/all_bg02.gif);padding-left:15px;padding-right:15px;'>";
		ausg += "<a class='linktext' href='javascript:showBegriffe("+i+")'><b>"+buchstabe[i]+"</b></a>";
		ausg += "</td>";
		ausg += "<td width='9' style='background-image:url(../img/all_bg03.gif);repeat:repeat-y;'></td>";
		ausg += "</tr>";
				
		document.write(ausg);
	}
}

// ---------------------------------------
// Zeige Begriff(e) zu angeklicktem Buchstaben
// ---------------------------------------
function showMiddle() {

	var terms = parseInt(page);

	for(i = 1; i < begriff[terms].length; i++) {

		var ausg = "<tr>";
		ausg += "<td width='157' bgcolor='#BAD3ED' style='background-image:url(../img/all_bg02.gif);padding-left:15px;padding-right:15px;'>";
		ausg += "&nbsp;<a class='linktext' href='javascript:showErklaerung("+[i]+")'>"+begriff[terms][i]+"</a>";
		ausg += "</td>";
		ausg += "<td width='9' style='background-image:url(../img/all_bg03.gif);repeat:repeat-y;'></td>";
		ausg += "</tr>";
				
		document.write(ausg);
		
	}

}

// ---------------------------------------
// Zeige letzte(n) Buchstaben
// ---------------------------------------
function showLast() {

	var last = parseInt(page)+1;
	
	for(i = last; i < buchstabe.length; i++) {
		
		var ausg = "<tr>";
		ausg += "<td width='157' bgcolor='#BAD3ED' style='background-image:url(../img/all_bg02.gif);padding-left:15px;padding-right:15px;'>";
		ausg += "<a class='linktext' href='javascript:showBegriffe("+i+")'><b>"+buchstabe[i]+"</b></a>";
		ausg += "</td>";
		ausg += "<td width='9' style='background-image:url(../img/all_bg03.gif);repeat:repeat-y;'></td>";
		ausg += "</tr>";
				
		document.write(ausg);
		
	}
}

//--------------------------------------------------
// Pruefen des Formulars
//--------------------------------------------------
function checkFormular() {
  	if(document.formular.vorname.value == "") {
   		alert("Bitte Ihren Vornamen eingeben!");
   		document.formular.vorname.focus();
   		return false;
  	}
 	if(document.formular.name.value == "") {
   		alert("Bitte Ihren Nachnamen eingeben!");
   		document.formular.name.focus();
   		return false;
  	}  	
   	if(document.formular.anschrift.value == "") {
   		alert("Bitte die Anschrift eingeben!");
   		document.formular.anschrift.focus();
   		return false;
  	}
  	if(document.formular.plz.value == "") {
   		alert("Bitte die Postleitzahl eingeben!");
   		document.formular.plz.focus();
   		return false;
  	}
   	if(document.formular.ort.value == "") {
   		alert("Bitte den Ort eingeben!");
   		document.formular.ort.focus();
   		return false;
  	}	

	var chPLZ = 1;
	
 	for(i=0; i < document.formular.plz.value.length; ++i) {
   		if(document.formular.plz.value.charAt(i) < "0" || document.formular.plz.value.charAt(i) > "9") {
    			chPLZ = -1;
    		}
 		if(chPLZ == -1) {
   			alert("Bitte bei der PLZ nur Zahlen eingeben!");
   			document.formular.plz.focus();
   			return false;
  		}
  	return true;
	}
}

//--------------------------------------------------
// Formular formular absenden
//--------------------------------------------------
function sendenFormular() {
	var ok;
	ok = checkFormular();
	if(ok == true) {
		document.formular.submit();
	}
}

//--------------------------------------------------
// PopUp mit Erklärungen
//--------------------------------------------------
function showDialog(term,descr) {

	var original = erklaerung[term][descr];
	
	var duplikat = original.replace(/(<p>)/g,"\n");
	var duplikat = duplikat.replace(/(<\/p>)/g,"\n");
	var duplikat = duplikat.replace(/(<br>)/g,"\n");
	var duplikat = duplikat.replace(/(&quot;)/g,"'");
	
	alert(duplikat);
}
