var http_request = false;
var agregar = false;
var reporto = false;

function ValidateBusqueda(palabra)
{
	var palabra = trim(palabra.value);
	var length = palabra.length;

	if (length < 3) // Debe Tirar Error.
	{
		alert('Debe ingresar 3 caracteres o más.');
		return false;
	}
	else // Debe hacer Submit.
	{
		document.formBusqPalabra.submit();
		return true;
	}
}
function RollOver(id, src)
{
	document.getElementById(id).src = src;
}
function insertAviso()
{
	document.getElementById('dm404').value = 1;
	document.dmformaparte.submit();

}

function ValidateBusquedaDM(palabra)
{
	var palabra = trim(palabra.value);
	var length = palabra.length;

	if (length < 3) // Debe Tirar Error.
	{
		alert('Debe ingresar 3 caracteres o más.');
		return false;
	}
	else // Debe hacer Submit.
	{
		document.formBusqPalabraDM.submit();
		return true;
	}
}

function filtrarOptions(opt, comboZona, comboSubZona, dia, mes, anio)
{
	http_request = false;

	if (window.XMLHttpRequest)
	{ // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
			// Ver nota sobre esta linea al final
		}
	} else if (window.ActiveXObject) { // IE
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}

	if (!http_request) {
		alert('Falla :( No es posible crear una instancia XMLHTTP');
		return false;
	}

	variablesPost = "opt=" + opt;
	if(comboZona != undefined && comboSubZona != undefined)
	{
		idZona = document.getElementById(comboZona).value;
		idSubZona = document.getElementById(comboSubZona).value;

		if(idSubZona == 0)
		{
			variablesPost += "&drpZona=" + idZona;
		}
		else
		{
			variablesPost += "&drpZona=" + idZona + "&drpSubZona=" + idSubZona;
		}
	}

	http_request.onreadystatechange = filtrar;
	http_request.open("POST", "/getavisos.php?dia="+dia+"&mes="+mes+"&anio="+anio,true);
	http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	http_request.send(variablesPost);
}

function filtrar()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{
			document.getElementById('contenedor').innerHTML = http_request.responseText;
		}
		else
		{
			alert('Hubo problemas con la petición.');
		}
	}
}

function var_dump(objeto, vista)
{
	var res = '';
	for (i in objeto)
	{
		res += "\t["+i+"] => "+objeto[i]+" \n";
	}

	if (!vista)
	{
		myWindow = window.open('','','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=800,height=800');
		myWindow.document.write("<pre>\ndebug\n{\n"+res+'\n}\n</pre>');
		myWindow.focus();
	}
	else
	{
		eval(vista+"(res);");
	}
}

var control = 0;
function pasarMes(mesPasar, anioPasar, dia, mes, anio)
{
	http_request = false;

	if (window.XMLHttpRequest)
	{ // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
			// Ver nota sobre esta linea al final
		}
	} else if (window.ActiveXObject) { // IE
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}

	if (!http_request) {
		alert('Falla :( No es posible crear una instancia XMLHTTP');
		return false;
	}

	http_request.onreadystatechange = moverCalendario;

	http_request.open("POST", "/rshome.php?dia=" + dia + "&mes=" + mes + "&anio=" + anio, true);
	http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	http_request.send("mesPasar=" + mesPasar + "&anioPasar=" + anioPasar + "&ajax=1");
}

function moverCalendario()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{
			document.getElementById('calendario').innerHTML = http_request.responseText;
		}
		else
		{
			alert('Hubo problemas con la petición.');
		}
	}
}

function Buscar()
{
	document.getElementById('busquedaavanzada').action = 'buscador';
	document.busquedaavanzada.submit();
}

function BuscarDM()
{
	var DrpCatPadres = document.getElementById('DrpCategoriasPadres').selectedIndex;
	var DrpCatHijas = document.getElementById('DrpCategorias').selectedIndex;
	var TxtTitulo = document.getElementById('TxtTitulo').value;
	var DrpZona = document.getElementById('drpZona').selectedIndex;
	var DrpSubZona = document.getElementById('drpSubZona').selectedIndex;

	if ((DrpCatPadres != 0) && (DrpCatHijas == 0) && (TxtTitulo.length == 0) && (DrpZona == 0) && (DrpSubZona == 0))
	{
		document.getElementById('divErroresBusqAv').style.display = 'block';
		document.getElementById('divErroresBusqAv').innerHTML = 'Debe seleccionar una sub categoría.';
	}
	else
	{
		if ((DrpCatPadres == 0) && (DrpCatHijas == 0) && (TxtTitulo.length == 0) && (DrpZona == 0) && (DrpSubZona == 0))
		{
			document.getElementById('divErroresBusqAv').style.display = 'block';
			document.getElementById('divErroresBusqAv').innerHTML = 'Debe seleccionar un item de búsqueda.';
		}
		else
		{
			document.getElementById('divErroresBusqAv').style.display = 'none';
			document.getElementById('dmbusquedaavanzada').action = 'dm-buscador';
			document.dmbusquedaavanzada.submit();
		}

	}
}

