//
// Thanks to BrainError.net for this Checkbox script!
// http://brainerror.net/scripts_js_checkbox2.php
//
// Modification for Radio buttons created by William Blake Galbreath
//
var inputs;
var imgFalse = 'images/radio_uncheck.gif';
var imgTrue = 'images/radio_check.gif';
function initChecks() { replaceChecks(); }
function replaceChecks() {
 inputs = document.getElementsByTagName('input');
 for(var i=0;i<inputs.length;i++) {
  if((inputs[i].getAttribute('type') == 'checkbox')||(inputs[i].getAttribute('type') == 'radio')) {
   // ### START - This is to stop certain buttons from being changed...
   if(inputs[i].getAttribute('name') == "sitesearch") { }
   else if(inputs[i].getAttribute('name') == "rating") { }
   ///### END
   else {
    var img = document.createElement('img');
    if(inputs[i].checked) { img.src = imgTrue; }
    else { img.src = imgFalse; }
    img.id = 'checkImage'+i;
    img.onclick = new Function('checkChange('+i+')');
    inputs[i].parentNode.insertBefore(img, inputs[i]);
    inputs[i].style.display='none';
   } // ### End
  }
 }
}
function checkChange(i) {
 fixRadios(i);
 checkIt(i);
 if(inputs[i].checked) {
  inputs[i].checked = '';
  document.getElementById('checkImage'+i).src=imgFalse;
 } else {
  inputs[i].checked = 'checked';
  document.getElementById('checkImage'+i).src=imgTrue;
 }
}
function fixRadios(i) {
 if(inputs[i].getAttribute('type') == 'radio') {
  radioName=inputs[i].getAttribute('name');
  for(var i=0;i<inputs.length;i++) {
   if(inputs[i].getAttribute('name') == radioName) {
    document.getElementById('checkImage'+i).src=imgFalse;
   }
  }
 }
}

// other functions

function extraCheck(obj) { return !obj.disabled; }
function checkIt(i) {
 if(inputs[i].getAttribute('name') == 'other') {
  if(inputs[i].checked) { document.form1.other_text.disabled=true;document.form1.other_text.value=""; }
  else { document.form1.other_text.disabled=false; }
 }
}