/** * Append to any existing onload events, used from behaviour.js code */ function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } } function textNav(id, status, color) { if(status == "on") { document.getElementById(id).style.backgroundColor = color; } else { document.getElementById(id).style.backgroundColor = ''; } document.getElementById(id).style.cursor = 'pointer'; } function show(id, type) { if (document.getElementById){ document.getElementById(id).style.display = type; } } function hide(id) { if (document.getElementById){ document.getElementById(id).style.display = 'none'; } } function open_window1(url, width, height) { mywin1 = window.open(url,"win1",'alwaysRaised=1,toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=' + width + ',height=' + height); mywin1.resizeTo(width, height); mywin1.focus(); } function open_window2(url, width, height) { mywin2 = window.open(url,"win2",'alwaysRaised=1,toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=' + width + ',height=' + height); mywin2.resizeTo(width, height); mywin2.focus(); } function in_array(needle, haystack) { for(var j = 0; j < haystack.length; j++) { if(needle == haystack[j]) { return true; } } return false; } function check_required_new(form, fields) { //alert(fields.length); for(var i = 0; i < form.elements.length; i++) { if(in_array(form.elements[i].name, fields)) { //alert(form.elements[i].type); if(form.elements[i].type == "text" || form.elements[i].type == "password") { if(form.elements[i].value == "") { alert(form.elements[i].name + " is a required field"); form.elements[i].focus(); return false; } } else if(form.elements[i].type == "select-one") { //alert(fields[i].name + " is a pull-down"); if(form.elements[i].selectedIndex == 0) { alert(form.elements[i].name + " is a required field"); form.elements[i].focus(); return false; } } else if(form.elements[i].type == 'radio') { var radio = form.elements[i].name; //alert(form[radio].length); for(var j = 0; j < form[radio].length; j++) { if(form[radio][j].checked == true) { var checked = true; } } if(checked != true) { alert(form.elements[i].name + " is a required field"); form.elements[i].focus(); return false; } } else if(form.elements[i].type == 'textarea') { if(form.elements[i].value == "") { alert(form.elements[i].name + " is a required field"); form.elements[i].focus(); return false; } } } } return true; } function send_parent(href) { window.opener.location = href; window.close(); } var limit = 255; function check() { if(document.f.description.value.length > limit) { alert('Too much data!'); document.f.description.focus(); return false; } else { return true; } } function update() { var old = document.f.counter.value; document.f.counter.value=document.f.description.value.length; if(document.f.counter.value > limit && old <= limit) { alert('Too much data in the text description!'); if(document.styleSheets) { document.f.counter.style.fontWeight = 'bold'; document.f.counter.style.color = '#ff0000'; } } else if(document.f.counter.value <= limit && old > limit && document.styleSheets ) { document.f.counter.style.fontWeight = 'normal'; document.f.counter.style.color = '#000000'; } }