﻿$(document).ready(function()
{	$('input[name="lookfor"]').click(function(){
		$(this).attr('value','');
	});

	$('a[href^="http://"]').attr("target", "_blank");
    $(".tablesorter").tablesorter(); 

	// Ausklappliste
	$(function() {
		$('div.dentagen-tk li div').each(function(i) {
			var parent_li = $(this).parent('li');

			var sub_ul = $(this).remove();
			parent_li.wrapInner('<a></a>').find('a').click(function() {
				sub_ul.toggle();
			});
			parent_li.append(sub_ul);
		});

		$('div.dentagen-tk ul div').hide();
	});

	// Form check
$(function() {
	$("form#tk-eintragen input").click(function() {
		if ($("select#tk-category option[value='" + $("select#tk-category").val() + "']").hasClass('forbidden')) {
			alert("Bitte wählen Sie eine der erlaubten Eintrags-Kategorien aus der Liste (nicht grau markiert).");
			$("select#tk-category").focus();
			return false;
		} 
		fehlertext = false; fehlerzahl = false;
		$("form#tk-eintragen textarea").each(function() {
			if ($(this).val() == "") fehlertext = true;
			//if ($(this).val() == "0,00") fehlerzahl = true;
		});
		if (fehlertext) {
			fehler = "Füllen Sie bitte alle Textfelder aus.";
			alert(fehler);
			return false;
		}
	});
}); 

});




/*
function noError()
{return true;}
window.onerror=noError;


Behaviour.addLoadEvent 
(	function()
	{	
		if (document.attachEvent)
		{
			// Suckerfish Hovers
			var sfEls = document.getElementById("navigation").getElementsByTagName("UL")[0].getElementsByTagName("LI");
			for (var i=0; i<sfEls.length; i++) {
				sfEls[i].onmouseover=function() {
					this.className+=" sfhover";
				}
				sfEls[i].onmouseout=function() {
					this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
				}
			}
		}
		
		
	}
);

var Rules = {
    '.extern' : function(el)
	{	el.onclick = function()
		{   alert('tests');
			this.setAttribute('target','_blank');
		}
	}
};

Behaviour.register(Rules);
*/
