function hover(Ziel) {
	Ziel.firstChild.style.visibility = "visible";
}
function hover_out(Ziel) {
	Ziel.firstChild.style.visibility = "hidden";
}

function newsletter_focus(Ziel) {
	if(Ziel.value == "email-Adresse")
		Ziel.value = "";
}
function newsletter_blur(Ziel) {
	if(Ziel.value == "")
		Ziel.value = "email-Adresse";
}
function check_special_chars(String) {
	if(String.length > 0 && String.search(special_chars) == -1) {
		alert("Nur folgende Sonderzeichen sind erlaubt:\n" + special_chars_text);
		return false;
	}
	else
		return true;
}


function vorladen(Url) {
	load_img = new Image();
	load_img.src = Url;
}

function gal_bildwechsel(mal, diashow) {
	if((Gal_status < Gal.length-1 && mal > 0) || (Gal_status > 0 && mal < 0)) {
		Gal_status += mal;
		document.getElementById('bild_load').src = Gal[Gal_status][2];
		gal_pos_middle(Gal[Gal_status][0], Gal[Gal_status][1]);
	}
	
	if(Gal_status == 0) {
		document.getElementById("prev").style.visibility = "hidden";
		document.getElementById("next").style.visibility = "visible";
	}
	else if(Gal_status == Gal.length-1) {
		document.getElementById("prev").style.visibility = "visible";
		document.getElementById("next").style.visibility = "hidden";
		
		if(diashow) {
			document.getElementById("zeitwechsel_img").src = "page_parts/start.gif";
			clearInterval(Diashow);
			gal_Aktiv = false;
		}
	}
	else {
		document.getElementById("prev").style.visibility = "visible";
		document.getElementById("next").style.visibility = "visible";
	}
}

function gal_pos_middle(width, height) {
	if(window.innerWidth !== undefined) {
		WindowX = window.innerWidth - (20);
		WindowY = window.innerHeight - (20 + 65);
	}
	//JUHUUUUUUUU ie
	else {
		WindowX = document.body.clientWidth - (20);
		if(document.body.clientHeight > 0)
			WindowY = document.body.clientHeight - (20 + 65);
		//TOOOOOOL ie7 - Improvisiert (body ist bei diesem Doctype imer 0, bei allen neueren Browsern...? Aber zum Glück kann der ie7 die sinnvollen Befehle immer noch nicht... ( Ode an SO EIN UNFÄHIGER SCHEISS)
		else
			WindowY = screen.availHeight;
	}

	
	DiffX = width - WindowX;
	DiffY = height - WindowY;
	
	Prozent = 100;
	if(DiffX > 0 && DiffX > DiffY)
		Prozent = 100 / (width / WindowX);
	else if(DiffY > 0 && DiffY > DiffX)
		Prozent = 100 / (height / WindowY);
	
	
	newWidth = (width / 100) * Prozent;
	newHeight = (height / 100) * Prozent;
	
	document.getElementById("bild_load").style.width = Math.ceil(newWidth) + "px";
	document.getElementById("bild_load").style.height = Math.ceil(newHeight) + "px";
	document.getElementById("schatten_breite").style.width = Math.ceil(newWidth-20) + "px";
	document.getElementById("schatten_hoehe").style.height = Math.ceil(newHeight-20) + "px";
	
	if(DiffX > 0 && DiffX > DiffY) {
		document.getElementById("gal_nav").style.left = "2px";
		document.getElementById("gal_nav").style.marginLeft = "0px";
	}
	else {
		document.getElementById("gal_nav").style.marginLeft = Math.ceil(newWidth/(-2)) + "px";
		document.getElementById("gal_nav").style.left = "50%";
	}
}

//**********
//Smilie -->
//**********
function smilie(Typ) {
	Textfeld = document.getElementById("textarea");
	Textfeld.focus();
	if(Textfeld.selectionStart !== undefined) {
		Sel_start = Textfeld.selectionStart;
		Start = Textfeld.value.substring(0, Sel_start);
		Ende = Textfeld.value.substring(Textfeld.selectionEnd, Textfeld.value.length);
		
		Textfeld.value = Start + " " + Typ + Ende;
		
		
		//Anpassen der Cursorposition (1 = Leerzeichen)
		pos = Sel_start + Typ.length + 1;
		
		Textfeld.selectionStart = pos;
		Textfeld.selectionEnd = pos;
	}
	else if(typeof document.selection != 'undefined') {
		range = document.selection.createRange();
		range.text = " " + Typ;
	}
}
//<--Smilie


