// Funciones 
var newwin;
function launchwin(winurl,winname,winfeatures)
{
	newwin = window.open(winurl,winname,winfeatures);
}

function publicidad()
{
var tips =window.open("http://www.epensa.com.pe/modulacionEPENSA/modulosCORREO.html","_blank","toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=auto,width=800,height=600"); 
}

function Foto_tapa()
{
var content = window.open("","popup","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,menubar=no,width=256,height=392");
var d = content.document
  d.write('<html><head><title>Portada</title></head>');
  d.write('<body bgcolor="#EF0808"  bottommargin="0" leftmargin="0" marginheight="0" marginwidth="0" rightmargin="0" topmargin="0">');
  d.write('<img src="fotos/portada_grande.gif" width="256" height="338">');
  d.write('<TABLE WIDTH="100%" BORDER=0 CELLSPACING=2 CELLPADDING=0 BGCOLOR=#EF0808>');
  d.write('</BR>');
  d.write('<TR><TD align=center><INPUT type="button" value="Cerrar" onClick="self.close();"></TD></TR>');
  d.write('</TABLE>');
  d.write('</body></html>');
  d.close();
 }

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function No_Submit() {
	return false;
}

function chekEnter()
{
	var sEnter = window.event.keyCode;
	if(sEnter == 13) buscar();
}

function buscar()
{
	var d = document.frmBuscar;
//	var txtBusca = d.CiRestriction.value;
//	var txtBusca = "\""+ d.CiRestriction.value + "\"";
	CadenaB = new String(d.CiRestriction.value);
	rExp = / /gi;
	nCadenaB = new String(" and ")
	txtBusca = CadenaB.replace(rExp, nCadenaB)	
	var sOpcion = d.selector.value;
	var msg = 'Primero escriba una palabra o frase... \n luego presione el botón Buscar';
	if(txtBusca == "") {
		alert(msg);
		d.CiRestriction.focus();
		return;
	}
	else
	{
		var cofx="LW:235;L:http://www.correoperu.com.pe/enlinea/estilos/botones/logo.gif;LH:60;AH:left;GL:0;S:http://www.correoperu.com.pe;AWFID:88dca8efb1d36d58;";
		if(sOpcion == 0) window.location.href = "http://www.correoperu.com.pe/enlinea/buscador/buscahoy/query.idq?CiScope=/&CiMaxRecordsPerPage=10&TemplateName=query&CiSort=rank[d]&CiRestriction=" + txtBusca;
		if(sOpcion == 1) window.location.href = "http://anteriores.epensa.com.pe/enlinea/Xbuscador/query.idq?CiScope=/&CiMaxRecordsPerPage=10&TemplateName=query&CiSort=rank[d]&CiRestriction=" + txtBusca;
		if(sOpcion == 2) window.location.href = "http://www.google.com/custom?q=" + txtBusca + "&cof=" + cofx + "&domains=correoperu.com.pe&sitesearch=";
	}
}

function votar()
{
	var valorR, dc = document.frmEncuesta;
	var idPreg = dc.idPregunta.value;
	if(dc.respuesta[0].checked) valorR = dc.respuesta[0].value;
	else if(dc.respuesta[1].checked) valorR = dc.respuesta[1].value;
	else valorR = "Estimado lector marque su elección por favor";
	if(valorR == 1 || valorR == 2) {
		var URL = "/enlinea/manager/encuestaUpdate.asp?id=" + idPreg + "&elec=" + valorR;
		mostrarDatos(URL,'encuesta',400,310,'no'); }
	else { alert(valorR); return; }
}

function resultado()
{
	var valorR, dc = document.frmEncuesta;
	var idPreg = dc.idPregunta.value;
	var URL = "/enlinea/manager/encuestaShow.asp?id=" + idPreg;
	mostrarDatos(URL,'encuesta',400,310,'no');
}

function ultimas()
{
	var URL = "/enlinea/manager/encuanteriores.asp";
	mostrarDatos(URL,'encuesta',400,310,'no');
}
function cine()
{
	mostrarDatos('/enlinea/especiales/cine/buscacines.asp','eliminatorias',680,500,'yes');
}

function ampliar(numImagen)
{
	var URLimagen = "/enlinea/imgSemana/ampliar.asp?numImg=" + numImagen;
	mostrarDatos(URLimagen,'imagenes',600,420,'no');
}

function mostrarDatos(url,nombre,ancho,alto,scroll)
{
	var objWin = new Object();
	objWin.width = ancho;
	objWin.height = alto;
	if (navigator.appName == "Netscape")
	{
		objWin.left = window.screenX + ((window.outerWidth - objWin.width) / 2);
		objWin.top = window.screenY + ((window.outerHeight - objWin.height) / 2);
		var atributo = 'screenX=' + objWin.left + ',screenY=' + objWin.top + ',resizable=no,width=' + objWin.width + ',height=' + objWin.height + ',scrollbars=' + scroll + ',menubar=no,location=no,toolbar=no,status=no,directories=no';
	}
	else if (document.all)
	{
		objWin.left = ((screen.width-objWin.width) / 2);
		objWin.top = ((screen.height-objWin.height) / 2);
		var atributo = 'left=' + objWin.left + ',top=' + objWin.top + ',resizable=no,width=' + objWin.width + ',height=' + objWin.height + ',scrollbars=' + scroll + ',menubar=no,location=no,toolbar=no,status=no,directories=no';
	}
window.open(url,nombre,atributo);
}

