$(document).ready(function() {
	$("div.panel_button").click(function(){
		$("div#panel")
		.animate({
			height: "180px"
		}, "fast");
		$("div.panel_button").toggle();
	
	});	
	
   $("div#hide_button").click(function(){
		$("div#panel").animate({
			height: "0px"
		}, "fast");
		
	
   });	
	
});

function submitToggle() 
{
    if ($('#hidden_submit').css('display') == 'none') 
    {
		    $('#hidden_submit').slideDown();
    } 
    else 
    {
		    $('#hidden_submit').slideUp();
    }
}
function chkFormular () {

 if (document.frm_failsend.fail.value.indexOf("Heute") == -1) {
    alert("Dein Fail muss mit Heute beginnen!");
    document.frm_failsend.fail.focus();
    return false;
  }
}
function checkLen()
{
maxLen=550;
var txt=document.frm_commsend.comment.value;
if(txt.length>maxLen)
    {
      alert("Bitte maximal "+maxLen+" Zeichen eingeben!");
      document.frm_commsend.comment.value=txt.substring(0,maxLen);
      document.frm_commsend.zaehler.value=0;
    }
else
    {
    document.frm_commsend.zaehler.value=maxLen-txt.length;
    }
}

function checkLenFail()
{
maxLen=1000;
var txt=document.frm_failsend.failtext.value;
if(txt.length>maxLen)
    {
      alert("Du darfst nicht mehr als "+maxLen+" Zeichen eingeben!");
      document.frm_failsend.failtext.value=txt.substring(0,maxLen);
      document.frm_failsend.zaehlerfail.value=0;
    }
else
    {
    document.frm_failsend.zaehlerfail.value=maxLen-txt.length;
    }
}

function insertSmiley(smiley)
{    
    var currentText = document.getElementById("comment");        
    var txtlen = document.frm_commsend.comment.value;
    
    document.frm_commsend.comment.focus();
    
    if(txtlen.length > 0)
    { 
        if(txtlen.length + smiley.length <= 550)
        {
            currentText.value += smiley;
        }
    }
    else
    {
        currentText.value += smiley;
    }
    
    currentText.focus();
}
