var olddata;
var indexcount=0;
var opacity=10;
var elem;
function showdialog(height,width){
  //olddata=document.body.innerHTML;
  var dialogdata='<div style="'+vFact_theboxstyle(width,height)+'">'+document.getElementById('dialogcontent').innerHTML+'</div>';  
  var thedialog=vFact_GetShade();
  elem=document.createElement("div");
  elem.innerHTML=thedialog+dialogdata;
  var my_div = document.getElementById("dialogcontent");
  document.body.appendChild(elem);
  //document.body.innerHTML=olddata+thedialog+dialogdata;
  vFact_checkshade();
}

function closedialog(){
  //document.body.innerHTML=olddata;
  document.body.removeChild(elem);
  document.getElementsByTagName('html')[0].style.overflow = "auto";
  document.getElementsByTagName('body')[0].style.overflow = "auto";
}
function vFact_checkshade()
{
  opacity=opacity+12;
  indexcount=indexcount+2;
  if (indexcount<10){
    setTimeout("vFact_checkshade()",1);
    document.getElementById('theshade').innerHTML=vFact_opastyle();
    
  } else {
    indexcount=0;
    opacity=10;
    document.body.style.overflow='hidden';
    document.getElementsByTagName('html')[0].style.overflow = "hidden";
  }    
}


function vFact_GetShade(){
  var data='<div id="theshade">'+vFact_opastyle()+'</div>';
  opacity=0;
  indexcount=0;
  return data;
}

function vFact_opastyle(){
 var data='<div style="';
 var toppos=vFact_getthetop();
 data=data+'display: block; background-color: black;filter:alpha(opacity='+opacity+');-moz-opacity:'+opacity/100+';opacity:'+opacity/100+';';
 if (vFact_isie()){ 
   data=data+'width: 100%; height: 100%; position: absolute; left: 0px; top: '+toppos+'px; z-index: 50000;"></div>';
 }
 else{
   data=data+'width: 100%; height: 100%; position: absolute; left: 0px; top: '+toppos+'px; z-index: 50000;"></div>';
 }  
 return data;
}



function vFact_theboxstyle(yesnowidth,yesnoheight){
  if (window.clientWidth){
    var x=window.clientWidth;
    var y=window.clientHeight;
  } else {  
    var x=document.body.clientWidth;
    var y=document.body.clientHeight;
  }
  y = (y/2) -(yesnoheight/2);
  x = (x/2) -(yesnowidth/2);
  if (vFact_isie()){   
    var toppos=vFact_getthetop()+50;
  }
  else{
    var toppos=vFact_getthetop()+50;
  }  
  var data="POSITION:absolute;LEFT:"+x+"px;TOP:"+toppos+"px;";
  data = data + "WIDTH:"+yesnowidth+"px;HEIGHT:"+yesnoheight+"px;";
  data = data + "COLOR:black;z-index: 50001;"; 
  return data;
}

function vFact_checkshade()
{
  opacity=opacity+12;
  indexcount=indexcount+2;
  if (indexcount<10){
    setTimeout("vFact_checkshade()",1);
    document.getElementById('theshade').innerHTML=vFact_opastyle();
    
  } else {
    indexcount=0;
    opacity=10;
    document.body.style.overflow='hidden';
    document.getElementsByTagName('html')[0].style.overflow = "hidden";
  }    
}

function vFact_isie(){
 return ((navigator.userAgent.indexOf("MSIE") != -1) &&  (! vFact_isopera())); 
}
function vFact_isopera(){
 return (navigator.userAgent.indexOf("Opera") != -1);
}

function vFact_getthetop(){
if (window.pageYOffset) return window.pageYOffset;
else if (document.documentElement && document.documentElement.scrollTop) return document.documentElement.scrollTop;
else if (document.body) return document.body.scrollTop;
}
