function nwindow(mypage,myname,w,h,scroll,pos)
{
  if (pos=="random")
  {
    LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
    TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
  }
  else if (pos=="center")
  {
    LeftPosition=(screen.width)?(screen.width-w)/2:100;
    TopPosition=(screen.height)?(screen.height-h)/2:100;
  }
  else
  {
    LeftPosition=0;
    TopPosition=20;
  }

  settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
  win=window.open(mypage,myname,settings);

  if(win.focus)
  {
    win.focus();
  }
}

function redimensionar (ancho, alto)
{
  LeftPosition=(screen.width)?(screen.width-ancho)/2:100;
  TopPosition=(screen.height)?(screen.height-alto)/2:100;
	
  window.moveTo(LeftPosition,TopPosition);
  window.resizeTo(ancho,alto);
  window.focus();
}
function redimensionar_galeria (imagen)
{
  var ancho = imagen.width+20;
  var alto = imagen.height+16;
	
  if (Number(ancho) < 500)
  {
    ancho="500";
  }
  if (Number(alto) < 200)
  {
    alto="200";
  }
  
  if (navigator.appName == "Netscape")
  {
    alto = String(Number(alto) + 200);
  }
  else
  {
    ancho = String(Number(ancho) + 30);
    alto = String(Number(alto) + 170);
  }
  
  window.moveTo(((screen.availWidth - ancho)/2),((screen.availHeight - alto)/2));
  window.resizeTo(ancho, alto);
}
(function ($) {
	$.fn.vAlign = function() {
		return this.each(function(i){
		var ah = $(this).height();
		var ph = $(this).parent().height();
		var mh = (ph - ah) / 2;
		$(this).css('margin-top', mh);
		alert(mh);
		});
	};
})(jQuery);

function abrirCapa (valor)
{
	document.getElementById(valor).style.position = 'absolute';
	document.getElementById(valor).style.top = "50%";
	document.getElementById(valor).style.position = 'fixed';
	document.getElementById(valor).style.top = document.documentElement.clientHeight/2 - document.getElementById(valor).offsetHeight/2+'px';
	//$('#'+valor).vAlign();	
	
	document.getElementById(valor).style.display = 'block';	
	$("#fondo_capa").css('height', $(document).height()-4);
	document.getElementById("fondo_capa").style.display = 'block';	
}

function cerrarCapa(valor)
{
	document.getElementById('fr_video').src = document.getElementById('fr_video').src;	
	document.getElementById('fondo_capa').style.display = 'none';
	document.getElementById(valor).style.display = 'none';
}
