var vorteile_open = false;
$(document).ready(function() {
	$('#vorteile_box').hide();
	$('#Einstellungen').hide();
	$('#option_resize').hide();

	$('#vorteile_button').click(function() {

		if ( vorteile_open )
		{
			$('#vorteile_box').animate({height: '0px' }, 'normal', 'linear', function() { $('#vorteile_box').hide() });
		}
		else
		{
			$('#vorteile_box').css('height', 0).show();
			$('#vorteile_box').animate({height: '190px' }, 'normal', 'linear');
		}
		vorteile_open = !vorteile_open;
	});
});

function Smilies(Zeichen, WoFeld)
{
	if (WoFeld == 'news_kurzform_text')
	{
		document.schreibe.news_kurzform_text.value += Zeichen;
		document.schreibe.news_kurzform_text.focus();
	}
	else
	{
		document.schreibe.news_text.value += Zeichen;
		document.schreibe.news_text.focus();
	}

}
function BBcode(Zeichen1, Inhalt, Zeichen2, WoFeld)
{
	var Zeichen = Zeichen1 + Inhalt + Zeichen2;

	if (WoFeld == 'news_kurzform_text')
	{
		document.schreibe.news_kurzform_text.value += Zeichen;
		document.schreibe.news_kurzform_text.focus();
	}
	else
	{
		document.schreibe.news_text.value += Zeichen;
		document.schreibe.news_text.focus();
	}
}
function weiterleitung(Adresse)
{
			window.location.href=Adresse;
}

function matpo_upload (FeldText) {
	// 'Bitte warten..' auf Submit
	FeldName = document.upload_bild.upload_a;
	FeldName.value=FeldText;

	// Submit Deaktievieren
	FeldName.disabled=true;

	// Submit ausführen für IE benötigt
	document.upload_bild.submit();

	// Formular ausblenden
	document.upload_bild.style.display = 'none';

	// Grafik beim warten anzeigen.
	document.getElementById('BitteWarten').style.display = 'block';
}
function ausblenden (FeldName1, FeldName2) {
  FeldName1 = document.getElementById(FeldName1);
	FeldName1.style.display = 'none';

  FeldName2 = document.getElementById(FeldName2);
	FeldName2.style.display = 'block';
}
function matpo_bildgroesse () {

	Feld1 = document.upload_bild.check_bild_groesse;
	Feld2 = document.upload_bild.bild_groesse;
	if (Feld1.checked == true)
	{
		Feld2.disabled=false;
	}
	else
	{
		Feld2.disabled=true;
	}
}
function matpo_datei () {

	Feld1 = document.upload_bild.datei;
	Feld2 = document.upload_bild.agb;
	// if (Feld1.value == '' || Feld1.value == 'http://')
	// {
	// 	Feld2.disabled=true;
	// }
	// else
	// {
		Feld2.disabled=false;
	// }
}

function matpo_agb () {

	Feld1 = document.upload_bild.agb;
	Feld2 = document.upload_bild.upload_a;
	if (Feld1.checked == true)
	{
		Feld2.disabled=false;
	}
	else
	{
		Feld2.disabled=true;
	}
}

var multiupload_count = 1;
function multiupload_add()
{
	if ( multiupload_count >= max_upload_fields ) return;
	multiupload_count++;

	$('#upload_datei').append($('#multiupload_row_file').html());
	$('#upload_link').append($('#multiupload_row_link').html());
}
function multiupload_del()
{
	if ( multiupload_count >= max_upload_fields ) return;
	multiupload_count--;
    
    $('#upload_datei #datei:last').remove();
    $('#upload_link #datei:last').remove()
}