 /*Version: $Id: admin_submenu.js 1522 2006-01-09 09:36:54Z kglass $*/

/*******************************************/
/* Content list popup toolbox menu            */
/*******************************************/

function adminSubmenu ( section, menuelement ) {
  sH=screen.height - 16;
  sW=screen.width - 16;

  myPopUp = document.getElementById("popOverHelp");

  if (!myPopUp) {
    popOverHelp = document.createElement("div");
    popOverHelp.setAttribute("id","popOverHelp");
    popOverHelp.onclick = Function("hidePopOverHelp(document);");

    document.getElementsByTagName("body")[0].appendChild(popOverHelp);
    myPopUp = document.getElementById("popOverHelp");
  } else {
    while (myPopUp.childNodes.length > 0) {
	myPopUp.removeChild(myPopUp.childNodes[myPopUp.childNodes.length - 1]);
    }
  }

  if ( section == 'articles') {
     containerDiv = document.createElement("div");
     containerDiv.setAttribute("style", "position:relative;float:none;clear:both;width:auto;height:auto;vertical-align:middle;margin:0px;padding:5px;");
     myPopUp.appendChild(containerDiv);
     span1 = document.createElement("span");
     span1.setAttribute("style","width:auto;height:auto;position:relative;float:left;margin:0px 0px 0px 0px;padding:0px;cursor:pointer;");
     anchor1 = document.createElement("a");

     anchor1.setAttribute("href", "#");
     anchor1.onclick=Function("window.location = \'/cms/content/?searchBtn=1&recent=25\';hidePopOverHelp(document);");
     text1 = document.createTextNode("Latest");
     img1 = document.createElement('img');
     img1.setAttribute('src','/global/images/toolbar/admin_recent.gif');
     img1.setAttribute('style','margin:0px 12px 0px 0px;');

     anchor1.appendChild(text1);
     span1.appendChild(img1);
     span1.appendChild(anchor1);
     containerDiv.appendChild(span1);

     containerDiv = document.createElement("div");
     containerDiv.setAttribute("style", "position:relative;float:none;clear:both;width:auto;height:auto;vertical-align:middle;margin:0px;padding:5px;");
     myPopUp.appendChild(containerDiv);

     span1 = document.createElement("span");
     span1.setAttribute("style","width:auto;height:auto;position:relative;float:left;margin:0px 0px 0px 0px;padding:0px;cursor:pointer;");
     anchor1 = document.createElement("a");
     anchor1.setAttribute("href", "#");
     anchor1.onclick=Function("window.location = \'/cms/content/fragment\';hidePopOverHelp(document);");
     text1 = document.createTextNode('Categories');
     img1 = document.createElement('img');
     img1.setAttribute('src','/global/images/toolbar/admin_cat.gif');


     anchor1.appendChild(text1);
     span1.appendChild(img1);
     span1.appendChild(anchor1);
     containerDiv.appendChild(span1);

     containerDiv = document.createElement("div");
     containerDiv.setAttribute("style", "position:relative;float:none;clear:both;width:auto;height:auto;vertical-align:middle;margin:0px;padding:5px;");
     myPopUp.appendChild(containerDiv);

     span1 = document.createElement("span");
     span1.setAttribute("style","width:auto;height:auto;position:relative;float:left;margin:0px 0px 0px 0px;padding:0px;cursor:pointer;");
     anchor1 = document.createElement("a");
     anchor1.setAttribute("href", "#");
     anchor1.onclick=Function("window.location = \'/cms/content/?searchBtn=1\';hidePopOverHelp(document);");
     text1 = document.createTextNode("Search");
     img1 = document.createElement('img');
     img1.setAttribute('src','/global/images/toolbar/search.gif');
     img1.setAttribute('style','margin:0px 14px 0px 0px;');

     span1.appendChild(img1);
     anchor1.appendChild(text1);
     span1.appendChild(anchor1);
     containerDiv.appendChild(span1);


     showPopUpAtElement(document,'popOverHelp', document.getElementById(menuelement)); 
     return 1;

  }
  if ( section == 'users') {
     containerDiv = document.createElement("div");
     containerDiv.setAttribute("style", "position:relative;float:none;clear:both;width:auto;height:auto;vertical-align:middle;margin:0px;padding:5px;");
     myPopUp.appendChild(containerDiv);
     span1 = document.createElement("span");
     span1.setAttribute("style","width:auto;height:auto;position:relative;float:left;margin:0px 0px 0px 0px;padding:0px;cursor:pointer;");
     anchor1 = document.createElement("a");
     anchor1.setAttribute("href", "#");
     anchor1.onclick=Function("window.location = \'/cms/admin/users\';window.stop();hidePopOverHelp(document);");
     text1 = document.createTextNode("Latest");

     anchor1.appendChild(text1);

     img1 = document.createElement('img');
     img1.setAttribute('src','/global/images/toolbar/admin_recent.gif');
     img1.setAttribute('style','margin:0px 12px 0px 0px;');

     span1.appendChild(img1);

     span1.appendChild(anchor1);
     containerDiv.appendChild(span1);

     containerDiv = document.createElement("div");
     containerDiv.setAttribute("style", "position:relative;float:none;clear:both;width:auto;height:auto;vertical-align:middle;margin:0px;padding:5px;");
     myPopUp.appendChild(containerDiv);

     span1 = document.createElement("span");
     span1.setAttribute("style","width:auto;height:auto;position:relative;float:left;margin:0px 0px 0px 0px;padding:0px;cursor:pointer;");
     anchor1 = document.createElement("a");
     anchor1.setAttribute("href", "#");
     anchor1.onclick=Function("window.location = \'/cms/admin/users/?alpha=A\';document.getElementById(\'userlist\').style.display=\'none\';hidePopOverHelp(document);");

     text1 = document.createTextNode("Browse");
     img1 = document.createElement('img');
     img1.setAttribute('src','/global/images/toolbar/admin_browse.gif');
     img1.setAttribute('style','margin:0px 8px 0px 0px;');

     span1.appendChild(img1);
 
     anchor1.appendChild(text1);
     span1.appendChild(anchor1);
     containerDiv.appendChild(span1);

     containerDiv = document.createElement("div");
     containerDiv.setAttribute("style", "position:relative;float:none;clear:both;width:auto;height:auto;vertical-align:middle;margin:0px;padding:5px;");
     myPopUp.appendChild(containerDiv);

     span1 = document.createElement("span");
     span1.setAttribute("style","width:auto;height:auto;position:relative;float:left;margin:0px 0px 0px 0px;padding:0px;cursor:pointer;");
     anchor1 = document.createElement("a");
     anchor1.setAttribute("href", "#");
     anchor1.onclick=Function("window.location = \'/cms/admin/users/?searchBtn=Search&surname=.\';document.getElementById(\'userlist\').style.display=\'none\';hidePopOverHelp(document);");
     text1 = document.createTextNode("Search");
     img1 = document.createElement('img');
     img1.setAttribute('src','/global/images/toolbar/search.gif');
     img1.setAttribute('style','margin:0px 14px 0px 0px;');

     span1.appendChild(img1);
 
     anchor1.appendChild(text1);
     span1.appendChild(anchor1);
     containerDiv.appendChild(span1);


     showPopUpAtElement(document,'popOverHelp', document.getElementById(menuelement)); 
     return 1;

  }
  if ( section == 'staff') {
     containerDiv = document.createElement("div");
     containerDiv.setAttribute("style", "position:relative;float:none;clear:both;width:auto;height:auto;vertical-align:middle;margin:0px;padding:5px;");
     myPopUp.appendChild(containerDiv);
     span1 = document.createElement("span");
     span1.setAttribute("style","width:auto;height:auto;position:relative;float:left;margin:0px 0px 0px 0px;padding:0px;cursor:pointer;");
     anchor1 = document.createElement("a");
     anchor1.setAttribute("href", "#");
     anchor1.onclick=Function("window.location = \'/cms/staffdirectory\';hidePopOverHelp(document);");
     text1 = document.createTextNode("Latest");
     img1 = document.createElement('img');
     img1.setAttribute('src','/global/images/toolbar/admin_recent.gif');
     img1.setAttribute('style','margin:0px 12px 0px 0px;');

     anchor1.appendChild(text1);
     span1.appendChild(img1);
     span1.appendChild(anchor1);
     containerDiv.appendChild(span1);

     containerDiv = document.createElement("div");
     containerDiv.setAttribute("style", "position:relative;float:none;clear:both;width:auto;height:auto;vertical-align:middle;margin:0px;padding:5px;");
     myPopUp.appendChild(containerDiv);

     span1 = document.createElement("span");
     span1.setAttribute("style","width:auto;height:auto;position:relative;float:left;margin:0px 0px 0px 0px;padding:0px;cursor:pointer;");
     anchor1 = document.createElement("a");
     anchor1.setAttribute("href", "#");
     anchor1.onclick=Function("window.location = \'/cms/staffdirectory/?alpha=A\';document.getElementById(\'userlist\').style.display=\'none\';hidePopOverHelp(document);");
     img1 = document.createElement('img');
     img1.setAttribute('src','/global/images/toolbar/admin_browse.gif');
     img1.setAttribute('style','margin:0px 8px 0px 0px;');

     span1.appendChild(img1);

     text1 = document.createTextNode("Browse");

     anchor1.appendChild(text1);
     span1.appendChild(anchor1);
     containerDiv.appendChild(span1);

     containerDiv = document.createElement("div");
     containerDiv.setAttribute("style", "position:relative;float:none;clear:both;width:auto;height:auto;vertical-align:middle;margin:0px;padding:5px;");
     myPopUp.appendChild(containerDiv);

     span1 = document.createElement("span");
     span1.setAttribute("style","width:auto;height:auto;position:relative;float:left;margin:0px 0px 0px 0px;padding:0px;cursor:pointer;");
     anchor1 = document.createElement("a");
     anchor1.setAttribute("href", "#");
     anchor1.onclick=Function("window.location = \'/cms/staffdirectory/?searchBtn=Search&surname=.\';document.getElementById(\'userlist\').style.display=\'none\';hidePopOverHelp(document);");
     text1 = document.createTextNode("Search");
     img1 = document.createElement('img');
     img1.setAttribute('src','/global/images/toolbar/search.gif');
     img1.setAttribute('style','margin:0px 14px 0px 0px;');

     span1.appendChild(img1);

     anchor1.appendChild(text1);
     span1.appendChild(anchor1);
     containerDiv.appendChild(span1);


     showPopUpAtElement(document,'popOverHelp', document.getElementById(menuelement)); 
     return 1;

  }
  if ( section == 'files') {
     containerDiv = document.createElement("div");
     containerDiv.setAttribute("style", "position:relative;float:none;clear:both;width:auto;height:auto;vertical-align:middle;margin:0px;padding:5px;");
     myPopUp.appendChild(containerDiv);
     span1 = document.createElement("span");
     span1.setAttribute("style","width:auto;height:auto;position:relative;float:left;margin:0px 0px 0px 0px;padding:0px;cursor:pointer;");
     anchor1 = document.createElement("a");
     anchor1.setAttribute("href", "#");
     anchor1.onclick=Function("window.location = \'/cms/filemanager/document/?searchBtn=1&recent=25\';hidePopOverHelp(document);");
     text1 = document.createTextNode("Latest");
     img1 = document.createElement('img');
     img1.setAttribute('src','/global/images/toolbar/admin_recent.gif');
     img1.setAttribute('style','margin:0px 14px 0px 0px;');

     span1.appendChild(img1);

     anchor1.appendChild(text1);
     span1.appendChild(anchor1);
     containerDiv.appendChild(span1);

     containerDiv = document.createElement("div");
     containerDiv.setAttribute("style", "position:relative;float:none;clear:both;width:auto;height:auto;vertical-align:middle;margin:0px;padding:5px;");
     myPopUp.appendChild(containerDiv);

     span1 = document.createElement("span");
     span1.setAttribute("style","width:auto;height:auto;position:relative;float:left;margin:0px 0px 0px 0px;padding:0px;cursor:pointer;");
     anchor1 = document.createElement("a");
     anchor1.setAttribute("href", "#");
     anchor1.onclick=Function("window.location = \'/cms/filemanager/document/system\';hidePopOverHelp(document);");
     img1 = document.createElement('img');
     img1.setAttribute('src','/global/images/toolbar/admin_browse.gif');
     img1.setAttribute('style','margin:0px 8px 0px 0px;');

     span1.appendChild(img1);

     text1 = document.createTextNode("Browse");

     anchor1.appendChild(text1);
     span1.appendChild(anchor1);
     containerDiv.appendChild(span1);

     containerDiv = document.createElement("div");
     containerDiv.setAttribute("style", "position:relative;float:none;clear:both;width:auto;height:auto;vertical-align:middle;margin:0px;padding:5px;");
     myPopUp.appendChild(containerDiv);

     span1 = document.createElement("span");
     span1.setAttribute("style","width:auto;height:auto;position:relative;float:left;margin:0px 0px 0px 0px;padding:0px;cursor:pointer;");
     anchor1 = document.createElement("a");
     anchor1.setAttribute("href", "#");
     anchor1.onclick=Function("window.location = \'/cms/filemanager/document/?searchBtn=1\';hidePopOverHelp(document);");
     text1 = document.createTextNode("Search");
     img1 = document.createElement('img');
     img1.setAttribute('src','/global/images/toolbar/search.gif');
     img1.setAttribute('style','margin:0px 14px 0px 0px;');

     span1.appendChild(img1);

     anchor1.appendChild(text1);
     span1.appendChild(anchor1);
     containerDiv.appendChild(span1);


     showPopUpAtElement(document,'popOverHelp', document.getElementById(menuelement)); 
     return 1;

  }
  if ( section == 'images') {
     containerDiv = document.createElement("div");
     containerDiv.setAttribute("style", "position:relative;float:none;clear:both;width:auto;height:auto;vertical-align:middle;margin:0px;padding:5px;");
     myPopUp.appendChild(containerDiv);
     span1 = document.createElement("span");
     span1.setAttribute("style","width:auto;height:auto;position:relative;float:left;margin:0px 0px 0px 0px;padding:0px;cursor:pointer;");
     anchor1 = document.createElement("a");
     anchor1.setAttribute("href", "#");
     anchor1.onclick=Function("window.location = \'/cms/filemanager/photo/?searchBtn=1&recent=25\';hidePopOverHelp(document);");
     text1 = document.createTextNode("Latest");
     img1 = document.createElement('img');
     img1.setAttribute('src','/global/images/toolbar/admin_recent.gif');
     img1.setAttribute('style','margin:0px 14px 0px 0px;');

     span1.appendChild(img1);

     anchor1.appendChild(text1);
     span1.appendChild(anchor1);
     containerDiv.appendChild(span1);

     containerDiv = document.createElement("div");
     containerDiv.setAttribute("style", "position:relative;float:none;clear:both;width:auto;height:auto;vertical-align:middle;margin:0px;padding:5px;");
     myPopUp.appendChild(containerDiv);

     span1 = document.createElement("span");
     span1.setAttribute("style","width:auto;height:auto;position:relative;float:left;margin:0px 0px 0px 0px;padding:0px;cursor:pointer;");
     anchor1 = document.createElement("a");
     anchor1.setAttribute("href", "#");
     anchor1.onclick=Function("window.location = \'/cms/filemanager/photo/system\';hidePopOverHelp(document);");

     text1 = document.createTextNode("Browse");
     img1 = document.createElement('img');
     img1.setAttribute('src','/global/images/toolbar/admin_browse.gif');
     img1.setAttribute('style','margin:0px 8px 0px 0px;');

     span1.appendChild(img1);

     anchor1.appendChild(text1);
     span1.appendChild(anchor1);
     containerDiv.appendChild(span1);

     containerDiv = document.createElement("div");
     containerDiv.setAttribute("style", "position:relative;float:none;clear:both;width:auto;height:auto;vertical-align:middle;margin:0px;padding:5px;");
     myPopUp.appendChild(containerDiv);

     span1 = document.createElement("span");
     span1.setAttribute("style","width:auto;height:auto;position:relative;float:left;margin:0px 0px 0px 0px;padding:0px;cursor:pointer;");
     anchor1 = document.createElement("a");
     anchor1.setAttribute("href", "#");
     anchor1.onclick=Function("window.location = \'/cms/filemanager/photo/?searchBtn=1\';hidePopOverHelp(document);");
     text1 = document.createTextNode("Search");
     img1 = document.createElement('img');
     img1.setAttribute('src','/global/images/toolbar/search.gif');
     img1.setAttribute('style','margin:0px 14px 0px 0px;');

     span1.appendChild(img1);

     anchor1.appendChild(text1);
     span1.appendChild(anchor1);
     containerDiv.appendChild(span1);


     showPopUpAtElement(document,'popOverHelp', document.getElementById(menuelement)); 
     return 1;

  }

}

