/**
 * Flash Tag Object v2.1b - by Lucas Fererira
 * @author Lucas Ferreira - http://lucasferreira.com/
 * @version 2.2b
 * @date October 30, 2008
 * @copyright (c) 2008 Lucas Ferreira (lucasferreira.com)
 * @example Visit http://www.lucasferreira.com/flashtag/ for more informations about this
 */
var FlashTag=function(){var k=null;return{YOUTUBE_URL_PLAYER:"http://www.youtube.com/v/%s",init:function(){k=this.getPlayerVersion();var s=document.getElementsByTagName("SCRIPT");for(var i=0;i<s.length;i++){if(s[i].getAttribute("src")&&s[i].getAttribute("src").indexOf("?correct-all")>-1){FlashTag.automatic()}}return(function(c,d,e,g,h){this.onNotDetect=function(){};this.variables=new Array();this.flashversion=(h&&h.flashversion!=undefined)?h.flashversion:"6,0,21";this.protocol=(window.location.protocol.indexOf("https")<0)?"http":"https";this.attributes={"classid":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000","codebase":this.protocol+"://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab#version="+this.flashversion,"type":"application/x-shockwave-flash","rel":"flashtag"};this.params={"pluginurl":this.protocol+"://www.macromedia.com/go/getflashplayer"};this.addAttribute=function(a,b){this.attributes[a]=b};this.addParameter=function(a,b){this.params[a]=b};this.addVariable=function(a,b){this.variables.push([a,b])};this.getFlashVars=function(){for(var i=0,tempString=new Array();i<this.variables.length;i++)tempString.push(this.variables[i].join("="));return tempString.join("&")};this.getObject=function(){return FlashTag.getObject(this)};this.toString=function(){this.html="";this.params.flashVars=this.getFlashVars();if(FlashTag.isIE()){this.html="<ob"+"ject";var a=FlashTag.getObjectByExceptions(this.attributes,["type","data","variables"]);for(var i in a)if(i.toString()!="extend")this.html+=" "+i.toString()+" = \""+a[i]+"\"";this.html+="> ";var b=FlashTag.getObjectByExceptions(this.params,["pluginurl","extend","version","variables"]);for(var i in b)if(i.toString()!="extend")this.html+="<param name=\""+i.toString()+"\" value=\""+b[i]+"\" /> ";this.html+=" </obj"+"ect>"}else{this.html="<!--[if !IE]> <--> <obj"+"ect";var a=FlashTag.getObjectByExceptions(this.attributes,["classid","codebase","variables"]);for(var i in a)if(i.toString()!="extend")this.html+=" "+i.toString()+" = \""+a[i]+"\"";this.html+="> ";var b=FlashTag.getObjectByExceptions(this.params,["extend","version","variables"]);for(var i in b)if(i.toString()!="extend")this.html+="<param name=\""+i.toString()+"\" value=\""+b[i]+"\" /> ";this.html+=" </obj"+"ect> <!--> <![endif]-->"}return this.html};this.redirectToUrl=function(a){window.location.href=a};this.write=function(o){if(typeof o!="undefined"){return this.writeIn(o)}document.write(this.toString());var f=FlashTag.getPlayerVersion();if(!f||(typeof this.params["version"]!="undefined"&&!FlashTag.isMajor(f,this.params["version"]))){this.onNotDetect(f);if(typeof this.params["redirectUrl"]!="undefined"){this.redirectToUrl(this.params["redirectUrl"])}}return true};this.writeIn=function(o){if(typeof o=="undefined"){return this.write()}else if(typeof o=="string"){o=document.getElementById(o)||null}if(o==undefined||o==null)return false;var f=FlashTag.getPlayerVersion();if(!f||(typeof this.params["version"]!="undefined"&&!FlashTag.isMajor(f,this.params["version"]))){this.onNotDetect(f);if(typeof this.params["redirectUrl"]!="undefined"){this.redirectToUrl(this.params["redirectUrl"])}}else{o.innerHTML=this.toString()}return true};if(c){this.addAttribute("data",c);this.addParameter("movie",c)}if(d&&d!=null&&(this.id=d)){this.addAttribute("id",this.id);this.addAttribute("name",this.id)}else{this.id=null}if(e)this.addAttribute("width",e);if(g)this.addAttribute("height",g);if(h!=undefined){if(typeof h["variables"]!="undefined"){h["flashVars"]=h["variables"];h["variables"]={}}for(var i in h){if(i.toLowerCase()!="flashvars"){this.addParameter(i.toString(),h[i])}else{for(var j in h[i])this.addVariable(j.toString(),h[i][j])}}}})},isIE:function(){return(window.ActiveXObject&&document.all&&navigator.userAgent.toLowerCase().indexOf("msie")>-1&&navigator.userAgent.toLowerCase().indexOf("opera")==-1)?true:false},getObjectByExceptions:function(a,b){var c={};for(var i in a){for(var j=0,EOF=false;j<b.length;j++)if(b[j]==i.toString()){EOF=true;break};if(!EOF)c[i]=a[i]}return c},getObject:function(a){if(a.id==null)return null;try{if(window.document[a.id]){return window.document[a.id]}else{return document.getElementById(a.id)}}catch(e){return null}},createInstanceFromObject:function(o){var a={},params={},src,on;for(var i=0;i<o.attributes.length;i++){var b=(o.attributes[i].nodeName||i.toString()).toLowerCase(),attrv=o.getAttribute(b);if(b!="contenteditable"&&b!="style"&&attrv!=""&&attrv!=null&&attrv!="null"){try{a[b]=attrv}catch(ex){null}}if(b=="style"&&attrv!=""&&attrv!=null&&attrv!="null"&&o.outerHTML){try{attrv=o.outerHTML.replace(/\s=/g,"=").replace(/=\s/g,"=").match(/style=[\"\'](.+)[\"\']/);if(attrv.length>1)a[b.toString()]=attrv[1]}catch(ex){null}}}for(var i=0;i<o.childNodes.length;i++){if((on=o.childNodes[i]).nodeType&&on.nodeType==1&&on.nodeName&&on.nodeName.toLowerCase()=="param"){try{params[on.getAttribute("name")]=on.getAttribute("value")}catch(ex){null}}}if((src=(a["src"]||a["data"]||a["movie"]||params["movie"]||null))!=null){var c=new Flash(src,(a["id"]||null),(a["width"]||"100%"),(a["height"]||"100%"));for(var i in a)c.addAttribute(i.toString(),a[i]);for(var i in params)c.addParameter(i.toString(),params[i]);return c}return false},correctAll:function(){var o=document.getElementsByTagName("OBJECT"),e=document.getElementsByTagName("EMBED"),objects=[];for(var i=0;i<e.length;i++){if(!e[i].getAttribute("rel")||e[i].getAttribute("rel")!="flashtag")objects.push(e[i])}for(var i=0;i<o.length;i++){if(!o[i].getAttribute("rel")||o[i].getAttribute("rel")!="flashtag")objects.push(o[i])}for(var i=0;i<objects.length;i++){if(objects[i].outerHTML){try{var a=FlashTag.createInstanceFromObject(objects[i]);if(!a)continue;objects[i].style.visibility="hidden";objects[i].outerHTML=a.toString();objects[i].style.visibility="visible"}catch(ex){null}}}},automatic:function(){if(!FlashTag.isIE()||!document.getElementsByTagName)return false;if(window.attachEvent){window.attachEvent("onload",FlashTag.correctAll)}},isMajor:function(a,b){for(var i=0,a=a.replace(/[,]/g,".").split(".");i<a.length;(a[i]=parseInt(a[i])),i++);for(var i=0,b=b.replace(/[,]/g,".").split(".");i<b.length;(b[i]=parseInt(b[i])),i++);if(a.length>0&&b.length>0){for(var i=-1,l=Math.min(a.length,b.length);++i<l&&b[i]==a[i];);return+(i!=l&&b[i]-a[i])>0?false:true}return false},getPlayerVersion:function(){if(k==null){if(!this.isIE()&&navigator.plugins&&navigator.mimeTypes.length&&(f=navigator.plugins["Shockwave Flash"])&&f.description){return(f.description.replace(/[^0-9r.]/g,"").replace(/[r]/g,"."))}else{var a=null;try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(e){var v=8;do{try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+v);try{a.AllowScriptAccess="always"}catch(eex){}}catch(ee){a=null}}while(v--&&v>2&&a==null)}return(a!=null&&a)?a.GetVariable("$version").replace(/[^0-9,]/g,"").replace(/[,]/g,"."):false}}else{return k}}}}();var Flash=FlashTag.init();Flash.YouTube=function(a,b,c,d,e){if(!a)return false;movie=a.match(/\?([v=]?[^\&?]+)/);if(movie.length>1){movie=movie[1].replace(/v=/gi,"");movie=FlashTag.YOUTUBE_URL_PLAYER.split("%s").join(movie);return(new Flash(movie,b,c,d,e))}return false};if(typeof jQuery=="undefined"){alert("jQuery lib is needed for this script.")}else{(function($){$.fn.flash=function(a,b,c,d,f,g){if(typeof a=="object"){if(typeof a["src"]=="undefined"&&typeof a["url"]=="undefined"){return false}if(typeof a["id"]=="undefined")a["id"]=null;if(typeof a["width"]=="undefined")a["width"]="100%";if(typeof a["height"]=="undefined")a["height"]="100%";var f={},_excep=["src","url","id","width","height"];for(var i in a){var h=false;for(var e in _excep){if(_excep[e]==i){h=true;break}}if(!h){f[i]=a[i]}}var d=a["height"];var c=a["width"];var b=a["id"];var a=(a["src"]||a["url"])}var j=((!g)?new Flash(a,b,c,d,f):new Flash.YouTube(a,b,c,d,f));if(f&&f["variables"]){for(var i in f["variables"]){j.addVariable(i.toString(),f["variables"][i])}}if(this.length>0){this.each(function(){j.writeIn(this)})}return this};$.fn.youtube=function(a,b,c,d,e){return this.flash(a,b,c,d,e,true)}})(jQuery)}
