function sendit(filename) 
	{
		location.href=filename
	}
	


//-----------------------------------
function Petrolin()
{
window.open('http://www.petroperu.com.pe/Miscelaneos/petrolin/petrolin.htm','', 'scrollbars=yes,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=617,height=500,top=50,left=200,,');		  		
}	
	 
function Museo()
{
window.open('http://www.petroperu.com.pe/Miscelaneos/museo.htm','', 'scrollbars=yes,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=617,height=500,top=50,left=200,,');		}	

function fasesn()
{
	window.open('http://www.petroperu.com.pe/Animaciones/fasesn.html','', 'scrollbars=yes,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=670,height=502,top=50,left=200,,');		  		
}	

function derivadosn()
{
	window.open('http://www.petroperu.com.pe/Animaciones/derivadosn.html','', 'scrollbars=yes,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=670,height=502,top=50,left=200,,');		  		
}	

function fases()
{
	window.open('http://www.petroperu.com.pe/Animaciones/Fases_Petroleo/fases.htm','', 'scrollbars=yes,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=670,height=560,top=50,left=200,,');		  		
}	

function gnv()
{
	window.open('http://www.petroperu.com.pe/Animaciones/Gaseoducto/gnv.htm','', 'scrollbars=yes,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=670,height=560,top=50,left=200,,');		  		
}	

function datosfinancieros()
{
	window.open('http://www.petroperu.com.pe/QuienesSomos/Excel/datosfinancieros.html','', 'scrollbars=yes,resizable=yes,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=617,height=500,top=50,left=200,,');		  		
}	

function ejecutivos()
{
	window.open('http://www.petroperu.com.pe/QuienesSomos/Excel/ejecutivos.html','', 'scrollbars=yes,resizable=yes,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=617,height=500,top=50,left=200,,');		  		
}	


function eeff()
{
	window.open('http://www.petroperu.com.pe/QuienesSomos/Excel/eeff.html','', 'scrollbars=yes,resizable=yes,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=617,height=500,top=50,left=200,,');		  		
}	

function produccion1()
{
	window.open('http://www.petroperu.com.pe/Instalaciones/produccionimg.html','', 'scrollbars=no,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=570,height=410,top=50,left=200,,');		  		
}

function produccion2()
{
	window.open('http://www.petroperu.com.pe/Instalaciones/produccionimg2.html','', 'scrollbars=no,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=830,height=510,top=50,left=200,,');		  		
}

function produccion3()
{
	window.open('http://www.petroperu.com.pe/Instalaciones/produccionc.html','', 'scrollbars=yes,resizable=yes,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=570,height=410,top=50,left=200,,');		  		
}


function eeff_grafica1()
{
	window.open('http://www.petroperu.com.pe/QuienesSomos/Excel/eeff/grafica1.html','', 'scrollbars=no,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=715,height=370,top=50,left=200,,');		  		
}

function eeff_grafica2()
{
	window.open('http://www.petroperu.com.pe/QuienesSomos/Excel/eeff/grafica2.html','', 'scrollbars=no,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=715,height=370,top=50,left=200,,');		  		
}

function eeff_grafica3()
{
	window.open('http://www.petroperu.com.pe/QuienesSomos/Excel/eeff/grafica3.html','', 'scrollbars=no,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=715,height=408,top=50,left=200,,');		  		
}

function eeff_grafica4()
{
	window.open('http://www.petroperu.com.pe/QuienesSomos/Excel/eeff/grafica4.html','', 'scrollbars=no,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=715,height=380,top=50,left=200,,');		  		
}

function eeff_grafica5()
{
	window.open('http://www.petroperu.com.pe/QuienesSomos/Excel/eeff/grafica5.html','', 'scrollbars=no,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=715,height=390,top=50,left=200,,');		  		
}

function eeff_grafica6()
{
	window.open('http://www.petroperu.com.pe/QuienesSomos/Excel/eeff/grafica6.html','', 'scrollbars=no,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=715,height=380,top=50,left=200,,');		  		
}

function eeff_grafica7()
{
	window.open('http://www.petroperu.com.pe/QuienesSomos/Excel/eeff/grafica7.html','', 'scrollbars=yes,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=715,height=360,top=50,left=200,,');		  		
}

function eeff_indicadores()
{
	window.open('http://www.petroperu.com.pe/QuienesSomos/Excel/eeff/indicadores.html','', 'scrollbars=yes,resizable=no,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=830,height=520,top=50,left=200,,');		  		
}


