/**
 * Created by .
 * User: gpendl
 * Date: 19.05.11
 * Time: 13:38
 * To change this template use File | Settings | File Templates.
 */
function submitenter(myfield, e) {
    var keycode;
    if (window.event) keycode = window.event.keyCode;
    else if (e) keycode = e.which;
    else return true;

    if (keycode == 13) {
        myfield.form.submit();
        return false;
    }
    else
        return true;
}

var resize_top_margin = function() {

    $("#top_menu_margin").css("width", $("#top_menu_content").offset().left + "px");

};

var resize_sidemenu_margin = function() {

    $sidemenu = $("#sidemenu");

    $sidemenu.css("margin-left", 990 + $("#top_menu_content").offset().left + "px");

};


$(window).resize(function() {
    resize_top_margin();
    //resize_sidemenu_margin();
});

$(document).ready(function() {


    $("#searchfield").DefaultValue("suche");


    $("#login").click(function() {
        $form = $("#memeber_login_form");

        if ($form.css('display') == "none") {
            $("#login_name").DefaultValue("login");
            $("#login_password").DefaultValue("passsword");
            $form.css('display', "block");
        } else {
            $form.css('display', 'none');
        }
    });
    /* resize margins of background divs and submenu */
    resize_top_margin();
    //resize_sidemenu_margin();
    $("#top_menu_logo").click(function() {
        window.location = "/";
    });

    $("#brand").hover(function() {
        $this = $(this).find("img");
        $this.attr("src", "/plone/++resource++ye.theme/img/brand_over.png");

    }, function() {
        $this = $(this).find("img");
        $this.attr("src", "/plone/++resource++ye.theme/img/brand.png");
    });
    $("#login").hover(function() {
        $this = $(this).find("img");

        $this.attr("src", "/plone/++resource++ye.theme/img/member_over.png");
    }, function() {
        $this = $(this).find("img");
        $this.attr("src", "/plone/++resource++ye.theme/img/member.png");
    });

    $('.hover_basics').hover(function() {
        $this = $(this);
        $this.attr("src", $this.attr('over'));
    }, function() {
        $this = $(this);
        $this.attr("src", $this.attr('out'));
    });

});


