// specifies new value for the specified style class
function applyValue(classNames, propertyName, propertyValue, ownerID) {
var propertyNames = typeof(propertyName) == "string" ? [propertyName] : propertyName;
classNames = classNames.split(",");
var cssrules = getSheet(ownerID)[document.all? "rules" : "cssRules"];
for(var i = 0; i < cssrules.length; i++)
for(var j = 0; j < classNames.length; j++) {
if(cssrules.item(i).selectorText.toLowerCase() == classNames[j].toLowerCase()) {
for(var k = 0; k < propertyNames.length; k++) {
var propName = propertyNames[k];
if(new String(propName).indexOf("color") != -1 && new String(propertyValue).match(/^[\da-f]{6}$/i))
propertyValue = "#" + propertyValue;
cssrules[i].style[propName] = propertyValue;
}
}
}
};
// returns style sheet by owner ID. If owner ID is missing it returns last style sheet in the document
function getSheet(ownerID) {
var sheets = document.styleSheets;
if(ownerID) {
var owner = document.getElementById(ownerID);
if(!owner) alert("Error: The styleSheet owner not found!");
for(var i = 0; i < sheets.length; i++) {
var sh = sheets[i];
if((sh.ownerNode || sh.owningElement) == owner)
return sh;
}
return null;
} else {
return sheets[sheets.length - 1];
}
};
// returns style sheet class attribute
function getCssValue(className, propertyName, ownerID) {
var cssrules = getSheet(ownerID)[document.all? "rules" : "cssRules"];
for(var i = 0; i < cssrules.length; i++)
if(cssrules.item(i).selectorText.toLowerCase() == className.toLowerCase()) {
return cssrules[i].style[propertyName];
}
return null;
};
// Find and store bgcolor
var colorModel = getCssValue(".sh_Table", "backgroundColor");
function selectLoginType(adm) {
var display = adm ? "none" : "";
document.getElementById("proj_part").style.display = display;
document.getElementById("cons_part").style.display = display;
if (document.all) {
document.getElementsByName("project")[0].style.display = display;
document.getElementsByName("console_sel")[0].style.display = display;
}
var form = document.forms[1];
// fill console value
if (adm) {
form.console.value = "2";
form.project.disabled = true;
} else {
form.console.value = form.console_sel.value;
form.project.disabled = false;
}
// Lets separate consoles by color
applyValue(".sh_Table", "backgroundColor", adm ? "FF8080" : colorModel);
};
function onkeyup$(e) {
if((e.keyCode || e.which) == 13) document.getElementById("OK").onclick();
};
