function docId(id){
	return document.getElementById(id); 	
}

function goToURL() { //v3.0
  var i, args=goToURL.arguments; document.returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}


var ns6=document.getElementById&&!document.all

function restrictinput(maxlength,e,placeholder){
if (window.event&&event.srcElement.value.length>=maxlength)
return false
else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){
var pressedkey=/[a-zA-Z0-9\.\,\/]/ //detect alphanumeric keys
if (pressedkey.test(String.fromCharCode(e.which)))
e.stopPropagation()
}
}

function countlimit(maxlength,e,placeholder){
var theform=eval(placeholder)
var lengthleft=maxlength-theform.value.length
var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder)
if (window.event||e.target&&e.target==eval(placeholder)){
if (lengthleft<0)
theform.value=theform.value.substring(0,maxlength)
placeholderobj.innerHTML=lengthleft
}
}

function displaylimit(theform,thelimit){
var limit_text='<strong><span id="'+theform.toString()+'">'+thelimit+'</span></strong>'
if (document.all||ns6)
document.write(limit_text)
if (document.all){
eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
}
else if (ns6){
document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true); 
document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true); 
}
}


//abre y cierra proteccion de datos

function protPol(idprotpol){
	if(document.getElementById('protect_text'+idprotpol)){
		dataLayer=document.getElementById('protect_text'+idprotpol);
		if(dataLayer.className=='novisible') dataLayer.className='';
		else dataLayer.className='novisible';
	}
	return false;
}

function initProtPol(idprotpol){
	document.getElementById('protect_text'+idprotpol).className='novisible';
}

function cancelaCont(){
	if(confirm('¿Seguro que desea cancelar todo el proceso de contratación?')){
		location.href='sale-cancel.php';
	}else{
		
	}
}

function imprime(frame){
	eval('window.'+frame+'.focus();');
	eval('window.'+frame+'.print();');
}

//funciones usadas por el portapapeles

function mostrarMensaje(num, tipo, accion){
	//porta_tit7
	 
	spanId='porta_'+tipo+num;
	document.getElementById(spanId).className='porta_msj';
	//alert(textoId);
	switch (accion) {
    	case 'c':
    	document.getElementById(spanId).innerHTML='Copiar datos al portapapeles';
    	break
    case 'p':
    	document.getElementById(spanId).innerHTML='Pegar datos desde el portapales';
    	break
    case 'v':
    	document.getElementById(spanId).innerHTML='Ver datos del portapapeles';
    	break
	case 'h':
    	document.getElementById(spanId).innerHTML='Ayuda del portapapeles';
    	break
    default:
     
	}
	document.getElementById(spanId).className='porta_msj porta_proceso_funcion';
}

function retira(num, tipo){
	spanId='porta_'+tipo+num;
	document.getElementById(spanId).className='porta_msj';
	document.getElementById(spanId).innerHTML='Portapapeles';
}

