// JavaScript Document

		//Funcion que transforma un string de la forma "rgb(xxx,xxx,xxx)" a un color en hexadecimal "#hhhhhh"
		// siendo las x los valores del color en RGB
		function rgbToHex(rgb) {
			
			
			
			
			//Nota : hay que diferenciar entre nagedores, ya que los que son herencia de Netscape, 
			//con la funcion jquery nos devuelve el valor del color en rgb, mientras que en Iexplorer
			//nos devuleve el valor en hexadecimal
			
			
			var nombre_nav = navigator.appName;
			
			//Si se trata de un navegador herencia de Netscape
			if (nombre_nav == "Netscape"){
			

				size = (rgb.length)-5;
				rgb = rgb.substr(4,size);
				
				colors = rgb.split(',');
				
				var red = parseInt(colors[0]);
				var green = parseInt(colors[1]);
				var blue = parseInt(colors[2]);
				
				if(red == "0")
					red = "00";
				if(green == "0")
					green = "00";	
				if(blue == "0")
					blue = "00";
					
				
				
				
				
				var hex =  red.toString(16) + green.toString(16) + blue.toString(16);
				
				
	    		
				return hex;	
			}		
			
			//Si es IExplorer 
			else{
				size = (rgb.length);				
				var hex = rgb.substr(1,size);				
				return hex;
			}	
		
		} 

		//var text_width1 = document.getElementById('titulo_contenth2_01');	
		//var text_width2 = text_width1.parentElement().id;
		
			
		//alert(text_width2);
		
		
		var i=0;
		
		for(i=1;i<20;i++){
			if($("#titulo_flash_"+i).length>0){
				//console.log($("#titulo_contenth2_0"+i).length);
			
				//Obtiene texto dentro del div (salta span)
				var text_span = $("#titulo_flash_"+i).text();		
	
				
				//Obtenemos el color en hexadecimal de la clase
				//var color_parent_rgb = $(".titulo_content_h2").css('color');
				var color_parent_rgb = $("#titulo_flash_"+i).css('color');
				//var color_parent_rgb = $("#titulo_contenth2_0"+i).parent().css('color');		
				var color_parent = rgbToHex(color_parent_rgb);
				
				
				
				var text_width = $("#titulo_flash_"+i).css('width');	
				//var text_fontsize = $(".titulo_content_h2").css('font-size');	$(this).parent()
				var text_fontsize = $("#titulo_flash_"+i).parent().css('font-size');
				
				var text_fontweight = $("#titulo_flash_"+i).parent().css('font-weight');


				//Pasamos valores para flash
				var nRandom=Math.random();
				var titulo_content_flash01_prod = new SWFObject("swf/tituloflash.swf?kk="+nRandom, "contenttituloflash01", "97%", "19", "8", "#000000");
				titulo_content_flash01_prod.addVariable("texto",text_span);		
				titulo_content_flash01_prod.addVariable("txcolor",color_parent);
				titulo_content_flash01_prod.addVariable("txwidth",text_width);	
				titulo_content_flash01_prod.addVariable("txfontsize", text_fontsize);
				titulo_content_flash01_prod.addVariable("txfontweight", text_fontweight);
				titulo_content_flash01_prod.addParam("wmode", "transparent");
				titulo_content_flash01_prod.write("titulo_flash_"+i);
				
			}
		}
		
