function Site(options) {
    //Pagename
    this.pageName = null;
    this.language = null;
    
    //Dom
    this.navigationEl = null;
    this.contentEl = null;
    this.additionalContentEl = null;
    this.footerEl = null;
    this.languageContainerEl = null;
    this.imageEl = null;
    this.imageContainerEl = null;
    
    //Json Data
    this.title = null;
    this.image = null;
    this.template = null;
    this.addTemplate = null;
    this.navigation = {};
    this.content = {};
    
    this.defaults = {
        navigationId: "navigation",
        contentId: "textContent", 
        additionalContentId: "additionalContent", 
        footerId: "footer",
        languageContainerId: "header",
        imageId: "image", 
        imageContainerId: "imageContent", 
        readyFunction: 'readyTemplate',
        startPage: 'home',
        language: 'de',
        animation: {
            duration: 1000,
            timeoutImage: 300
        },
        path: {
            image: "img/",
            json: "json/",
            template: "templates/",
            addTemplate: "templates/adds/"
        },
        error: {
            divId: 'error',
            messages: {
                de: {
                    system: 'Es ist ein Fehler aufgetreten, bitte versuchen Sie es später erneut',
                    title: 'Bitte wählen Sie eine Anrede aus',
                    surname: 'Bitte geben Sie Ihren Vornamen ein',
                    name: 'Bitte geben Sie Ihren Nachnamen ein',
                    email: 'Bitte geben Sie Ihrer E-Mail Adresse ein'
                },
                en: {
                    system: 'Es ist ein Fehler aufgetreten, bitte versuchen Sie es später erneut(english)',
                    title: 'Bitte wählen Sie eine Anrede aus(english)',
                    surname: 'Bitte geben Sie Ihren Vornamen ein(english)',
                    name: 'Bitte geben Sie Ihren Nachnamen ein(english)',
                    email: 'Bitte geben Sie Ihrer E-Mail Adresse ein(english)'
                }
            }
        },
        success: {
            divId: 'success',
            messages: {
                de: {
                    sendMail: 'Ihre Nachricht wurde erfolgreich an uns versendet'
                },
                en: {
                    sendMail: 'Ihre Nachricht wurde erfolgreich an uns versendet(english)'
                }
            }
        },
        navigationItems: {
            de: {
                home: "home",
                collection: "kollektion",
                shop: "shop",
                storefinder: "storefinder",
                team: "team",
                herstellung: "herstellung",
                freunde: "freunde",
                tipps: "tipps",
                kontakt: "kontakt",
                faqs: "FAQs",
                agbs: "AGBs",
                impressum: "Impressum"
            },
            en: {
                home: "home",
                collection: "collection",
                shop: "shop",
                storefinder: "store finder",
                team: "team",
                herstellung: "manufacturing",
                freunde: "friends",
                tipps: "tips",
                kontakt: "contact",
                faqs: "FAQs",
                agbs: "Terms & conditions",
                impressum: "Legal notice"
            }
        }
    };
    
    //Instanzkonstruktor
    this.Site = function(options) {
    
        this.options = $.extend({}, this.defaults, options);
        
        this.navigationEl = $("#" + this.options.navigationId);
        this.contentEl = $("#" + this.options.contentId);
        this.additionalContentEl = $("#" + this.options.additionalContentId);
        this.footerEl = $("#" + this.options.footerId);
        this.languageContainerEl = $("#" + this.options.languageContainerId);
        this.imageEl = $("#" + this.options.imageId);
        this.imageContentEl = $("#" + this.options.imageContentId);

        this.language = this.options.language;
        
        var self = this;
        
        //Füge onclick Funktionalität der Navigation hinzu
        this.navigationEl.find('a').click(function() {
            if ($(this).attr('rel'))
                self.show($(this).attr('rel'));
        });
        //Füge onclick Funktionalität dem Footer hinzu
        this.footerEl.find('a').click(function() {
            if ($(this).attr('rel'))
                self.show($(this).attr('rel'));
        });
        //Füge onclick Funktionalität dem LangugeChooser hinzu
        this.languageContainerEl.find('a').click(function() {
            if ($(this).attr('rel'))
                self.changeLanguage($(this).attr('rel'));
        });
        //Mouseover der Navigation hinzufügen
        this.navigationEl.find('a').hover(
            function() {
                if(self.pageName != $(this).attr('rel')){
                    var tmp = $(this).css("color");
                    $(this).css("color", $(this).css("background-color"));
                    $(this).css("background-color", tmp);
                }
            },
            function() {
                if(self.pageName != $(this).attr('rel')){
                    var tmp = $(this).css("color");
                    $(this).css("color", $(this).css("background-color"));
                    $(this).css("background-color", tmp);
                }
            }
        );
        
        var requestPage = window.location.href.split("#").pop();
        if(!this.options.navigationItems.de[requestPage])
            requestPage = this.options.startPage;
        
        // Initialize history plugin.
		// The callback is called at once by present location.hash. 
		$.historyInit(pageload, requestPage);
        this.load(requestPage, "none");
    }
    this.show = function(pageName, animationType){       
        $.historyLoad(pageName);
    }
    this.load = function(pageName, animationType){
        if(pageName == "home")
            pageName += Math.ceil(Math.random() * 5) ;
        
        this.pageName = pageName;
        
        this.getData();
        this.animate(animationType);        
    }
    this.getData = function() {
        var dataJSON = null;
        var self = this;
        $.ajax({
            type: "GET",
            cache: true,
            dataType: "json",
            async: false,
            url: this.options.path.json + this.pageName + ".json",
            success: function(data) {
                self.setData(data);
            },
            error: function(XMLHttpRequest, textStatus, errorThrown) {
                alert(XMLHttpRequest.status + "\n" + XMLHttpRequest.responseText);
            }
        });
    }
    this.setData = function(dataJSON) {
        this.title = dataJSON.page.title;
        this.image = dataJSON.page.image;
        this.template = dataJSON.page.template[this.language];
        if(dataJSON.page.addTemplate)
            this.addTemplate = dataJSON.page.addTemplate[this.language];
        else
            this.addTemplate = null;
        this.navigation = {
            top: dataJSON.page.navigation.top,
            left: dataJSON.page.navigation.left,
            backgroundColor: dataJSON.page.navigation.backgroundColor,
            fontColor: dataJSON.page.navigation.fontColor
        };
        this.content = {
            top: dataJSON.page.content.top,
            left: dataJSON.page.content.left
        };
        if(dataJSON.page.content.divClass && dataJSON.page.content.divClass != "")
            this.content.divClass = dataJSON.page.content.divClass;
        $(document).attr('title', this.title);
    }
    this.animate = function(animationType) {
        this.animateContent(this.contentEl, this.options.path.template + this.template, this.content, animationType);
        this.animateContent(this.additionalContentEl, this.options.path.addTemplate + this.addTemplate, null, animationType);
        this.animateImage(this.imageEl, this.image, animationType);
        this.animateNavigation(this.navigationEl, this.navigation, animationType);
    }
    this.animateContent = function(el, template, data, animationType) {
        var self = this;
                    
        if (animationType == "none") {
            if (template.substr(template.length - 5) != ".html")
                el.empty();
            else{
                el.load(template, null, function() { //Content laden und einfügen
                    eval(self.options.readyFunction + "(self)");
                });
                if (data != null) {
                        el.css("top", data.top);
                        el.css("left", data.left);
                        el.removeClass();
                        el.addClass(self.pageName);
                        if(data.divClass)
                            el.addClass(data.divClass);
                }
            }
        }
        else {
            el.slideUp(self.options.animation.duration, function() {
                if (template.substr(template.length - 5) != ".html")
                    el.empty();
                else {
                    el.load(template, null, function() { //Content laden und einfügen
                        eval(self.options.readyFunction + "(self)");
                    });
                    if (data != null) {
                        el.css("top", data.top);
                        el.css("left", data.left);
                        el.removeClass();
                        el.addClass(self.pageName);
                        if(data.divClass)
                            el.addClass(data.divClass);
                    }
                    el.slideDown(self.options.animation.duration);
                }
            });
        }
    }
    this.animateNavigation = function(el, data, animationType){
        if(animationType == "none"){
                el.css("top", data.top);
                el.css("left", data.left);
                
                this.navigationEl.find('a').css("background-color", data.backgroundColor);
                this.navigationEl.find('a').css("color", data.fontColor);
                
                this.navigationEl.find('*[rel="' + this.pageName + '"]').css("color", data.backgroundColor);
                this.navigationEl.find('*[rel="' + this.pageName + '"]').css("background-color", data.fontColor);
                
                $.each(this.footerEl.find('a'), function(){
                    $(this).removeClass('active');
                });
                this.footerEl.find('*[rel="' + this.pageName + '"]').addClass('active');
        }
        else{
            var self = this;
            
            el.slideUp(self.options.animation.duration, function(){
                el.css("top", data.top);
                el.css("left", data.left);
                
                self.navigationEl.find('a').css("background-color", data.backgroundColor);
                self.navigationEl.find('a').css("color", data.fontColor);
                
                self.navigationEl.find('*[rel="' + self.pageName + '"]').css("color", data.backgroundColor);
                self.navigationEl.find('*[rel="' + self.pageName + '"]').css("background-color", data.fontColor);
                
                $.each(self.footerEl.find('a'), function(){
                    $(this).removeClass('active');
                });
                self.footerEl.find('*[rel="' + self.pageName + '"]').addClass('active');
                
                el.slideDown(self.options.animation.duration);
            });
        }
    }
    this.animateImage = function(image, imageSrc, animationType){
        
        if(animationType == "none"){
            image.attr('src', this.options.path.image + imageSrc);
        }
        else{
            var self = this;
            
            image.animate({
                opacity: 0
            }, self.options.animation.duration, "", function(){
                self.imageContentEl.append(image);
                    image.attr('src', self.options.path.image + imageSrc);
                    image.cacheImage({load: function(){
                        setTimeout(function(){
                            image.animate({
                                opacity: 1
                            }, self.options.animation.duration);
                        }, self.options.animation.timeoutImage);
                    }});
			});
            return true;
        }
    }
    this.changeLanguage = function(language){
        this.languageContainerEl.find('*[rel="' + this.language + '"]').removeClass('active'); //active Klasse bei alter Sprache entfernen
        this.languageContainerEl.find('*[rel="' + language + '"]').addClass('active');
        
        this.language = language;
        this.options.language = language;
        
        var self = this;
        
        setTimeout(function(){
            $.each(self.options.navigationItems[language], function(key, val){
                $('*[rel="' + key + '"]').html(val);
            });
        }, self.options.animation.duration);
        
        this.load(this.pageName);
    }
    //Aufruf Instanzkonstruktor
    this.Site(options);
}