function copiaPega(num, tipo, accion){
	var arrayCampos=new Array();
	arrayCampos = new Array("Nombre","Email","Telefono","Fax","Direccion","Localidad","Provincia","CP","Cod_Pais","NIF","Forma_Juridica");
	spanId='porta_'+tipo+num;
	recorre=arrayCampos.length;
	
	if(tipo=='tit'){
		prefijo='Titular_';
		tipoDatos='titular';
	}else{
		prefijo='CA_';
		tipoDatos='contacto administrativo';
	}
	var campos=0;
	var camposvacios=0;
	
	if(accion=='c'){ //copia
		for(i=0;i<recorre;i++){ //comprobacion previa de campos vacios
			campoPorta='Porta_'+arrayCampos[i];
			campoCopia=prefijo+arrayCampos[i]+num;
			if(document.getElementById(campoPorta)&&document.getElementById(campoCopia)){
				campos++;
				if(document.getElementById(campoCopia).value==''){camposvacios++;}
				if(arrayCampos[i]=='Cod_Pais'){ camposvacios++}
			}			
		}//comprobacion previa de campos vacios
		if(camposvacios==campos){
			document.getElementById(spanId).className='porta_msj porta_proceso_ko';
			document.getElementById(spanId).innerHTML='No se han copiado los datos al portapapeles porque los campos están vacios.';
			//alert('Todos los campos del '+tipoDatos+' estan vacios por lo que no se ha llevado a cabo la acción de copiar al portapapeles.')
		}else{
			spanId='porta_'+tipo+num;
			for(i=0;i<recorre;i++){
				campoPorta='Porta_'+arrayCampos[i];
				campoCopia=prefijo+arrayCampos[i]+num;
				if(document.getElementById(campoPorta)&&document.getElementById(campoCopia)){
					document.getElementById(campoPorta).value=document.getElementById(campoCopia).value;
				}
				if((arrayCampos[i]=='Cod_Pais')&&document.getElementById(campoCopia)){ //hay pais
					nodoPais=document.getElementById(campoCopia);
					//document.formulariocarrito.Porta_Cod_Pais_Name.value=nodoPais.options[nodoPais.selectedIndex].text;
					document.getElementById('Porta_Cod_Pais_Name').value=nodoPais.options[nodoPais.selectedIndex].text;
				}
			}
			document.getElementById(spanId).innerHTML='Datos de dominios copiados al portapapeles';
			document.getElementById(spanId).className='porta_msj porta_proceso_ok';
		}		

	}else{ 
		for(i=0;i<recorre;i++){ //comprobacion previa de campos vacios
			campoPorta='Porta_'+arrayCampos[i];
			campoPega=prefijo+arrayCampos[i]+num;
			if(document.getElementById(campoPega)&&document.getElementById(campoPorta)){
				campos++;
				if(document.getElementById(campoPorta).value==''){camposvacios++;}
				//if(arrayCampos[i]=='Cod_Pais'){ camposvacios++}
			}			
		}//comprobacion previa de campos vacios
		if(camposvacios==campos){
			document.getElementById(spanId).className='porta_msj porta_proceso_ko';
			document.getElementById(spanId).innerHTML='No se han pegado los datos desde el portapapeles porque los campos están vacios.';
			//alert('Todos los campos del '+tipoDatos+' estan vacios por lo que no se ha llevado a cabo la acción de copiar al portapapeles.')
		}else{
			spanId='porta_'+tipo+num;
			for(i=0;i<recorre;i++){
				campoPorta='Porta_'+arrayCampos[i];
				campoPega=prefijo+arrayCampos[i]+num;
			
				if(document.getElementById(campoPega)&&document.getElementById(campoPorta)){
					sigue=true;

					if((campoPorta=='Porta_Cod_Pais')&&(document.getElementById(campoPorta).value=='')) sigue=false;
					if(sigue){
						document.getElementById(campoPega).value=document.getElementById(campoPorta).value;
					}
				}
			}
			document.getElementById(spanId).innerHTML='Datos de dominio pegados desde el portapapeles';
			document.getElementById(spanId).className='porta_msj porta_proceso_ok';
		}
	}
}

function cerrar(capaId){
	document.getElementById(capaId).style.display='none';
}


function viewProductHelp(event, capaId){
 var el, x, y;
	
  el = document.getElementById(capaId);
  
  if (window.event) {
    x = window.event.clientX + document.documentElement.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop;
  }
  else {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }
  x -= 2; y -= 2;
  
  el.style.left = x + "px";
  el.style.top  = y + "px";
  el.style.display = "block";
}


//funciones de arrastre de capas

//*****************************************************************************
// Do not remove this notice.
//
// Copyright 2001 by Mike Hall.
// See http://www.brainjar.com for terms of use.
//*****************************************************************************

// Determine browser and version.