//**********
//Fett, Kursiv, Unterstrichen, img, url -->
//**********
function Textart(bb_anf, bb_end, Button) {
	Textfeld = document.getElementById("textarea");
	Textfeld.focus();
	
	//BWAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH SCHEISS SCHEISS SCHEISS SCHEISS IE!! Sorry Leute, aber auf noch so eine neue hirnrissige "Sicherheitsmaßname" vom 7er nehm ich sicher keine Rücksicht mehr.  Ich habs sowas von Satt! Am liebsten würd ich diesen Dreckbrowser einfach aussperren....
	if(bb_anf == "[quote]" && (Button.style.color !== "red" || Button.style.color == "#ff0000") && (bb_anf = "[quote=" + prompt("Wen möchtest du zitieren?", "") + "]") == "[quote=" + null + "]")
		return;
	
	if(Textfeld.selectionStart !== undefined) {
		Sel_start = Textfeld.selectionStart;
		Sel_end = Textfeld.selectionEnd;
		
		Start = Textfeld.value.substring(0, Sel_start);
		Ende = Textfeld.value.substring(Sel_end, Textfeld.value.length);
		
		Markierung = Textfeld.value.substring(Textfeld.selectionStart, Textfeld.selectionEnd);
		
		
		if(Button.style.color == "red" || Button.style.color == "#ff0000") {
			Textfeld.value = Start + bb_end + Ende;
			pos = Sel_start + Markierung.length + bb_end.length;
			Button.style.color = "black";
		}
		else if(Sel_start == Sel_end && (bb_anf == "[b]" || bb_anf == "[i]" || bb_anf == "[u]" || bb_end == "[/quote]")) {
			Textfeld.value = Start + bb_anf + Ende;
			pos = Sel_start + bb_anf.length + Markierung.length;
			Button.style.color = "red";
		}
		else {
			if(bb_anf == "[url]") {
				if(Markierung == "" && (Markierung = prompt("Gib den Titel des Links an", "")) == null)
					return;
				UrlAnfang = Markierung.substring(0, 4);
				Vorgabe = ((UrlAnfang == "www." || UrlAnfang == "http") ? Markierung : "");
				if((bb_anf = "[url=" + prompt("Gib die Ziel-url an", Vorgabe) + "]") == "[url=" + null + "]")
					return;
			}
			else if(bb_anf == "[img]") {
				UrlAnfang = Markierung.substring(0, 4);
				Vorgabe = ((UrlAnfang == "www." || UrlAnfang == "http") ? Markierung : "");
				if((Markierung = prompt("Gib den Link zum Bild an", Vorgabe)) == null)
					return;
			}
			else if(Markierung == "" && (bb_end == "[/color]" || bb_end == "[/size]") && (Markierung = prompt("Gib einen Text ein", "")) == null)
				return;
			
			
			Textfeld.value = Start + bb_anf + Markierung + bb_end + Ende;
			pos = Sel_start + bb_anf.length + Markierung.length + bb_end.length;
		}
		
		Textfeld.selectionStart = pos;
		Textfeld.selectionEnd = pos;
	}
	else if(document.selection !== undefined) {
		range = document.selection.createRange();
		
		if(Button.style.color == "#ff0000" || Button.style.color == "red") {
			range.text = range.text + bb_end;
			Button.style.color = "black";
		}
		else if(range.text == "" && (bb_anf == "[b]" || bb_anf == "[i]" || bb_anf == "[u]" || bb_end == "[/quote]")) {
			range.text = bb_anf;
			Button.style.color = "red";
		}
		else {
			Markierung = range.text;
			if(bb_anf == "[url]") {
				if(range.text == "" && (Markierung = prompt("Gib den Titel des Links an", "")) == null)
					return;
				UrlAnfang = Markierung.substring(0, 4);
				Vorgabe = ((UrlAnfang == "www." || UrlAnfang == "http") ? Markierung : "");
				if((bb_anf = "[url=" + prompt("Gib die Ziel-url an", Vorgabe) + "]") == "[url=" + null + "]")
					return;
			}
			else if(bb_anf == "[img]") {
				UrlAnfang = Markierung.substring(0, 4);
				Vorgabe = ((UrlAnfang == "www." || UrlAnfang == "http") ? Markierung : "");
				if((Markierung = prompt("Gib den Link zum Bild an", Vorgabe)) == null)
					return;
			}
			else if(Markierung == "" && (bb_end == "[/color]" || bb_end == "[/size]") && (Markierung = prompt("Gib einen Text ein", "")) == null) {
				return;
			}
			
			range.text = bb_anf + Markierung + bb_end;
			range.moveStart('character', range.text.length);
			range.select();
		}
	}
}