function enviarInscripcion(){

	var forma = document.forms.inscripcion;
	var msj = "";

	if (forma.empresa.value=="")
		msj += "El campo Empresa es obligatorio\n";

	if (forma.nombre.value=="")
		msj += "El campo Nombre es obligatorio\n";

	if (forma.cargo.value=="")
		msj += "El campo Cargo es obligatorio\n";

	if (forma.telefono.value=="")
		msj += "El campo Telefono es obligatorio\n";

	if (!validaEmail(forma.email.value))
		msj += "El campo Email debe tener un valor valido\n";


	if (msj!="")
		alert(msj);
	else{
		 procesoAjaxForm('inscripcion','respuestaInscripcion','Enviando...');

		new PeriodicalExecuter(function(pe) {

			//VALIDAMOS ESTE OBJETO PARA HACER REDIRECCION  SELECCIONAR EL PREMIO
			if ($('respuesta')!=null){
				closeDialog();
				pe.stop();
			}

		}, 1.5);

	}

}

function validaEmail(email){

	var error = "";
	var regEx = new RegExp("^[\\w\.=-][^+]+@([\\w\-]+\\.)+[a-z]{2,4}$");
	if(!regEx.test(email))
		return false;

	return true;
}

function cambiarEstilo(tipo){

	var indiceCSS = getCookie("indiceCSS");
	var indice;
	indice = 0;
	if (typeof(indiceCSS)=="string");
		indice = parseInt(indiceCSS);


	var obj = $("tamanoTexto");
	var nuevoIndice = 0;

	if (tipo=="+")
		nuevoIndice = indice + 1;
	else if (tipo=="-")
		nuevoIndice = indice - 1;
	else if (tipo=="normal")
		nuevoIndice = 0;


	if (nuevoIndice==0){
		setActiveStyleSheet('normal');
	}
	else if (nuevoIndice>=-2 && nuevoIndice<=2){
		setActiveStyleSheet('estilo' + nuevoIndice);
	}

	if (nuevoIndice>=-2 && nuevoIndice<=2)
		setCookieLT("indiceCSS", nuevoIndice,1000000);


}

function setCookie(name, value, expires, path, domain, secure)
{
  document.cookie =
    name+"="+escape(value)+
    (expires ? "; expires="+expires.toGMTString() : "")+
    (path    ? "; path="   +path   : "")+
    (domain  ? "; domain=" +domain : "")+
    (secure  ? "; secure" : "");
}

// ***** setCookieLT *****
// PARAMETERS: lifetime - cookie lifetime in seconds
function setCookieLT(name, value, lifetime, path, domain, secure)
{
  if (lifetime) lifetime = new Date(Date.parse(new Date())+lifetime*1000);
  setCookie(name, value, lifetime, path, domain, secure);
}

// ***** getCookie *****
function getCookie(name)
{
  var cookie, offset, end;
  cookie  = " "+document.cookie;
  offset  = cookie.indexOf(" "+name+"=");
  if (offset == -1) return undefined;
  offset += name.length+2;
  end     = cookie.indexOf(";", offset)
  if (end    == -1) end = cookie.length;
  return unescape(cookie.substring(offset, end));
}

// ***** delCookie *****
function delCookie(name, path, domain)
{
  if (getCookie(name))
    setCookie(name, "", new Date("January 01, 2000 00:00:01"), path, domain);
}


function logoutBuzon(){
	forma = document.buzon_form;
	forma.p_options.value = 'logout';
	forma.submit();

}

function descargar(archivo){
	location.href="../plugins/buzon/descarga.php?accion=descargar&id=" + archivo;
}

function recordarClaveBuzon(){
	forma = document.buzon_form;
	if (forma.usuario_buzon.value=="")
		alert("El campo usuario es obligatorio.");
	else{
		forma.p_options.value = 'recordarClave';
		forma.submit();
	}
}