function Browser() {

  var ua, s, i;

  this.isIE    = false;
  this.isNS    = false;
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

var browser = new Browser();

// Global object to hold drag information.

var dragObj = new Object();
dragObj.zIndex = 0;

function dragStart(event, id) {

  var el;
  var x, y;

  // If an element id was given, find it. Otherwise use the element being
  // clicked on.

  if (id)
    dragObj.elNode = document.getElementById(id);
  else {
    if (browser.isIE)
      dragObj.elNode = window.event.srcElement;
    if (browser.isNS)
      dragObj.elNode = event.target;

    // If this is a text node, use its parent element.

    if (dragObj.elNode.nodeType == 3)
      dragObj.elNode = dragObj.elNode.parentNode;
  }

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Save starting positions of cursor and element.

  dragObj.cursorStartX = x;
  dragObj.cursorStartY = y;
  dragObj.elStartLeft  = parseInt(dragObj.elNode.style.left, 10);
  dragObj.elStartTop   = parseInt(dragObj.elNode.style.top,  10);

  if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0;
  if (isNaN(dragObj.elStartTop))  dragObj.elStartTop  = 0;

  // Update element's z-index.

  dragObj.elNode.style.zIndex = ++dragObj.zIndex;

  // Capture mousemove and mouseup events on the page.

  if (browser.isIE) {
    document.attachEvent("onmousemove", dragGo);
    document.attachEvent("onmouseup",	dragStop);
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS) {
    document.addEventListener("mousemove", dragGo,   true);
    document.addEventListener("mouseup",   dragStop, true);
    event.preventDefault();
  }
}

function dragGo(event) {

  var x, y;

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Move drag element by the same amount the cursor has moved.

  dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px";
  dragObj.elNode.style.top  = (dragObj.elStartTop  + y - dragObj.cursorStartY) + "px";

  if (browser.isIE) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS)
    event.preventDefault();
}

function dragStop(event) {

  // Stop capturing mousemove and mouseup events.

  if (browser.isIE) {
    document.detachEvent("onmousemove", dragGo);
    document.detachEvent("onmouseup",	dragStop);
  }
  if (browser.isNS) {
    document.removeEventListener("mousemove", dragGo,	true);
    document.removeEventListener("mouseup",   dragStop, true);
  }
}

function openWhois(url){
	window.open(url, '_blank', 'width=670,height=460,resizable=yes,scrollbars=yes'); 
}

function showHide(id){
	node=docId(id);
	if(node.className=='show'){
		node.className='noshow'
	}else{
		node.className='show';
	}
}

function copiaDatos(num, check){
	var campos=0;
	var emptyFailed=0;
	arrayCampos = new Array("Nombre","Email","Telefono","Fax","Direccion","Localidad","Provincia","CP","Cod_Pais","NIF","Forma_Juridica");
	arrayTipos= new Array("Gen","Email","Tel","Fax","Gen","Gen","Gen","CP","Gen","CIFNIF","Gen");
	
	recorre=arrayCampos.length;
	
	for(i=0;i<recorre;i++){ //comprobacion previa de campos vacios o invalidos
			campoTit='Titular_'+arrayCampos[i]+num;
			campoCA='CA_'+arrayCampos[i]+num;
			if(docId(campoTit)&&docId(campoCA)){
				campos++;
				
				
				
				if( !comprueba2(docId(campoTit), arrayTipos[i])  || !docId(campoTit).value!=''  ){emptyFailed++;}
				
				if(arrayCampos[i]=="Fax"){ //caso especial fax, puede ir vacio, así que le quitamos el emptyfailed que habriamos añadido antes
					if(docId(campoTit).value=='')emptyFailed--;
				}
				//if(docId(campoTit).value==''){emptyFailed++;}
			}	
	
		}//comprobacion previa de campos vacios
		caInfo=docId('ca_info'+num);
		if(emptyFailed>0){
			showMessage(num,'ca','error');
		}else{
			for(i=0;i<recorre;i++){
				campoTit='Titular_'+arrayCampos[i]+num;
				campoCA='CA_'+arrayCampos[i]+num;
				if(docId(campoTit)&&docId(campoCA)){
					docId(campoCA).value=docId(campoTit).value;
				}
				if((arrayCampos[i]=='Cod_Pais')&&docId(campoCA)){ //hay pais
					nodoPais=docId(campoTit);
				}
			}
			showMessage(num,'ca','notif','t');
		}
	
	check.checked=false;
}

