
function getHtmlImprimir(title,texto){
	var titlemod=new String(title);	
	var pos=titlemod.indexOf('Javascript');
	if (pos>-1){
		title=titlemod.substr(46)//temporal hasta que 	
	}				
	var cadena="<div class=\"imprimir\"><a href=\"javascript:imprimir2()\"";
	cadena= cadena + "title=\"" + title + "\">" + texto + "</a><noscript>script deshabilitado</noscript></div>";
	document.write(cadena);
	//return cadena;
	//return cadena;
}
function getHtmlCerrarVentana(texto){
	var cadena="<a href=\"javascript:window.close()\">";
	cadena= cadena + texto + "</a>";
	document.write(cadena);
}

function ajustaHome(){

var nc = (document.layers) ? true:false
    var ie = (document.all) ? true:false
    var n6 = (document.getElementById) ? true:false
   	var dd=0;
	var ancho=0;
    if(ie)
      {	
    
		dd=window.document.body.offsetWidth; 	
		ancho=(dd-780-5)/2	
		if (ancho<1) {ancho=0}
		
		if (document.all['capaCentral']!=null){
			document.all['capaCentral'].style.left=ancho;
			//document.body.style.backgroundImage='url(../r/gif/centro.gif)';
		}	
	}

    else if(n6)
      {      
			dd=window.innerWidth;	
			ancho=(dd-780-15)/2	
			if (ancho<1) {ancho=0}
			
			if (document.getElementById("capaCentral")!=null){
			document.getElementById("capaCentral").style.left=ancho+ 'px';			
			//document.body.style.backgroundImage='url(../r/gif/centro.gif)';	
			}
			
	
	}
	
window.onresize=ajustaHome;
}

function ajusta() {

    var nc = (document.layers) ? true:false
    var ie = (document.all) ? true:false
    var n6 = (document.getElementById) ? true:false
   	var dd=0;
	var ancho=0;
    if(ie)
      {	
    
		dd=window.document.body.offsetWidth; 	
		//ancho=(dd-780-25)/2;
		ancho=(dd-780-5)/2;
		if (ancho<1) {ancho=0}
		
		if (document.all['capaCentral']!=null){
			document.all['capaCentral'].style.left=ancho;
			//document.body.style.backgroundImage='url(../r/gif/centro.gif)';
		}	
	}

    else if(n6)
      {      
			dd=window.innerWidth;	
			ancho=(dd-780-15)/2	
			if (ancho<1) {ancho=0}
			
			if (document.getElementById("capaCentral")!=null){
			document.getElementById("capaCentral").style.left=ancho+ 'px';			
			//document.body.style.backgroundImage='url(../r/gif/centro.gif)';	
			}
			
	
	}
	
window.onresize=ajusta;
}

//window.onresize=ajusta;
//window.onload=ajusta;
function imprimir() {
	myWindow = window.open("about:blank", "myWindow", 'width=780, height=420, left=0, top=0, menubar=yes, status=no, location=no, toolbar=yes, scrollbars=yes, resizable=yes');	
	myWindow.document.write("<html>");
	myWindow.document.write("<head>");
	myWindow.document.write("<title></title>");
	
	
	if (document.location.port != "") {
		myWindow.document.write("<base href='" + document.location.protocol + "//" + document.location.hostname + ":" + document.location.port + "/MFOMWeb/r/'>");
		myWindow.document.write("<LINK href='" + document.location.protocol + "//" + document.location.hostname + ":" + document.location.port + "/MFOMWeb/r/css/estilos.css' rel='stylesheet'>");
	} else {
		myWindow.document.write("<base href='" + document.location.protocol + "//" + document.location.hostname + "/MFOMWeb/r/'>");
		myWindow.document.write("<LINK href='" + document.location.protocol + "//" + document.location.hostname + "/MFOMWeb/r/css/estilos.css' rel='stylesheet'>");
	}
	myWindow.document.write("</head>");
	myWindow.document.write("<body>");
	//alert(document.getElementById("celdaContenidos").innerHTML);	
	//alert(document.getElementById("Pie1_TablaPie").innerHTML);	
	myWindow.document.write(document.getElementById("celdaContenidos").innerHTML);
	myWindow.document.write("<br>");
	myWindow.document.write("<table cellpadding=0 cellspacing=0>");
	myWindow.document.write(document.getElementById("Pie1_TablaPie").innerHTML);
	myWindow.document.write("</table>");
	myWindow.document.write("</body>");
	myWindow.document.write("</html>");
	
}			        
function imprimir2() {
	myWindow = window.open("about:blank", "myWindow", 'width=490, height=420, left=0, top=0, menubar=yes, status=no, location=no, toolbar=yes, scrollbars=yes, resizable=yes');
	//myWindow.document.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
	myWindow.document.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11-transitional.dtd\">");
	myWindow.document.write("<html>");
	myWindow.document.write("<head>");
	myWindow.document.write("<title>Version para imprimir</title>");		
	/*if (document.location.port != "") {
		myWindow.document.write("<base href=\"" + document.location.protocol + "//" + document.location.hostname + ":" + document.location.port + "/MFOMWeb/r/\" />");
		myWindow.document.write("<link href=\"" + document.location.protocol + "//" + document.location.hostname + ":" + document.location.port + "/MFOMWeb/r/css/estilosAA2.css\" rel=\"stylesheet\" />");
		myWindow.document.write("<link href=\"" + document.location.protocol + "//" + document.location.hostname + ":" + document.location.port + "/MFOMWeb/r/css/estilosAplicacionIframe.css\" rel=\"stylesheet\" />");
		myWindow.document.write("<link href=\"" + document.location.protocol + "//" + document.location.hostname + ":" + document.location.port + "/MFOMWeb/r/css/estilosAplicacion.css\" rel=\"stylesheet\" />");
	} else {
		myWindow.document.write("<base href=\"" + document.location.protocol + "//" + document.location.hostname + "/MFOMWeb/r/\" />");
		myWindow.document.write("<link href=\"" + document.location.protocol + "//" + document.location.hostname + "/MFOMWeb/r/css/estilosAA2.css\" rel=\"stylesheet\" />");
		myWindow.document.write("<link href=\"" + document.location.protocol + "//" + document.location.hostname + "/MFOMWeb/r/css/estilosAplicacionIframe.css\" rel=\"stylesheet\" />");
		myWindow.document.write("<link href=\"" + document.location.protocol + "//" + document.location.hostname + "/MFOMWeb/r/css/estilosAplicacion.css\" rel=\"stylesheet\" />");
	}*/
	myWindow.document.write("<script src=\"http://www.fomento.es/MFOMWeb/r/js/m.js\" type=\"text/javascript\"></script>");
	myWindow.document.write("<link href=\"http://www.fomento.es/MFOMWeb/r/css/estilosAA2.css\" rel=\"stylesheet\" />");
	myWindow.document.write("<link href=\"http://www.fomento.es/MFOMWeb/r/css/estilosAplicacionIframe.css\" rel=\"stylesheet\" />");
	myWindow.document.write("<link href=\"http://www.fomento.es/MFOMWeb/r/css/estilosAplicacion.css\" rel=\"stylesheet\" />");
	myWindow.document.write("</head>");
	myWindow.document.write("<body>");
	//myWindow.document.write("<div class=\"contenidosImpresion\">");
	myWindow.document.write(document.getElementById("contenidos").innerHTML);
