function PopUpFill( name, inhalt, width, height, left, top )
{
  win = window.open( '', name, "width=" + width + ",height=" + height + ",left=" + left + ",top=" + top + ",resizable=yes,scrollbars=yes");
  win.document.write( inhalt );
  win.focus();
  win.stop();
}

function PopUp( link, name )
{
  win = window.open( link, name );
  win.focus();
}


// Adminmenü-Dropdown 
sfHover = function() {

	var sfEls = document.getElementById("a_menu").getElementsByTagName("LI");
	var sfEls2 = document.getElementById("menue_aussehen_9").getElementsByTagName("LI");
	
	// Adminmenü
  for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
	
	//Menü Auswahl 9
	for (var i=0; i<sfEls2.length; i++) {
		sfEls2[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls2[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);



function insert_action_picture_pool_1( pic_name, beschreibung, width, height )
{
  var newpic = new Image();
  newpic.src = pic_name;
  
  document.images['action_bild_original'].src = newpic.src;
  document.images['action_bild_original'].width = width;
  document.images['action_bild_original'].height = height;
  document.getElementById( 'pool_1_beschreibung' ).innerHTML = beschreibung;
}


offen = new Array();
function insert_klappmenue( struct_id, insert )
{
  var name = "klapp_menue_";
  var name2 = "vorzeichen_";
  if( offen[struct_id] != 1 ){
   offen[struct_id] = 1;
   document.getElementById( name + struct_id ).innerHTML = insert;
   document.getElementById( name2 + struct_id ).innerHTML = '- ';
  }else{
   offen[struct_id] = 0;
   document.getElementById( name + struct_id ).innerHTML = ''; 
   document.getElementById( name2 + struct_id ).innerHTML = '+ ';
  }  
}

var merk_menue = 0;
function insert_klappmenue_mouseover( struct_id, insert )
{
  var name = "klapp_menue_";
  
  if( !struct_id ) struct_id = "0";
  if( !insert ) insert = "";
    
  if( merk_menue != 0 ){
    document.getElementById( name + merk_menue ).innerHTML = '';
  }     
  document.getElementById( name + struct_id ).innerHTML = insert;  
  merk_menue = struct_id;
}
function insert_klappmenue_mouseover_out( )
{
  var name = "klapp_menue_";
  
  if( merk_menue != 0 ){
    document.getElementById( name + merk_menue ).innerHTML = '';
  }     
}




var title;
function statuszeit( title_board )
{
  var a = new Date();
  var b = String(a.getSeconds());
  var c = String(a.getHours());
  var d = String(a.getMinutes());
  if(title_board) title = title_board;
  if(b.length < 2){ b = "0"+b; }
  if(c.length < 2){ c = "0"+c; }
  if(d.length < 2){ d = "0"+d; }
  var f = title+"   "+c+":"+d+":"+b;
  window.status = f;

  window.setTimeout('statuszeit()',1000);
}


function mouseover_bg( wert, row )
{
	if(row==1)wert.style.background='#FFFFF5';
	if(row==2)wert.style.background='#FFFFF5';
}

function mouseover_bg2( wert, row )
{
	if(row==2)wert.style.background='#EEEEEE';
	if(row==1)wert.style.background='#FFFFFF';
}

function mouseover( nr, url )
{
  Bild2 = new Image();
  Bild2.src = url;
  window.document.images[nr].src=Bild2.src;
}
function mouseout( nr, url )
{
  Bild1 = new Image();
  Bild1.src = url;
  window.document.images[nr].src=Bild1.src;
}




function pic_show_open() {
	var win;
	win = window.open("./show_pic.php", "Bilder", "width=250, height=600, resizable=yes, scrollbars=yes");
	win.focus();
}

function search_open( link ) {
	var win;
	win = window.open("./search_open.php" + link , "Suchergebnis", "width=900, height=400, resizable=yes, scrollbars=yes");
	win.focus();
}

function open_search( link ) {
	var win;
	win = window.open( link , "Suchergebnis", "width=530, height=350, resizable=yes, scrollbars=yes");
	win.focus();
}





function insert(tag) {
  var input = document.forms['add'].elements['inhalt'];

  aTag = tag;
  eTag = "";

  var ausdruck=/\[size=[0-9]+\]/;
  if(ausdruck.exec(tag)){
    eTag = "[/size]";
  }

  ausdruck=/\[color=[a-z]+\]/;
  if(ausdruck.exec(tag)){
    eTag = "[/color]";
  }

  ausdruck=/\[font=[a-z]+\]/;
  if(ausdruck.exec(tag)){
    eTag = "[/font]";
  }


  if(tag=='bild'){
    var url;
    url = prompt("Geben Sie die Url vom Bild ein:","http://");
    aTag = "";
    eTag = "";
    if(url){
      aTag = "[img]"+url;
      eTag = "[/img]";
    }
  }
  if(tag=='link'){
    var url;
    url = prompt("Geben Sie die Url vom Link ein:","http://");
    link = prompt("Geben Sie den Linknamen ein:","");
    aTag = "";
    eTag = "";
    if(url){
      aTag = "[url="+url+"]"+link;
      eTag = "[/url]";
    }
  }

 if(tag=='flow_right'){
   aTag = "[float_right]";
   eTag = "[/float_right] [float_right_none]";
 }

 if(tag=='flow_left'){
   aTag = "[float_left]";
   eTag = "[/float_left] [float_left_none]";
 }

  if(tag=='center'){
    aTag = "[center]";
    eTag = "[/center]";
  }

  if(tag=='bold'){
    aTag = "[b]";
    eTag = "[/b]";
  }

  if(tag=='rechts'){
    aTag = "[right]";
    eTag = "[/right]";
  }

  if(tag=='[color=339900]'){
    aTag = "[color=339900]";
    eTag = "[/color]";
  }

  if(tag=='[color=009A34]'){
    aTag = "[color=009A34]";
    eTag = "[/color]";
  }

 if(tag=='[color=E9E9E9]'){
    aTag = "[color=E9E9E9]";
    eTag = "[/color]";
  }

  if(tag=='[color=999999]'){
    aTag = "[color=999999]";
    eTag = "[/color]";
  }

  if(tag=='ueberschrift'){
    aTag = "[h2]";
    eTag = "[/h2]";
  }

  if(tag=='ueberschrift2'){
    aTag = "[h3]";
    eTag = "[/h3]";
  }

  if(tag=='mail'){
    var url;
    url = prompt("Geben Sie die Mail-Adresse ein:","name@host.de");
    aTag = "";
    eTag = "";
    if(url){
      aTag = "[mail="+url+"]"+url;
      eTag = "[/mail]";
    }
  }

  if(tag=='block'){
    aTag = "[block]";
    eTag = "[/block]";
  }

  if(tag=='italic'){
    aTag = "[italic]";
    eTag = "[/italic]";
  }

  if(tag=='under'){
    aTag = "[under]";
    eTag = "[/under]";
  }


  input.focus();
  /* fuer Internet Explorer */
  if(typeof document.selection != 'undefined') {
    /* Einfuegen 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.moveStart(0, aTag.length + insText.length + eTag.length);
    }
    range.select();
  }
  /* fr neuere auf Gecko basierende Browser */
  else if(typeof input.selectionStart != 'undefined')
  {
    /* Einfuegen 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;  */
      pos = 0;
    }
    input.selectionStart = pos;
    input.selectionEnd = pos;
  }
  /* fuer die uebrigen Browser */
  else
  {
    /* Abfrage der Einfuegeposition */
    var pos;
    var re = new RegExp('^[0-9]{0,3}$');
    while(!re.test(pos)) {
      pos = prompt("Einfgen an Position (0.." + input.value.length + "):", "0");
    }
    if(pos > input.value.length) {
      pos = input.value.length;
    }
    /* Einfuegen 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);
  }
}

