window.defaultStatus = "Herzlich Willkommen auf der Seite des SV Fortuna Ulmen 1921 e.V.";

function addbookmark(){
	if (document.all) window.external.AddFavorite("http://www.fortuna-ulmen.de","SV Fortuna Ulmen 1921 e.V.")
}

function hyperlink() {
     addlink_url = prompt("Url des Links:","http://www.");
     addlink_name = prompt("Name der angezeigt werden soll:");
     window.document.forms[4].eintrag.value = window.document.forms[4].eintrag.value + "[LINK " + addlink_url + "]" + addlink_name + "[/LINK] ";
}

function email() {
     addemail = prompt("Email Adresse eingeben:\nz.B Name@Provider.de","");
     window.document.forms[4].eintrag.value = window.document.forms[4].eintrag.value + "[EMAIL " + addemail + "] ";
}

function grafik() {
     addpic_picurl = prompt("Verzeichniss des Bildes:\nBilder auf FTP in dieses Verzeichniss ","gfx/nachrichten/");
     window.document.forms[4].eintrag.value = window.document.forms[4].eintrag.value + "[IMG " + addpic_picurl + "] ";
}


function liste() {

	liststart="[LIST]\n";
	listend="[/LIST] ";

list="";
theentry = "bla";

	while ( theentry != "" && theentry != null ) {
	theentry = prompt("Gib ein Element der Liste an\nKlicke auf \"Abbrechen\" um die Liste fertigzustellen!","");
		if ( theentry!="" && theentry!=null ) {
		list+="[L]"+theentry+"[/L]\n";
		}
	}

	if ( list!="" ) {
	document.form.eintrag.value+=liststart+list+listend;
	}

liststart="";
listend="";
list="";
}

function insert_smilie(what)
{	
	document.forms.fortuna_gb.elements.eintrag.value+= " ";
	document.forms.fortuna_gb.elements.eintrag.value+= what;
	document.forms.fortuna_gb.elements.eintrag.value+= " ";
}

function insert_smilie_adm(what)
{	
	document.forms.form.elements.kommentar.value+= " ";
	document.forms.form.elements.kommentar.value+= what;
	document.forms.form.elements.kommentar.value+= " ";
}

function insert_text(what,info)
{
if (document.selection) // für IE
   {
    var str = document.selection.createRange().text;
    if(str != "")
    {
    document.form.elements['eintrag'].focus();
    var inb = document.selection.createRange();
    inb.text = "[" + what + "]" + str + "[/" + what + "]";
    return;
    }
    else
    {
        // wenn nichts gewählt wurde, mache ein prompt und hängs hinten an
     	inb = prompt(info,"");
        if(inb != "" && inb != null)
        {
	document.form.elements['eintrag'].value += "["+what+"]"+inb+"[/"+what+"] ";
        document.form.elements['eintrag'].focus();
        }
    }
  }
  else if (document.getElementById && !document.all) // für Mozilla/Gecko
  {

    var txtarea = document.form.elements['eintrag'];
    var selLength = txtarea.textLength;
    var selStart = txtarea.selectionStart;
    var selEnd = txtarea.selectionEnd;
    if (selEnd == 1 || selEnd == 2)
    selEnd = selLength;
    var start = (txtarea.value).substring(0,selStart);
    var inb = (txtarea.value).substring(selStart, selEnd)

    if(inb != "")
    {
    var end = (txtarea.value).substring(selEnd, selLength);
    txtarea.value = start + '[' + what + ']' + inb + '[/' + what + ']' + end;
    return;
    }
    else
    {
        // wenn nichts gewählt wurde, mache ein prompt und hängs hinten an
        inb = prompt(info,"");
        if(inb != "" && inb != null)
        {
	document.form.elements['eintrag'].value += "["+what+"]"+inb+"[/"+what+"] ";
        document.form.elements['eintrag'].focus();
        }
    }
   }
   else
   {
       // wenn der browser nix versteht (z.B. opera) dann hängs hinten an
       inb = prompt(info,"");
       if(inb != "" && inb != null)
       {
	   document.form.elements['eintrag'].value += "["+what+"]"+inb+"[/"+what+"] ";
           document.form.elements['eintrag'].focus();
       }
   }
}

