/**
 * 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(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){if(!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"detectflash";
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();
if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";
this.addParam("quality",q);
this.setAttribute("useExpressInstall",_7);
this.setAttribute("doExpressInstall",false);
var _d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){this.setAttribute("redirectUrl",_a);}};
deconcept.SWFObject.prototype={setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},getAttribute:function(_10){
return this.attributes[_10];
},addParam:function(_11,_12){
this.params[_11]=_12;
},getParams:function(){
return this.params;
},addVariable:function(_13,_14){
this.variables[_13]=_14;
},getVariable:function(_15){
return this.variables[_15];
},getVariables:function(){
return this.variables;
},getVariablePairs:function(){
var _16=new Array();
var key;
var _18=this.getVariables();
for(key in _18){_16.push(key+"="+_18[key]);}
return _16;},getSWFHTML:function(){var _19="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){
this.addVariable("MMplayerType","PlugIn");}
_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
var _1a=this.getParams();
for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}
var _1c=this.getVariablePairs().join("&");
if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";
}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}
_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
var _1d=this.getParams();
for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}
var _1f=this.getVariablePairs().join("&");
if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}
return _19;
},write:function(_20){
if(this.getAttribute("useExpressInstall")){
var _21=new deconcept.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(_21)&&!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 _20=="string")?document.getElementById(_20):_20;
n.innerHTML=this.getSWFHTML();return true;
}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}
return false;}};
deconcept.SWFObjectUtil.getPlayerVersion=function(){
var _23=new deconcept.PlayerVersion([0,0,0]);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_23=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");
_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}
catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}
catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}
return _23;};
deconcept.PlayerVersion=function(_27){
this.major=_27[0]!=null?parseInt(_27[0]):0;
this.minor=_27[1]!=null?parseInt(_27[1]):0;
this.rev=_27[2]!=null?parseInt(_27[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(_29){
var q=document.location.search||document.location.hash;
if(q){var _2b=q.substring(1).split("&");
for(var i=0;i<_2b.length;i++){
if(_2b[i].substring(0,_2b[i].indexOf("="))==_29){
return _2b[i].substring((_2b[i].indexOf("=")+1));}}}
return "";}};
deconcept.SWFObjectUtil.cleanupSWFs=function(){if(window.opera||!document.all){return;}
var _2d=document.getElementsByTagName("OBJECT");
for(var i=0;i<_2d.length;i++){_2d[i].style.display="none";for(var x in _2d[i]){
if(typeof _2d[i][x]=="function"){_2d[i][x]=function(){};}}}};
deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};
__flash_savedUnloadHandler=function(){};
if(typeof window.onunload=="function"){
var _30=window.onunload;
window.onunload=function(){
deconcept.SWFObjectUtil.cleanupSWFs();_30();};
}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(_31){
this[this.length]=_31;
return this.length;};}
var getQueryParamValue=deconcept.util.getRequestParameter;
var FlashObject=deconcept.SWFObject;
var SWFObject=deconcept.SWFObject;
function echeck(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }

		 if (str.indexOf(" ")!=-1){
		    return false
		 }

 		 return true
	}/*
==================================================================
LTrim(string) : Returns a copy of a string without leading spaces.
==================================================================
*/
function LTrim(str)
/*
   PURPOSE: Remove leading blanks from our string.
   IN: str - the string we want to LTrim
*/
{
   var whitespace = new String(" \t\n\r");

   var s = new String(str);

   if (whitespace.indexOf(s.charAt(0)) != -1) {
      // We have a string with leading blank(s)...

      var j=0, i = s.length;

      // Iterate from the far left of string until we
      // don't have any more whitespace...
      while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
         j++;

      // Get the substring from the first non-whitespace
      // character to the end of the string...
      s = s.substring(j, i);
   }
   return s;
}

/*
==================================================================
RTrim(string) : Returns a copy of a string without trailing spaces.
==================================================================
*/
function RTrim(str)
/*
   PURPOSE: Remove trailing blanks from our string.
   IN: str - the string we want to RTrim

*/
{
   // We don't want to trip JUST spaces, but also tabs,
   // line feeds, etc.  Add anything else you want to
   // "trim" here in Whitespace
   var whitespace = new String(" \t\n\r");

   var s = new String(str);

   if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
      // We have a string with trailing blank(s)...

      var i = s.length - 1;       // Get length of string

      // Iterate from the far right of string until we
      // don't have any more whitespace...
      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
         i--;


      // Get the substring from the front of the string to
      // where the last non-whitespace character is...
      s = s.substring(0, i+1);
   }

   return s;
}