function toolbarbuttonOn(btnObject) {
         btnObject.style.border= '1px solid #0033FF';
         btnObject.style.backgroundColor= '#99CCCC';
}

function toolbarbuttonOff(btnObject) {
         btnObject.style.border= '1px solid #ccc';
         btnObject.style.backgroundColor= 'transparent';
}

function api1replaceDoc(fileName,fileTitle) {
   var fileNameArray = fileName.split('/');
   var docAlias = fileNameArray[fileNameArray.length-1];
   var title = fileTitle ? fileTitle : docAlias;
   var editURL = '/cms/inlineadmin?Command=FileUpload&doc=1&response=closerefresh&replace='+docAlias+'&folder='+fileNameArray[5];
   window.open(editURL, 'replaceDoc', 'top=200px, left=200px, width=450px, height=100px, status=no, scrollbars=no, resizable=yes');
}


function api1replacePhoto(fileName,fileTitle,folder) {
   var fileNameArray = fileName.split('/');
   var docAlias = fileNameArray[fileNameArray.length-1];
   var title = fileTitle ? fileTitle : docAlias;
   var editURL = '/cms/inlineadmin?Command=FileUpload&photo=1&response=closerefresh&replace='+docAlias+'&folder='+folder;
   window.open(editURL, 'replaceDoc', 'top=200px, left=200px, width=450px, height=100px, status=no, scrollbars=no, resizable=yes');
}


document.getElementsByClass = function (needle)
{
  var         my_array = document.getElementsByTagName("*");
  var         retvalue = new Array();
  var        i = 0;
  var        j = 0;

  for (i = 0, j= 0; i < my_array.length; i++)
  {
    var c = " " + my_array[i].className + " ";
    if (c.indexOf(" " + needle + " ") != -1)
      retvalue[j++] = my_array[i];
  }
  return retvalue;
}

