<!--
function bbcode(form,field,v)
 {
 if (document.selection) // for IE
   {
    var str = document.selection.createRange().text;
    document.forms[form].elements[field].focus();
    var sel = document.selection.createRange();
    sel.text = "[" + v + "]" + str + "[/" + v + "]";
    return;
   }
  else if ((typeof document.forms[form].elements[field].selectionStart) != 'undefined') // for Mozilla
   {
    var txtarea = document.forms[form].elements[field];
    var selLength = txtarea.textLength;
    var selStart = txtarea.selectionStart;
    var selEnd = txtarea.selectionEnd;
    var oldScrollTop = txtarea.scrollTop;
    var s1 = (txtarea.value).substring(0,selStart);
    var s2 = (txtarea.value).substring(selStart, selEnd)
    var s3 = (txtarea.value).substring(selEnd, selLength);
    txtarea.value = s1 + '[' + v + ']' + s2 + '[/' + v + ']' + s3;
    txtarea.selectionStart = s1.length;
    txtarea.selectionEnd = s1.length + 5 + s2.length + v.length * 2;
    txtarea.scrollTop = oldScrollTop;
    txtarea.focus();
    return;
   }
  else insert(form,field,'[' + v + '][/' + v + '] ');
 }

function insert(form,field,what)
 {
  if (document.forms[form].elements[field].createTextRange)
   {
    document.forms[form].elements[field].focus();
    document.selection.createRange().duplicate().text = what;
   }
  else if ((typeof document.forms[form].elements[field].selectionStart) != 'undefined') // für Mozilla
   {
    var tarea = document.forms[form].elements[field];
    var selEnd = tarea.selectionEnd;
    var txtLen = tarea.value.length;
    var txtbefore = tarea.value.substring(0,selEnd);
    var txtafter =  tarea.value.substring(selEnd, txtLen);
    var oldScrollTop = tarea.scrollTop;
    tarea.value = txtbefore + what + txtafter;
    tarea.selectionStart = txtbefore.length + what.length;
    tarea.selectionEnd = txtbefore.length + what.length;
    tarea.scrollTop = oldScrollTop;
    tarea.focus();
   }
  else
   {
    document.forms[form].elements[field].value += what;
    document.forms[form].elements[field].focus();
   }
 }

function insert_opener(form,field,what)
 {
  if (opener.document.forms[form].elements[field].createTextRange)
   {
    opener.document.forms[form].elements[field].focus();
    opener.document.selection.createRange().duplicate().text = what;
   }
  else if ((typeof opener.document.forms[form].elements[field].selectionStart) != 'undefined') // für Mozilla
   {
    var tarea = opener.document.forms[form].elements[field];
    var selEnd = tarea.selectionEnd;
    var txtLen = tarea.value.length;
    var txtbefore = tarea.value.substring(0,selEnd);
    var txtafter =  tarea.value.substring(selEnd, txtLen);
    var oldScrollTop = tarea.scrollTop;
    tarea.value = txtbefore + what + txtafter;
    tarea.selectionStart = txtbefore.length + what.length;
    tarea.selectionEnd = txtbefore.length + what.length;
    tarea.scrollTop = oldScrollTop;
    tarea.focus();
   }
  else
   {
    opener.document.forms[form].elements[field].value += what;
    opener.document.forms[form].elements[field].focus();
   }
 }