function yoVoy(pagina, idAviso, fecha, dia, mes, anio)
{
	idVan = idAviso;
	http_request = false;

	if (window.XMLHttpRequest)
	{ // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
			// Ver nota sobre esta linea al final
		}
	} else if (window.ActiveXObject) { // IE
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}

	if (!http_request) {
		alert('Falla :( No es posible crear una instancia XMLHTTP');
		return false;
	}

	http_request.onreadystatechange = voyAlEvento;

	http_request.open("POST", "/"+pagina+'?dia='+dia+'&mes='+mes+'&anio='+anio,true);
	http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

	if (fecha == false)
	{
		http_request.send("idAviso="+idAviso);
	}
	else
	{

		http_request.send("idAviso="+idAviso+"&fecha="+fecha);
	}
}

function voyAlEvento(idAviso)
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{
			document.getElementById('van'+idVan).innerHTML = http_request.responseText;
		}
		else
		{
			alert('Hubo problemas con la petición.');
		}
	}
}

/*
* Funciones para el manejo de Pedidos por Ajax
*/
var ajaxRequest = false;

function builtAjax()
{
	if (window.XMLHttpRequest)
	{ // Mozilla, Safari, ...
		ajaxRequest = new XMLHttpRequest();
		if (ajaxRequest.overrideMimeType)
		{
			//ajaxRequest.overrideMimeType('text/xml');
			// See note below about this line
		}
	}
	else if (window.ActiveXObject)
	{ // IE
		try {
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try {
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) {}
		}
	}
	return ajaxRequest;
}

//function de testeo
function print_r(obj,vista)
{
	var out = "";
	var txt = "";
	var nli = "\n";
	var tab = "\t";
	var ret = "\r";
	var erg = "";

	if(obj)
	{
		txt = "["+typeof(obj)+"] => "+obj.name+nli+"{"+nli;
		if(typeof(obj) == "object")
		{
			for(i in obj)
			{
				txt += nli+tab+'['+i+'] => '+((typeof(obj[i]) == "function")?"function "+obj[i].name+"()":obj[i]);
				if (obj[i])
				{
					txt += nli+tab+"{";
					if(typeof(obj[i]) == "object")
					{
						if (obj[i].length > 0)
						{
							for(n in obj[i])
							{
								if(obj[i][n]) txt += nli+tab+tab+'['+n+'] => '+((typeof(obj[i][n]) == "function")?"function "+obj[i][n].name+"()":obj[i][n]);
							}
						}
					}
					else if(typeof(obj[i]) == "string")
					{
						txt += nli+tab+tab+'['+typeof(obj[i])+'] => "'+obj[i]+'"';
					}
					txt += nli+tab+"}";
				}
			}
		}
		else
		{
			txt += tab+'['+typeof(obj)+'] => "'+obj+'"';
		}

		erg = /\{[\s]*\}[\s]*/g;
		txt = txt.replace(erg, "");
		txt += ret+"}";
	}
	else
	{
		txt += "NULL or UNDEFINED";
	}

	switch(vista)
	{
		case 2:
		out = window.open('','debug','');
		out.document.write("<pre>"+txt+"</pre>");
		break;
		default:
		alert(txt);
		break;
	}
	return false;
}

/*
* Carga de Localidades en un combobox por Ajax
* funciones para la carga de combobox de provincias y sus localidades
*/
function generarListadoLocs(idProv)
{
	if(!locs[idProv])
	{
		cargLocs(idProv);
	}
	else
	{
		cargarOpcionesLocs(false,idProv,false);
	}
}

function cargLocs(id, selectedValue)
{
	var res = false;
	_ajax = builtAjax();
	
	if(_ajax)
	{
		_ajax.onreadystatechange=function()
		{
			if (_ajax.readyState == 4)
			{
				if (_ajax.status == 200)
				{
					cargarOpcionesLocs(_ajax.responseText,id,true, selectedValue);
				}
			}
		}

		_ajax.open("POST", '/rsagendaupload.php',true);
		_ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		_ajax.send('l=1&v='+parseInt(id));
	}
}

