/*
CUSTOM FORM ELEMENTS
Created by Ryan Fait
www.ryanfait.com
The only thing you need to change in this file is the following
variables: checkboxHeight, radioHeight and selectWidth.
Replace the first two numbers with the height of the checkbox and
radio button. The actual height of both the checkbox and radio
images should be 4 times the height of these two variables. The
selectWidth value should be the width of your select list image.
You may need to adjust your images a bit if there is a slight
vertical movement during the different stages of the button
activation.
Visit http://ryanfait.com/ for more information.
*/
var checkboxHeight = "35";
var radioHeight = "12";
document.write('');
var Custom = {
init: function() {
var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active;
// Radio-Buttons are not styled in IE6
if (Browser.Engine.trident4) {
var radios = $$('#bailMaterials input');
for (var i=0;i "styled".length) {
span[a].className += inputs[a].className["styled".length];
}
/* set ids for span, inputs get _old - suffix */
span[a].id = inputs[a].id;
inputs[a].id = inputs[a].id + "_old";
if(inputs[a].checked == true) {
if(inputs[a].type == "checkbox") {
position = "0 -" + (checkboxHeight*2) + "px";
span[a].style.backgroundPosition = position;
} else {
position = "0 -" + (radioHeight*2) + "px";
span[a].style.backgroundPosition = position;
}
}
inputs[a].parentNode.insertBefore(span[a], inputs[a]);
inputs[a].onchange = Custom.clear;
span[a].onmousedown = Custom.pushed;
span[a].onmouseup = Custom.check;
document.onmouseup = Custom.clear;
}
}
/* register moving functions for custom styled radio-buttons */
window.addEvent('domready', function() {
$('pos_left').addEvent('click', moveBailTo1);
$('pos_middle').addEvent('click', moveBailTo2);
$('pos_right').addEvent('click', moveBailTo3);
// Make Bails visible/invisible
$('bailCount1').addEvent('click', function() { $('bail1').toggleVisibility(); change_bail_overlay(); setChosenBail(); });
$('bailCount2').addEvent('click', function() { $('bail2').toggleVisibility(); change_bail_overlay(); setChosenBail(); });
$('bailCount3').addEvent('click', function() { $('bail3').toggleVisibility(); change_bail_overlay(); setChosenBail(); });
$('bailCount4').addEvent('click', function() { $('bail4').toggleVisibility(); change_bail_overlay(); setChosenBail(); });
$('bailCount5').addEvent('click', function() { $('bail5').toggleVisibility(); change_bail_overlay(); setChosenBail(); });
// Change Bail Material
var spans = $$('#bailMaterials span');
for (var i=0;i