﻿/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
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){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"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(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},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[_16.length]=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");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_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");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_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{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}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(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[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(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;


/* formexp.js compiled from X 4.0 with XC 0.27b. Distributed by GNU LGPL. For copyrights, license, documentation and more visit Cross-Browser.com */
var xOp7Up,xOp6Dn,xIE4Up,xIE4,xIE5,xNN4,xUA=navigator.userAgent.toLowerCase();if(window.opera){var i=xUA.indexOf('opera');if(i!=-1){var v=parseInt(xUA.charAt(i+6));xOp7Up=v>=7;xOp6Dn=v<7;}}else if(navigator.vendor!='KDE' && document.all && xUA.indexOf('msie')!=-1){xIE4Up=parseFloat(navigator.appVersion)>=4;xIE4=xUA.indexOf('msie 4')!=-1;xIE5=xUA.indexOf('msie 5')!=-1;}else if(document.layers){xNN4=true;}xMac=xUA.indexOf('mac')!=-1;function xDef(){for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])=='undefined') return false;}return true;}function xDisplay(e,s){if(!(e=xGetElementById(e))) return null;if(e.style && xDef(e.style.display)) {if (xStr(s)) e.style.display = s;return e.style.display;}return null;}function xGetElementById(e){if(typeof(e)!='string') return e;if(document.getElementById) e=document.getElementById(e);else if(document.all) e=document.all[e];else e=null;return e;}function xStr(s){for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])!='string') return false;}return true;}


//VALIDACIÓ FORMULARIS

//funcions generals 

function esta_ple(d1)
{
/* Torna
	0: Camp Buit
	1: Camp Ple
*/
	if (d1.value=='')
		return 0;
	else
		return 1;
}


function mira_email(email) {
/* Torna
        0: no hi ha res
        1: si es correcte
        9: email incorrecte
*/

if(email.value!="")
   {
   if (/^[A-Za-z0-9\.+_-]+@[A-Za-z0-9\.-]+\.[A-Za-z]{2,6}$/.test(email.value))
  	{
	return 1;
	}
	else
	{
	return 9;
	}
   }
else
   {
	return 0;
   }
}


function comprova_radio(que,longitud)
{

/*
        Retorna 0 si no hi ha cap seleccio
        Retorna el numero d'ordre de la seleccionada (començant per 1)
*/
                value=0;
                for(i=0;i<longitud;i++)
                {

                        if(que[i].checked == true)
                        {
                                value=i+1;
                        }
                }
                return value;
}



function alerta_en (str)
{
	alert("Check the field " + str + " ...");
}


function alerta_ca (str)
{
	alert("Revisa el camp " + str + " ...");
}

function alerta_fr (str)
{
	alert("Contrôlez le champ " + str + " ...");
}

function alerta_es (str)
{
	alert("Revisa el campo " + str + " ...");
}


// valida incripció


function inscripcio_ca()
{
        with (document.form1)
               {
               	result1 = esta_ple(nif);
		result2 = esta_ple(nom);
		result3 = esta_ple(cognom1);
		result4 = esta_ple(cognom2);
		result5 = esta_ple(telefon2);
        result6 = mira_email(email);
		result7 = esta_ple(empresa_rao);
		result8 = esta_ple(empresa_cif);


		
               	
		
               if (result1 == 0)
               {		pinta_blanc();
				alerta_ca('NIF');
				document.getElementById('nif').style.background = '#FFEFEF';
				nif.focus();
				return false;
				}
				
		else if (result2 == 0)
               {		pinta_blanc();
				alerta_ca('Nom');
				document.getElementById('nom').style.background = '#FFEFEF';
				nom.focus();
				return false;
				}
				
		else if (result3 == 0)
               {
				pinta_blanc();
				alerta_ca('Primer Cognom');
				document.getElementById('cognom1').style.background = '#FFEFEF';
				cognom1.focus();
				return false;
				}
				
		else if (result4 == 0)
               {
				pinta_blanc();
				alerta_ca('Segon Cognom');
				document.getElementById('cognom2').style.background = '#FFEFEF';
				cognom2.focus();
				return false;
				}
				
		else if (result5 == 0)
               {
				pinta_blanc();
				alerta_ca('Telèfon Mòbil');
				document.getElementById('telefon2').style.background = '#FFEFEF';
				telefon2.focus();
				return false;
				}
							
				
               else if (result6 != 1)
               {
				pinta_blanc();
				alert('Escriu una adreça de correu electrònic vàlida');
				document.getElementById('email').style.background = '#FFEFEF';
				email.focus();
				return false;
				}
				
		else if (result7 == 0)
               {
				pinta_blanc();
				alerta_ca('Empresa Raó Social');
				document.getElementById('empresa_rao').style.background = '#FFEFEF';
				empresa_rao.focus();
				return false;
				}
		
		else if (result8 == 0)
               {
				pinta_blanc();
				alerta_ca('Empresa CIF');
				document.getElementById('empresa_cif').style.background = '#FFEFEF';
				empresa_cif.focus();
				return false;
				}

	       else 
		   {
		   

		   submit();
		   }
       }
}



