/* JavaScript-File f½r Website der St. Jacobi Gemeinde */


/*
funktion f¸r RollOvers
Aufruf setzt sich aus Dateiname und dateinamenzusatz zusammen

die Variable is_act ist f¸r Men¸s - zum darstellen aktiver men¸punkte - wird durch setpage(bildname) gesetzt

*/
function men_act(img,act)
{
  if(top.menu.is_act && top.menu.is_act != img ) document.images[img].src = eval(img+'_'+act+'.src');
}


/*
bewirkt, dass ein Men¸punkt aktiv bleibt - also, wenn ein Men¸punkt aufgerufen wird
*/
function setpage(page)
{
  top.menu.is_act = page;
  init_menu();
}

function unsetpage()
{
  top.menu.is_act = 'intro';
  init_menu();
}

/*
 initialisiert das men¸ in sofern, dass der mit is_act markierte men¸punkt aktiviert wird
*/
function init_menu()
{
 if(top.menu.is_loaded)
 {
   for(i=0;i<top.menu.arrMenu.length;i++)
   {
     if(top.menu.is_act == 'intro') top.menu.document.images[top.menu.arrMenu[i]].src =top.menu.clear.src;
	 else
	 {
       if(top.menu.arrMenu[i] == top.menu.is_act) eval("top.menu.document.images[top.menu.arrMenu[i]].src = top.menu."+top.menu.arrMenu[i]+"_ovr.src");
       else  eval("top.menu.document.images[top.menu.arrMenu[i]].src = top.menu."+top.menu.arrMenu[i]+"_out.src");
     }
   }
 }
 else
 {
  window.setTimeout("init_menu();",100);
 }
}


/*
 wechselt die klasse eines Objektes (zb Tabellenzelle)
 aufruf zB mit "chgStyle(this);"
*/
function chgStyle(obj)
{
  if (document.all || document.getElementById)
  {
    if(obj.className == 'out') obj.className = 'ovr';
    else obj.className = 'out';
  }
}

/* funktion f¸r Pop-Ups */
function pop(file)
{
 F1 = window.open(file,"Fenster1","width=500,height=350,scrollbars=yes,menubar=no,resizeable=no,menubar=no,status=no,toolbar=no,location=no");
 newX = (screen.availWidth/2)-250;
 newY = (screen.availHeight/2)-175;
 F1.moveTo(newX,newY);
}

function view_pic(bild, width, height)
{
 F1 = window.open("view.php?file="+bild,"Fenster1","width="+width+",height="+height+",scrollbars=no,menubar=no,resizeable=no,menubar=no,status=no,toolbar=no,location=no");
 newX = (screen.availWidth/2)-width/2;
 newY = (screen.availHeight/2)-height/2;
 F1.moveTo(newX,newY);
}

/* Diese beiden Funktionen tauschen nur Bilder aus */
function ovr(img)
{
  document.images[img].src = eval(img+"_ovr.src");
}

function out(img)
{
  document.images[img].src = eval(img+"_out.src");
}

/* ¸berpr¸ft, ob das Frameset komplett geladen wurde */
function check_location()
{
  if(self.location == top.location) self.location.replace('http://www.kirche-sangerhausen.de/index.html');
}



/* funktionen f¸r den "aktuelle Angebote" - ADMIN-BEREICH */

function add_bold_text()
{
	newText = prompt("Bitte geben Sie den Text ein, der fett geschrieben werden soll.","");
	if(newText != null) document.forms[0].beschr.value += "[b]"+newText+"[/b]";
}

function add_italic_text()
{
	newText = prompt("Bitte geben Sie den Text ein, der kursiv geschrieben werden soll.","");
	if(newText != null) document.forms[0].beschr.value += "[i]"+newText+"[/i]";
}

function add_underlined_text()
{
	newText = prompt("Bitte geben Sie den Text ein, der unterstrichen werden soll.","");
	if(newText != null) document.forms[0].beschr.value += "[u]"+newText+"[/u]";
}

function add_paragraph_open()
{
	document.forms[0].beschr.value += "\r\n[p]";
}

function add_paragraph_close()
{
	document.forms[0].beschr.value += "[/p]\r\n";
}

function add_left_text()
{
	newText = prompt("Bitte geben Sie den Text ein, der rechtsb&uuml;ndig sein soll.","");
	if(newText != null) document.forms[0].beschr.value += "[p align=right]"+newText+"[/p]";
}

function add_center_text()
{
	newText = prompt("Bitte geben Sie den Text ein, der zentriert werden soll.","");
	if(newText != null) document.forms[0].beschr.value += "[center]"+newText+"[/center]";
}

function add_right_text()
{
	newText = prompt("Bitte geben Sie den Text ein, der linksb&uuml;ndig sein soll.","");
	if(newText != null) document.forms[0].beschr.value += "[p align=left]"+newText+"[/p]";
}

function add_image()
{
	newText = prompt("Bitte geben Sie den Pfad des Bildes an","http://");
	if(newText != null) document.forms[0].beschr.value += "[img src='"+newText+"']";

}

function add_link()
{
	newLink = prompt("Bitte geben Sie die Link-URL ein.","http://");
	newText = prompt("Bitte geben Sie die Link-Text ein.","");
	if(newLink != null && newText != null) document.forms[0].beschr.value += "[url '"+newLink+"']"+newText+"[/url]";
}