function cargarOpcionesLocs(arrLocs,idProvinc,decoJson,selectedValue)
{
	idProv = idProvinc;
	var arrIdProvinc = new Array();
	var selPostLoc = false;
	if(decoJson)
	{
		arrIdProvinc = arrLocs.parseJSON();
	}
	else
	{
		arrIdProvinc = arrLocs;
	}

	if(arrLocs)
	{
		locs[idProvinc] = arrIdProvinc;
	}

	document.getElementById('loc').disabled = true;

	document.getElementById('loc').length = 0;

	document.getElementById('loc').options[0] = new Option('-- Localidad --', '0' , (locSelecc!='' ? false : true));
	
	if(idProvinc != 0)
	{
		for(var i = 0 ; i < locs[idProvinc].length ; i++)
		{
			selPostLoc = ((locSelecc == locs[idProvinc][i]['IDLOCALIDAD']) ? true : false);
	
			if(selectedValue && selectedValue == locs[idProvinc][i]['IDLOCALIDAD'])
			{
				document.getElementById('loc').options[i+1] = new Option(locs[idProvinc][i]['DENOMINACION'], locs[idProvinc][i]['IDLOCALIDAD'], selPostLoc , true);
			}
			else
			{
				document.getElementById('loc').options[i+1] = new Option(locs[idProvinc][i]['DENOMINACION'], locs[idProvinc][i]['IDLOCALIDAD'], selPostLoc);
			}
		}
	}
	
	document.getElementById('loc').disabled = false;
}

function vaciarComboLocalidades()
{
	var combo = document.getElementById('loc')
	
	for (k = 0; k < combo.options.length; k++)
	{
		combo.options[k] = null;
		
	}
	document.getElementById('loc').options[0] = new Option('-- Localidad --', '0' , true);
	
 	combo.options.length = 1;
}

function cargCombBoxFecha()
{
	var aniosMost = 10;
	var mesXsel = parseInt(mesSelecc);
	var selPostMes = false;
	var selPostAni = false;

	var nombreMes = new Array();
	nombreMes[1] = "Enero";
	nombreMes[2] = "Febrero";
	nombreMes[3] = "Marzo";
	nombreMes[4] = "Abril";
	nombreMes[5] = "Mayo";
	nombreMes[6] = "Junio";
	nombreMes[7] = "Julio";
	nombreMes[8] = "Agosto";
	nombreMes[9] = "Septiembre";
	nombreMes[10] = "Octubre";
	nombreMes[11] = "Noviembre";
	nombreMes[12] = "Diciembre";

	var date = new Array();

	for(i = 0 ; i <= aniosMost ; i++)
	{
		date[i] = new Date();
		selPostAni = (aniSelecc == parseInt(date[i].getFullYear()+i)) ? true : false;
		date[i].setFullYear(parseInt(date[i].getFullYear()+i));
		document.getElementById('anio').options[i] = new Option(date[i].getFullYear(),date[i].getFullYear(),selPostAni,selPostAni);
	}

	for(n = 0 ; n < 12 ; n++)
	{
		selPostMes = (parseInt(n+1) == mesXsel) ? true : false;
		document.getElementById('mes').options[n] = new Option(nombreMes[parseInt(n+1)],parseInt(n+1),selPostMes,selPostMes);
	}
	cargDias(false);
}

function cargDias(ctrlDia)
{
	var mesSel = document.getElementById('mes').value;
	var anioSel = document.getElementById('anio').value;
	var diaSel = document.getElementById('dia').value;
	if (ctrlDia) diaSelecc = diaSel;
	var selPostDia = false;
	var xFecha = new Date();
	xFecha.setFullYear(anioSel);
	xFecha.setMonth(parseInt(mesSel - 1));

	var numDias = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30,31, 30, 31);
	var diasMes = new Array();

	if (xFecha.getMonth()  == 1)
	{
		var year = xFecha.getYear();
		if (year % 4 == 0 && (year % 400 == 0 || year % 100 != 0))
		{
			numDias[1] = 29;
		}
		else
		{
			numDias[1] = 28;
		}
	}

	var i;
	if(pltMes.length < 28)
	{
		for (i = 1 ; i <= 31 ; i++)
		{
			selPostDia = false;
			pltMes[i] = document.getElementById('dia').options[parseInt(i - 1)] = new Option(i,i,selPostDia);
		}
	}

	if (numDias[parseInt(xFecha.getMonth())] < document.getElementById('dia').length)
	{
		document.getElementById('dia').length = numDias[parseInt(xFecha.getMonth())];
	}
	if(document.getElementById('dia').length < numDias[parseInt(xFecha.getMonth())])
	{
		for (i = document.getElementById('dia').length ; i <= numDias[parseInt(xFecha.getMonth())] ; i++)
		{
			document.getElementById('dia').options[i] = new Option(i,i,selPostDia);
		}
	}

	if(document.getElementById('dia').options[parseInt(diaSelecc - 1)])
	{
		document.getElementById('dia').options[parseInt(diaSelecc - 1)].selected = true;
	}
}