function inscripcio_es()
{
        with (document.form1)
               {
               	result1 = esta_ple(nif);
		result2 = esta_ple(nom);
		result3 = esta_ple(cognom1);
		result4 = esta_ple(cognom2);
		result5 = esta_ple(telefon2);
        result6 = mira_email(email);
		result7 = esta_ple(empresa_rao);
		result8 = esta_ple(empresa_cif);


		
               	
		
               if (result1 == 0)
               {		pinta_blanc();
				alerta_es('NIF');
				document.getElementById('nif').style.background = '#FFEFEF';
				nif.focus();
				return false;
				}
				
		else if (result2 == 0)
               {		pinta_blanc();
				alerta_es('Nombre');
				document.getElementById('nom').style.background = '#FFEFEF';
				nom.focus();
				return false;
				}
				
		else if (result3 == 0)
               {
				pinta_blanc();
				alerta_es('Primer Apellido');
				document.getElementById('cognom1').style.background = '#FFEFEF';
				cognom1.focus();
				return false;
				}
				
		else if (result4 == 0)
               {
				pinta_blanc();
				alerta_es('Segundo Apellido');
				document.getElementById('cognom2').style.background = '#FFEFEF';
				cognom2.focus();
				return false;
				}
				
		else if (result5 == 0)
               {
				pinta_blanc();
				alerta_es('Teléfono Móbil');
				document.getElementById('telefon2').style.background = '#FFEFEF';
				telefon2.focus();
				return false;
				}
							
				
               else if (result6 != 1)
               {
				pinta_blanc();
				alert('Escribe una dirección de correo electrónico válida');
				document.getElementById('email').style.background = '#FFEFEF';
				email.focus();
				return false;
				}
				
		else if (result7 == 0)
               {
				pinta_blanc();
				alerta_es('Empresa Razón Social');
				document.getElementById('empresa_rao').style.background = '#FFEFEF';
				empresa_rao.focus();
				return false;
				}
		
		else if (result8 == 0)
               {
				pinta_blanc();
				alerta_es('Empresa CIF');
				document.getElementById('empresa_cif').style.background = '#FFEFEF';
				empresa_cif.focus();
				return false;
				}

	       else 
		   {

		   submit();
		   }
       }
}

function inscripcio2_ca()
{
        with (document.form1)
               {
               	result1 = esta_ple(nif);
		result2 = esta_ple(nom);
		result3 = esta_ple(cognom1);
		result4 = esta_ple(cognom2);
		result5 = esta_ple(telefon2);
               	result6 = mira_email(email);
		result7 = esta_ple(empresa_rao);
		result8 = esta_ple(empresa_cif);
		result9 = comprova_radio(bonificacio,2);
		result10 = comprova_radio(factura,2);

		
               	
		
               if (result1 == 0)
               {		pinta_blanc();
				alerta_ca('NIF');
				document.getElementById('nif').style.background = '#FFEFEF';
				nif.focus();
				return false;
				}
				
		else if (result2 == 0)
               {		pinta_blanc();
				alerta_ca('Nom');
				document.getElementById('nom').style.background = '#FFEFEF';
				nom.focus();
				return false;
				}
				
		else if (result3 == 0)
               {
				pinta_blanc();
				alerta_ca('Primer Cognom');
				document.getElementById('cognom1').style.background = '#FFEFEF';
				cognom1.focus();
				return false;
				}
				
		else if (result4 == 0)
               {
				pinta_blanc();
				alerta_ca('Segon Cognom');
				document.getElementById('cognom2').style.background = '#FFEFEF';
				cognom2.focus();
				return false;
				}
				
		else if (result5 == 0)
               {
				pinta_blanc();
				alerta_ca('Telèfon Mòbil');
				document.getElementById('telefon2').style.background = '#FFEFEF';
				telefon2.focus();
				return false;
				}
							
				
               else if (result6 != 1)
               {
				pinta_blanc();
				alert('Escriu una adreça de correu electrònic vàlida');
				document.getElementById('email').style.background = '#FFEFEF';
				email.focus();
				return false;
				}
				
		else if (result7 == 0)
               {
				pinta_blanc();
				alerta_ca('Empresa Raó Social');
				document.getElementById('empresa_rao').style.background = '#FFEFEF';
				empresa_rao.focus();
				return false;
				}
		
		else if (result8 == 0)
               {
				pinta_blanc();
				alerta_ca('Empresa CIF');
				document.getElementById('empresa_cif').style.background = '#FFEFEF';
				empresa_cif.focus();
				return false;
				}
				
		else if (result9== 0)
		{
				pinta_blanc();
				alert('Selecciona la bonificació')
				return false;
				}
				
		else if (result10== 0)
		{
				pinta_blanc();
				alert('Selecciona el tipus de factura')
				return false;
				}

	       else 
		   {

		   submit();
		   }
       }
}


