$(document).ready(function() {
	$('#graggo-tab').toggle(function() {
		$('#graggo-nav-container:hidden').slideDown();
		$('#graggo-tab')[0].blur();
		$(this).addClass('on');
		return false;
	},
	function() {
		$('#graggo-nav-container:visible').slideUp();
		$('#graggo-tab')[0].blur();
		$(this).removeClass('on');
		return false;
	}
	);

	$('textarea.expand').autogrow({
		maxHeight: 200,
		minHeight: 50
	});
});



function chkKtk() {
    var error = 0;
    var ALERTTXT = "";

    if (document.getElementById('Ktk').name.value == '') {
	error = 1;
    	ALERTTXT = ALERTTXT + "Bitte geben Sie Ihren Nachnamen an!\n";
    }

    if (document.getElementById('Ktk').vorname.value == '') {
	error = 1;
    	ALERTTXT = ALERTTXT + "Bitte geben Sie Ihren Vornamen an!\n";
    }

    if (document.getElementById('Ktk').telefon.value == '' && document.getElementById('Ktk').email.value == '') {
	error = 1;
    	ALERTTXT = ALERTTXT + "Bitte geben Sie Ihre Telefonnummer oder E-Mail-Adresse an!\n";
    }

    if (document.getElementById('Ktk').nachricht.value == '') {
	error = 1;
    	ALERTTXT = ALERTTXT + "Bitte geben Sie Ihre Nachricht an uns ein!\n";
    }
	
    if(error == 1) {
        alert(ALERTTXT);
        return false;
    }
    return true;
}


function chkBwb() {
    var error = 0;
    var ALERTTXT = "";

	if (document.getElementById('bwb').bewerbung.value == '') {
		error = 1;
    	ALERTTXT = ALERTTXT + "Bitte wählen Sie eine Stellenbeschreibung aus!\n";
    }
	
    if (document.getElementById('bwb').name.value == '') {
		error = 1;
    	ALERTTXT = ALERTTXT + "Bitte geben Sie Ihren Nachnamen an!\n";
    }

    if (document.getElementById('bwb').vorname.value == '') {
		error = 1;
    	ALERTTXT = ALERTTXT + "Bitte geben Sie Ihren Vornamen an!\n";
    }

    if (document.getElementById('bwb').telefon.value == '' && document.getElementById('bwb').email.value == '') {
		error = 1;
    	ALERTTXT = ALERTTXT + "Bitte geben Sie Ihre Telefonnummer oder E-Mail-Adresse an!\n";
    }
	
    if(error == 1) {
        alert(ALERTTXT);
        return false;
    }
    return true;
}

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
         }
      }
   }    
}