
var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
var isOpera = document.addEventListener && document.attachEvent && !navigator.onLine; /* Opera may pretend to be IE */
var isIE = rslt != null && !isOpera;
var isIEold = isIE && Number(rslt[1]) < 5.5 || navigator.userAgent.indexOf('mac') != -1;
var isIE55 = isIE && Number(rslt[1]) >= 5.5;
var isIE6 = isIE && Number(rslt[1]) >= 6;
var isMoz = navigator.userAgent.indexOf('Gecko') != -1;
function get(obj) {
return document.getElementById(obj);
}
function collapseBorder(h) {
doCollapseBorder(h);
resized();
}
function doCollapseBorder(header) {
var h = header.innerHTML;
var vis;
var tr=header.parentNode;
if (tr.className=="editor-collapsable-header") {
header.innerHTML = "&#9658"+h.substring(1);
tr.className = "editor-collapsed-header";
while ( (tr=tr.nextSibling) ) {
if (tr.nodeType!=1) continue;
if (!tr || tr.className.substring(0,6)=="editor") break; tr.style.display="none";
}
} else {
header.innerHTML = "&#9660"+h.substring(1);
tr.className = "editor-collapsable-header";
while ( (tr=tr.nextSibling) ) {
if (tr.nodeType!=1) continue;
if (!tr || tr.className.substring(0,6)=="editor") break; if (isIE) {
tr.style.display="block";
} else {
tr.style.display="table-row";
}
}
}
}
function collapseBorders() {
var ths = document.getElementsByTagName("th");
for (i in ths) {
if (ths[i].parentNode && ths[i].parentNode.className == "editor-collapsable-header") {
doCollapseBorder(ths[i]);
}
}
}
function addActionMagic() {
var newp=get("action-new-page");
if (newp) {
// create dropdown list of new-...
var aclist = document.createElement("ul");
aclist.id = "action-new-box";
aclist.className = "popup";
var acs = get("actions").getElementsByTagName("ul")[0];
var newacs=[];
var ac;
for(ac = acs.firstChild ; ac ; ac=ac.nextSibling) {
if (ac.nodeType==1 && ac.firstChild.id.substring(0,11)=="action-new-") {
newacs.push(ac);
}
}
for(aci in newacs) {
ac=newacs[aci];
acs.removeChild(ac);
aclist.appendChild(ac);
}
// create link for new...
var li = document.createElement("li");
li.innerHTML = '<a href="javascript:showNew();" id="action-new"><img src="http://www.cellutionbiotech.com/theme/cellution/image/edit/new" align="absbottom" alt="" width="16" height="16" />New...</a>';
li.appendChild(aclist);
acs.appendChild(li);
}
}
function showNew() {
openActionBox("new",'');
}
function openActionBox(action,content) {
var div = get("action-"+action+"-box");
var li = get("action-"+action).parentNode;
if (!div) {
li = get("action-delete").parentNode;
div = document.createElement("div");
div.id="action-"+action+"-box";
div.className="popup";
div.innerHTML=content;
li.appendChild(div);
}
li.className = 'with-popup';
if (!div.MYisStyled) {
div.MYisStyled = true;
var popupclose;
div.onmouseout = li.onmouseout = function() { if(!popupclose) popupclose=setTimeout(function(){ li.className = '';popupclose=0;},300); };
div.onmouseover = li.onmouseover = function() { if(popupclose) { clearTimeout(popupclose);popupclose=0;} };
}
}
var searchChanges = false;
var search;
function addSearchMagic() {
search = get("search-box");
search.onfocus = searchFocus;
search.onblur = searchBlur;
search.onchange = searchChange;
searchBlur();
}
function searchFocus() {
if (searchChanges) return;
search.value = "";
}
function searchBlur() {
if (searchChanges) return;
search.value = "Search this site";
}
function searchChange() {
if (!searchChanges) {
var v = search.value;
if (v=="Search this site" || v=="") return;
}
searchChanges = true;
}
function createTransparentMagic(src) {
var div = document.createElement("div");
if (isIE55) {
div.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"',sizingMethod=scale)";
div.style.fontSize = 0;
} else {
div.style.backgroundImage="url("+src+")";
}
div.className = 'dont-print';
div.style.position = 'absolute';
return div;
}
var all,lef,rig;
function addDropLRMagic(obj) {
if (isIEold) return;
if (!obj) return;
var b=get("textbox");
lef = createTransparentMagic("http://www.cellutionbiotech.com/theme/cellution/image/drop-left");
rig = createTransparentMagic("http://www.cellutionbiotech.com/theme/cellution/image/drop-right");
lef.style.top =
rig.style.top = "0px";
lef.style.left = "-6px";
rig.style.left = "771px";
lef.style.width = rig.style.width = "5px";
lef.style.height = rig.style.height = "100%";
if (isOpera) {
lef.style.height= "auto";
lef.style.minHeight =
rig.style.minHeight = "100%";
}
obj.insertBefore(rig,b);
obj.insertBefore(lef,b);
obj.className = "have-js";
}
function addMagic() {
if (!document.getElementById || !document.childNodes) return;
addActionMagic();
collapseBorders();
addSearchMagic();
addDropLRMagic(all=get("all"));
window.onresize = resized;
resized();
}
function resized() {
if (!lef || !rig) return;
if (isIE || isOpera) {
var height = all.offsetHeight + "px";
lef.style.height = rig.style.height = height;
}
rig.style.left = document.body.offsetWidth > 800 ? "771px" : "770px"; if (isMoz || isOpera) {
var b2 = get("body2");
if (all.offsetHeight > innerHeight) {
b2.style.height = "auto";
} else {
b2.style.height = "100%";
}
}
}