function inscripcio2_es()
{
        with (document.form1)
               {
               	result1 = esta_ple(nif);
		result2 = esta_ple(nom);
		result3 = esta_ple(cognom1);
		result4 = esta_ple(cognom2);
		result5 = esta_ple(telefon2);
               	result6 = mira_email(email);
		result7 = esta_ple(empresa_rao);
		result8 = esta_ple(empresa_cif);
		result9 = comprova_radio(bonificacio,2);
		result10 = comprova_radio(factura,2);

		
               	
		
               if (result1 == 0)
               {		pinta_blanc();
				alerta_es('NIF');
				document.getElementById('nif').style.background = '#FFEFEF';
				nif.focus();
				return false;
				}
				
		else if (result2 == 0)
               {		pinta_blanc();
				alerta_es('Nombre');
				document.getElementById('nom').style.background = '#FFEFEF';
				nom.focus();
				return false;
				}
				
		else if (result3 == 0)
               {
				pinta_blanc();
				alerta_es('Primer Apellido');
				document.getElementById('cognom1').style.background = '#FFEFEF';
				cognom1.focus();
				return false;
				}
				
		else if (result4 == 0)
               {
				pinta_blanc();
				alerta_es('Segundo Apellido');
				document.getElementById('cognom2').style.background = '#FFEFEF';
				cognom2.focus();
				return false;
				}
				
		else if (result5 == 0)
               {
				pinta_blanc();
				alerta_es('Teléfono Móbil');
				document.getElementById('telefon2').style.background = '#FFEFEF';
				telefon2.focus();
				return false;
				}
							
				
               else if (result6 != 1)
               {
				pinta_blanc();
				alert('Escribe una dirección de correo electrónico válida');
				document.getElementById('email').style.background = '#FFEFEF';
				email.focus();
				return false;
				}
				
		else if (result7 == 0)
               {
				pinta_blanc();
				alerta_es('Empresa Razón Social');
				document.getElementById('empresa_rao').style.background = '#FFEFEF';
				empresa_rao.focus();
				return false;
				}
		
		else if (result8 == 0)
               {
				pinta_blanc();
				alerta_es('Empresa CIF');
				document.getElementById('empresa_cif').style.background = '#FFEFEF';
				empresa_cif.focus();
				return false;
				}
				
		else if (result9== 0)
		{
				pinta_blanc();
				alert('Selecciona la bonificación')
				return false;
				}
				
		else if (result10== 0)
		{
				pinta_blanc();
				alert('Selecciona el tipo de factura')
				return false;
				}

	       else 
		   {

		   submit();
		   }
       }
}

 
 function pinta_blanc ()
 {
	document.getElementById('nif').style.background = '#FFF';
	document.getElementById('nom').style.background = '#FFF';
	document.getElementById('cognom1').style.background = '#FFF';
	document.getElementById('cognom2').style.background = '#FFF';
	document.getElementById('telefon2').style.background = '#FFF';
	document.getElementById('email').style.background = '#FFF';
	document.getElementById('empresa_rao').style.background = '#FFF';
	document.getElementById('empresa_cif').style.background = '#FFF';
 }
 
 // valida incripció serveis i acords


