2012-02-08 14:01:00 +00:00
|
|
|
jQuery(document).ready(function(){
|
|
|
|
|
|
|
|
jQuery(".niceRadio").each(
|
2012-02-14 16:05:41 +00:00
|
|
|
|
2012-02-08 14:01:00 +00:00
|
|
|
function() {
|
|
|
|
|
|
|
|
changeRadioStart(jQuery(this));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
function changeRadio(el)
|
2012-02-14 16:05:41 +00:00
|
|
|
|
2012-02-08 14:01:00 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
var el = el,
|
|
|
|
input = el.find("input").eq(0);
|
|
|
|
var nm=input.attr("name");
|
|
|
|
|
|
|
|
jQuery(".niceRadio input").each(
|
|
|
|
|
|
|
|
function() {
|
|
|
|
|
|
|
|
if(jQuery(this).attr("name")==nm)
|
|
|
|
{
|
|
|
|
jQuery(this).parent().removeClass("radioChecked");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if(el.attr("class").indexOf("niceRadioDisabled")==-1)
|
|
|
|
{
|
|
|
|
el.addClass("radioChecked");
|
|
|
|
input.attr("checked", true);
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
function changeVisualRadio(input)
|
|
|
|
{
|
2012-02-14 16:05:41 +00:00
|
|
|
|
2012-02-08 14:01:00 +00:00
|
|
|
var wrapInput = input.parent();
|
|
|
|
var nm=input.attr("name");
|
|
|
|
|
|
|
|
jQuery(".niceRadio input").each(
|
|
|
|
|
|
|
|
function() {
|
|
|
|
|
|
|
|
if(jQuery(this).attr("name")==nm)
|
|
|
|
{
|
|
|
|
jQuery(this).parent().removeClass("radioChecked");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
if(input.attr("checked"))
|
|
|
|
{
|
|
|
|
wrapInput.addClass("radioChecked");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function changeRadioStart(el)
|
2012-02-14 16:05:41 +00:00
|
|
|
|
2012-02-08 14:01:00 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
var el = el,
|
|
|
|
radioName = el.attr("name"),
|
|
|
|
radioId = el.attr("id"),
|
|
|
|
radioChecked = el.attr("checked"),
|
|
|
|
radioDisabled = el.attr("disabled"),
|
|
|
|
radioTab = el.attr("tabindex"),
|
|
|
|
radioValue = el.attr("value");
|
|
|
|
if(radioChecked)
|
|
|
|
el.after("<span class='niceRadio radioChecked'>"+
|
|
|
|
"<input type='radio'"+
|
|
|
|
"name='"+radioName+"'"+
|
|
|
|
"id='"+radioId+"'"+
|
|
|
|
"checked='"+radioChecked+"'"+
|
|
|
|
"tabindex='"+radioTab+"'"+
|
|
|
|
"value='"+radioValue+"' /></span>");
|
|
|
|
else
|
|
|
|
el.after("<span class='niceRadio'>"+
|
|
|
|
"<input type='radio'"+
|
|
|
|
"name='"+radioName+"'"+
|
|
|
|
"id='"+radioId+"'"+
|
|
|
|
"tabindex='"+radioTab+"'"+
|
|
|
|
"value='"+radioValue+"' /></span>");
|
|
|
|
|
2012-02-14 16:05:41 +00:00
|
|
|
|
2012-02-08 14:01:00 +00:00
|
|
|
if(radioDisabled)
|
|
|
|
{
|
|
|
|
el.next().addClass("niceRadioDisabled");
|
|
|
|
el.next().find("input").eq(0).attr("disabled","disabled");
|
|
|
|
}
|
2012-02-28 15:40:22 +00:00
|
|
|
|
|
|
|
el.next().bind("mousedown", function(e) {
|
|
|
|
changeRadio(jQuery(this));
|
|
|
|
$(this).find("input:radio").change();
|
|
|
|
});
|
|
|
|
|
2012-02-08 14:01:00 +00:00
|
|
|
if(jQuery.browser.msie) el.next().find("input").eq(0).bind("click", function(e) { changeVisualRadio(jQuery(this)) });
|
|
|
|
else el.next().find("input").eq(0).bind("change", function(e) { changeVisualRadio(jQuery(this)) });
|
|
|
|
el.remove();
|
|
|
|
}
|
|
|
|
catch(e)
|
|
|
|
{
|
2012-02-14 16:05:41 +00:00
|
|
|
|
2012-02-08 14:01:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|