function comentariosVerTodosRS(url, idAviso)
{
	http_request = false;

	if (window.XMLHttpRequest)
	{ // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
			// Ver nota sobre esta linea al final
		}
	} else if (window.ActiveXObject) { // IE
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}

	if (!http_request) {
		alert('Falla :( No es posible crear una instancia XMLHTTP');
		return false;
	}

	http_request.onreadystatechange = cargarComentariosRS;

	http_request.open('GET', url+'?comentario=1&'+'idAviso='+idAviso, true);

	http_request.send(null);

}

function cargarComentariosRS()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{
			document.getElementById('contenido').innerHTML = http_request.responseText;
		}
		else
		{
			alert('Hubo problemas con la petición.');
		}
	}
}
function verAviso(url)
{
	window.location = url;
}

function RedirectToFeed(dia, mes, anio, idDropZona, idDropSubZona)
{
	idZona = document.getElementById(idDropZona).value;
	idSubZona = document.getElementById(idDropSubZona).value;

	queryString = 'rsfeedeventos.php?dia=' + dia + '&mes=' + mes + '&anio=' + anio + '&prov=' + idZona;
	if(idSubZona != 0)
	{
		queryString += '&loc=' + idSubZona;
	}
	window.location = queryString;

}

function ltrim(s)
{
    return s.replace(/^\s+/, "");
}

function rtrim(s)
{
    return s.replace(/\s+$/, "");
}

function trim(s)
{
    return rtrim(ltrim(s));
}

function showHide(idDiv)
{
	if (document.getElementById(idDiv).style.display == 'none')
	{
		document.getElementById(idDiv).style.display = 'block';
	}
	else
	{
		document.getElementById(idDiv).style.display = 'none';
	}
}
function ScreenOpacity(idMostrar)
{
	element = document.getElementById('layerDiv');
	element.style.display = "block";
	document.getElementById('layerDiv').style.height = document.body.clientHeight + 'px';
	document.getElementById('layerDiv').style.width = document.body.clientWidth + 'px';
	element = document.getElementById(idMostrar);
	element.style.display = "";

	var x = parseInt((window.screen.width / 2) - (element.offsetWidth / 2), 10);
	var y = parseInt((window.screen.height / 2) - (element.offsetHeight), 10);

	if (y < 0)
	{
		y = 10;

	}
	element.style.top = y + 'px';
	element.style.left = x + 'px';
	element.style.position = 'fixed';
	if (navigator.userAgent.indexOf('MSIE 6') >= 0)
	{
		element.style.position = 'absolute';
	}
}
function clearText(id)
{
	document.getElementById(id).value = '';
}

function isEmail(s)
{
	if(s.match(/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/))
	{
		return true;
	}
	return false;
}

function enviarRecomendacion(TxtEmailDestinatario, TxtNombreRemitente, TxtEmailRemitente, ChkCopia, OptEnviar, TxtComentarios, idAviso)
{
	var EmailDestinatario = document.getElementById(TxtEmailDestinatario).value;
	var NombreRemitente = document.getElementById(TxtNombreRemitente).value;
	var EmailRemitente = document.getElementById(TxtEmailRemitente).value;
	var ChkCopy = document.getElementById(ChkCopia).value;
	var OptEnviarCompl = document.getElementById(OptEnviar).checked;
	var Comentarios = document.getElementById(TxtComentarios).value;
	var arrErrores = new Array('', '', '');
	var valid = true;

	if (!isEmail(EmailDestinatario))
	{
		valid = false;
		arrErrores[0] = 'Verifique el e-mail de destinatario.<br>';
	}
	if (NombreRemitente == '')
	{
		valid = false;
		arrErrores[1] = 'Verifique el nombre de remitente.<br>';
	}
	if (!isEmail(EmailRemitente))
	{
		valid = false;
		arrErrores[2] = 'Verifique el e-mail de remitente.<br>';
	}

	if (valid)
	{
		enviarMailNota(EmailDestinatario, NombreRemitente, EmailRemitente, ChkCopy, OptEnviarCompl, Comentarios, idAviso);
		ScreenOpacity('divEnviarExito');
		document.getElementById('divCerrar').style.display = 'none';
		setTimeout("showHide('divEnviarExito');showHide('divEnviar');showHide('layerDiv');",2000);
	}
	else
	{
		showHide('divErrorEnvio');
		document.getElementById('divErrorEnvio').innerHTML = arrErrores[0] + arrErrores[1] + arrErrores[2];
	}
}

