jQuery.noConflict();

jQuery(document).ready(function(){

    var headerFlash = loadFlash(
           /*Flash-file*/   "http://www.maxim-sportnahrung.at/themes/maxim/media/1033_229.swf",
           /*BgColor*/  "",
           /*Wmode*/    "transparent",
           /*Width*/    800,
           /*Height*/   154,
           /*Alt-Url*/  "http://www.adobe.com/go/getflashplayer",
           /*Alt-File*/     "",
           /*Title*/    "Maxim Performance"
           );


    jQuery('#HeaderMedia').html(headerFlash);

    animHeaderStreifen();


});

    function animHeaderStreifen() {
        var e = jQuery('#streifen');

        var pos = e.css('background-position');
        if (!pos) pos =  e.css('background-position-x');
        pos = parseInt(pos);
        if (pos < -1600) pos += 1600;
        pos -= 20;
        e.css('background-position', pos + 'px 0px');
        setTimeout('animHeaderStreifen()',40);
    }


// Returns major flash version
    function FlashVersion(){
        var iMaxFlashVersion = 20;
        var iFlashVersion = 0;
        if (navigator.plugins && navigator.plugins.length) {
            for (var i = 0; i < navigator.plugins.length; i++) {
                if (navigator.plugins[i].name.indexOf('Shockwave Flash') != -1) {
                    iFlashVersion = parseInt(navigator.plugins[i].description.split('Shockwave Flash ')[1], 10);
                    break;
                }
            }
        } else if (window.ActiveXObject) {
            for (var i = 2; i <= iMaxFlashVersion; i++) {
                try {
                    oFlash = eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash." + i + "');");
                    if( oFlash ) {
                        iFlashVersion = i;
                    }
                }
                catch(e) {}
            }
        }
        return iFlashVersion;
    }


//INDSÆT FLASH
function loadFlash(sMovieUrl, sBgColor, sWmode, iWidth, iHeight, sAlternativeUrl, sAlternativeImage, sTitle){
        var sReturn = "";
        if(FlashVersion() >= 6){
            sReturn += "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"" + iWidth + "\" height=\"" + iHeight + "\" id=\"flashloader\" align=\"middle\">\n";
            sReturn += "<param name=\"allowScriptAccess\" value=\"sameDomain\" />\n";
            sReturn += "<param name=\"movie\" value=\"" + sMovieUrl + "\" />\n";
            sReturn += "<param name=\"quality\" value=\"high\" />\n";
            sReturn += "<param name=\"bgcolor\" value=\"" + sBgColor + "\" />\n";
            sReturn += "<param name=\"wmode\" value=\"" + sWmode + "\" />\n";
            sReturn += "<embed src=\"" + sMovieUrl + "\" quality=\"high\" bgcolor=\""+ sBgColor +"\" wmode=\""+ sWmode +"\" width=\"" + iWidth + "\" height=\"" + iHeight + "\" name=\"flashloader\" align=\"middle\" allowscriptaccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" />\n";
            sReturn += "</object>\n";
/*            document.write(sReturn);*/
        }
        //Hvis der er valgt en alternativ fil (billede) og/eller url, indsættes de i stedet for flashfilen.
        else {
            if (sAlternativeImage){
                //start på url'en
                if (sAlternativeUrl) sReturn += "\n<a href=\"" + sAlternativeUrl + "\" target=\"_blank\" title=\"" + sTitle + "\">";
                //Billede
                sReturn += "\n\t<img src=\"" + sAlternativeImage + "\" alt=\"" + sTitle + "\" title=\"" + sTitle + "\" />\n";
                //afslut url'en
                if (sAlternativeUrl) sReturn += "</a>\n";
 /*               document.write(sReturn);*/
            }
            //Her viderstilles automatisk til en valgt url (no flash site), hvis der ikke er nogen alternativ fil
            /*else {
                document.location.href = sAlternativeUrl;
            }*/
        }
        return sReturn;
    }

