function STRDetect(){ if(!detectFlash(6) || !document.getElementsByTagName || !document.getElementById || !document.createElement) return(false); if(Array.prototype.push == null){Array.prototype.push = function(){ this[this.length] = arguments[0]; return(this.length);}} return(true); } function SwishReplace(selector,flashsource,w,h,bk){ var hx=getElementsBySelector(selector); for(var i=0;i<hx.length;i++){ el=hx[i]; var text=el.firstChild.nodeValue; var span=document.createElement("span"); span.appendChild(document.createTextNode(text)); span.className="strText"; el.removeChild(el.childNodes[0]); el.appendChild(span); var fr=document.createElement("span"); fr.className="strFlash"; var htmlcode=""; if(window.ActiveXObject && navigator.userAgent.indexOf('Mac')==-1){ //Internet Explorer PC htmlcode='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + w + '" height="' + h + '">'; htmlcode+='<param name="movie" value="' + flashsource + '">'; htmlcode+='<param name="bgcolor" value="' + bk + '">'; htmlcode+='<param name="flashVars" value="txt=' + text + '">'; htmlcode+='</object>'; } else{ htmlcode='<embed type="application/x-shockwave-flash" src="' + flashsource + '" width="' + w + '" height="' + h + '"' + ' bgcolor="' + bk + '" flashVars="txt=' + text + '"'+'></embed>'; } fr.innerHTML=htmlcode; el.appendChild(fr); } } function detectFlash(ver){ var flashversion=0; if(navigator.plugins && navigator.plugins.length){ var x=navigator.plugins["Shockwave Flash"]; if(x && x.description) { var y=x.description; flashversion=y.charAt(y.indexOf('.')-1); } } else{ for(var i=15; i>=3 && flashversion==0;i--){ execScript('on error resume next: result = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))','VBScript'); flashversion=i; } } return(flashversion>=ver); } function getElementsBySelector(selector){ var i; var s=[]; var selid=""; var selclass=""; var tag=selector; var objlist=[]; if(selector.indexOf(" ")>0){ //selettore discendente accetta "tag#id tag" s=selector.split(" "); var fs=s[0].split("#"); if(fs.length==1) return(objlist); return(document.getElementById(fs[1]).getElementsByTagName(s[1])); } if(selector.indexOf("#")>0){ //selettore di id accetta "tag#id" s=selector.split("#"); tag=s[0]; selid=s[1]; } if(selid!=""){ objlist.push(document.getElementById(selid)); return(objlist); } if(selector.indexOf(".")>0){ //selettore di classe accetta "tag.classe" s=selector.split("."); tag=s[0]; selclass=s[1]; } var v=document.getElementsByTagName(tag); //selettore di tag accetta "tag" if(selclass=="") return(v); for(i=0;i<v.length;i++){ if(v[i].className==selclass){ objlist.push(v[i]); } } return(objlist); }