var radioHeight = "25";
document.write('<style type="text/css">input.rdDsgStyle { display: none; } </style>');

var Custom = {
	init: function() 
      {
		var inputs = document.getElementsByTagName("input");
            var span = Array();
		for(count = 0; count < inputs.length; count++) 
            {
			if(inputs[count].type == "radio" && inputs[count].className == "rdDsgStyle") 
                  {
				span[count] = document.createElement("SPAN");
				span[count].className = inputs[count].type;

				if(inputs[count].checked == true) 
                        {
					position = "0 -" + (radioHeight*2) + "px";
					span[count].style.backgroundPosition = position;

				}
				inputs[count].parentNode.insertBefore(span[count], inputs[count]);
				inputs[count].onchange = Custom.clear;
				span[count].onmousedown = Custom.pushed;
				span[count].onmouseup = Custom.check;
				document.onmouseup = Custom.clear;
			}
		}
	},
	pushed: function() 
      {
		element = this.nextSibling;
		if(element.checked == true && element.type == "radio") 
            {
			this.style.backgroundPosition = "0 -" + radioHeight*3 + "px";
		} 
            else 
            {
			this.style.backgroundPosition = "0 -" + radioHeight + "px";
		}
	},
	check: function() 
      {
		element = this.nextSibling;
		this.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
		group = this.nextSibling.name;
		inputs = document.getElementsByTagName("input");
		for(count = 0; count < inputs.length; count++) 
            {  
                if(inputs[count].name == group && inputs[count] != this.nextSibling) 
                {
			  inputs[count].previousSibling.style.backgroundPosition = "0 0";
		    }
		}
		element.checked = true;
		
	},
	clear: function() 
	{
		inputs = document.getElementsByTagName("input");
		for(var count = 0; count < inputs.length; count++) 
            {
		     if(inputs[count].type == "radio" && inputs[count].checked == true && inputs[count].className == "rdDsgStyle") 
                 {
			     inputs[count].previousSibling.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
		     } 
                 else if(inputs[count].type == "radio" && inputs[count].className == "rdDsgStyle") 
                 {
				inputs[count].previousSibling.style.backgroundPosition = "0 0";
		     }
		}
	}
}