function Herramientas()
{
	var h
	h = '<img src="/enlinea/estilos/logos/toolIcono.gif" border="0" usemap="#Map">';
	h = h + '<map name="Map">';
	h = h + '<area shape="rect" coords="29,1,51,22" href="javascript:Ampliar();" alt="Aumentar tamaño de texto">';
	h = h + '<area shape="rect" coords="59,1,80,21" href="javascript:Reducir();" alt="Reducir tamaño de texto">';
	h = h + '<area shape="rect" coords="88,1,110,21" href="javascript:Imprimir();" alt="Imprimir artículo">';
	h = h + '<area shape="rect" coords="117,0,139,21" href="javascript:Recomendar();" alt="Enviar por E-mail">';
	h = h + '</map>';
	document.write(h);
}

function Recomendar()
{
	var URL = window.location;
	var txtVol = document.getElementById('idVolada').innerText;
	var txtTit = document.getElementById('idTitular').innerText;
	var recomArt = "/enlinea/include/recomendar.asp?vol=" + txtVol + "&tit=" + txtTit + "&enlace=" + URL;
	mostrarDatos(recomArt,'recomienda',650,470,'no')
}

function Imprimir()
{
	var dc = document.getElementById;
	var contenido =  dc('notaCompleta').innerHTML;
	var impDoc =window.open('','imprime',atributos(650,400));
	var im = '<html><head>';
		im = im + '<title>DIARIO CORREO / Impresión de noticias</title>';
		im = im	+ '<link href="/enlinea/estilos/estilo.css" rel="stylesheet" type="text/css"></head>';
		im = im	+ '<body>';
		im = im	+ '<table width="100%" border="0" cellspacing="0" cellpadding="10" bgcolor="#ffffff">';
		im = im	+ '<tr><td align="right" bgcolor="#EA0437" id="impresion">| <a href="javascript:window.print();">Imprimir</a> | <a href="javascript:self.close();">Cerrar</a> |</td></tr>';
		im = im	+ '<tr><td bgcolor="#efefef"><img src="/enlinea/estilos/logos/espacio.gif"></td></tr>';
		im = im	+ '<tr><td>' + contenido + '</td></tr>';
		im = im	+ '<tr><td id="newPoston"><hr> \n &copy; 2003 - 2004 DIARIO CORREO - Todos los derechos reservados</td></tr></table>\n';
		im = im	+ '</body>\n</html>';
	impDoc.document.write(im);
	impDoc.document.close();
}

function atributos(ancho,alto)
{
	var objWin = new Object();
	objWin.width = ancho;
	objWin.height = alto;
	if (navigator.appName == "Netscape")
	{
		objWin.left = window.screenX + ((window.outerWidth - objWin.width) / 2);
		objWin.top = window.screenY + ((window.outerHeight - objWin.height) / 2);
		var atributo = 'screenX=' + objWin.left + ',screenY=' + objWin.top + ',resizable=no,width=' + objWin.width + ',height=' + objWin.height + ',scrollbars=yes,menubar=no,location=no,toolbar=no,status=no,directories=no';
	}
	else if (document.all)
	{
		objWin.left = ((screen.width-objWin.width) / 2);
		objWin.top = ((screen.height-objWin.height) / 2);
		var atributo = 'left=' + objWin.left + ',top=' + objWin.top + ',resizable=no,width=' + objWin.width + ',height=' + objWin.height + ',scrollbars=yes,menubar=no,location=no,toolbar=no,status=no,directories=no';
	}
	return atributo;
}

// FONT SIZE MANAGEMENT 
function FindObj(n, d) { //v4.01
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=FindObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function ChangeProp(objName,x,theProp,theValue) { //v6.0
var obj = FindObj(objName);
if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
if (theValue == true || theValue == false)
eval("obj."+theProp+"="+theValue);
else eval("obj."+theProp+"='"+theValue+"'");
}
}

function LoadActualFontSize() {
tempArray = document.cookie.split(";");
for (tA = 0; tA < tempArray.length; tA++){
if (tempArray[tA].indexOf('fontSize') > -1){
fontSizeValue = tempArray[tA].split("=")
ACTUAL_FONTSIZE = parseInt(fontSizeValue[1]);
}
}
}

function SaveActualFontSize() {
var expire = new Date ();
expire.setTime (expire.getTime() + (6000 * 24 * 3600000));
expire = expire.toGMTString();
document.cookie="fontSize="+ACTUAL_FONTSIZE+"; path=/; expires="+expire;
}

function Ampliar() {
ACTUAL_FONTSIZE = ACTUAL_FONTSIZE+1;
if (ACTUAL_FONTSIZE > LARGEST_FONTSIZE) { ACTUAL_FONTSIZE = LARGEST_FONTSIZE }
ChangeProp('texto','','style.fontSize',ACTUAL_FONTSIZE,'SPAN');
SaveActualFontSize();
}

function Reducir() {
ACTUAL_FONTSIZE = ACTUAL_FONTSIZE-1
if (ACTUAL_FONTSIZE < SMALLEST_FONTSIZE) { ACTUAL_FONTSIZE = SMALLEST_FONTSIZE }
ChangeProp('texto','','style.fontSize',ACTUAL_FONTSIZE,'SPAN');
SaveActualFontSize();
}

ACTUAL_FONTSIZE = 12;
SMALLEST_FONTSIZE = 12;
LARGEST_FONTSIZE = 20;
//================================================================================================================
