var dragapproved=false;
var minrestore=0;
var initialwidth,initialheight;
var ie5=document.all&&document.getElementById;
var ns6=document.getElementById&&!document.all;
var currentObject;

function setActiveStyleSheet(title) {
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1
        && a.getAttribute("title")) {
       a.disabled = true;
       if(a.getAttribute("title") == title) a.disabled = false;
     }
   }
   
   setCookie('odp_stylesheet', title, new Date(2037, 12, 31));
}

function getActiveStyleSheet() {
var i, a;
 for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
  if(a.getAttribute("rel").indexOf("style") != -1
  && a.getAttribute("title")
  && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function toggleSidebar() {
   if (getActiveStyleSheet() == "Default")
   {
      setActiveStyleSheet("No Side Panels");
   }
   else
   {
      setActiveStyleSheet("Default");
   }
}

function iecompattest(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function isDefined(variable)
{
   return (typeof(variable) == "undefined") ? false : true;
} 

function showDHTMLWindow(id, url, title) {
   document.getElementById('dhtmlwindow-'+id).style.top=ns6? window.pageYOffset*1+30+'px' : iecompattest().scrollTop*1+30+'px';
   document.getElementById('dhtmlwindow-'+id).style.display='';
   
   // TODO: Find way to clear iframe before loading new URL
   // The following won't work if an external URLs is loaded in the iframe...
   //if (ns6) document.getElementById('dhtmliframe-'+id).contentDocument.write('');
   //if (ie5) document.getElementById('dhtmliframe-'+id).contentWindow.document.write('');2
   
   document.getElementById('dhtmliframe-'+id).src=url;
   if (isDefined(title)) document.getElementById('dhtmlwindowtitle-'+id).innerHTML = title;
}

