//--------------------------------------------
//refresca pagina
//document.write('<meta http-equiv="refresh" content="60">');
document.write('<meta http-equiv="Pragma" content="no-cache"><meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">');
//-----------------------------------------------
//paliframe
function setHeight(){
var theHeight=document['body'].offsetHeight;
parent.document.getElementById('contp').height=theHeight;
document['body']['style'].background="transparent";
}
//-------------------------------------------------------------
//evitar que pongan tu pagina en  frames
//<SCRIPT>if (self != top)top.location = self.location
//--------------------------------------------
//Click derecho
//--------------------------------------------
function click(e) {
if (document.all) {
if (event.button==2||event.button==3) { //alert("hola mierda");
oncontextmenu='return false';
}
}
if (document.layers) {
if (e.which == 3) {
oncontextmenu='return false';
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
document.oncontextmenu = new Function("return false;")
//--------------------------------------------
//no copy 
//--------------------------------------------
document.ondragstart = new Function("return false;")
document.onselectstart = new Function("return false;")
//--------------------------------------------
//Mensaje en la barra de estado
//window.defaultStatus='[escribe aquí tu mensaje ]';
function ljlink(){
link.onmouseover="window.status='nada sin comentarios';";
}
//color de divisiones
function changecolor(id, color) { 
element = document.getElementById(id); 
event.cancelBubble = true; 
oldcolor = element.currentStyle.background; 
element.style.background = color; 
} 
//-------------------------------------------------------------
//poner favorito
function agregar_favorito(){ 
   if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) { 
      var url="http://www.mp3andino.com/"; 
      var titulo="mp3andino.com - Musica Latinoamericana para todos"; 
      window.external.AddFavorite(url,titulo); 
   } 
   else { 
      if(navigator.appName == "Netscape") 
         alert ("Presione Crtl+D para agregar www.puntoandino.com en sus Bookmarks"); 
   } 
} 

/*var urlfav="http://www.puntoandino.com";
var titulofav="Puntoandino.com - Musica Latinoamericana para todos";
function agregar_favorito(){
if (document.all)
window.external.AddFavorite(urlfav,titulofav);
}*/
//-------------------------------------------------------------
//------------------------------------PLayer-----------------------
function abrir_ventana(direccion,nomventana, pantallacompleta, herramientas, direcciones, estado, barramenu, barrascroll, cambiatamano, ancho, alto, izquierda, arriba, sustituir){ 
     var opciones = "fullscreen=" + pantallacompleta + 
                 ",toolbar=" + herramientas + 
                 ",location=" + direcciones + 
                 ",status=" + estado + 
                 ",menubar=" + barramenu + 
                 ",scrollbars=" + barrascroll + 
                 ",resizable=" + cambiatamano + 
                 ",width=" + ancho + 
                 ",height=" + alto + 
                 ",left=" + izquierda + 
                 ",top=" + arriba; 
     var ventana = window.open(direccion,nomventana,opciones,sustituir);
	 ventana.focus();
}                     
// para centrar popup usar
function player_pa(){
	 var i=0;
	 parametros="?"+arguments[i];
	 for(i=1; i<arguments.length; i++)
	 {
	 parametros=parametros+"&"+arguments[i];
	 }
	 //enlace="http://localhost/puntoandino/playermp3andino.php"+parametros;
	 enlace="http://www.andinomp3.com/playermp3andino.php"+parametros;
	 abrir_ventana(enlace,"ventanaplayer",0,0,0,0,0,0,0,550,450,100,100,1);
	 }
//==========================================================================
//encuesta
var leftcentro = (screen.width) ? (screen.width-408)/2 : 0;
var topcentro = (screen.height) ? (screen.height-280)/2 : 0;
function votar_encuesta(formulario)
{	
  	var frm = formulario;
	buttonGroup=formulario.grupoopcion;
	var key=0;
	var alt;
	for (var i=0; i < buttonGroup.length; i++) { 
    
       if (buttonGroup[i].checked == true) { // if a button in group is checked, 
       		key=1;
			alt=buttonGroup[i].value;
      }
   }    
	if (key) 
	{
		url = "../encuesta/resultado_enc.php?alt="+alt+"&tpag=votar";
		abrir_ventana(url,"_encuestas",0,0,0,0,0,0,0,400,200,leftcentro,topcentro,1);
		frm.reset();
	}else
		alert("Elija una Opción para votar");
}
//function setfocus(){document.form1.cmd_enviar.focus();}
function ver_resultado(formulario)
{
    var frm = formulario;
	var url;
	url = "../encuesta/resultado_enc.php?tpag=resultado";
	frm.reset();
	abrir_ventana(url,"_encuestas",0,0,0,0,0,0,0,400,200,leftcentro,topcentro,1);
}

//==========================================================================
//letras listas
function cargalistavideo(letr,tlista){
	eval("document._letrilla.location='../interiores/paginaletra.php?letra="+letr+"'");
	switch(tlista)
	{
	case 'video':
	eval("document._listavideo.location='../interiores/listavideos.php?letra="+letr+"'");
	break;
	case 'mp3':
		eval("document._listavideo.location='../interiores/listamp3.php?letra="+letr+"'");
		break;
	case 'artista':
		eval("document._listavideo.location='../interiores/listaartista.php?letra="+letr+"'");
		break;
	default :
	}
//	document.all('_letrilla').src='../interiores/paginaletra.php?letra='+letr;
//	document.all('_listavideo').src='../interiores/listavideos.php?letra='+letr;
	}
/*
img1 = new Image();
img1.src = "file.ext";

img2 = new Image();
img2.src = "file.ext";

img3 = new Image();
img3.src = "file.ext";


img4 = new Image();
img4.src = "file.ext";

function cmabialetra(num,id){

document.images[id].src = eval("img" + num);

}*/

//==========================================================================
//activarboton
function activarboton(formulario){
	if(formulario.checkbox.checked){
	formulario.archivo.disabled = false;
	}else{
	formulario.archivo.disabled = true;
	}
}
function validarcampos(formulario){
	var er_email = /^(.+\@.+\..+)$/
	//var er_nombre = /^([a-z]|[A-Z]|á|é|í|ó|ú|ñ|ü|\s|\.|-)+$/
	var mensaje="";
	if(formulario.nombre.value.length==0)
	{
		mensaje+="- Escribia su nombre\n";
		}
	var resmail=validarmail(formulario.correo.value);
	if(resmail!="")
	{
		mensaje+=resmail+"\n";
	}
	if(formulario.titulo.value.length==0 || formulario.titulo.value.length<10){
		
		mensaje+="- El titulo ingresado no es valido \n";
	}
	if(formulario.detalle.value.length==0 || formulario.detalle.value.length<100){
		
		mensaje+="- El contenido de la noticia no es valido\n";
	}
    var foto = formulario.archivo.value;
	var extimg = foto.substring(foto.length-3,foto.length);
	extimg=extimg.toLowerCase();
	if(formulario.archivo.disabled==false){
		if((extimg!="jpg")&&(extimg!="gif")){mensaje+='- la foto debe ser de formato gif o jpg\n'}
	}
	if(mensaje==""){
	formulario.submit();
	}else{
	alert("Corrija los siguientes campos : \n\n"+mensaje);
	}
}
function validarmail(campo){
    var pos1, pos2, bOk = true; 
    var sDir=campo; 
	var salida="";
    if (sDir==""){ 
     salida="- Por favor ingrese su dirección de correo"; 
    } 
    pos1 = sDir.indexOf('@', 0); 
    pos2 = sDir.indexOf('.', 0); 
    bOk = bOk && (pos1 > 0); 
    bOk = bOk && (pos2 != -1); 
    bOk = bOk && (pos1 < pos2 - 1); 
    bOk = bOk && (pos2 < sDir.length - 1); 
    if (!bOk){ 
    salida="- Dirección de correo inválida"; 
	}
	return salida;
}
//==================================================================
//popup abrir link
//==================================================================
function abrirlink(url){
var href;
href=url;
var raiz
raiz=window.parent.opener;
if(raiz.top.integro)
{
raiz=raiz.top.integro;
raiz.contp.location.href=href;
raiz.contp.focus();
}
else{
raiz.top.contp.location.href = href;
raiz.top.contp.focus();
}
}
//==================================================================