$(document).ready(function(){
    $("ul.sf-menu:first").supersubs({ 
        minWidth:    12,   // minimum width of sub-menus in em units 
        maxWidth:    27,   // maximum width of sub-menus in em units 
        extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
                           // due to slight rounding differences and font-family 
    }).superfish({speed: 'slow'});  // call supersubs first, then superfish, so that subs are 
                     // not display:none when measuring. Call before initialising 
                     // containing tabs for same reason.

    $('#picture_gallery a, #school_gallery a').lightBox({
		txtImage: 'Bild',
		txtOf: 'von'
	});

// Oeffentlichkeit Landkreis per Javascript neues Fenster öffnen lassen
	$('#blank').attr("target", "_blank");
	/* $(function(){
	    $('#blank').click(function(){
	        window.open(this.href);
	        return false;
	    });
	}); */

// Wo finde ich was und Handel / Gewerbe IN FUNKTION AUSLAGERN!!!!!!!!!!
	$('.anchor_div').hide();
	$('#a').addClass("anchor_div_visible");
	$('.anchor_div_visible').show();

    $('#A-Z').change(function(){
			var test = $('#A-Z').val();
				$('.anchor_div_visible').hide();
				$(".anchor_div_visible").removeClass("anchor_div_visible");
				$("#"+test).addClass("anchor_div_visible");
				$('.anchor_div_visible').show();
    });

	$("#query").focus(function() {
		if( this.value == this.title ) {
			this.value = "";
		}
	}).blur(function() {
		if( !this.value.length ) {
			this.value = this.defaultValue;
		}
	});

});

jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}

function validateForm(url) {
    var theAction = 'http://' + window.location.host + url.join('/');
    //console.log(theAction);
    $('#mail_form').attr({action: theAction});
    $('#submit_mail').attr({name: ['request', 'SendMail'].join('')});
}

//Functions for the Hover Header Image change
function over(target_el, object) {
	var picture = $(target_el).attr("id").replace("Pic_", "");
	$(object).hide();
	$('#Header_' + picture).show();
}

function out() {

}