/*  #####################################################
**  Domain:    www.aschau.de
**  Datei:     startseite.js
**  Funktion:  exklusiver JavaScriptCode für Folgeseiten

**  Erstellt:  12.03.2009

**  Autor:     Axel Güldner
**  copyright: infomax websolutions GmbH
##################################################### */

$(document).ready(function(){

    //Abgerundete Ecken für...
    //... Topnavigation
    $("#topnavi").corner("tr 15px #fff");
    //... Footer
    $("#CONT_footer").corner("br 15px #fff");
    //... coverFlow
    $(".coverFlow .top").parent().corner("tr 15px #fff");
    $(".coverFlow .bottom").parent().corner("br 15px #fff");


    //Artikeltexte in Spaltenform bringen
    //if(jQuery.isFunction($.fn.columnize))$("#contentarea .fliesstext").columnize({columns: 2});
    if(jQuery.isFunction($.fn.columnize))$(".contentForm .optionBlock ul").columnize({columns: 2});


    //Hubermap JS-Code
    //öffnen der Legendenpunkte
    $(".hubermap .legende .legende li").children("a").click(function(){
        $(this).parent().children("ul").slideToggle();
        $(this).toggleClass("active");
        if(!$(this).hasClass("active")){
            $(this).parent().find("a").removeClass("active");
            $(this).parent().find("ul").slideUp();
        }
    });

    //öffnen und schließen der Hubermap nach Klick auf entsprechende Links
    $("*[rel=openHuberMap]").click(function(){
    	//Zuerst prüfen ob VirtualEarth Api geladen ist
    	if(typeof(VEShapeLayer) != "undefined"){
	        $(".hubermap").animate({height:"toggle",opacity:"toggle"},"slow");
	        if($("#mapLarge").hasClass("startup")){
	        	//LazyLoad init der großen Karte, damit kleine Karte nicht mit initialisiert wird
				initmapLarge("lazyLoad");
				$("#mapLarge").removeClass("startup");
			}
    	}
    });
    //schließen der Hubermap nach betätigen von ESC
    $(document).keyup(function(event){
        if (event.keyCode == 27 && $(".hubermap").is(":visible") && $(".hubermap").is(":not(:animated)")) {
            $(".hubermap").animate({height:"toggle",opacity:"toggle"},"slow");
        }
    });
    //Neuladen der Hubermap nach Auswahl eines Profilings
    $("#huberMapLegende").find("a[rel=map]").click(function () {
		$(this).toggleClass("checked");
		if($(this).hasClass("checked"))UpdateSearch($(this).attr("id").substr(6), 'set');
		else UpdateSearch($(this).attr("id").substr(6), 'unset');					
	});
    $("#huberMapLegende").find("a[rel=mapUnload]").click(function () {
		$(this).toggleClass("checked");
		if(!$(this).hasClass("checked"))UpdateSearch($(this).attr("id").substr(6), 'unset');
	});

});

$(window).load(function(){

});