function solicitud_servei_ca()
{
        with (document.form1)
               {
               	result1 = esta_ple(nom);
		result2 = esta_ple(cognoms);
		result3 = mira_email(email);
		result6 = esta_ple(telefon);
		result4 = esta_ple(empresa);
		result5 = esta_ple(nif);
					
					if (condicions.checked)  
					{
					result8=0;
					}
					else
					{
					result8=1;      
					}
				

               if (result1 == 0)
               {
				pinta_blanc2();
				alerta_ca('Nom');
				document.getElementById('nom').style.background = '#FFEFEF';
				nom.focus();
				return false;
				}
				
		else if (result2 == 0)
               {		
			   
			    pinta_blanc2();
				alerta_ca('Cognoms');
				document.getElementById('cognoms').style.background = '#FFEFEF';
				cognoms.focus();
				return false;
				}
				

								
               else if (result3 != 1)
               {
				pinta_blanc2();
				alert('Escriu una adreça de correu electrònic vàlida');
				document.getElementById('email').style.background = '#FFEFEF';
				email.focus();
				return false;
				}
				
		else if (result6 == 0)
               {		
			   
			    pinta_blanc2();
				alerta_ca('Telèfon');
				document.getElementById('telefon').style.background = '#FFEFEF';
				telefon.focus();
				return false;
				}		
				
		else if (result4 == 0)
               {		
			   
			    pinta_blanc2();
				alerta_ca('Empresa');
				document.getElementById('empresa').style.background = '#FFEFEF';
				empresa.focus();
				return false;
				}		
				
	       else if (result5 == 0)
               {		
			   
			    pinta_blanc2();
				alerta_ca('N.I.F,');
				document.getElementById('nif').style.background = '#FFEFEF';
				nif.focus();
				return false;
				}	
				
				else if (result8==1)
		    {
		    alert("Ha de llegir i acceptar la Protecció de dades");
		    return false;        
			}
				
		

	       else 
		   {
		   document.getElementById('realname').value = document.getElementById('nom').value+"  "+document.getElementById('cognoms').value;
		   submit();
		   }
       }
}


function solicitud_servei_es()
{
        with (document.form1)
               {
               	result1 = esta_ple(nom);
				result2 = esta_ple(cognoms);
				result3 = mira_email(email);
				result6 = esta_ple(telefon);
				result4 = esta_ple(empresa);
				result5 = esta_ple(nif);
				
					if (condicions.checked)  
					{
					result8=0;
					}
					else
					{
					result8=1;      
					}

				

               if (result1 == 0)
               {
				pinta_blanc2();
				alerta_es('Nombre');
				document.getElementById('nom').style.background = '#FFEFEF';
				nom.focus();
				return false;
				}
				
		else if (result2 == 0)
               {		
			   
			    pinta_blanc2();
				alerta_es('Apellidos');
				document.getElementById('cognoms').style.background = '#FFEFEF';
				cognoms.focus();
				return false;
				}
				

								
               else if (result3 != 1)
               {
				pinta_blanc2();
				alert('Escribe una dirección de correo electrónico válida');
				document.getElementById('email').style.background = '#FFEFEF';
				email.focus();
				return false;
				}
				
		else if (result6 == 0)
               {		
			   
			    pinta_blanc2();
				alerta_es('Teléfono');
				document.getElementById('telefon').style.background = '#FFEFEF';
				telefon.focus();
				return false;
				}		
				
	       else if (result4 == 0)
               {		
			   
			    pinta_blanc2();
				alerta_es('Empresa');
				document.getElementById('empresa').style.background = '#FFEFEF';
				empresa.focus();
				return false;
				}		
				
	       else if (result5 == 0)
               {		
			   
			    pinta_blanc2();
				alerta_es('N.I.F.');
				document.getElementById('nif').style.background = '#FFEFEF';
				nif.focus();
				return false;
				}	
				
				
			else if (result8==1)
				{
				alert("Ha de  leer y aceptar la Protección de datos");
				return false;        
				}
				
		

	       else 
		   {
		   document.getElementById('realname').value = document.getElementById('nom').value+"  "+document.getElementById('cognoms').value;
		   submit();
		   }
       }
}

 function pinta_blanc2 ()
 {
	document.getElementById('nom').style.background = '#FFF';
	document.getElementById('cognoms').style.background = '#FFF';
	document.getElementById('email').style.background = '#FFF';
	document.getElementById('telefon').style.background = '#FFF';
	document.getElementById('empresa').style.background = '#FFF';
	document.getElementById('nif').style.background = '#FFF';

 }
 
 function mesinfo ()
{
	if (document.getElementById('mesinfo').style.display =='none')
		{
			xDisplay('mesinfo', 'block');
		}
		
		else
		
		{
			xDisplay('mesinfo', 'none');
		}

}




