estado=0
function displayPopup(idDiv, idDiv2){
	var idDiv = document.getElementById(idDiv);
	var idDiv2 = document.getElementById(idDiv2);
	if(estado==0){
		var windowHeight = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
		idDiv2.style.height = document.body.clientHeight + "px";
		idDiv.style.display="block";
		var oHeight;
		if(document.getElementById){
			oHeight = document.getElementById(idDiv.id).offsetHeight;
		}
		else if (document.layers){
			oHeight = document.layers[idDiv.id].clip.height;
		}
		idDiv.style.top = getScrollXY()[1] + (windowHeight / 2) - (oHeight / 2) + "px";
		idDiv2.style.display="block";
		estado=1;
	} else {
		idDiv.style.display="none";
		idDiv2.style.display="none";
		estado=0;
	}
}

function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}


function hidePopUp(idPopUp){
  var odiv = document.getElementById(idPopUp);
  odiv.style.display="none";
  //Vuelvo a setear el zIndex en 1 para que despues no se pise
  document.getElementById(idPopUp).parentNode.style.zIndex = 1;
  if (document.getElementById(idPopUp + "iFrame") != null) {
	  odiv.parentNode.removeChild(document.getElementById(idPopUp + "iFrame"));
  }
}

function showPopUp(idPopUp){
  var odiv = document.getElementById(idPopUp);
  var oframe = createIEFix(odiv);
  useIEFix(odiv,oframe);
  odiv.style.display="";
}
function applyIframe(sId, sClassName){
  var oframe = createIEFix(document.getElementById(sId));    
  oframe.className = sClassName;
  oframe.style.zIndex = '2';
}
function createIEFix(odiv){

 var isExplorer = (navigator.userAgent.indexOf('MSIE')>=0)?true:false;
  var fixIframeObj = document.createElement('IFRAME');
  fixIframeObj.id=odiv.id + "iFrame";
  fixIframeObj.style.filter = 'alpha(opacity=0)';
  fixIframeObj.style.position = 'absolute';
  fixIframeObj.style.left = '0';  
  fixIframeObj.style.top = '0'; 
  fixIframeObj.style.height = '3000'; 
  fixIframeObj.style.width = '1500';
  fixIframeObj.style.zIndex = '2147483646';
  odiv.parentNode.appendChild(fixIframeObj);
  return fixIframeObj;

}

function useIEFix(ObjReference, iframeReference)
{
 //use this function with the object visible
 if(iframeReference)
 {
  iframeReference.style.display = '';
  iframeReference.style.position = ObjReference.style.position;
  iframeReference.style.height = ObjReference.style.height;
  iframeReference.style.width = ObjReference.style.width;
  iframeReference.style.top = ObjReference.style.top;
  iframeReference.style.left = ObjReference.style.left;
  ObjReference.parentNode.style.zIndex = 2147483647;
 }
}
