var ENTEGA = {
	init: function() {
//alert("ENTEGA.init");
        History.init(); // Fallback für Back Button und Bookmarking in der Ajax Seite
		Thickbox.initLinks();
//		Scrollbars.initBody();
		ENTEGA.initRollo(1);
		ENTEGA.initRollo(2);
		ENTEGA.initRollo(3);
		ENTEGA.initRollo(4);
		Content.initSearch();
	},

	initRollo: function(rolloId) {
//alert("ENTEGA.initRollo("+rolloId+")");
		Rollos.removeLastMargin(rolloId);
		Dialog.init(rolloId);
		ENTEGA.initHomepage(rolloId);
		Thickbox.initInRollo(rolloId);
		ImageSliders.init(rolloId);
		Reiter.init(rolloId);
		Datepicker.init(rolloId);
      	TableSorter.init(rolloId);
//	//	sIFRButton.init(rolloId);
//	//	sIFRText.init(rolloId);
		Form.init(rolloId);
		Faqs.init(rolloId);
		Tooltip.init(rolloId);
		ENTEGA.removeLinkBorder(rolloId);
		Shop.init();
		Content.createPrintHeadlines(rolloId);
	},
	
	initHomepage: function(rolloId) {
		if ($(".rollo"+rolloId+" .home").size()) {
			$(".rollo"+rolloId).unbind("click");
			$(".rollo"+rolloId).click(function() {
                // Für das Januar Special einen speziellen Link nutzen und ein neues Fenster öffnen! tpo
                if (rolloId == 2) {
                    $(this).find("#denkanstoesseLink").click();
                    var url = "http://www.entega.de/denkanstoesse";	
                    window.open(url);
					//fenster = window.open(url, "Denkanstoesse", "width=1024,height=768,status=yes,scrollbars=yes,resizable=yes");
					//fenster.focus();

                } else {
				    $(this).find(".rollo-headline a").click();
				}
			});
		} else {
			$(".rollo"+rolloId).unbind("click");
		}
		Content.initUsertypeSwitchHomepage();
	},
	
	removeLinkBorder: function(rolloId) {
        $(".rollo"+rolloId+" a,.rollo"+rolloId+" input.form-submit-button").focus(function() {
            $(this).blur();
        });
    }
	
};

$(document).ready(function() {
	ENTEGA.init();
	if ($.browser.msie && $.browser.version<7) {
        $('#logo').click(function() {window.location.href='/de/home'});
        $('#logo').css('cursor','pointer');
    }
});
