/*******************************************************************************
 * all the things that have to be initializied on document load
 * requires JQuery 1.3 !!!!!!
 * @return void
 ******************************************************************************/
$(document).ready(function(){
    $("body").append('<div id="global_callback"></div>');
    $("a").each(function(){
        var hr = $(this).attr("href");
        if (hr == "#") {
            $(this).click(function(){
                return false;
            });
        }
    });
    $(".hide, .ip_expander").hide();
    $(".name").hover(function(){
        var id = $(this).attr("title");
        var pos = $(this).position();
        var body = $("body");
        var btm = body.height() - pos.top;
        var tp = pos.top;
        if (btm < 400) 
            tp = tp - 400;
        if (id.length > 0) {
            $("#custom").html($("#global_callback"));
            $("#global_callback").css({
                "top": tp + "px",
                "margin": "0 0 10px 10px",
                "z-index": "100"
            });
            $("#global_callback").html($("#" + id).html());
            $("#global_callback").show();
        }
    }, function(){
        $("#global_callback").hide();
        $("#global_callback").empty();
    });
    $(".eMailDiv").hide();
    $("form").submit(function(){
        var l = $("#_oe_password").val();
        if (l.length > 0) {
            $("#_pwd2").val(hex_md5(l));
            $("#_oe_password").val(hex_md5(l));
        }
    });
    $(".shadow").dropShadow({
        left: 4,
        top: 4,
        blur: 3,
        opacity: 1,
        color: "black",
        swap: false,
        useColor: true
    });
    
    $("input#date_from, input#date_to").datepicker({
        dateFormat: 'dd.mm.yy'
    });
    
    if ($.browser.msie && parseInt($.browser.version) == 6) {
        //DD_belatedPNG.fix('img, #top_shadow, #center, #bottom, .intern');
    }
}); // ende $(document).ready();
/******************************************************************************
 * debug(e)
 * if the browser has a concole then output e
 ******************************************************************************/
function debug(e){
    if (window.console) {
        console.debug(e);
    }
}

function loadGMap(id, address, map, geocoder, headline, txt){
    geocoder = new GClientGeocoder();
    geocoder.setBaseCountryCode("US");
    if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_" + id));
        if (geocoder) {
            geocoder.getLatLng(address, function(point){
                if (!point) {
                    alert(address + " not found");
                }
                else {
                    map.setCenter(point, 13);
                    map.addControl(new GLargeMapControl());
                    var marker = new GMarker(point);
                    map.addOverlay(marker);
                    marker.openInfoWindowHtml("<h1>" + unescape(headline.replace("+", " ")) + "</h1>" + "<p>" + unescape(txt.replace("+", " ")) + "</p>");
                }
            });
        }
        
    }
}

