hoverleer = new Image();
hoverleer.src = "../grafiken/hoverleer.gif";
hover = new Image();
hover.src = "../grafiken/hover.gif";

function bildwechsel(Index,Bildobjekt)
{
   	window.document.images[Index].src = Bildobjekt.src;
}

function neuesFenster(URL, breite, hoehe, resiz)
{
	var X = (screen.availWidth / 2) - (breite / 2);
	var Y = (screen.availHeight / 2) - (hoehe / 2);
	if (resiz == 'no')
	{
		window.open(URL, "", "resizable=no, menubar=no, scrollbars=yes, status=no, width=" + breite + ", height=" + hoehe + ", left=" + X + ", top=" + Y);
	}
	else
	{
		window.open(URL, "", "resizable=yes, menubar=no, scrollbars=yes, status=no, width=" + breite + ", height=" + hoehe + ", left=" + X + ", top=" + Y);
	}
}

function naviAendern(URL,hnz)
{
	top.frames["navigation"].location.href = URL;
	if (hnz == "ja")
	{
		horiNaviZurueck()
	}
}

function horiNaviZurueck()
{
	for (stelle = 0; stelle < 5; stelle++)
	{
       	parent.document.getElementById(stelle).className = "";
	}
}

function horiNaviOver(links,rechts)
{
	document.getElementById(links).className = "hell";
	document.getElementById(rechts).className = "hell";
}

function horiNaviOut(links,rechts)
{
	document.getElementById(links).className = "";
	document.getElementById(rechts).className = "";
}

function hgGewaehlt(i)
{
	if (i != 'leer') document.getElementById(i).className = "dunkel";
}

function vertiNaviHgGewaehlt(i)
{
	top.frames["navigation"].document.getElementById(i).className = "dunkel";
}

function hgWechsel(i,imax)
{
	for (stelle = 0; stelle < 5; stelle++)
	{
       	parent.document.getElementById(stelle).className = "";
	}
	for (stelle = 0; stelle <= imax; stelle++)
	{
		if (stelle != i)
		{
        	document.getElementById(stelle).className = "";
		}
		else
		{
        	document.getElementById(stelle).className = "dunkel";
		}
	}
	top.frames["gesamtinhalt"].focus();
}

function hgHorinavi(i,imax)
{
	urlLaenge = top.frames["navigation"].location.href.length;
	urlSuchstring = top.frames["navigation"].location.href.substring(urlLaenge-24,urlLaenge-19);
	if (urlSuchstring == "start")
	{
		for (stelle = 0; stelle <= imax; stelle++)
		{
   			navigation.document.getElementById(stelle).className = "";
		}
	}
	else
	{
		top.frames["navigation"].location.href = "navigation/start.php?hgauswahl=leer";
	}
	for (stelle = 0; stelle < 5; stelle++)
	{
		if (stelle != i)
		{
        	document.getElementById(stelle).className = "";
		}
		else
		{
        	document.getElementById(stelle).className = "mittel";
		}
	}
	top.frames["navigation"].focus();
}

function frameInhaltAendern(URL,Framename)
{
	top.gesamtinhalt.frames[Framename].location.href = URL;
}

function adminFrameInhaltAendern(URL)
{
	top.gesamtinhalt.location.href = URL;
}

function mail()
{
	string = '@';
	window.open("mailto:kontakt"+string+"musi-kuss.de", "Mail");
}

function insert(aTag, eTag)
{
	var input = document.forms['formular'].elements['textblock'];
	input.focus();
/* für Internet Explorer */
	if(typeof document.selection != 'undefined')
	{
/* Einfügen des Formatierungscodes */
		var range = document.selection.createRange();
		var insText = range.text;
		range.text = aTag + insText + eTag;
/* Anpassen der Cursorposition */
	    range = document.selection.createRange();
    	if (insText.length == 0)
		{
			range.move('character', -eTag.length);
	    }
		else
		{
		      range.moveStart('character', aTag.length + insText.length + eTag.length);
	    }
    	range.select();
	}
/* für neuere auf Gecko basierende Browser */
	else if(typeof input.selectionStart != 'undefined')
	{
/* Einfügen des Formatierungscodes */
	    var start = input.selectionStart;
    	var end = input.selectionEnd;
	    var insText = input.value.substring(start, end);
    	input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
/* Anpassen der Cursorposition */
	    var pos;
    	if (insText.length == 0)
		{
			pos = start + aTag.length;
	    }
		else
		{
			pos = start + aTag.length + insText.length + eTag.length;
	    }
    	input.selectionStart = pos;
	    input.selectionEnd = pos;
	}
/* für die übrigen Browser */
	else
	{
/* Abfrage der Einfügeposition */
		var pos;
	    var re = new RegExp('^[0-9]{0,3}$');
    	while(!re.test(pos))
		{
			pos = prompt("Einfügen an Position (0.." + input.value.length + "):", "0");
	    }
    	if(pos > input.value.length)
		{
			pos = input.value.length;
	    }
/* Einfügen des Formatierungscodes */
	    var insText = prompt("Bitte geben Sie den zu formatierenden Text ein:");
    	input.value = input.value.substr(0, pos) + aTag + insText + eTag + input.value.substr(pos);
	}
}
