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