// Log out

// Open edit content
function openEditContent (id) {
  
  width = 550;
  height = 445;
  popurl = 'editcontent.php?ckey=' + id;
  
  var winl = (screen.width - width) / 2;

    var wint = (screen.height - height) / 2;

  

  winpops=window.open(popurl,"","width=" + width + ",height=" + height + ",left=" + winl + ",top=" + wint + ",resizable=yes")

  
}

// Content mouseover
function setCMS_ContentMO (id, oo) {
  
  // Check if over or out
  if (oo) {
    
    // Over
    document.getElementById(id).style.backgroundColor = '#FBEDBB';    
    document.getElementById(id).style.border = '2px solid #F2C019';   
    document.getElementById(id).style.padding = '10px';   
    
  } else {
    
    // Out
    document.getElementById(id).style.backgroundColor = '#FFFFFF';    
    document.getElementById(id).style.border = '2px solid #F2C019';   
    document.getElementById(id).style.padding = '10px';   
    
  }
  
}



function logout () {



  // Get current url

  url = self.location;

  url = String(url);

  

  // A #?

  a = url.indexOf('#');

  if (a > 0) {

    url = url.substr(0, a);

  }

  

  // Already a ?

  if (url.indexOf('?') > 0) {

    url = url + '&logout=yes';

  } else {

    url = url + '?logout=yes';

  }

  self.location = url;

  

}



// Keep on top!

function ontop() {

   if (document.layers) {

        document.layers['cms_ontop'].pageY = window.pageYOffset;

    document.layers['cms_ontop2'].pageY = window.pageYOffset;

    }

    else if (document.all) {

      document.all['cms_ontop'].style.position = 'absolute';

        document.all['cms_ontop'].style.top = document.body.scrollTop;

    document.all['cms_ontop2'].style.position = 'absolute';

        document.all['cms_ontop2'].style.left =  document.body.scrollWidth / 2 + 370;

    document.all['cms_ontop2'].style.top = document.body.scrollTop;

    } else {

    document.getElementById('cms_ontop2').style.position = 'fixed';

        document.getElementById('cms_ontop2').style.left =  document.body.scrollWidth / 2 + 370;

    

  }

  

    setTimeout('ontop()',100);

}





// Popup function

function popup (url, width, height) {

  var popurl=url;

  

  var winl = (screen.width - width) / 2;

    var wint = (screen.height - height) / 2;

  

  winpops=window.open(popurl,"","scrollbars=yes,width=" + width + ",height=" + height + ",left=" + winl + ",top=" + wint)

  

  winpops.focus();

}

  

function swap(img){

  cursrc = img.src;

  

  overpos = cursrc.indexOf("_h.gif");

  normpos = cursrc.indexOf("_n.gif");

  

  if (normpos != -1) {

    //replace image

    begin = cursrc.substr(0,normpos)

    newsrc = begin + "_h.gif";

    img.src = newsrc;

  }

  

  if (overpos != -1) {

    //replace image

    begin = cursrc.substr(0,overpos)

    newsrc = begin + "_n.gif";

    img.src = newsrc;

  }   

}