// valida contactar


function contactar_ca()
{
        with (document.form1)
               {
               	result1 = esta_ple(empresa);
				result2 = esta_ple(persona_contacte);
				result3 = esta_ple(telefon);
				result4 = mira_email(email);
				
				 if (condicions.checked)  
					{
					result8=0;
					}
					else
					{
					result8=1;      
					}


				

               if (result1 == 0)
               {
				pinta_blanc3();
				alerta_ca('Empresa');
				document.getElementById('empresa').style.background = '#FFEFEF';
				empresa.focus();
				return false;
				}
				
				else if (result2 == 0)
               {		
			   
			    pinta_blanc3();
				alerta_ca('Persona de Contacte');
				document.getElementById('persona_contacte').style.background = '#FFEFEF';
				persona_contacte.focus();
				return false;
				}
				
				else if (result3 == 0)
               {		
			   
			    pinta_blanc3();
				alerta_ca('Telèfon');
				document.getElementById('telefon').style.background = '#FFEFEF';
				telefon.focus();
				return false;
				}
				

								
               else if (result4 != 1)
               {
				pinta_blanc3();
				alert('Escriu una adreça de correu electrònic vàlida');
				document.getElementById('email').style.background = '#FFEFEF';
				email.focus();
				return false;
				}
				
			else if (result8==1)
		    {
		    alert("Ha de llegir i acceptar la Protecció de dades");
		    return false;        
			}

				
		

	       else 
		   {
		   document.getElementById('realname').value = document.getElementById('persona_contacte').value;
		   submit();
		   }
       }
}


function contactar_es()
{
        with (document.form1)
               {
               	result1 = esta_ple(empresa);
				result2 = esta_ple(persona_contacte);
				result3 = esta_ple(telefon);
				result4 = mira_email(email);
				
				
				if (condicions.checked)  
					{
					result8=0;
					}
					else
					{
					result8=1;      
					}

				

               if (result1 == 0)
               {
				pinta_blanc3();
				alerta_es('Empresa');
				document.getElementById('empresa').style.background = '#FFEFEF';
				empresa.focus();
				return false;
				}
				
				else if (result2 == 0)
               {		
			   
			    pinta_blanc3();
				alerta_es('Persona de Contacto');
				document.getElementById('persona_contacte').style.background = '#FFEFEF';
				persona_contacte.focus();
				return false;
				}
				
				else if (result3 == 0)
               {		
			   
			    pinta_blanc3();
				alerta_es('Teléfono');
				document.getElementById('telefon').style.background = '#FFEFEF';
				telefon.focus();
				return false;
				}
				

								
               else if (result4 != 1)
               {
				pinta_blanc3();
				alert('Escribe una dirección de correo electrónico válida');
				document.getElementById('email').style.background = '#FFEFEF';
				email.focus();
				return false;
				}
				
				else if (result8==1)
				{
				alert("Ha de  leer y aceptar la Protección de datos");
				return false;        
				}
				
		

	       else 
		   {
		   document.getElementById('realname').value = document.getElementById('persona_contacte').value;
		   submit();
		   }
       }
}

 function pinta_blanc3 ()
 {
	document.getElementById('empresa').style.background = '#FFF';
	document.getElementById('persona_contacte').style.background = '#FFF';
	document.getElementById('telefon').style.background = '#FFF';
	document.getElementById('email').style.background = '#FFF';

 }
 
 
 function ampliaImatges(imatge)
{

obj=document.getElementById("imatgeGran");
obj.src = imatge;   
	
}

 function ampliaImatgesVarisIds(imatge,id)
{

obj=document.getElementById("imatgeGran"+id);
obj.src = imatge;   
	
}


function proteccio ()
{
	if (document.getElementById('dades').style.display =='block')
	{
		xDisplay('dades', 'none');
	}
	else
	{
	 xDisplay('dades', 'block');
	}

}


function veureFitxa (item, total)
{
	 xDisplay(item, 'block');
	 
	 
                for(i=1;i<=total;i++)
                {

	
                        if(item!='item'+i)
                        {
                           xDisplay('item'+i, 'none'); 
							
                        }
                }
}



