function initTag(div) {
	 
	 var printTag = "100%";
	 if (document.styleSheets) { 
	  
	  for (var i=0; i< document.styleSheets.length; i++) { // For each stylesheet
			var styleSheet=document.styleSheets[i];          // Get the current Stylesheet
         var ii=0;                                        // Initialize subCounter.
         var cssRule=false;                               // Initialize cssRule. 
         do {                                             // For each rule in stylesheet
            if (styleSheet.cssRules) {                    // Browser uses cssRules?
               cssRule = styleSheet.cssRules[ii];         // Yes --Mozilla Style
            } else {                                      // Browser usses rules?
               cssRule = styleSheet.rules[ii];            // Yes IE style. 
            }                                             // End IE check.
            
			
				if (cssRule)  {                               // If we found a rule...
             //alert(cssRule.selectorText.toLowerCase() + " " + div.toLowerCase());
				 if (cssRule.selectorText.toLowerCase()== "#" + div.toLowerCase()) { //  match ruleName?*/*/                  
						
						widthStyle = cssRule.style.width;
						if (widthStyle == "") {
							printTag="640"
						} else {
							printTag = widthStyle;
							printTag = widthStyle.replace(/"px"/g,"");
							if (printTag > 640) {
								printTag = 500
							}
						}
					}                                         
            }                                            
            ii++;                                         
         } while (cssRule)  
	  	}
	 } 
	 
	 return printTag;
	 
}

function replaceTag(tagR , cssDiv ,versioneR , linguaR , x , y ) {
	
	if (document.getElementById(cssDiv) != null) {
	
	var numeroTag = 0;
	var tagDaCambiare = document.getElementsByTagName(tagR);
	var ww = initTag(cssDiv);
	
	var numeroTag = document.getElementsByTagName(tagR).length;
	
	for(t=0;t<numeroTag;t++) {
		tagDaCambiare[t].setAttribute("id" , tagR +"-" + t);
	}
	
	for(t=0;t<numeroTag;t++) {

		var testoDaScrivere = document.getElementById(tagR +"-" + t).innerHTML;
		
		variabili = "";
		variabili += "testo=" + escape(testoDaScrivere) + "&";
		variabili += "style=" + tagR + "&";
		variabili += "xx=" + x + "&";
		variabili += "yy=" + y + "";
		
		altezza = 30;

		insFlash(tagR+"-" + t,true,"/flash/sifrExtera.swf",variabili,ww,altezza,"",true,"left",linguaR,"false",tagR +"-" + t + "-flash")
	
	}
	
	}
	
}


function insFlash(tag,versione,file,variabili,larghezza,altezza,colore,trasparente,allineamento,lingua,connect,id) {

if (trasparente == true ) { trasparente = "transparent" } else { trasparente = "" }
	if (tag == "") {
				
				if (versione != false) {
						var stringa = versione	
				} else {
						var stringa = true
				}
					
		if (stringa == true )  {
			
					stringa = ""
					stringa += "  <object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\""+larghezza+"\" height=\""+altezza+"\" id=\""+id+"\" align=\"" + allineamento + "\">"
					stringa += "          <param name=\"allowScriptAccess\" value=\"sameDomain\" />"
					stringa += "          <param name=\"movie\" value=\""+file+"\" />"
					stringa += "          <param name=\"quality\" value=\"high\" />"
					stringa += "          <param name=\"bgcolor\" value=\"#"+colore+"\" />"
					stringa += "          <param name=\"flashvars\" value=\""+variabili+"\" />"
					stringa += "          <param name=\"wmode\" value=\""+trasparente+"\" />"
					stringa += "          <embed src=\""+file+"\" quality=\"high\" flashvars=\""+ variabili+ "\" wmode=\""+trasparente+"\"bgcolor=\"#"+colore+"\" width=\""+larghezza+"\" height=\""+altezza+"\" name=\""+file+"\" align=\"" + allineamento + "\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />"
					stringa += "  </object>"
					
					document.writeln(stringa);
					
		}
		
	} else {
	
		
	if (document.getElementById(tag) != null  ) {
				
				
					if (versione != false) {
						var stringa = versione	
					} else {
						var stringa = true
					}
					
				if (stringa == true )  {
				
				detectValueSifr = true // detect ok esegui il sifr
					
					stringa = ""
					stringa += "  <object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\""+larghezza+"\" height=\""+altezza+"\" id=\""+id+"\" align=\"" + allineamento + "\">"
					stringa += "          <param name=\"allowScriptAccess\" value=\"sameDomain\" />"
					stringa += "          <param name=\"movie\" value=\""+file+"\" />"
					stringa += "          <param name=\"quality\" value=\"high\" />"
					stringa += "          <param name=\"bgcolor\" value=\"#"+colore+"\" />"
					stringa += "          <param name=\"flashvars\" value=\""+variabili+"\" />"
					stringa += "          <param name=\"wmode\" value=\""+trasparente+"\" />"
					stringa += "          <embed src=\""+file+"\" quality=\"high\" flashvars=\""+ variabili+ "\" wmode=\""+trasparente+"\"bgcolor=\"#"+colore+"\" width=\""+larghezza+"\" height=\""+altezza+"\" name=\""+file+"\" align=\"" + allineamento + "\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />"
					stringa += "  </object>"
					
					document.getElementById(tag).innerHTML = stringa
				
				} else {
					
					detectValueSifr = false
					
					if (rimpiazzaContenuto == true) {
					
						if (onlyFlash == true) {
							
							document.getElementById(tag).innerHTML = stringa
							
						} else {
							
							if (imagesFlash == false) {
								
								document.getElementById(tag).style.padding = "50px;";
								
								/*
								if (backGroundDetect != "") {
									document.getElementById(tag).style.backgroundColor  = "#" + backGroundDetect + ";";
								}
								
								document.getElementById(tag).style.fontColor =  fontColorDetect+ ";";
								document.getElementById(tag).style.font = fontDetect+ ";";
								document.getElementById(tag).style.fontSize = fontSizeDetect+ ";";
								document.getElementById(tag).style.lineHeight = "1.5em";
								*/
							} else {
								document.getElementById(tag).style.backgroundImage = "url(" + imagesNoOnlyFlash +");"
							}
							
							/*document.getElementById(tag).style.width = larghezza
							document.getElementById(tag).style.height = altezza
							
							if (larghezza > 150 && altezza > 50) {
									document.getElementById(tag).innerHTML = stringa
							}
							*/
							document.getElementById(tag).innerHTML = stringa
						}
						
					}
					
				}
			}
	}

}
-->