if (typeof(Linderoth) == "undefined") Linderoth = {};
Linderoth.CommonScripts = Linderoth.CommonScripts || {
    toggle: false,
    link: null,
    initialize: function() {
        var _me = this;
        $(document).ready(function() {
            $('#contactSlides').cycle({
                fx:                 'scrollDown', 
                delay:              0,
                speed:              300,
	            timeout:            0,
                pager:              '#toolBar',
                pagerAnchorBuilder: _me.linkBuilder,
                containerResize:    0
            });
            $(".toolbarLink").each(function(i) {
                $(this).bind("click", function() {
                    if (!_me.toggle) {
                        _me.open();
                    } else {
                        if (_me.link == this) {
                            _me.close();
                        }
                    }
                    _me.link = this;
                });
            });
            $("#contactTop img").bind("click", function() {
                _me.close();
            });
        });
    },
    open: function() {
        var _me = this;
	$("#contactContainer").css("display","block");
        $("#contactContainer").stop().animate({
            marginTop: "0px"
        }, 250);
        _me.toggle = true;
    },
    close: function() {
        var _me = this;
        $("#contactContainer").stop().animate({
            marginTop: (-1 * $("#contactContainer").height()) + "px"
        }, 250);
        _me.toggle = false;
    },
    linkBuilder: function(index, DOMelement) {
        return $('#toolbarLink_' + index);
    }
};
Linderoth.CommonScripts.initialize();