//funciones comprobacion automatica de campos en dominios
regEmail=/^([a-zA-Z0-9_'+*$%\^&!\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9:]{2,4})+$/;
regCP=/^\w{1,8}$/;
regCPEs=/^\d{5}$/;
regTelEs=/^(\+34\s)?(\d|\s){9,14}$/;
regFaxEs=regTelEs;
regTel=/^(\+\d{2,3}\s)?(\d|\s){4,16}$/; //tel fax internacional, más abierto
regFax=regTel;
regCIFNIF=/^((X|\d{1})\d{7}[A-Za-z]{1})|([A-Za-z]{1}\d{8})$/;
regGen='';
					
ejCP='Ej: 28888';
ejCPEs=ejCP;
ejTel='Ej: +34 999888777';
ejFax='Ej: +34 999888777';
ejEmail='Ej: nombre@sudominio.com';
ejEmailCat='Ej: nombre@sudominio.com';
ejCIFNIF='Ej: 12345678Z ó B12345678';
ejGen='Este campo debe rellenarse';
					
errorCP='El codigo postal no es correcto; no debe superar los ocho caracteres.';
errorCPEs='El codigo postal para España no es correcto; debe tener 5 dígitos.';
errorTel='El télefono no es correcto. Ej España: +34 999888777';
errorTel9='El télefono no es correcto, no tiene 9 dígitos';
//errorTelEs='El formato de telefono debe ser internacional ej: +34 999999999';
errorFax='El formato de fax debe ser internacional. Ej España: +34 999888777';
errorFax9='El fax no es correcto, no tiene 9 dígitos';
errorEmail='El email introducido no es correcto. <br />Ej: nombre@sudominio.com';
errorEmailCat='Debe introducir un mail operativo para registrar el dominio.';
errorCIFNIF='El formato de NIF no es correcto. ej: 12345678Z ó B12345678';
errorNIFLetra='La letra del NIF no se corresponde con su numero.';
errorCIFLetra='La letra del NIF no se corresponde con su numero.';
errorCIFGen='El NIF introducido no es correcto.';
errorGen='Este campo no se puede dejar vacio.';
					
function campoOK(inp, msj){
	id=inp.id;
	if(docId('h_'+id)){
		docId('h_'+id).style.color='';
		docId('h_'+id).innerHTML=msj;
	}
	docId('label_'+id).parentNode.className='ok';
}

function campoKO(inp, error){
	id=inp.id;
	if(docId('h_'+id)){
		docId('h_'+id).style.color='red';
		docId('h_'+id).innerHTML=error;
	}
	docId('label_'+id).parentNode.className='error';
}

function compruebaCIFNIF(nif){
	if(nif.search(/^(X|\d{1})\d{7}[A-Za-z]{1}$/)!=-1){ //DNI
		var primeraLetra=nif.substring(0,1).toUpperCase();
  		if(primeraLetra=="X"){
      		nif="0"+nif.substring(1,9);
		}
		numero=nif.substring(0,8).replace(/^0+/, ""); //quito posibles ceros de delante paar que no haya lios con el octal
		letra=nif.substring(8,9).toUpperCase();	
		letrasNIF='TRWAGMYFPDXBNJZSQVHLCKET';
		posLetraOK = numero % 23;
		letraCorrecta = letrasNIF.substring(posLetraOK,posLetraOK+1);
		if(letra!=letraCorrecta) { return errorNIFLetra;}			
		else{ return '';}
   	}else{
		cif=nif;
		//CIF
		   /* Correspondencia de las letras del CIF:
             A - Sociedades Anónimas
             B - Sociedades de responsabilidad limitada
             C - Sociedades colectivas
             D - Sociedades comanditarias
             E - Comunidades de bienes
             F - Sociedades cooperativas
             G - Asociaciones y otros tipos no definidos
             H - Comunidades de propietarios
             P - Corporaciones locales
             Q - Organismos autónomos
             S - Organos de la administración
             K, L y M - seguramente para compatibilidad con formatos antiguos
             X - Extranjeros, que en lugar del D.N.I. tienen el N.I.E.
        */
        var letrasCIF='ABCDEFGHPQSKLMX';
        // La primera ha de ser una letra válida...
        var primeraLetra=cif.substring(0,1).toUpperCase();
        if( letrasCIF.indexOf(primeraLetra) == -1) {
            return errorCIFLetra;
        }

        // CIF 'normal'...
        else {
            //A58818501 --> x5881850x --> 8 + 1 + 5
            var suma=parseInt(cif.substring(2,3)) + parseInt(cif.substring(4,5)) + parseInt(cif.substring(6,7));
            for(var n=1; n<=4; n++) {
                suma+= ((2* parseInt(cif.substring(2*n-1,2*n)))%10) + Math.floor((2*parseInt(cif.substring(2*n-1,2*n)))/10);
            }
            control=10-(suma % 10);
            // Organismos públicos
            if(primeraLetra=="P" || primeraLetra=="S") {
               if(cif.substring(8,9)==String.fromCharCode(64+control)) return '';
			   else return errorCIFGen;
            }
            // Resto de CIFs
            else {
                if(control==10)
                    control=0;
                if(cif.substring(8,9)==""+control) return '';
				else return errorCIFGen;
            }
        }
    	return errorCIFGen;
	}
}

function comprueba(input, tipo){

	regExp=eval('reg'+tipo);
						
	if(tipo=='Tel'||tipo=='Fax'||tipo=='CP'){
		primeraLetra=input.id.substring(0,1);
							
		if(primeraLetra=='T'){ campo='Titular_'}
			else{ campo='CA_'}
						
			number=input.id.match(/\d$/g);
			pais=campo+'Cod_Pais'+number[0];
					
					
			if(docId(pais)){		
				if(docId(pais).value=='ES'){
					regExp=eval('reg'+tipo+'Es');
					if(tipo=='CP') tipo='CPEs';
				}
			}
		}
		
		
		res=input.value.search(regExp);
		
		/* hec - compruebo que sea un email, que sea un .cat y que se haya usado
		el dominio a registrar como mail. Ej perro.cat y mail luis@perro.cat*/
		if(res==0){
			if(input.name.split('Email')[1]){ //cgomez - comprobación previa que evita errores en resto de campos no email, quizas sea error de concepto
				var arrayCat=getDomMulti(input.name.split('Email')[1]).split('.');
				if(tipo=='Email' && arrayCat[arrayCat.length-1]=='cat' && input.value.indexOf(getDomMulti(input.name.split('Email')[1]))!= -1){
					res=1;
					tipo='EmailCat';
				}
			}
		}
		/*fin comprobacion email cat*/
		
		if(res==0){
			campoOK(input, eval('ej'+tipo));
			
			if(tipo=='CIFNIF'&&compruebaCIFNIF(input.value)!=''){//caso especial DNI, comprobacion especifica
				campoKO(input, compruebaCIFNIF(input.value));
			}
							
			if(tipo=='Fax'||tipo=='Tel'){
				faxTel=input.value;
				
				if(docId(pais)){
					if(docId(pais).value=='ES'){ //caso especial telefono de España
						
						prefijo=input.value.substring(0,4);
						
						if(prefijo=='+34 '){
							faxTel=faxTel.substring(4,faxTel.length);
						}
						faxTel=faxTel.replace(/\s/g,'');
						if(faxTel.length!=9){
							campoKO(input, eval('error'+tipo+'9'));
						}
						
						if(prefijo=='+34 '){faxTel=prefijo+faxTel;}
						input.value=faxTel;
						
						
					}else{
						if((faxTel.search(/^(\+\d{2,3}\s)/))==0){
							resMatch=faxTel.match(/^(\+\d{2,3}\s)/);
							prefijo=resMatch[0];
							numFaxTel=faxTel.replace(prefijo,'');
							numFaxTel=numFaxTel.replace(/\s/g,'');
							input.value=prefijo+numFaxTel;
						}else{
							faxTel=faxTel.replace(/\s/g,'');
							input.value=faxTel;
						} 
					}
				}
			}
		}else{
			campoKO(input, eval('error'+tipo));
		}
						
		if(tipo=='Fax'&&input.value==''){//caso especial Fax puede ir vacio al no ser obligatorio
			campoOK(input, eval('ej'+tipo));
		}
		
		if(tipo=='Gen'&&input.value!=''){ //resto de casos, solo se comprueba que este lleno
			campoOK(input, '');
		}else if(tipo=='Gen'&&input.value==''){
			campoKO(input, errorGen);
		}
	}


function comprueba2(input, tipo){

	regExp=eval('reg'+tipo);
						
	if(tipo=='Tel'||tipo=='Fax'||tipo=='CP'){
		primeraLetra=input.id.substring(0,1);
							
		if(primeraLetra=='T'){ campo='Titular_'}
		else{ campo='CA_'}
						
			number=input.id.match(/\d$/g);
			pais=campo+'Cod_Pais'+number[0];
					
			if(docId(pais).value=='ES'){
				regExp=eval('reg'+tipo+'Es');
				if(tipo=='CP') tipo='CPEs';
			}
		}
		
		res=input.value.search(regExp);
		
		if(res==0){
			return true;
			
			if(tipo=='CIFNIF'&&compruebaCIFNIF(input.value)!=''){//caso especial DNI, comprobacion especifica
				return false;
			}
							
			if(tipo=='Fax'||tipo=='Tel'){
				faxTel=input.value;
				if(docId(pais).value=='ES'){ //caso especial telefono de España
					prefijo=input.value.substring(0,4);
					
					if(prefijo=='+34 '){
						faxTel=faxTel.substring(4,faxTel.length);
					}
					faxTel=faxTel.replace(/\s/g,'');
					if(faxTel.length!=9){
						return false;
					}
					
					if(prefijo=='+34 '){faxTel=prefijo+faxTel;}
					input.value=faxTel;
					
					
				}else{
					if((faxTel.search(/^(\+\d{2,3}\s)/))==0){
						resMatch=faxTel.match(/^(\+\d{2,3}\s)/);
						prefijo=resMatch[0];
						numFaxTel=faxTel.replace(prefijo,'');
						numFaxTel=numFaxTel.replace(/\s/g,'');
						input.value=prefijo+numFaxTel;
					}else{
						faxTel=faxTel.replace(/\s/g,'');
						input.value=faxTel;
					} 
				}
			}
		}else{
			return false;
		}
						
		if(tipo=='Fax'&&input.value==''){//caso especial Fax puede ir vacio al no ser obligatorio
			return true;
		}
		
		if(tipo=='Gen'&&input.value!=''){ //resto de casos, solo se comprueba que este lleno
			return true;
		}else if(tipo=='Gen'&&input.value==''){
			return false;
		}
	}
	
	
function showMessage(pos,typeDomain,typeInfo,typeData){
	if(typeData=='c'){tipo='cliente';}
	else{tipo='titular';}
	
	if(typeInfo=='notif'){
		text='Los datos de '+tipo+' se han copiado correctamente.';
	}else{
		text='No se pueden copiar los datos del titular ya que algunos datos obligatorios no están rellenos o no son correctos.';
	}
	infoPar=docId(typeDomain+'_info'+pos);
	//location.href='#h1_'+pos;
	infoPar.className=typeInfo;
	infoText=document.createTextNode(text);
	if(infoPar.lastChild){infoPar.removeChild(infoPar.lastChild);}
	infoPar.appendChild(infoText);	
	setTimeout('infoPar.className=\'noshow\'',8000);
}

function getDomMulti(num){ //ñapa
	//alert(num);
	domMulti='';
	h1Node=docId('h1_'+num);
	h1spanChilds=h1Node.getElementsByTagName('span');
	
	for(i=0;i<h1spanChilds.length;i++){
		if(h1spanChilds[i].className=='product_domain'){
			domMulti=h1spanChilds[i].innerHTML;
		}
	}
	return domMulti;
}


function checkCarrito(){
	if(docId('num_prod_cart')){ //plantillas sin count.php no lo llaman
        if(num_products>0){
            docId('text_cart').innerHTML='Carrito';
            docId('link_cart').href='shopping-cart.php';
            docId('link_cart').title='Carrito';
            docId('num_prod_cart').innerHTML="("+num_products+")";
        }
    }
}

function addEvent(obj, evType, fn){
  if (obj.addEventListener){
    obj.addEventListener(evType, fn, true);
    return true;
  } else if (obj.attachEvent){
  	var r = obj.attachEvent("on"+evType, fn);
    return r;
  } else {
  	return false;
  }
}
addEvent(window, "load", checkCarrito);
