function _site()
{
  var jsdbo = null;
  this.escapeKeyPressed = 0;

  var screenWidth = window.screen.availWidth;
  var editorWidth = screenWidth*3/5;

  this.windowOptions = "top=0,left="+(window.screen.availWidth-414)+",height="+(window.screen.availHeight-62)+",width=402,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes";
  this.windowOptionsFull = "top=0,left="+(0)+",height="+(window.screen.availHeight-62)+",width="+(window.screen.availWidth)+",status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes";
  this.windowOptions35 = "top=0,left="+(screenWidth-editorWidth)+",height="+(window.screen.availHeight-62)+",width="+(editorWidth)+",status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes";
  
  var curPageId = null;
  //*****************************************************************************************************************************
  //*****************************************************************************************************************************
  this.refreshPage = function(pageid)
  {
    if(window.location.toString().indexOf("?") == -1){
      window.location = window.location+"?p="+pageid;
    }
    else {
      window.location = window.location.toString().substring(0,window.location.toString().indexOf("?"))+"?p="+pageid;
    }
  }
  //*****************************************************************************************************************************
  //*****************************************************************************************************************************
  this.setCurrentPage = function(pageid)
  {
    jsdbo = eval(jso.get("jsdbo/jsdbo.php",null,"_site"));
    curPageId = pageid;
  }
  //*****************************************************************************************************************************
  //*****************************************************************************************************************************
  this.showEditableInput = function(id)
  {
    if(this.escapeKeyPressed == 2){
      document.getElementById(id).style.display = "none";
      document.getElementById(id+"input").value = document.getElementById(id).innerHTML.replace(/<br\/>/gi,"\n").replace(/<br>/gi,"\n");
      document.getElementById(id+"input").style.display = "";
      document.getElementById(id+"input").focus();
    }
  }
  //*****************************************************************************************************************************
  //*****************************************************************************************************************************
  this.hideEditableInput = function(id,itemid,value)
  {
    jsdbo.getItem(itemid).setTextContent(value);
    document.getElementById(id).innerHTML = value;
    document.getElementById(id+"input").style.display = "none";
    document.getElementById(id).style.display = "";
  }
  //*****************************************************************************************************************************
  //*****************************************************************************************************************************
  this.hideEditableTextArea = function(id,itemid,value)
  {
    jsdbo.getItem(itemid).setTextContent(value.replace(/\n/gi,"__NL__"));
    document.getElementById(id).innerHTML = value.replace(/\n/gi,"<br/>");
    document.getElementById(id+"input").style.display = "none";
    document.getElementById(id).style.display = "";
  }
  //*****************************************************************************************************************************
  //*****************************************************************************************************************************
  this.onbodyclick = function()
  {
    if((event.keyCode == 27)){
      this.escapeKeyPressed++;
      if(this.escapeKeyPressed == 4){
        this.edit();
      }
    }
    else {
      this.escapeKeyPressed = 0;
    }
  }
  //*****************************************************************************************************************************
  //*****************************************************************************************************************************
  this.edit = function()
  {
    window.resizeTo(screenWidth-editorWidth,window.screen.availHeight-62);
    window.open(""+"scripts/edit.php?p="+curPageId,"_siteEditWindowFull_",this.windowOptions35);
  }
  //*****************************************************************************************************************************
  //*****************************************************************************************************************************
  this.updatePage = function(pid)
  {
    var args = location.search;
    if(pid != null) args="?p="+pid;
    setTimeout(oname+"doUpdatePage('"+args+"')", 5);
  }
  //*****************************************************************************************************************************
  //*****************************************************************************************************************************
  this.doUpdatePage = function(args)
  {
    jso.evaluateObjects = false;
    if(document.getElementById("theBodyContent___")) document.getElementById("theBodyContent___").innerHTML = jso.get("scripts/default.php"+args,null,null);
    jso.evaluateObjects = true;
  }
  //*****************************************************************************************************************************
  //*****************************************************************************************************************************
  var oname;
  var jso = null;
  var script = "";
  var debugcnt = 0;
  //*****************************************************************************************************************************
  //*****************************************************************************************************************************
  this._init_ = function(j,s,n)
  {
    jso = j;
    script = s;
    oname = n+".";
  }
  //*****************************************************************************************************************************
  //*****************************************************************************************************************************
  this.info = function()
  {
    var a = script.split("\n");
    var out = "";
    for(var i=0;i<a.length;i++){
      if(a[i].split("this.").length == 2 && a[i].split("function").length == 2 && a[i].split("=").length == 2 && a[i].split("__").length != 3){
        out += a[i].replace("function","").replace("this.","").replace(" = ","").replace("  ","")+"\n";
      }
    }
  }
  //*****************************************************************************************************************************
  //*****************************************************************************************************************************
}

