  function errorTip(theID,theMsg){
  new Tip(theID, theMsg,{
  style: 'protoblue',
  stem: 'leftMiddle',
  fixed: true,
  hideAfter: 5,
  hideOn: false,
  showOn: 'click',
  radius:3,
  border:3,
  hook: { target: 'rightMiddle', tip: 'leftMiddle' },
  width: 200
});

	  $(theID).prototip.show(); 
	  }

  function errorTipLeft(theID,theMsg){
  new Tip(theID, theMsg,{
  style: 'protoblue',
  stem: 'rightMiddle',
  fixed: true,
  hideAfter: 5,
  hideOn: false,
  showOn: 'click',
  radius:3,
  border:3,
  hook: { target: 'leftMiddle', tip: 'rightMiddle' },
  width: 200
});
	  $(theID).prototip.show(); 
	  }

  function emailNoValido(){
	  errorTip('email','<strong>Email invalido: </strong>Revisa que sea correcto.');
	  }
  function emailNoDisponible(){
	  errorTip('email','<strong>Ya existe una cuenta con el email ingresado.</strong><br>Puedes cambiar tu contraseņa haciendo <a href="http://perfilunico.com/?logic=recuperar" target="_blank">click aqui</a>.');
	  }
  function usernameNoValido(){
	  errorTip('username','Solo letras minusculas, numeros y _');
	  }
  function usernameNoDisponible(){
	  errorTip('username','<strong>ya existe una cuenta con ese nombre de usuario</strong>');
	  }
  function passwordInvalido(){
	  errorTip('password','Las contrase&ntilde;as no coinciden.');
	  }
  function removeErrorTips01(){
	  try{
			Tips.remove('username');
			Tips.remove('password');
			Tips.remove('email');
		  }catch(e){}
	  }
function step01Send(){
  removeErrorTips01();
  switchLoader('ajaxStep1');
  goAJAX('ajaxStep1','ajax.php','c=reg.step1&'+akiSfrm('frmStep1'),'switchLoader2(\'ajaxStep1\');eval(respuesta);setTimeout(\'removeErrorTips01()\',8000);','','0','0');
  return false;
}

function loadRegions(id){
	get('tr_regiones').style.display='';
	get('tr_ciudades').style.display='none';
	goAJAX('dynRegions','ajax.php','c=reg.step2&acc=loadRegions&id='+id);
	}
function loadCiudades(id){
	get('tr_regiones').style.display='';
	get('tr_ciudades').style.display='';
	goAJAX('dynCiudades','ajax.php','c=reg.step2&acc=loadCiudades&id='+id);
}


function errorPais(){
  errorTip('id_pais','Selecciona tu pais.');
  }
function errorRegiones(){
  errorTip('id_region','Selecciona tu region.');
  }
function errorCiudades(){
  errorTip('id_ciudad','Selecciona tu ciudad.');
  }
function errorCodigoP(){
  errorTip('codigo_postal','Ingresa tu codigo postal.');
  }

function step02Send(){
	 switchLoader('ajaxStep2');
	  goAJAX('ajaxStep2','ajax.php','c=reg.step2&'+akiSfrm('frmStep2'),'switchLoader2(\'ajaxStep2\');eval(respuesta);','','0','0');
	  return false;
}

  function ocuError(){
	  errorTip('ocu_id','Selecciona tu ocupaci&oacute;n');
	  }
  function secError(){
	  errorTip('sec_id','Selecciona tu sector');
	  }
  function fechaError(){
	  errorTip('yob','Ingresa tu fecha de nacimiento');
	  }
  function sexoError(){
	  errorTip('sexo','Selecciona tu g&eacute;nero');
	  }
	  
  function step03Send(){
	  switchLoader('ajaxStep3');
	  goAJAX('ajaxStep3','ajax.php','c=reg.step3&'+akiSfrm('frmStep3'),'switchLoader2(\'ajaxStep3\');eval(respuesta);','','0','0');
	  return false;
	  }
  function step04Send(){
	  switchLoader('ajaxStep4');
	  goAJAX('ajaxStep4','ajax.php','c=reg.step4&'+akiSfrm('frmStep4'),'switchLoader2(\'ajaxStep4\');eval(respuesta);','','0','0');
	  return false;
	  }  
function chkAddRemoveText(obj,val,desID){
	val='x'+val+'x';
	get(desID).value=str_replace(','+val,'',get(desID).value);
	get(desID).value=str_replace(''+val,',',get(desID).value);
	get(desID).value=str_replace(',,',',',get(desID).value);
	if (obj.checked==true){
		get(desID).value=get(desID).value+','+val;
		}
}
function errorCantIntereres(){
  new Tip('infoIntereses', 'Selecciona al menos 3 temas',{
  style: 'protoblue',
  stem: 'leftMiddle',
  fixed: true,
  hideAfter: 5,
  hideOn: false,
  showOn: 'click',
  hook: { target: 'rightMiddle', tip: 'leftMiddle' },
  width: 150
});
	  $('infoIntereses').prototip.show();
	}