//	myWindow.document.write(document.getElementById("contenidos").attributes("class").value);
//alert(document.getElementById("contenidos").attributes.getNamedItem("class").value);
	//myWindow.document.write("</div>");
	myWindow.document.write("<br />");
	myWindow.document.write("<div class=\"piePaginaAmpliado\" id=\"Pie1_TablaPie\">");
	myWindow.document.write(document.getElementById("Pie1_TablaPie").innerHTML);
	myWindow.document.write("</div>");
	myWindow.document.write("</body>");
	myWindow.document.write("</html>");
	
	//intentamos borrar la capa correspondiente a la fecha
	//myWindow.document.getElementById("ControlFecha1_tablaPrincipal").innerHTML="";
	myWindow.document.close();
	
}

function abrirVentana(url){
	window.open(url,'_blank','width=800,height=600,toolbar=no,scrollbars=yes,location=no,resizable=yes,directories=no,status=no,titlebar=no');
	return false;
}

function abrirPopup(url,enlace){
	if (url=='') return false;
	
	if (enlace.target=='POPUP'){
		window.open(url,'POPUP','scrollbars=auto,width=625,height=500,top=10,left=10,toolbar=no,location=no,resizable=yes,directories=no,status=no,titlebar=no');
		return false;
	}
	if (enlace.target=='POPUP1'){
		window.open(url,'POPUP1','width=780,height=570,top=0,left=0,toolbar=no,scrollbars=no,location=no,resizable=no,directories=no,status=no,titlebar=no');
		return false;
	}
	if (enlace.target=='POPUP2'){
		window.open(url,'POPUP2','width=400,height=400,top=10,left=10,toolbar=no,scrollbars=yes,location=no,resizable=no,directories=no,status=no,titlebar=no');		
		return false;
	}
	if (enlace.target=='POPUP3'){
		window.open(url,'POPUP3','width=760,height=540,top=0,left=0,toolbar=no,scrollbars=no,location=no,resizable=no,directories=no,status=no,titlebar=no');		
		return false;
	}
	if (enlace.target=='POPUP4'){
		window.open(url,'POPUP4','width=750,height=400,top=10,left=10,toolbar=no,scrollbars=no,location=no,resizable=no,directories=no,status=no,titlebar=no');
		return false;
	}
	if (enlace.target=='POPUP5'){
	    window.open(url,'POPUP5','width=720,height=540,top=0,left=0,toolbar=no,scrollbars=no,location=no,resizable=no,directories=no,status=no,titlebar=no');
		return false;
	}
	
	return true;
	
	/*if (enlace.target=='POPUP'){		
		window.open(url,'POPUP','width=800,height=600,top=10,left=10,toolbar=no,scrollbars=yes,location=no,resizable=yes,directories=no,status=no,titlebar=no');
		return false;
	}else{
		if (enlace.target=='POPUP1'){
			alert('popup1');
			window.open(url,'POPUP1','width=700,height=540,top=0,left=0,toolbar=no,scrollbars=no,location=no,resizable=no,directories=no,status=no,titlebar=no');
			return false;
		}else{
			if (enlace.target=='POPUP2'){
				//poner aquí la instrucion window.open con los parametros de apertura que se quiera
				return false;
			}else{
				if (enlace.target=='POPUP3'){
				
				}else{
					return true;
				}
				
			}
		}		
	}*/
}

function aumentarLetra(){
alert('aumentando letra');
	for (var j=0;j<document.styleSheets.length;j++){
		s=document.styleSheets[j].rules;
		for (var i=0;i<s.length;i++){
			T=s[i].style.fontSize;
			if (T!=''){
				N=parseFloat(T);
				if (!isNaN(N)) {
					U=T.substring(String(N).length,100);
					s[i].style.fontSize=(N*1.1)+U;
				}
			}
		}
	}
	return false;
}




