﻿(function ($) {
    $.fn.extend(
	{   //ie 6,5 ve diğer düşük versiyonlar için "select option disabled" özelliğini ayarlar
	    optionDisable: function () {
	        var ths = $(this);
	        if (ths.attr('tagName').toLowerCase() == 'option') {
	            ths.before($('<optgroup>&nbsp;</optgroup>').css({ color: '#ccc', height: ths.height() }).attr({ id: ths.attr('value'), label: ths.text() })).remove();
	        }
	        return ths;
	    },
	    optionEnable: function () {
	        var ths = $(this);
	        var tag = ths.attr('tagName').toLowerCase();
	        if (tag == 'option') {
	            ths.removeAttr('disabled');
	        }
	        else if (tag == 'optgroup') {
	            ths.before($('<option />').attr({ value: ths.attr('id') }).text(ths.attr('label'))).remove();
	        }
	        return ths;
	    }
	});
})(jQuery);
