<!--
/**
*  +----------------------------------------------------------------------+
*  | BWARE Content Management System - Modul Galerie		              |
*  +----------------------------------------------------------------------+
*  | (c) Balazs Bezeczky / BWARE                    all rights reserved.  |
*  +----------------------------------------------------------------------+
*  | Lizenz stuff														  |
*  | Balazs Bezeczky / BWARE  Leystr. 54/9 1200 Wien					  |
*  +----------------------------------------------------------------------+
*
*	@since	20050510
*   @author	Balazs Bezeczky <office@bware.at>
*	@copyright	© 2005 Balazs Bezeczky / BWARE
*
*	Version: $Revision: 1.7 $
*	Letzte Änderung: $Date: 2009/08/18 11:29:07 $
*	Author: $Author: bman $
*	Release Version: $Name:  $
*	Fullinfo: $Id: bware.js,v 1.7 2009/08/18 11:29:07 bman Exp $
*  +----------------------------------------------------------------------+
*/

//############# globale Variablen ############

var scrolling = false;
var posx = 0;
var posy = 0;
var farbeAlt = "";
//var sIESelection = ""; // selektierter text für den IE


if (navigator.userAgent.indexOf("MSIE") != -1)
{
	var sBrowser = "IE";
}
else
{
	var sBrowser = "MOZ";
}

 
//############# Funktionen ############

// *** wandelt Umlaute/Sonderzeichen in entities um
function ascii2html(text)
{
/*
	// *** Deutsch & allgemein
	text = text.replace(/ä/,"&auml;");
	text = text.replace(/Ä/,"&Auml;");
	text = text.replace(/ö/,"&ouml;");
	text = text.replace(/Ö/,"&Ouml;");
	text = text.replace(/ü/,"&uuml;");
	text = text.replace(/Ü/,"&Uuml;");
	text = text.replace(/ß/,"&szlig;");
*/
	// *** Ungarisch
	/*
	text = text.replace(/?/,"&#337;");
	text = text.replace(/?/,"&#336;");
	text = text.replace(/?/,"&#369;");
	text = text.replace(/?/,"&#368;");
	// á,í,ó,ú,Á,Í,Ó,Ú fehlen!
	*/

	return text;
}


// *** öffnet ein Confirm-Dialog
function confirmQuestion(sFrage,sURL)
{
	antwort = confirm(sFrage);

	if (antwort)
	{
		location.href = sURL;
	}
}


/**
* 	ersetzen
*	@access	public
*
*	Ersetzt in einem String einen Teilstring
*
*	@param	string sAlt....der Teil, der erstetzt werden soll
*	@param	string sNeu....der String, mit dem ersetzt werden soll
*	@param	string sStr....der String, in dem ersetzt werden soll
*
*	@return string.........der neu zusammengestellte String
*
*	@author		Balazs Bezeczky <office@bware.at>
*	@version	1.0
*/
function ersetzen2(sAlt, sNeu, sStr1)
{
	if (sAlt != 'undefined' && sStr1 != 'undefined')
	{
		iStart = sStr1.indexOf(sAlt);
		iEnde = parseInt(iStart,10) + sAlt.length;

		sBeginn = sStr1.substr(0,iStart);
		sEnde = sStr1.substr(iEnde,sStr1.length);
		return sBeginn + sNeu + sEnde;
	}
	else
	{
		return sStr1;
	}
}


// ***
function mailto(adresse)
{
	adresse = adresse.replace(/ \( AT \) /, '@')
	mail="mailto:" + adresse;
	location.href=mail;
}//end 

/***
* \brief öffnet ein neues Fenster
*
* \author Balazs Bezeczky
*
* \date   Init: 30.06.2004
*
* \param 
*		\arg \c url, string, kann Parameter nach dem '?' enthalten
*		\arg \c hoehe, string, Höhe des neuen Fensters
*		\arg \c breite, string, Breite des neuen Fensters
*			
* \return none
*
*
*/	
function windowOpen(url, hoehe, breite)
{
	
	if (hoehe == undefined || breite == undefined)
	{
		hoehe = 480;
		breite = 640;
	}
	
	var tmp = window.open(url,"neu","height=" + hoehe + ",width=" + breite + ",location=no,menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,top=30,left=30");
	tmp.focus();
}


//############# Zellen highlighten ############ 
// *** 
function highlightZeile(zeile,col)
{
	zeile.bgColor = col;
}


