function changeInputType(
oldElm, // a reference to the input element
iType, // value of the type property: 'text' or 'password'
iValue, // the default value, set to 'password' in the demo
blankValue, // true if the value should be empty, false otherwise
noFocus) { // set to true if the element should not be given focus
if(!oldElm || !oldElm.parentNode || (iType.length<4) || !document.getElementById || !document.createElement) return;
var newElm = document.createElement('input');
newElm.type = iType;
if(oldElm.name) newElm.name = oldElm.name;
if(oldElm.id) newElm.id = oldElm.id;
if(oldElm.className) newElm.className = oldElm.className;
if(oldElm.size) newElm.size = oldElm.size;
if(oldElm.tabIndex) newElm.tabIndex = oldElm.tabIndex;
if(oldElm.accessKey) newElm.accessKey = oldElm.accessKey;
if(oldElm.style.marginTop) newElm.style.marginTop = oldElm.style.marginTop;
// hasFocus is to prevent a loop where onfocus is triggered over and over again
newElm.hasFocus=false;
oldElm.parentNode.replaceChild(newElm,oldElm);
if(!blankValue) newElm.value = iValue;
if(!noFocus || typeof(noFocus)=='undefined') {
window.tempElm = newElm;
setTimeout("tempElm.hasFocus=true;tempElm.focus();",1);
}
return newElm;
}
function changeFont() {
//if (!document.thisFontSize) document.thisFontSize = 'small';
if (document.thisFontSize == 'big') document.location.reload(); else document.thisFontSize = 'big';
if (document.getElementById('rightcontent')) {
if (document.thisFontSize == 'small') {
document.getElementById('leftcontent').style.width='420px';
document.getElementById('rightcontent').style.display='block';
} else {
document.getElementById('rightcontent').style.display='none';
document.getElementById('leftcontent').style.width='550px';
}
}
var startElement = document.getElementById('contenttext');
// walk through all child nodes
walkTree(startElement, document.thisFontSize);
}
function walkTree(start, thisFontSize) {
if (start.style) {
if (thisFontSize == 'small') start.style.fontSize = '11px'; else start.style.fontSize = '20px';
}
if (start.childNodes.length != 0) {
for (var x = 0; x < start.childNodes.length; x++) walkTree(start.childNodes[x], thisFontSize);
}
}
function eventAdd(aobject, aeventstring, afunction) {
if(window.addEventListener){ // Mozilla, Netscape, Firefox
aobject.addEventListener(aeventstring, afunction, false);
} else { // IE
aobject.attachEvent('on' + aeventstring, afunction);
}
}
function loading() {
while ( (document.getElementById('leftbarcontent').offsetHeight + document.getElementById('menu').offsetHeight) > document.getElementById('contentcenter').offsetHeight) {
document.getElementById('contentcenter').innerHTML += '
';
}
}
eventAdd(window, 'load', loading);