/*
=============================================================
Trim(string) : Returns a copy of a string without leading or trailing spaces
=============================================================
*/
function Trim(str)
/*
   PURPOSE: Remove trailing and leading blanks from our string.
   IN: str - the string we want to Trim

   RETVAL: A Trimmed string!
*/
{
   return RTrim(LTrim(str));
}

function marcarColorPared(colorPared, num_lis){

	// Cambio del fondo del diseño
	window.document.combi_id.SetVariable("fondo", colorPared);
	// Seleccion del color de fondo
//	var num_lis = window.document.getElementById('punto2').childNodes.length;
//	for(var i=0; i<num_lis*2; i++){
//		if(window.document.getElementById('punto2').childNodes[i].tagName=="LI"){
//			var id_actual = window.document.getElementById('punto2').childNodes[i].id;
//			var col_actual = id_actual.substr(9,6);
//			var fila_actual = id_actual.substr(7,1);
//			if(id_actual.match(colorPared)){
//				window.document.getElementById(id_actual).className = "punto2_fila"+fila_actual+" "+"col"+col_actual+" "+"punto2_fila"+num_fila+"_selec";
//				window.document.getElementById(id_actual).blur();
//			}else{
//				window.document.getElementById(id_actual).className = "punto2_fila"+fila_actual+" "+"col"+col_actual;
//			}
//		if (window.document.getElementById('punto2').childNodes[i].className == "on"){
//			var id_actual = window.document.getElementById('punto2').childNodes[i].id;
//			window.document.getElementById('punto2').childNodes[i].className = "";
//			}
//
//	}
	var div_bgcolors = document.getElementById('punto2');
	if (div_bgcolors != null){
		list_a = div_bgcolors.getElementsByTagName('A');
		for(var i=0; i<list_a.length; i++){
			// alert(listado_li[i].className);
			list_a[i].className = "";
		}

	window.document.getElementById('bg_'+colorPared).className = "on";
	}
//	window.document.getElementById('color_fondo').value = colorPared;
}

function marcarColorVinilo(vinilo_selec, colorVinilo, texto_vinilo, num_lis){
	if(vinilo_selec=='1'){
		letra_vinilo="A";
	}else if(vinilo_selec=='2'){
		letra_vinilo="B";
	}
//	for(var i=0; i<num_lis*2; i++){	
//		window.document.getElementById('colores_vinilo'+vinilo_selec).childNodes[i].className = "";
//        }

	var div_colors = document.getElementById('colores_vinilo'+vinilo_selec);
	if (div_colors != null){
		list_a = div_colors.getElementsByTagName('A');
		for(var i=0; i<list_a.length; i++){
			// alert(listado_li[i].className);
			list_a[i].className = "";
		}
	window.document.getElementById('cl'+vinilo_selec+'_'+colorVinilo).className = "on";
	}
	// Meter los espacios donde toquen
//	texto_vinilo=texto_vinilo.replace('_',' ');
	// Establecer el color del primer vinilo
	window.document.combi_id.SetVariable("vinilo"+vinilo_selec, colorVinilo);
	// Marcar boton
//	window.document.getElementById('vinilo'+vinilo_selec+'_'+colorVinilo).className = "combiColores_marcado";
//	window.document.getElementById('vinilo'+vinilo_selec+'_'+colorVinilo).blur();
	// Nombre de la etiqueta
//	window.document.getElementById('id_grafico_'+vinilo_selec).innerHTML = texto_vinilo;
	// Valores en los campos escondidos para el carrito
//	window.document.getElementById('grafismo'+letra_vinilo+'_color').value = colorVinilo;
//	window.document.getElementById('grafismo'+letra_vinilo+'_txt').value = texto_vinilo;
	
//	switch(window.document.getElementById('lang').value){
//		case "cat":
//			var y=1;						
//		break;
//		case "eng":
//			var y=2;						
//		break;
//		default:
//			var y=0;						
//		break;				
//	}

	var textes=new Array();
	textes[0]=new Array();
	textes[0][0]="Burgundy es un granate oscuro";
	textes[0][1]="Burgundy és un granat fosc";
	textes[0][2]="Burgundy is a dark maroon";
	textes[1]=new Array();
	textes[1][0]="Brown es un color chocolate oscuro";
	textes[1][1]="Brown és un color xocolata fosc";
	textes[1][2]="Brown is a dark chocolate color";
	textes[2]=new Array();
	textes[2][0]="Turquoise es un azul verdoso";
	textes[2][1]="Turquoise és un blau verdós";
	textes[2][2]="Turquoise is greenish blue";
	textes[3]=new Array();
	textes[3][0]="Light green es un verde luminoso";
	textes[3][1]="Light green és un verd lluminós";
	textes[3][2]="Light green is a bright green";
	textes[4]=new Array();
	textes[4][0]="";
	textes[4][1]="";
	textes[4][2]="";
	

	switch(texto_vinilo){
		case "Burgundy":
			var x=0;	
			break;
		case "Brown":
			var x=1;	
			break;
		case "Turquoise":
			var x=2;	
			break;
		case "Light Green":
			var x=3;	
			break;
		default:
			var x=4;	
			break;
	}
	
//	window.document.getElementById('colores_grafismo_nota').innerHTML=textes[x][y];
}

