 function moveBox(boxdiv,shadowdiv,width, height, bws) {
   var boxdivLeftPos;
   var boxdivTopPos;
   
   shadowdiv.style.left = 0;
   shadowdiv.style.top = 0;
   shadowdiv.style.height = bws.pageHeight + "px";
   shadowdiv.style.width = "100%";

   boxdivLeftPos = parseInt((bws.width - width) / 2);
   boxdivTopPos = bws.scrollTop + parseInt((bws.height - height) / 2);
   
   boxdivLeftPos = (boxdivLeftPos > 0 ? boxdivLeftPos : 10);
   boxdivTopPos = (boxdivTopPos > 0 ? boxdivTopPos : 10);
   
   boxdiv.style.left = boxdivLeftPos+"px";
   boxdiv.style.top = boxdivTopPos+"px";   
 
 }

  function closePopUpPage(){  
    var contentId = "contentId";
    var shadowId = "shadowId"; 
    var boxdiv = document.getElementById(contentId);
    var shadowdiv = document.getElementById(shadowId);
    shadowdiv.style.display='none';
    boxdiv.style.display='none';
  }

  function showPopUpPage(myForm, myPage, width, height, borderStyle,iframeScrollingVal) {
    var contents;
    var contentId = "contentId";
    var shadowId = "shadowId";
    var contentIframeId = "contentIframeId";
    var boxdiv = document.getElementById(contentId);
	var shadowdiv = document.getElementById(shadowId);
    var bws = getBrowserHeight();	

    if (boxdiv != null) {
      if (boxdiv.style.display=='none') {

	    contents = document.getElementById(contentIframeId);
		shadowdiv.style.display='block';
	    boxdiv.style.display='block';
		
		myForm.target = contentIframeId;
	    myForm.action = myPage;
        myForm.submit();
		
        moveBox(boxdiv,shadowdiv,width, height, bws);
      }else{
	    shadowdiv.style.display='none'; 
        boxdiv.style.display='none';
	  }	
    }else{
      shadowdiv = document.createElement('div');
      shadowdiv.setAttribute('id', shadowId); 
      shadowdiv.style.display = 'block';
      shadowdiv.style.position = 'absolute';
	  shadowdiv.style.backgroundColor = '#000000';
      shadowdiv.style.opacity = 0.6;
	  shadowdiv.style.filter = "alpha(opacity=20)";
	  shadowdiv.style.zIndex  = 1000;
	  
  
      boxdiv = document.createElement('div');
      boxdiv.setAttribute('id', contentId);
      boxdiv.style.display = 'block';
      boxdiv.style.position = 'absolute';
      boxdiv.style.width = width + 'px';
      boxdiv.style.height = height + 'px';
      boxdiv.style.border = borderStyle;
      boxdiv.style.backgroundColor = '#fff';
	  boxdiv.style.zIndex  = 1001;

      contents = document.createElement('iframe');
	  contents.setAttribute('id', contentIframeId);
	  contents.setAttribute('name', contentIframeId);
      contents.scrolling = iframeScrollingVal;
      contents.frameBorder = '0';
      contents.style.width = width + 'px';
      contents.style.height = height + 'px';

      boxdiv.appendChild(contents);
	  document.body.appendChild(shadowdiv);
      document.body.appendChild(boxdiv);
	  self.frames[contentIframeId].name = contentIframeId;
	  
	  myForm.target = contentIframeId;
	  myForm.action = myPage;
	  myForm.submit();
      moveBox(boxdiv,shadowdiv,width, height, bws);
      
    }
  }
  
  
 
  function getBrowserHeight() {
    var intH = 0;
    var intW = 0;
	var totalH = 0;
	var totalW = 0;
	var scrollTop = 0;
              
    if (typeof window.innerWidth  == 'number' ) {
	  scrollTop = window.pageYOffset;
	  totalH = window.innerHeight + window.scrollMaxY + 16;         
	  totalW = window.innerWidth + window.scrollMaxX - 16; 
      intH = window.innerHeight;
      intW = window.innerWidth;
	 
    }else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
      scrollTop = document.documentElement.scrollTop;
	  totalH = document.documentElement.scrollHeight;         
	  totalW = document.documentElement.scrollWidth;  
      intH = document.documentElement.clientHeight;
      intW = document.documentElement.clientWidth;
	  
    }else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
	  scrollTop = document.body.scrollTop;	
      totalH = document.body.scrollHeight;
	  totalW = document.body.scrollWidth;
	  intH = document.body.clientHeight;
      intW = document.body.clientWidth;
    }
	totalH = (totalH > intH ? totalH : intH);

    return { width: parseInt(intW), height: parseInt(intH), pageWidth: parseInt(totalW), pageHeight: parseInt(totalH),scrollTop: parseInt(scrollTop)};
  }  