/**
 * The SWFObject code has been slightly modified.
 * The putSWFMovie function has been added. The same license applies.
 * -----------------------------------------------------------------------------------------
 *
 * SWFObject v1.4.4: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for
 *   legal reasons.
 * 
 */
if(typeof deconcept=="undefined"){
    var deconcept=new Object();
}
if(typeof deconcept.util=="undefined"){
    deconcept.util=new Object();
}
if(typeof deconcept.SWFObjectUtil=="undefined"){
    deconcept.SWFObjectUtil=new Object();
}
deconcept.SWFObject=function(swf,id,w,h,version,bgcolor,useExpressInstall,quality,xiRedirectUrl,redirectUrl,detectKey){
        if(!document.getElementById){
            return;
        }
        this.DETECT_KEY=detectKey?detectKey:"detectflash";
        this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
        this.params=new Object();
        this.variables=new Object();
        this.attributes=new Array();
        if(swf){
            this.setAttribute("swf",swf);
        }
        if(id){
            this.setAttribute("id",id);
        }
        if(w){
            this.setAttribute("width",w);
        }
        if(h){
            this.setAttribute("height",h);
        }
        if(! version){
            version = "8";
        }
        this.setAttribute("version",new deconcept.PlayerVersion(version.toString().split(".")));
        this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();
        if(bgcolor){
            this.addParam("bgcolor",bgcolor);
        }
        var q=quality?quality:"high";
        this.addParam("quality",q);
        this.setAttribute("useExpressInstall",useExpressInstall);
        this.setAttribute("doExpressInstall",false);
        xiRedirectUrl=(xiRedirectUrl)?xiRedirectUrl:window.location;
        this.setAttribute("xiRedirectUrl",xiRedirectUrl);
        this.setAttribute("redirectUrl","");
        if(redirectUrl){
            this.setAttribute("redirectUrl",redirectUrl);
        }
    };
deconcept.SWFObject.prototype={
    setAttribute:function(key,value){
                 this.attributes[key]=value;
                 },
    getAttribute:function(key){
                 return this.attributes[key];
             },
    addParam:function(key,value){
             this.params[key]=value;
         },
    getParams:function(){
              return this.params;
          },
    addVariable:function(key,value){
                this.variables[key]=value;
            },
    getVariable:function(key){
                return this.variables[key];
            },
    getVariables:function(){
                 return this.variables;
             },
    getVariablePairs:function(){
                     var pairs=new Array();
                     var key;
                     var vars=this.getVariables();
                     for(key in vars){
                         pairs.push(key+"="+vars[key]);
                     }
                     return pairs;
                 },
     getSWFHTML:function(){
             var text="";
             if(navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length){
                 if(this.getAttribute("doExpressInstall")){
                     this.addVariable("MMplayerType","PlugIn");
                 }
                 text='<embed type="application/x-shockwave-flash" src="'+this.getAttribute('swf')+'" width="'+this.getAttribute('width')+'" height="'+this.getAttribute('height')+'"';
                 text+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
                 var params=this.getParams();
                 for(var key in params){
                     text+=[key]+"=\""+params[key]+"\" ";
                 }
                 var pairs=this.getVariablePairs().join("&");
                 if(pairs.length>0){
                     text+="flashvars=\""+pairs+"\"";
                 }text+="/>";
             }else{
                 if(this.getAttribute("doExpressInstall")){
                     this.addVariable("MMplayerType","ActiveX");
                 }
                 text="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
                 text+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
                 for(var key in params){
                     text+="<param name=\""+key+"\" value=\""+params[key]+"\" />";
                 }
                 if(pairs.length>0){
                     text+="<param name=\"flashvars\" value=\""+pairs+"\" />";
                 }
                 text+="</object>";
             }
             return text;
         },
     write:function(idOrObject){
                 if(this.getAttribute("useExpressInstall")){
                     var version=new deconcept.PlayerVersion([6,0,65]);
                     if(this.installedVer.versionIsValid(version)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
                         this.setAttribute("doExpressInstall",true);
                         this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
                         document.title=document.title.slice(0,47)+" - Flash Player Installation";
                         this.addVariable("MMdoctitle",document.title);
                     }
                 }
                 if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){

                     var n=(typeof idOrObject=="string")?document.getElementById(idOrObject):idOrObject;
                     if(typeof n=="undefined" || n==null) {
                        document.write("<br>Error, no HTML element "+idOrObject+"<br>");
                     } else {
                         if (typeof n.innerHTML == "undefined"){
                             document.write("<br>Error, no HTML element with innerHTML "+idOrObject+"<br>");
                         } else {
                             n.innerHTML=this.getSWFHTML();
                         }
                     }
                     return true;
                 }else{
                     if(this.getAttribute("redirectUrl")!=""){
                         document.location.replace(this.getAttribute("redirectUrl"));
                     }
                 }
                 return false;
             }
    };
