var root = '/';

;(function(){
var $$;
$$ = jQuery.fn.flash = function(htmlOptions, pluginOptions, replace, update) {
    var block = replace || $$.replace;
    pluginOptions = $$.copy($$.pluginOptions, pluginOptions);
    if(!$$.hasFlash(pluginOptions.version)) {
        if(pluginOptions.expressInstall && $$.hasFlash(6,0,65)) {
            var expressInstallOptions = {
                flashvars: {    
                    MMredirectURL: location,
                    MMplayerType: 'PlugIn',
                    MMdoctitle: jQuery('title').text() 
                }                   
            };
        } else if (pluginOptions.update) {
            block = update || $$.update;
        } else {
            return this;
        }
    }
    htmlOptions = $$.copy($$.htmlOptions, expressInstallOptions, htmlOptions);
    
    // Invoke $block (with a copy of the merged html options) for each element.
    return this.each(function(){
        block.call(this, $$.copy(htmlOptions));
    });
    
};

$$.copy = function() {
    var options = {}, flashvars = {};
    for(var i = 0; i < arguments.length; i++) {
        var arg = arguments[i];
        if(arg == undefined) continue;
        jQuery.extend(options, arg);
        // don't clobber one flash vars object with another
        // merge them instead
        if(arg.flashvars == undefined) continue;
        jQuery.extend(flashvars, arg.flashvars);
    }
    options.flashvars = flashvars;
    return options;
};

$$.hasFlash = function() {
    // look for a flag in the query string to bypass flash detection
    if(/hasFlash\=true/.test(location)) return true;
    if(/hasFlash\=false/.test(location)) return false;
    var pv = $$.hasFlash.playerVersion().match(/\d+/g);
    var rv = String([arguments[0], arguments[1], arguments[2]]).match(/\d+/g) || String($$.pluginOptions.version).match(/\d+/g);
    for(var i = 0; i < 3; i++) {
        pv[i] = parseInt(pv[i] || 0);
        rv[i] = parseInt(rv[i] || 0);
        if(pv[i] < rv[i]) return false;
        if(pv[i] > rv[i]) return true;
    }
    return true;
};

$$.hasFlash.playerVersion = function() {
    // ie
    try {
        try {
            var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
            try { axo.AllowScriptAccess = 'always'; } 
            catch(e) { return '6,0,0'; }                
        } catch(e) {}
        return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
    } catch(e) {
        try {
            if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
                return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
            }
        } catch(e) {}       
    }
    return '0,0,0';
};
$$.htmlOptions = {
    wmode: 'transparent',
    //id: 'flashmovie',
    height: 240,
    flashvars: {},
    pluginspage: 'http://www.adobe.com/go/getflashplayer',
    src: '#',
    type: 'application/x-shockwave-flash',
    width: 320      
};
$$.pluginOptions = {
    expressInstall: false,
    update: true,
    version: '6.0.65'
};
$$.replace = function(htmlOptions) {
    this.innerHTML = '<div class="alt">'+this.innerHTML+'</div>';
    jQuery(this)
        .addClass('flash-replaced')
        .prepend($$.transform(htmlOptions));
};
$$.update = function(htmlOptions) {
    var url = String(location).split('?');
    url.splice(1,0,'?hasFlash=true&');
    url = url.join('');
    var msg = '<p>This content requires the Flash Player. <a href="http://www.adobe.com/go/getflashplayer">Download Flash Player</a>. Already have Flash Player? <a href="'+url+'">Click here.</a></p>';
    this.innerHTML = '<span class="alt">'+this.innerHTML+'</span>';
    jQuery(this)
        .addClass('flash-update')
        .prepend(msg);
};
function toAttributeString() {
    var s = '';
    for(var key in this)
        if(typeof this[key] != 'function')
            s += key+'="'+this[key]+'" ';
    return s;       
};
function toFlashvarsString() {
    var s = '';
    for(var key in this)
        if(typeof this[key] != 'function')
            s += key+'='+encodeURIComponent(this[key])+'&';
    return s.replace(/&$/, '');     
};
$$.transform = function(htmlOptions) {
    htmlOptions.toString = toAttributeString;
    if(htmlOptions.flashvars) htmlOptions.flashvars.toString = toFlashvarsString;
    return '<object><param name="wmode" value="opaque"/><param name="menu" value="false"/><embed ' + String(htmlOptions) + '/></object>';        
};
if (window.attachEvent) {
    window.attachEvent("onbeforeunload", function(){
        __flash_unloadHandler = function() {};
        __flash_savedUnloadHandler = function() {};
    });
}
    
})();

(function($) {
    $.fn.syncHeight = function(settings) {
        var max = 0;
        var browser_id = 0;
        var property = [
           ['min-height','0px'],
            ['height','1000']
        ];
        if($.browser.msie && $.browser.version < 7){
            browser_id = 1;
        }
        $(this).each(function() {
            $(this).css(property[browser_id][0],property[browser_id][1]);
            var val=$(this).height();
            if(val > max){
               max = val;
            }
        });
        $(this).each(function() {
            $(this).css(property[browser_id][0],max+'px');
        });
        return this;
    };  
})(jQuery);