function insert_protokoll(what,info)
{
if (document.selection) // für IE
   {
    var str = document.selection.createRange().text;
    if(str != "")
    {
    document.form_protokoll.elements['protokoll'].focus();
    var inb = document.selection.createRange();
    inb.text = "[" + what + "]" + str + "[/" + what + "]";
    return;
    }
    else
    {
        // wenn nichts gewählt wurde, mache ein prompt und hängs hinten an
     	inb = prompt(info,"");
        if(inb != "" && inb != null)
        {
	document.form_protokoll.elements['protokoll'].value += "["+what+"]"+inb+"[/"+what+"] ";
        document.form_protokoll.elements['protokoll'].focus();
        }
    }
  }
  else if (document.getElementById && !document.all) // für Mozilla/Gecko
  {

    var txtarea = document.form_protokoll.elements['protokoll'];
    var selLength = txtarea.textLength;
    var selStart = txtarea.selectionStart;
    var selEnd = txtarea.selectionEnd;
    if (selEnd == 1 || selEnd == 2)
    selEnd = selLength;
    var start = (txtarea.value).substring(0,selStart);
    var inb = (txtarea.value).substring(selStart, selEnd)

    if(inb != "")
    {
    var end = (txtarea.value).substring(selEnd, selLength);
    txtarea.value = start + '[' + what + ']' + inb + '[/' + what + ']' + end;
    return;
    }
    else
    {
        // wenn nichts gewählt wurde, mache ein prompt und hängs hinten an
        inb = prompt(info,"");
        if(inb != "" && inb != null)
        {
	document.form_protokoll.elements['protokoll'].value += "["+what+"]"+inb+"[/"+what+"] ";
        document.form_protokoll.elements['protokoll'].focus();
        }
    }
   }
   else
   {
       // wenn der browser nix versteht (z.B. opera) dann hängs hinten an
       inb = prompt(info,"");
       if(inb != "" && inb != null)
       {
	   document.form_protokoll.elements['protokoll'].value += "["+what+"]"+inb+"[/"+what+"] ";
           document.form_protokoll.elements['protokoll'].focus();
       }
   }
}

function insert_anlage(what,info)
{
if (document.selection) // für IE
   {
    var str = document.selection.createRange().text;
    if(str != "")
    {
    document.form_protokoll.elements['anlage'].focus();
    var inb = document.selection.createRange();
    inb.text = "[" + what + "]" + str + "[/" + what + "]";
    return;
    }
    else
    {
        // wenn nichts gewählt wurde, mache ein prompt und hängs hinten an
     	inb = prompt(info,"");
        if(inb != "" && inb != null)
        {
	document.form_protokoll.elements['anlage'].value += "["+what+"]"+inb+"[/"+what+"] ";
        document.form_protokoll.elements['anlage'].focus();
        }
    }
  }
  else if (document.getElementById && !document.all) // für Mozilla/Gecko
  {

    var txtarea = document.form_protokoll.elements['anlage'];
    var selLength = txtarea.textLength;
    var selStart = txtarea.selectionStart;
    var selEnd = txtarea.selectionEnd;
    if (selEnd == 1 || selEnd == 2)
    selEnd = selLength;
    var start = (txtarea.value).substring(0,selStart);
    var inb = (txtarea.value).substring(selStart, selEnd)

    if(inb != "")
    {
    var end = (txtarea.value).substring(selEnd, selLength);
    txtarea.value = start + '[' + what + ']' + inb + '[/' + what + ']' + end;
    return;
    }
    else
    {
        // wenn nichts gewählt wurde, mache ein prompt und hängs hinten an
        inb = prompt(info,"");
        if(inb != "" && inb != null)
        {
	document.form_protokoll.elements['anlage'].value += "["+what+"]"+inb+"[/"+what+"] ";
        document.form_protokoll.elements['anlage'].focus();
        }
    }
   }
   else
   {
       // wenn der browser nix versteht (z.B. opera) dann hängs hinten an
       inb = prompt(info,"");
       if(inb != "" && inb != null)
       {
	   document.form_protokoll.elements['anlage'].value += "["+what+"]"+inb+"[/"+what+"] ";
           document.form_protokoll.elements['anlage'].focus();
       }
   }
}

function expandcollapse(id)
{
	if (document.getElementById('toggle_' + id).style.display == 'none')
	{
    	document.getElementById('toggle_' + id).style.display = 'block';
    	document.getElementById('toggleimg_' + id).src = '../gfx/minus.gif';
	}
	else
	{
    	document.getElementById('toggle_' + id).style.display = 'none';
    	document.getElementById('toggleimg_' + id).src = '../gfx/plus.gif';
	}
}