function abreFoto(nombre,ancho,alto) 
	{
	  ancho += 0;
	  alto += 0;
	  props = 'width=' + ancho + ',height=' + alto + ',scrollbars=no,resizable=no';
	  window.open(nombre,'',props)
}
	
//-----------------------------------

var cont = "menujs";
var cont_tag = "div";
var nom_cookie_1 = "serie";
var nom_cookie_2 = "opcion";

function cargar() {
	var x = readCookie(nom_cookie_1);
	var y = readCookie(nom_cookie_2);
	for (p=0; p<document.getElementById(x).getElementsByTagName('a').length; p++) {
		if (document.getElementById(x).getElementsByTagName('a')[p].innerHTML == y) {
			document.getElementById(x).getElementsByTagName('a')[p].className = "ahover";
		}
	}
	menujs(x);
}

function menujs(ids) {
	var x = document.getElementById(cont).getElementsByTagName(cont_tag).length;
	var idstring = "";

	for (i = 0; i < x; i++) {
		idstring += document.getElementById(cont).getElementsByTagName(cont_tag)[i].id + ";";
	}

	if (document.getElementById(ids).style.display == "none") {
		document.getElementById(ids).style.display = "block";
	} else {
		document.getElementById(ids).style.display = "none";
	}

	for (j = 0; j < x; j++) {
		var idtxt = idstring.split(';')[j];
		if (idtxt != ids) {
			if (document.getElementById(idtxt).style.display == "block") {
				document.getElementById(idtxt).style.display = "none";
			}
		}
	}

	createCookie(nom_cookie_1, ids)
}

