var dragapproved=false
var minrestore=0
var initialwidth,initialheight
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all

function getPageSize(){
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
if (self.innerHeight) { // all except Explorer
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
// for small pages with total height less then height of the viewport
if(yScroll < windowHeight){
pageHeight = windowHeight;
} else {
pageHeight = yScroll;
}
// for small pages with total width less then width of the viewport
if(xScroll < windowWidth){
pageWidth = windowWidth;
} else {
pageWidth = xScroll;
}
arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;
}

  function detectBrowser() {
    var ie = document.all != undefined;
    var opera = window.opera != undefined;
   
    if (opera) return "opera";
    if (ie) return "ie";
    if ((window)&&(window.netscape)&&(window.netscape.security)) {
      if (window.XML) {
        return "firefox15";
      }
      else return "firefox10";
    }
    return "ie";      // Si no sabemos que navegador es, devolvemos ie.
  }

function iecompattest(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function loadwindow(url){
x = getPageSize();
if (!ie5&&!ns6)
window.open(url,"","width=width,height=height,scrollbars=1")
else{
document.getElementById("dwindow").style.display=''
document.getElementById("dwindow").style.width=ns6? x[0]-20+"px" : x[0]+"px"
document.getElementById("dwindow").style.height=ns6? x[1]-0+"px" : x[1]+"px"
document.getElementById("dwindow").style.left="0px"
document.getElementById("dwindow").style.top="0px"
if (detectBrowser()=='ie') {
document.getElementById("dwindow").style.background='url(images/fondotrans.gif)'
} else {
document.getElementById("dwindow").style.background='url(images/fondotrans.png)'
}
document.getElementById("cframe").src=url
document.getElementById("cframe").style.width=x[2]-20
document.getElementById("cframe").style.height=x[3]
document.getElementById("cframe").style.marginTop=ns6? window.pageYOffset*1+"px" : iecompattest().scrollTop*1+"px"
}
}

function closeit(){
document.getElementById("dwindow").style.display="none"
}

