

function RenderPopup(windowsource, windowname, width, height, scrollbars, directories, location, menubar, status, toolbar, resizable) {
	var winl = (screen.width - width) / 2;
	var wint = (screen.height - height) / 2;
	var windowfeatures = 'width=' + width +
	',top='+wint+',left='+winl+',height=' + height + ',directories=' + directories +
	',location=' + location + ',menubar=' + menubar +
	',scrollbars=' + scrollbars + ',status=' + status +
	',toolbar=' + toolbar + ',resizable=' + resizable;
	window.open(windowsource, windowname, windowfeatures);
}
/*
función que escribe el flash en el html para evitar el problema de iExplorer del 11 de abril de 2006
*/

function insertFlash(movie,ancho,alto){
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ancho+'" height="'+alto+'">');
document.write('<param name="movie" value="'+movie+'">');
document.write('<param name="quality" value="high">');
document.write('<param name="menu" value="false">');	
document.write('<param name="wmode" value="transparent">');
document.write('<embed src="'+movie+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ancho+'" height="'+alto+'" menu="false"></embed>');
document.write('</object>');
}

//////////////
//////////////////
//////------>>>>>> Funciones para el scroll del menu -------------


vbaja=true;
vsube=true;
function sube(valor){
		if (valor){
			vbaja=true;
			var alturacapa=document.getElementById("scrollIn").offsetHeight;
			top1= new String(document.getElementById("scrollIn").style.top);
			var pos=top1.indexOf("px");
			top1=parseInt(top1.substring(0,pos));
			if ((0-top1+173)<alturacapa) {
				document.getElementById("scrollIn").style.top = top1 -10;
			} else {
				vsube=false;
			}
			if (vsube) {
					setTimeout("sube(true)",100);
			} /*else {
				vsube=true;
			}*/
		}
}

/// Funciones Scroll

function baja(valor){
		if (valor){
			vsube=true;
			var alturacapa=document.getElementById("scrollIn").offsetHeight;
			top1= new String(document.getElementById("scrollIn").style.top);
			var pos=top1.indexOf("px");
			top1=parseInt(top1.substring(0,pos));
			if (top1<0) {
				document.getElementById("scrollIn").style.top = top1 +10;
			} else {
				vbaja=false;
			}
			if (vbaja) {
					setTimeout("baja(true)",100);
			} /*else {
				vbaja=true;
			}*/

			//if ((0-top1+520)>alturacapa) document.getElementById("scrollIn").style.top = top1 +15;
		}
}

function para(valor){
	
	if (valor==1)	vbaja=false;
	if (valor==2)	vsube=false;
	
}

////////////////////////////////////

// Rollovers de las flechas

//---->>>>> Funciones cambia imagen del menu superior (efecto rollover)

function cambia_imagen_arriba(imagen){
		document.getElementById('adalt').src=imagen;
}
function cambia_imagen_abajo(imagen){
		document.getElementById('abaix').src=imagen;
}

//

// Funcion Popup 

ventanas=new Array();
function abre(destino,name,ancho,alto){
	//alert(destino);
	anchura="";
	altitud="";
	anchura+="width=";
	anchura+=ancho;
	altitud+="height=";
	altitud+=alto;
	tamany="";
	tamany=anchura;
	tamany+=",";
	tamany+=altitud;
            if (ventanas[name]!=undefined) ventanas[name].close();{	
	ventanas[name]=window.open(destino,name,tamany);
			}			
}

// imagen de las noticias

function abreme(esta,titol){
	
	abre('pops/imagen.php?imagen='+esta+'&titulo='+titol,'imagen',100,100);
	
}
	
	function restaurtamany(ancho,alto){
		var myWidth = 0, myHeight = 0;
	  if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	  }
	  if(myWidth<ancho){
	  for(l=myWidth;l<ancho;l+=5){
		  window.resizeTo(l,myHeight);
	  }
	  }else{
		   for(l=myWidth;l>ancho;l-=5){
		  window.resizeTo(l,myHeight);
	  }
	  }
	  if(myHeight<alto){
	   for(y=myHeight;y<alto;y+=5){
		  window.resizeTo(ancho,y);
	  }
	  }else{
		  for(y=myHeight;y>alto;y-=5){
		  window.resizeTo(ancho,y);
	  }
	  }
		window.resizeTo(ancho,alto);
	}


	// Control de la ventana
	
	function tamany(ancho,alto){
		if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		//var ample:Number=0;
		ample=ancho-4;
		alt=alto-5;
		restaurtamany(ample+4,alt+4);
		//alert("Non IE : Ancho y alto: "+ancho+" / "+alto+" Tratado a: "+ample+" / "+alt);
	  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		//alert("ie6+");
	 restaurtamany(ancho+4,alto+4);
	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
	   restaurtamany(ancho+4,alto+4);
	   //alert("ie4");
	  }
	  
	}