function insert_link(form,field)
 {
 var link_text='Link text (optional):';
 var link_target='Link target (URL):';

 if (document.selection) // for IE
   {
    var str = document.selection.createRange().text;
    document.forms[form].elements[field].focus();
    var sel = document.selection.createRange();
    var insert_link = prompt(link_target,'http://');
    if(sel.text=='' && insert_link!='' && insert_link!=null) str = prompt(link_text,'');

    if(insert_link && str!=null)
     {
      if(str!='')
       {
        sel.text = "[link=" + insert_link + "]" + str + "[/link]";
       }
      else
       {
        sel.text = "[link]" + insert_link + "[/link]";
       }
     }
    return;
   }
  else if ((typeof document.forms[form].elements[field].selectionStart) != 'undefined') // for Mozilla
   {
    var txtarea = document.forms[form].elements[field];
    var selLength = txtarea.textLength;
    var selStart = txtarea.selectionStart;
    var selEnd = txtarea.selectionEnd;
    var oldScrollTop = txtarea.scrollTop;
    var s1 = (txtarea.value).substring(0,selStart);
    var s2 = (txtarea.value).substring(selStart, selEnd);
    var s3 = (txtarea.value).substring(selEnd, selLength);

    var insert_link = prompt(link_target,'http://');
    if(selEnd-selStart==0 && insert_link!='' && insert_link!=null) s2 = prompt(link_text,'');
    if(insert_link && s2!=null)
     {
      if(s2!='')
       {
        txtarea.value = s1 + '[link=' + insert_link + ']' + s2 + '[/link]' + s3;
       }
      else
       {
        txtarea.value = s1 + '[link]' + insert_link + '[/link]' + s3;
       }
      txtarea.selectionStart = s1.length;
      txtarea.selectionEnd = s1.length + 5 + s2.length + v.length * 2;
      txtarea.scrollTop = oldScrollTop;
      txtarea.focus();
      return;
     }
   }
  else insert('[link=http://www.domain.tld/]Link[/link]');
 }

    function popup(url,width,height) {
		day = new Date();
		id = day.getTime();
		var options = "'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=" + width + ",height=" + height + "'";
		var page = "pop.php?imgid=" + url;
		window.open(page, id, options);
    }

    function popups(page,width,height,scroll) {
	if (scroll == "") scroll = "0";
    day = new Date();
	id = day.getTime();
	var nerd = "'toolbar=0,scrollbars=" + scroll + "0,location=0,statusbar=0,menubar=0,resizable=1,width=" + width + ",height=" + height + "'";
    window.open(page, id, nerd);
    }

    function showhide(part) {
    if(document.getElementById(part).style.display=='none')
    document.getElementById(part).style.display='';
    else document.getElementById(part).style.display='none'
    }

    <!-- Bilder Pop-Ups ;) -->
    function Foto1() {NewWindow = window.open("intern/galerie.php?id=0001", "SilvesterFotos", "width=600,height=600,scrollbars"); NewWindow.focus();}
    function Foto2() {NewWindow = window.open("foto.php?id=0159", "Schneetage 2005", "width=600,height=600,scrollbars"); NewWindow.focus();}
    function Foto3() {NewWindow = window.open("foto.php?id=0113", "Umbau", "width=600,height=600,scrollbars"); NewWindow.focus();}
    function Foto4() {NewWindow = window.open("foto.php?id=0012", "Studierwerkstatt", "width=600,height=600,scrollbars"); NewWindow.focus();}
    function Foto5() {NewWindow = window.open("foto.php?id=0023", "Ausmalen", "width=600,height=600,scrollbars"); NewWindow.focus();}
    function Foto6() {NewWindow = window.open("foto.php?id=0036", "Zeichnungen", "width=600,height=600,scrollbars"); NewWindow.focus();}
    function Foto7() {NewWindow = window.open("foto.php?id=0028", "Wandertage04", "width=600,height=600,scrollbars"); NewWindow.focus();}
    function Foto8() {NewWindow = window.open("schneetage.php?id=0001", "Schneetage04", "width=600,height=600,scrollbars"); NewWindow.focus();}

    <!-- Handy-Galerie -->
    function Foto11() {NewWindow = window.open("foto.php?id=0001", "Handy_Fotos", "width=600,height=600,scrollbars"); NewWindow.focus();}
    function Foto12() {NewWindow = window.open("foto.php?id=0041", "2nd_Season", "width=600,height=600,scrollbars"); NewWindow.focus();}
    function Foto13() {NewWindow = window.open("foto.php?id=0060", "3rd_Season", "width=600,height=600,scrollbars"); NewWindow.focus();}
    function Foto14() {NewWindow = window.open("foto.php?id=0071", "4th_Season", "width=600,height=500,scrollbars"); NewWindow.focus();}
    function Foto15() {NewWindow = window.open("foto.php?id=0089", "Sabsai_Season", "width=600,height=500,scrollbars"); NewWindow.focus();}

//-->