function mostrarColoresVinilo(vinilo_selec){
	if(vinilo_selec=='1'){
		window.document.getElementById('colores_vinilo1').style.display = 'block';
		window.document.getElementById('colores_vinilo2').style.display = 'none';
		window.document.getElementById('selector_colores_grafismos1').className="selector_colores_grafismos selector_colores_grafismos1";
		window.document.getElementById('selector_colores_grafismos2').className="selector_colores_grafismos selector_colores_grafismos2";
		window.document.getElementById('colores_grafismo_liniapx').innerHTML = '<img src="img/vista_detalle/limite_grafismo_a.gif" alt="separador" />';
	}else if(vinilo_selec=='2'){
		window.document.getElementById('colores_vinilo1').style.display = 'none';
		window.document.getElementById('colores_vinilo2').style.display = 'block';
		window.document.getElementById('selector_colores_grafismos1').className="selector_colores_grafismos selector_colores_grafismos2";
		window.document.getElementById('selector_colores_grafismos2').className="selector_colores_grafismos selector_colores_grafismos1";
		window.document.getElementById('colores_grafismo_liniapx').innerHTML = '<img src="img/vista_detalle/limite_grafismo_b.gif" alt="separador" />';
	}
	window.document.getElementById('selector_colores_grafismos1').blur();
}

function orientacionVinilo(orientacion_selec){
	window.document.combi_id.SetVariable("orientacion", orientacion_selec);
	
	if(orientacion_selec=='estandar'){
		window.document.getElementById('orientation_estandar').className='on';
		//if(window.document.getElementById('orientacion_invertida')){
			window.document.getElementById('orientation_invertida').className='off';
		//}
	}else if(orientacion_selec=='invertida'){
		window.document.getElementById('orientation_estandar').className='off';
		//if(window.document.getElementById('orientacion_invertida')){
			window.document.getElementById('orientation_invertida').className='on';
		//}
	}
	window.document.getElementById('orientation_estandar').blur();
//	window.document.getElementById('orientacion').value = orientacion_selec;
}

function marcarTamano(tamano_marcar, total_tamanos, txt_tamano, precio){
	for(i=1; i<=total_tamanos; i++){
		//if(window.document.getElementById('tamano_'+i)!="null")(
		if(window.document.getElementById('tamano_'+i)!=null){
			if(i==tamano_marcar){
				window.document.getElementById('tamano_'+i).className = "tamano tamano_marcado";
			}else{
				window.document.getElementById('tamano_'+i).className = "tamano";
			}
			window.document.getElementById('tamano_'+i).blur();
		}
		//}
	}
	window.document.getElementById('tamano').value = txt_tamano;
	window.document.getElementById('precio').value = precio;
}

function restarUnidad(){
	var valor_actual = window.document.getElementById('num_unitats').value;
	if(valor_actual>1){
		window.document.getElementById('num_unitats').value = (valor_actual-1);
	}
}
function sumarUnidad(){
	var valor_actual = window.document.getElementById('num_unitats').value;
	window.document.getElementById('num_unitats').value = (valor_actual*1)+1;
}<!-- Original:  Shawn Seley -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

function CountWords (this_field) {
	var char_count = this_field.value.length;
	var fullStr = this_field.value + " ";
	var initial_whitespace_rExp = /^[^A-Za-z0-9]+/gi;
	var left_trimmedStr = fullStr.replace(initial_whitespace_rExp, "");
	var non_alphanumerics_rExp = rExp = /[^A-Za-z0-9]+/gi;
	var cleanedStr = left_trimmedStr.replace(non_alphanumerics_rExp, " ");
	var splitString = cleanedStr.split(" ");
	var word_count = splitString.length -1;
	 var paraula=' palabra'; var paraules=' palabras';	if (fullStr.length <2) {
		word_count = 0;
	}
	wordOrWords=((word_count == 1)?paraula:paraules);
	
	document.getElementById("div_wordCount").style.color=((word_count>100)?"red":"");
	document.getElementById("div_wordCount").innerHTML=(word_count)+wordOrWords; 
	document.getElementById("input_wordCount").value=word_count; 
	return word_count;
}

function enviar(){
	if (document.getElementById("input_wordCount").value>100) {
		alert("El texto personalizado no puede contener más de 100 palabras.");
	} else {
		document.formulari.submit()
	}
}