function highlightOffZeile()
{

}
function highlight_on(zelle,raum,lehrer)
{
	farbeAlt = zelle.style.backgroundColor;
	//zelle.bgColor="#B0CCEE";
	zelle.style.backgroundColor = "#B0CCEE";
	if (raum != "" && raum != " ")
	{
		if (document.all)
		{
			if (lehrer != "undefined" && lehrer != "")
			{
				document.getElementById("raum").innerHTML = "Raum: " + raum + "<br>Lehrer: " + lehrer;
			}
			else
			{
				document.getElementById("raum").innerHTML = "Raum: " + raum;
			}
		}
		else
		{
			document.getElementById("raum").firstChild.nodeValue = "Raum: " + raum;
			if (lehrer != "undefined" && lehrer != "")
			{
				document.getElementById("lehrer").firstChild.nodeValue = "LehrerIn: " + lehrer;
			}
		}

		showDiv();
	}
	else if (lehrer != "undefined" && lehrer != "")
	{
		if (document.all)
		{
			document.getElementById("raum").innerHTML = "Raum: " + "" + "<br>Lehrer: " + lehrer;

		}
		else
		{
			document.getElementById("raum").firstChild.nodeValue = "Raum: " + "";
			document.getElementById("lehrer").firstChild.nodeValue = "LehrerIn: " + lehrer;
		}

		showDiv();

	}


	
	
}//end

// ***
function highlight_off(zelle)
{
//	zelle.bgColor="#FFFFFF";
	zelle.style.backgroundColor = farbeAlt;
	hideDiv();
}//end
//-->


//############# Show div ############

document.onmousemove = mausMove;

if (navigator.appName.indexOf("Explorer") == -1)
{
	sBrowser = "MOZ";
}
else
{
	if (navigator.appVersion.indexOf("MSIE 6.0") != -1)
		sBrowser = "IE";
	else
		sBrowser = "MOZ";
}

function mausMove(ereignis)
{
	posx = document.all ? window.event.clientX : ereignis.pageX;
	posy = document.all ? window.event.clientY : ereignis.pageY;

	if (sBrowser == "IE")
	{
		posx-=260;
		posy+=20;
	}
	else
	{
		posx+=20;
		posy+=20;
	}
}

function showDiv(ereignis)
{
	  document.getElementById("hint").style.top=posy + "px";
	  document.getElementById("hint").style.left=posx + "px";
//	  alert(posx + " " + posy);
	  document.getElementById("hint").style.visibility = "visible";
	document.getElementById("hint").style.zIndex = "1";
}


function hideDiv()
{
	  document.getElementById("hint").style.visibility="hidden";
}

//############# Scrolling stuff ############

function dummy()
{
}

function up()
{
	if(scrolling)
	{
		window.frames[0].scrollBy(0,-10);
		setTimeout("up()",100);
	}
}

function down()
{

	if(scrolling)
	{
		window.frames[0].scrollBy(0,10);
		setTimeout("down()",100);
	}
}

function start(richtung)
{
	scrolling = true;

	if (richtung == "up")
		up();
	else
		down();
}


function stop()
{
	scrolling = false;
}

function schliessen()
{
	document.getElementById('display').style.visibility='hidden';
}

//############# MouseOver Effekte für das Hauptmenü ############

/*
var schulprofil_off = new Image();
schulprofil_off.src = "buttons/about_off.gif";
var schulprofil_on  = new Image();
schulprofil_on.src  = "buttons/about_on.gif";
*/

function over(bild)
{
	document.images[bild].src = eval(bild + "_on.src");
}

function out(bild)
{
	document.images[bild].src = eval(bild + "_off.src");
}


//############# Debugging ############

/***
* \brief funktioniert wie PHP's dump, gibt die Werte hintereinander aus
*
* \author Balazs Bezeczky
*
* \date   Init: 22.10.2005
*
* \param 
*		\arg \c Objekt, dessen Inhalt ausgegeben werden soll

*			
* \return none
*
*
*/	
function dump(oObj)
{
	switch (typeof oObj)
	{
		case "string":
			alert(oObj);
			break;
		case "number":
			alert(oObj);
			break;	
		case "object":
			txt = "obejkt:\n";
			for (i = 0; i < oObj.length; i++)
			{
				txt+= oObj[i][0].toString();
			}
			alert(txt);
			break;
	}

	if (typeof oObj == "string")
	{
		alert(oObj);
	}

}
//-->
