var okeys = {"0": "oncart", "1": "workroom", "2": "repair", "3": "missing", "length": "4"};
var pkeys = {"0": "noupdate", "1": "oncart", "2": "workroom", "3": "repair", "4": "missing", "length": "5"};
var qkeys = {"0": "oncart", "1": "workroom", "2": "repair", "3": "missing", "4": "never", "length": "5"};
var proper = {"noupdate": "No Update", "oncart": "On Cart", "workroom": "Workroom", "repair": "Repair/CCS", "missing": "Missing", "unknown": "Unknown", "never": "Never Set", "length": "7"};
var mouseIsDown = false;
function isMobile() { return false; }
function collapsySet(id,collapsed) {
var collapsyc = document.getElementById('collapsyc'+id);
var collapsy = document.getElementById('collapsy'+id);
if(!collapsyc || !collapsy || !collapsy.style) return;
collapsyc.innerHTML = (collapsed ? "Show" : "Hide");
collapsy.style.display = (collapsed ? 'none' : 'inline');
}
function setDisabled(obj) { obj.disabled = true; obj.blur(); }
function initializeForm() {
setTimeout(prepareNotes,0); //Should be prepareNotes() but Safari 4 has a redraw bug
}
function prepareNotes() {
var i = 0;
while(document.getElementById('notes'+i)) {
var notes = document.getElementById('notes'+(i++));
notes.__value = notes.value;
setDisabled(notes);
}
}
function statusChanged(n) {
var status = document.getElementById('status'+n);
var notes = document.getElementById('notes'+n);
if(!status || !notes) return;
if(status.value == 'noupdate') {
setTimeout(setDisabled,0,notes); //Again, Safari 4 bug.
notes.value = (notes.__value ? notes.__value : '');
} else {
notes.disabled = false;
if(!isMobile()) notes.focus();
}
}
function statusChangedImg(n,i) {
var ii = 0;
while(document.getElementById('icon'+n+'.'+ii)) { iconClassModify('icon'+n+'.'+ii,(i == ii)); ii++; }
var status = document.getElementById('status'+n);
var notes = document.getElementById('notes'+n);
if(!status || !notes) return;
status.value = pkeys[i];
if(status.value == 'noupdate') {
setTimeout(setDisabled,0,notes); //Again, Safari 4 bug.
notes.value = (notes.__value ? notes.__value : '');
} else {
notes.disabled = false;
if(!isMobile()) notes.focus();
}
}
function yesnoChanged(n,i) {
var ii = 0;
while(document.getElementById('yesno'+n+'.'+ii)) { iconClassModify('yesno'+n+'.'+ii,(i == ii)); ii++; }
var yesno = document.getElementById('yesno'+n);
if(!yesno) return;
yesno.value = ((i == 0) ? '1' : '0');
}
function iconClassModify(id,lit) {
var img = document.getElementById(id); if(!img) { return; }
var classes = img.className.split(/\s+/);
var i = 0;
while(i < classes.length) { (classes[i] == 'icon' || classes[i] == 'iconSelect') ? classes.splice(i,1) : i++; }
classes.splice(0,0,(lit ? 'iconSelect' : 'icon'));
img.className = classes.join(' ');
}
function checkForm(form) {
if(!form || !form.initials) return false;
if(form.initials.value.length == 2 || form.initials.value.length == 3) return true;
alert("Please enter your 2 or 3 letter initials.");
return false;
}
document.onmousedown = function(e) { mouseIsDown = true; }
document.onmouseup = function(e) { mouseIsDown = false; }