function loadBg(page) {
    if($("#wrapper")) {
        var swfurl;
        var dark = "#050100";
        var light = "#FFFFFF"
        if (page == 'Home') {
            swfurl = root + "swf/bg2.swf";
            swfcolor = dark;
        }
        else if (page == 'Home_idee') {
            swfurl = root + "swf/bg2.swf";
            swfcolor = dark;
        }
        else if (page == 'Home_history') {
            swfurl = root + "swf/bg2.swf";
            swfcolor = dark;
        }
        else if (page == 'Aufnahme') {
            swfurl = root + "swf/bg3.swf";
            swfcolor = dark;
        }
        else if (page == 'Partner') {
            swfurl = root + "swf/bg1.swf";
            swfcolor = dark;
        }
        else if (page == 'Members') {
            swfurl = root + "swf/bg3.swf";
            swfcolor = dark;
        }
        else if (page == 'Presse') {
            swfurl = root + "swf/bg4.swf";
            swfcolor = dark;
        }
        else {
            swfurl = root + "swf/bg2.swf";
            swfcolor = dark;
        }
        $("#wrapper").flash({
            src: swfurl,
            width:  "100%",
            height: "100%",
            wmode:  "opaque",
            zIndex: "1",
            menu: "false",
            bgcolor: swfcolor
        });
    };
    swfheight = jQuery(window).height();
    // swfwidth = jQuery(window).width();
    $('#wrapper').css("height", swfheight + "px");
    /* $('#inner_wrapper').css("height", swfheight + "px"); */
    // $('#wrapper').css("width", swfwidth + "px");
    $(window).resize(function(){
        swfheight = jQuery(window).height();
        $('#wrapper').css("height", swfheight + "px");
        $('#inner_wrapper').css("height", swfheight + "px");
    });
}

function dotcoreMiniGallery(){
    $("#kol1").click(function(){
        $("#kollektionnav ul li a").removeClass("active");
        $(this).addClass("active");
        $("#HCF2008").hide();
        $("#HCF2009").hide();
        $("#HCF2010").hide();
        $("#HCF20102").show();
        $("#large img").hide().attr({"src": root + "img/kollektion20102/1.jpg"});
        return false;
    });
    $("#kol2").click(function(){
           $("#kollektionnav ul li a").removeClass("active");
           $(this).addClass("active");
           $("#HCF20102").hide();
           $("#HCF2009").hide();
           $("#HCF2008").hide();
           $("#HCF2010").show();
           $("#large img").hide().attr({"src": root + "img/kollektion2010/1.jpg"});
           return false;
       });
       $("#kol3").click(function(){
              $("#kollektionnav ul li a").removeClass("active");
              $(this).addClass("active");
              $("#HCF2010").hide();
              $("#HCF20102").hide();
              $("#HCF2008").hide();
              $("#HCF2009").show();
              $("#large img").hide().attr({"src": root + "img/kollektion2009/1.jpg"});
              return false;
          });
          $("#kol4").click(function(){
                    $("#kollektionnav ul li a").removeClass("active");
                    $(this).addClass("active");
                    $("#HCF2010").hide();
                    $("#HCF20102").hide();
                    $("#HCF2009").hide();
                    $("#HCF2008").show();
                    $("#large img").hide().attr({"src": root + "img/kollektion2008/1.jpg"});
                    return false;
                });
    $("#thumbnail1 li a").click(function(){
            $("img.sel").removeClass("sel");
            $("> img", this).addClass("sel");
    		$("#large img").hide().attr({"src": $(this).attr("href"), "title": $("> img", this).attr("title")});
    		$("#large h2").html($("> img", this).attr("title"));
    		return false;
    	});
    	$("#thumbnail2 li a").click(function(){
                $("img.sel").removeClass("sel");
                $("> img", this).addClass("sel");
        		$("#large img").hide().attr({"src": $(this).attr("href"), "title": $("> img", this).attr("title")});
        		$("#large h2").html($("> img", this).attr("title"));
        		return false;
        	});
        	$("#thumbnail3 li a").click(function(){
                    $("img.sel").removeClass("sel");
                    $("> img", this).addClass("sel");
            		$("#large img").hide().attr({"src": $(this).attr("href"), "title": $("> img", this).attr("title")});
            		$("#large h2").html($("> img", this).attr("title"));
            		return false;
            	});
            	$("#thumbnail4 li a").click(function(){
                        $("img.sel").removeClass("sel");
                        $("> img", this).addClass("sel");
                		$("#large img").hide().attr({"src": $(this).attr("href"), "title": $("> img", this).attr("title")});
                		$("#large h2").html($("> img", this).attr("title"));
                		return false;
                	});
    $("#large>img").load(function(){$("#large>img:hidden").fadeIn("slow")});
}