// jquery code start

var mapwindowstate = 2;
var newsarea = 0;
var contentarea = 0;

var isOpened = 0;
var rightSearchDisplaced  = false;
var keepRightSearchDisplaced = false;



function showNewsByTagCloud(tag){
	triggerSearchBySearchTerm(tag, 0); // from portal_dojo.js
}

function showNewsSection() {

}

function getContentFromWordPressById (pageId) {
	getPageByIdSubmit(pageId);
};

$(document).ready(function(){

	//hover states on the static widgets
	$('#dialog_link, ul#icons li').hover(
		function() { $(this).addClass('ui-state-hover'); },
		function() { $(this).removeClass('ui-state-hover'); }
	);

	var mapheight = 540;
	var newsdisplaystate = "none";

    $("#expandmap_lnk").click(function(){
		if (mapwindowstate == 2) {
			mapheight = 680;
			mapwindowstate = 3;
			document.getElementById('expandmap_img').src="templates/images/expand_map_button_down_off.png";
		}
		if (mapwindowstate == 1) {
			mapheight = 540;
			mapwindowstate = 2;
			document.getElementById('contractmap_img').src="templates/images/expand_map_button_up.png";
		}
		if ((mapwindowstate == 2) || (mapwindowstate == 3)) {
			var mapstatecurrent = mapwindowstate;
			mapwindowstate = 0;
			$("#map1div").animate({
				height: ""+mapheight+"px"
			}, 1500, function() {
					mapwindowstate = mapstatecurrent;
					if (mapwindowstate == 2) {
						hideshow('map_overlay_content_area', 'show');
					}
				} );
		}
    });

    $("#contractmap_lnk").click(function(){
		if (mapwindowstate == 2) {
			mapheight = 80;
			mapwindowstate = 1;
			window.setTimeout("hideshow('map_overlay_content_area', 'hide')", 1);
			document.getElementById('contractmap_img').src="templates/images/expand_map_button_up_off.png";
		}
		if (mapwindowstate == 3) {
			mapheight = 540;
			mapwindowstate = 2;
			document.getElementById('expandmap_img').src="templates/images/expand_map_button_down.png";
		}
		if ((mapwindowstate == 1) || (mapwindowstate == 2)) {
			var mapstatecurrent = mapwindowstate;
			mapwindowstate = 0;
			$("#map1div").animate({
				height: ""+mapheight+"px"
			}, 1500, function() {
					mapwindowstate = mapstatecurrent;
				} );
		}
    });

    $("#searchbox_results_close_lnk").click(function(){
    	searchboxResultsClose();
    });

    $("#searchbox_results_open_lnk").click(function(){
    	searchboxResultsOpen();
    });
    
    $("#searchbox_close_lnk").click(function(){
    	searchboxClose();
    });

    $("#searchbox_open_lnk").click(function(){
    	searchboxOpen();
    });




	/**
	 * Neuer Content aus Wordpress:
	 * Link mit Id generieren und diese Methode kopieren, Page Id anpassen und wordpress liest daten aus
	 */

	$("#weitereInformationen_open").click(function(){
		getContentFromWordPressById(144);
	});
	$("#weitereInformationen_open2").click(function(){
		getContentFromWordPressById(144);
	});

	$("#impressum_open").click(function(){
		getContentFromWordPressById(2);
	});

	$("#fix_topnews_open").click(function(){

		// kann nicht aufgerufen werden! fixme!
		//getContentFromWordPressById(534);
	});


});


//]]>

// jquery code stop