deconcept.SWFObjectUtil.getPlayerVersion=function(){
    var version=new deconcept.PlayerVersion([0,0,0]);
    if(navigator.plugins&&navigator.mimeTypes.length){
        var x=navigator.plugins["Shockwave Flash"];
        if(x&&x.description){
            version=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));
        }
    }else{
        try{
            var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
        }
        catch(e){
            try{
                var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
                version=new deconcept.PlayerVersion([6,0,21]);
                axo.AllowScriptAccess="always";
            }
            catch(e){
                if(version.major==6){
                    return version;
                }
            }try{
                axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
            }
            catch(e){
            }
        }if(axo!=null){
            version=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
        }
    }
    return version;
};
deconcept.PlayerVersion=function(version){
    this.major=version[0]!=null?parseInt(version[0]):0;
    this.minor=version[1]!=null?parseInt(version[1]):0;
    this.rev=version[2]!=null?parseInt(version[2]):0;
};
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
    if(this.major<fv.major){
        return false;
    }
    if(this.major>fv.major){
        return true;
    }
    if(this.minor<fv.minor){
        return false;
    }
    if(this.minor>fv.minor){
        return true;
    }
    if(this.rev<fv.rev){
        return false;
    }return true;
};
deconcept.util={
getRequestParameter:function(key){
                        var q=document.location.search||document.location.hash;
                        if(q){
                            var kvs=q.substring(1).split("&");
                            for(var i=0;i<kvs.length;i++){
                                if(kvs[i].substring(0,kvs[i].indexOf("="))==key){
                                    return kvs[i].substring((kvs[i].indexOf("=")+1));
                                }
                            }
                        }
                        return "";
                    }
};
deconcept.SWFObjectUtil.cleanupSWFs=function(){
    if(window.opera||!document.all){
        return;
    }
    var objElement=document.getElementsByTagName("OBJECT");
    for(var i=0;i<objElement.length;i++){
        objElement[i].style.display="none";
        for(var x in objElement[i]){
            if(typeof objElement[i][x]=="function"){
                objElement[i][x]=function(){};
            }
        }
    }
};
deconcept.SWFObjectUtil.prepUnload=function(){
    __flash_unloadHandler=function(){};
    __flash_savedUnloadHandler=function(){};
    if(typeof window.onunload=="function"){
        var oldOnUnload=window.onunload;
        window.onunload=function(){
            deconcept.SWFObjectUtil.cleanupSWFs();
            oldOnUnload();
        };
    }else{
        window.onunload=deconcept.SWFObjectUtil.cleanupSWFs;
    }
};
if(typeof window.onbeforeunload=="function"){
    var oldBeforeUnload=window.onbeforeunload;
    window.onbeforeunload=function(){
        deconcept.SWFObjectUtil.prepUnload();
        oldBeforeUnload();
    };
}else{
    window.onbeforeunload=deconcept.SWFObjectUtil.prepUnload;
}
if(Array.prototype.push==null){
    Array.prototype.push=function(value){
        this[this.length]=value;
        return this.length;
    };
}
var getQueryParamValue=deconcept.util.getRequestParameter;
var FlashObject=deconcept.SWFObject;
var SWFObject=deconcept.SWFObject;

var nbSWFMovie = 0;
function putSWFMovie(file, image, w, h) {
    nbSWFMovie += 1;
    document.writeln('<div id="film'+nbSWFMovie+'"></div>');
    var so = new SWFObject("http://storage.canalblog.com/46/74/81198/18813782.swf", "player"+nbSWFMovie, w, h);
    //so.addParam("wmode", "transparent");
    so.addVariable("file", file);
    if (image) {
        so.addVariable("image", image);
    }
    so.addVariable("overstretch", "false");
    so.addVariable("showdigits", "true");
    //so.addVariable("callback", "page.php");
    so.addVariable("backcolor", "0x3399BB");
    so.addVariable("frontcolor", "0x001155");
    so.addVariable("lightcolor", "0x99FF00");
    //so.addVariable("volume", "80");
    //so.addVariable("bufferlength", "5");
    if (w) {
        so.addVariable("width", w);
    }
    if (h) {
        so.addVariable("height", h);
    }
    so.write("film"+nbSWFMovie);
}