function showHideClose(idDiv)
{
	document.getElementById(idDiv).style.display = 'block';
}

function enviarMailNota(EmailDestinatario, NombreRemitente, EmailRemitente, ChkCopy, OptEnviar, Comentarios, idAviso)
{
	http_request = false;

	if (window.XMLHttpRequest)
	{ // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
			// Ver nota sobre esta linea al final
		}
	} else if (window.ActiveXObject) { // IE
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}

	if (!http_request) {
		alert('Falla :( No es posible crear una instancia XMLHTTP');
		return false;
	}

	http_request.onreadystatechange = envMailNota;

	var variablesPost = "nomRem=" + NombreRemitente + "&comentarios=" + Comentarios + "&emailRem=" + EmailRemitente + "&emailDest=" + EmailDestinatario +  "&enviar=" + OptEnviar + "&copy=" + ChkCopy;

	http_request.open("POST", "/dmfichaaviso.php?idAviso=" + idAviso, true);
	http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	http_request.send(variablesPost);
}

function envMailNota()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{
			document.getElementById('cantRecomendaciones').innerHTML = http_request.responseText;
		}
		else
		{
			alert('Hubo problemas con la petición.');
		}
	}
}

function selectAll(id)
{
	document.getElementById(id).select();
}
http_request_comentarios = false;

function verTodos(url, idAviso)
{
	http_request_comentarios = false;

	if (window.XMLHttpRequest)
	{ // Mozilla, Safari,...
		http_request_comentarios = new XMLHttpRequest();
		if (http_request_comentarios.overrideMimeType) {
			http_request_comentarios.overrideMimeType('text/xml');
			// Ver nota sobre esta linea al final
		}
	} else if (window.ActiveXObject) { // IE
		try {
			http_request_comentarios = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request_comentarios = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}

	if (!http_request_comentarios) {
		alert('Falla :( No es posible crear una instancia XMLHTTP');
		return false;
	}

	http_request_comentarios.onreadystatechange = cargarComentarios;

	http_request_comentarios.open('GET', url+'?comentario=1&'+'idAviso='+idAviso, true);

	http_request_comentarios.send(null);

}

function cargarComentarios()
{
	if (http_request_comentarios.readyState == 4)
	{
		if (http_request_comentarios.status == 200)
		{
			document.getElementById('contenido').innerHTML = http_request_comentarios.responseText;
		}
		else
		{
			alert('Hubo problemas con la petición.');
		}
	}
}

function reportarCierreMudanza(idAviso, tipoReporte, texto)
{
	http_request = false;

	if (window.XMLHttpRequest)
	{ // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
			// Ver nota sobre esta linea al final
		}
	} else if (window.ActiveXObject) { // IE
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}

	if (!http_request) {
		alert('Falla :( No es posible crear una instancia XMLHTTP');
		return false;
	}

	var variablesPost = "tipoReporte=" + tipoReporte + "&texto=" + texto;

	http_request.onreadystatechange = reportarAbuso;

	http_request.open("POST", "/dmfichaaviso.php?idAviso=" + idAviso, true);
	http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	http_request.send(variablesPost);
}

function reportarAbuso()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{
			ScreenOpacity('divReportarExito');
			document.getElementById('divCerrarReportar').style.display = 'none';
			setTimeout("showHide('divReportarExito');showHide('divReportar');showHide('layerDiv');", 2000);
			document.getElementById('linkReportar').href = 'javascript: ScreenOpacity(\'divReportado\');autoCierre();';
		}
		else
		{
			alert('Hubo problemas con la petición.');
		}
	}
}

function autoCierre(idDiv)
{
	setTimeout("showHide('divReportado');showHide('layerDiv');", 2000);
}

function openPopup(idAviso)
{
	popup = window.open('dmimprimir.php?idAviso=' + idAviso,'650x300','toolbar=no,status=no,scrolling=no,scrollbars=no,location=no,menubar=no,directories=no,resizable=yes,width=650,height=400');
}
