var nume=1;
var arrayfotos = new Array();

function abrirnot(idnoticia){
	ventana="ventana"+nume;
    ventana=window.open("noticia.php?idnot="+idnoticia,"_blank","width=650,height=450,top="+(screen.height-450)/2+",left="+(screen.width-650)/2+",scrollbars=YES,resizable=yes");
}
function muestra(cual, cuantos){
	for (i=1;i<=cuantos;i++){
		//eval("bloque"+i+".style.display='none'");
		document.getElementById("bloque"+i).style.display='none';
	}
	//eval(cual+".style.display='block'");
	document.getElementById(cual).style.display='block';
}

function imprime(usuario){
	ventana="ventana"+nume;
    ventana=window.open("imprimir.php?u="+usuario,"_blank","width=710,height=350,top="+(screen.height-350)/2+",left="+(screen.width-710)/2+",scrollbars=YES,resizable=NO");
}

function abrir(cual,id,tipo){
	ventana="ventana"+nume;
    ventana=window.open(cual+"?id="+id+"&tipo="+tipo,"_blank","width=520,height=550,top="+(screen.height-550)/2+",left="+(screen.width-520)/2+",scrollbars=NO,resizable=NO");
}

function abrirnewsletter(newsletter){
	ventana="ventana"+nume;
    ventana=window.open("vernewsletter.php?nwl="+newsletter,"_blank","width=840,height=800,top="+(screen.height-800)/2+",left="+(screen.width-840)/2+",scrollbars=YES,resizable=NO");
}

function abrirgooglemaps(idturismo){
	ventana="ventana"+nume;
    ventana=window.open("vermapa.php?tur="+idturismo,"_blank","width=810,height=410,top="+(screen.height-410)/2+",left="+(screen.width-810)/2+",scrollbars=NO,resizable=NO");
}

function redondear(cantidad, decimales) {
	var cantidad = parseFloat(cantidad);
	var decimales = parseFloat(decimales);
	//decimales = (!decimales ? 2 : decimales);
	return Math.round(cantidad * Math.pow(10, decimales)) / Math.pow(10, decimales);
} 



function letraNIF() { 
	cadena="TRWAGMYFPDXBNJZSQVHLCKET";
	posicion = formulario.dni.value % 23; 
	letra = cadena.substring(posicion,posicion+1); 
	if(formulario.dni.value==''){
		letra='';
	}else{
		document.formulario.letradni.value=letra; 
	}
} 


function agregararray(id){
	if(arrayfotos.length==0){
		arrayfotos[0] = id;
	}else{
		arrayfotos[(arrayfotos.length)+1] = id;
	}
}

function borrararray(id){
	//delete arrayfotos[posicion];
}





 function correctPNG()  
 {  
   var arVersion = navigator.appVersion.split("MSIE")  
   var version = parseFloat(arVersion[1])  
   if ((version >= 5.5) && (document.body.filters))  
   {  
      for(var i=0; i<document.images.length; i++)  
      {  
         var img = document.images[i]  
         var imgName = img.src.toUpperCase()  
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")  
         {  
            var imgID = (img.id) ? "id='" + img.id + "' " : ""  
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""  
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "  
            var imgStyle = "display:inline-block;" + img.style.cssText  
            if (img.align == "left") imgStyle = "float:left;" + imgStyle  
            if (img.align == "right") imgStyle = "float:right;" + imgStyle  
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle  
            var strNewHTML = "<span " + imgID + imgClass + imgTitle  
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"  
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"  
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"  
            img.outerHTML = strNewHTML  
            i = i-1  
         }  
      }  
   }      
 }  

function confirmDel(){
	var agree=confirm("Eliminar? ");
	if (agree) return true ;
	else return false ;
}


function validarfile(f){
    var ext=['jpg'];
    var v=f.value.split('.').pop().toLowerCase();
    for(var i=0,n;n=ext[i];i++){
        if(n.toLowerCase()==v)
            return
    }
    var t=f.cloneNode(true);
    t.value='';
    f.parentNode.replaceChild(t,f);
    alert('extensión no válida');
}

function LimitAttach(tField,iType) {
	file=tField.value;
	if (iType==1) extArray = new Array(".jpg");
	if (iType==2) extArray = new Array(".swf");
	if (iType==3) extArray = new Array(".exe",".sit",".zip",".tar",".swf",".mov",".hqx",".ra",".wmf",".mp3",".qt",".med",".et");
	if (iType==4) extArray = new Array(".mov",".ra",".wmf",".mp3",".qt",".med",".et",".wav");
	if (iType==5) extArray = new Array(".html",".htm",".shtml");
	if (iType==6) extArray = new Array(".doc",".xls",".ppt");
	if (iType==7) extArray = new Array(".pdf");

	allowSubmit = false;
	if (!file) return;
	while (file.indexOf("\\") != -1) file = file.slice(file.indexOf("\\") + 1);
	ext = file.slice(file.lastIndexOf(".")).toLowerCase();
	for (var i = 0; i < extArray.length; i++) {
		if (extArray[i] == ext) {
			allowSubmit = true;
			break;
		}
	}
	if (allowSubmit) {
		} else {
		tField.value="";
		alert("Sólo se admiten archivos con extensiones " + (extArray.join(" ")) + "\nPor favor seleccione un nuevo archivo");
	}
}  