function step05Send(){
  switchLoader('ajaxStep5');
  goAJAX('ajaxStep5','ajax.php','c=reg.step5&'+akiSfrm('frmStep5'),'switchLoader2(\'ajaxStep5\');eval(respuesta);','','0','0');
  return false;
  }
function tipLogo(){
try{
  new Tip('header_logo', '<p>1- Una cuenta de usuario <strong>ųnica</strong> para todos los sitios integrados. </p>  <p>2- Un perfil donde dar a conocer tus otros perfiles.</p>  <p>3- Aplicaciones &uacute;tiles para mejorar tu experiencia en Internet.</p>',{
  title: 'Perfil Unico es:',
  style: 'azulblanco',
  stem: 'topLeft',
  radius:3,	
  border:3,
  fixed: true,
  offset: { x: -100, y: -30 },
  hook: { target: 'bottomRight', tip: 'topLeft' },
  width: 340
});
}catch(e){}
}

function errorAutoriza(){
 errorTipLeft('chk_autoriza2','Debes marcar la casilla de verificacion.');	
}
function step06Send(){
  goAJAX('','ajax.php','c=reg.step6&'+akiSfrm('frmStep6'),'eval(respuesta);','','0','0');
  return false;
  }

function switchLoader(hideDiv){
	$(hideDiv).style.display='none';
	$('loaderSWajax').style.display='';
	}
function switchLoader2(hideDiv){
	$(hideDiv).style.display='';
	$('loaderSWajax').style.display='none';
	}
function initStepX(X){
	Tips.hideAll();
	$('sMain2').innerHTML='<div id="ajaxStep' + X + '"></div>';
	 goAJAX('ajaxStep'+X,'ajax.php','c=reg.step'+X);
	}
	
function popVinc(locStr,provider){
/*	window.open(locStr,provider,'width=950,height=600,scrollbars=auto,menubar=no,status=no,toolbar=no,location=yes,directories=no,resizable=yes');
	return false;*/
	return true;
}

function validateCampaigns(){
	var err = '';
	var add_fields = '';
	var campaigns = '';
    var arrayCFXSelects=$$('.cfx_ci');
	var arrayCFXNames=$$('.cfx_cn');
	var j =0;
	for (i=0;i<arrayCFXSelects.length;i++){
		j++;
		var id=str_replace('cfx_c','',(arrayCFXSelects[i]).id);
		if((arrayCFXSelects[i]).value==''){
			err += "Seleccione si desea o no participar en "+ $('cfx_cn'+id).value+".\n";
		}else if((arrayCFXSelects[i]).value=='1'){
			campaigns+=(arrayCFXSelects[i]).id+',';
		}
		try{
			if($('cfx_lista'+id).value=='-1' && $('cfx_c'+id).value=='1'){
				err += "Seleccione el criterio adicional de "+ $('cfx_cn'+id).value+".\n";
				}else{
					add_fields+='&lista='+$('cfx_lista'+id).value;
					}
		}catch(e){}
	}
	if(err==''){
		$('campaigns').value=''+campaigns+add_fields;
		//goAJAX('','ajax.php?c=reg.coreg','campaigns='+campaigns+add_fields,'$(\'frmReg\').submit()','','0','0');
		return true;
	}else{
		alert(err);
		return false;
	}
}



function validateCampaigns2(){
	var err = '';
	var add_fields = '';
	var campaigns = '';
    var arrayCFXSelects=$$('.cfx_ci');
	var arrayCFXNames=$$('.cfx_cn');
	var j =0;
	for (i=0;i<arrayCFXSelects.length;i++){
		j++;
		var id=str_replace('cfx_c','',(arrayCFXSelects[i]).id);
		if((arrayCFXSelects[i]).value==''){
			err += "Seleccione si desea o no aceptar la campaņa "+ $('cfx_cn'+id).value+".\n";
		}else if((arrayCFXSelects[i]).value=='1'){
			campaigns+=(arrayCFXSelects[i]).id+',';
		}
		try{
			if($('cfx_lista'+id).value=='-1' && $('cfx_c'+id).value=='1'){
				err += "Seleccione el criterio adicional de "+ $('cfx_cn'+id).value+".\n";
				}else{
					add_fields+='&lista='+$('cfx_lista'+id).value;
					}
		}catch(e){}
	}
	if(err==''){
		//goAJAX('','ajax.php?c=reg.coreg','campaigns='+campaigns+add_fields,'$(\'frmReg\').submit()','','0','0');
		goAJAX('','ajax.php?c=reg.coreg','campaigns='+campaigns+add_fields,'alert(respuesta);','','0','0');
		//alert(campaigns+add_fields);
		return false;
	}else{
		alert(err);
		return false;
	}
}