function createCookie(name,value) {
	document.cookie = name + "=" + value + "; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
//------------------
function clearText(thefield){
if (thefield.defaultValue == thefield.value)
thefield.value = ""
} 
//----------------------
// agrandar y reducir tamaño

//funcion para agrandar o achicar el tamaño de letra (25/09/2003)
		var max_size = 150;
		var min_size = 50;
		
		
		function dzIncreaseFontSize(idElemento) {
			if (document.all || document.getElementById) {	
				var elemento = document.all ? document.all[idElemento] : document.getElementById(idElemento);
				if (elemento) {	
					// el valor está; indicado en porcentaje:
					if(tamagnoLetras[idElemento] >= max_size){
						alert("No es posible aumentar más el texto.")
					}else{
						tamagnoLetras[idElemento] += 10;
						if (elemento.length) 
							for (i=0; i < elemento.length; i++) {
								elemento[i].style.fontSize = (tamagnoLetras[idElemento]+'%');
							}
						else
							elemento.style.fontSize = (tamagnoLetras[idElemento]+'%');
					}
				}
			}
		}
		
		function dzDecreaseFontSize(idElemento) {
			if (document.all || document.getElementById) {	
				var elemento = document.all ? document.all[idElemento] : document.getElementById(idElemento);
				if (elemento) {	
					// el valor est&aacute; indicado en porcentaje:
					if(tamagnoLetras[idElemento] <= min_size){
						alert("No es posible disminuir más el texto.")
					}else{
						tamagnoLetras[idElemento] -= 5;
						if (elemento.length) 
							for (i=0; i < elemento.length; i++) {
								elemento[i].style.fontSize = (tamagnoLetras[idElemento]+'%');
							}
						else
							elemento.style.fontSize = (tamagnoLetras[idElemento]+'%');	
					}
				}
			}
		}
		
		function dzResetFontSize(idElemento) {
			var elemento = document.all[idElemento];
			elemento.body.style.fontSize = '100';
			document.body.style.fontSize = '100';
		}
		
			var tamagnoLetras	= new Array(); 
			tamagnoLetras['contenidos_internas'] = 100;
			tamagnoLetras['resultados_busqueda'] = 100;			

//-----------------
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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 Consultas()
	 {
		window.open('Formularios/Consultas.asp','', 'scrollbars=yes,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=617,height=500,top=50,left=200,,');		  		
	 }	
  function Trabaje()
	 {
		window.open('Formularios/TrabajeconNosotros.asp','', 'scrollbars=yes,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=617,height=500,top=50,left=200,,');		  		
	 }	
  function Acceso()
	 {
		window.open('Formularios/AccesoInformacionPublicaok.asp','', 'scrollbars=yes,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=624,height=500,top=50,left=200,,');		  		
	 }	
  function Denuncias()
	 {
		window.open('Formularios/Denuncias.asp','', 'scrollbars=yes,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=617,height=500,top=50,left=200,,');		  		
	 }	
  function Sugerencias()
	 {
		window.open('Formularios/Sugerencias.asp','', 'scrollbars=yes,toolbar=no,location=0,directories=0,status=0,copyhistory=0,width=617,height=500,top=50,left=200,,');		  		
	 }

// desplegar---------------------------

var enablepersist="on" //Enable saving state of content structure using session cookies? (on/off)
var collapseprevious="no" //Collapse previously open content when opening present? (yes/no)

if (document.getElementById){
document.write('<style>.switchcontent{display:none;}<\/style>')
}

function getElementbyClass(classname){
ccollect=new Array()
var inc=0
var alltags=document.all? document.all : document.getElementsByTagName("*")
for (i=0; i<alltags.length; i++){
if (alltags[i].className==classname)
ccollect[inc++]=alltags[i]
}
}

function contractcontent(omit){
var inc=0
while (ccollect[inc]){
if (ccollect[inc].id!=omit)
ccollect[inc].style.display="none"
inc++
}
}

function expandcontent(cid){
if (typeof ccollect!="undefined"){
if (collapseprevious=="yes")
contractcontent(cid)
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
}
}

function revivecontent(){
contractcontent("omitnothing")
selectedItem=getselectedItem()
//selectedComponents=selectedItem.split("|")
//for (i=0; i<selectedComponents.length-1; i++)
//document.getElementById(selectedComponents[i]).style.display="block"
}


function getselectedItem(){
//if (get_cookie(window.location.pathname) != ""){
//selectedItem=get_cookie(window.location.pathname)
//return selectedItem
//}
//else
//return ""
}

function saveswitchstate(){
var inc=0, selectedItem=""
while (ccollect[inc]){
if (ccollect[inc].style.display=="block")
selectedItem+=ccollect[inc].id+"|"
inc++
}

document.cookie=window.location.pathname+"="+selectedItem
}

function do_onload(){
uniqueidn=window.location.pathname+"firsttimeload"
getElementbyClass("switchcontent")
//if (enablepersist=="on" && typeof ccollect!="undefined"){
//document.cookie=(get_cookie(uniqueidn)=="")? uniqueidn+"=1" : uniqueidn+"=0"
//firsttimeload=(get_cookie(uniqueidn)==1)? 1 : 0 //check if this is 1st page load
//if (!firsttimeload)
revivecontent()
//}
}


if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload

if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitchstate

//------------------

function validarBuscar( x )
{
	if (x=="")
	{
		alert("Debe ingresar el término a buscar.");
		document.frmBuscador.noticia.focus();
		return false;
	}
	
  var checkOK = "ABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚ" + "abcdefghijklmnñopqrstuvwxyzáéíóú " + "0123456789";
  var checkStr = x;
  var allValid = true; 
  for (i = 0; i < checkStr.length; i++) {
    ch = checkStr.charAt(i); 
    for (j = 0; j < checkOK.length; j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length) { 
      allValid = false; 
      break; 
    }
  }
  if (!allValid) { 
    alert("Porfavor, Escriba caracteres válidos"); 	
    return false; 
  } 
  
  
	if (x.length<3)
	{
		alert("Debe ingresar un término no menor a 3 caracteres.");
		document.frmBuscador.noticia.focus();
		return false;
	}	

	return true;
}

function Busqueda()
{
	valor	= document.frmBuscador.noticia.value;

	if ( validarBuscar( valor ) )
	{
		location.href='buscadorprensa.asp?word='+valor;
	}
}

//------------------------------

function validarBuscarGeneral( val )
{
	if (val=="")
	{
		alert("Porfavor, ingrese el término de búsqueda");
		document.fregistro.txtasunto.focus();
		return false;
	}
	
  var checkOK = "ABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚ" + "abcdefghijklmnñopqrstuvwxyzáéíóú " + "0123456789";
  var checkStr = val;
  var allValid = true; 
  for (i = 0; i < checkStr.length; i++) {
    ch = checkStr.charAt(i); 
    for (j = 0; j < checkOK.length; j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length) { 
      allValid = false; 
      break; 
    }
  }
  if (!allValid) { 
    alert("Porfavor, Escriba caracteres válidos"); 	
    return false; 
  } 
  
  
	if (val.length<3)
	{
		alert("Porfavor, debe ingresar un término no menor a 3 caracteres.");
		document.fregistro.txtasunto.focus();
		return false;
	}	

	return true;
}

function BusquedaGeneral()
{
	v = document.fregistro.txtasunto.value;

	if ( validarBuscarGeneral( v ) )
	{
		location.href='http://www.petroperu.com.pe/Buscador/index.asp?q='+v;
	}
} 