function makeSublist(parent,child,isSubselectOptional,childVals)
{
	$("body").append("<select style='display:none' id='"+parent+child+"'></select>");
	$('#'+parent+child).html($("#"+child+" option"));
	
			$('#'+child).html('');
			$('#'+parent).find("option:selected").each(
				function()
				{
					var parentValue = this.value;
					$('#'+child).append($("#"+parent+child+" .sub_"+parentValue).clone());
				}
			);
	
	var childVals = (typeof(childVals) == "undefined")? "" : childVals.split(',');
	for (i=0;i<childVals.length;i++) {
		$("#"+child+' option[value="'+ childVals[i] +'"]').attr('selected','selected');
	}
	
	$('#'+parent).change( 
		function()
		{
			$('#'+child).html('');
			$('#'+parent).find("option:selected").each(
				function()
				{
					var parentValue = this.value;
					
					$('#'+child).append($("#"+parent+child+" .sub_"+parentValue).clone());
					if(isSubselectOptional) $('#'+child).prepend('<option value="0">-</option>');
					$('#'+child).trigger("change");
					$('#'+child).focus();
				}
			);
		}
	);
}

(function($) {
        $.fn.disableTextSelect = function() {
            return this.each(function() {
		$(this).bind('keydown', function(e) {
			if (e.ctrlKey && e.keyCode == 86) {
				$(this).blur();
				alert("Nekopijuoti!");
				return false;
			}
                });
	    });
        }
})(jQuery);
/*
    if ($.browser.mozilla) {
        $.fn.disableTextSelect = function() {
            return this.each(function() {
                $(this).css({
                    'MozUserSelect' : 'none'
                });
            });
        };
        $.fn.enableTextSelect = function() {
            return this.each(function() {
                $(this).css({
                    'MozUserSelect' : ''
                });
            });
        };
    } else if ($.browser.msie) {
        $.fn.disableTextSelect = function() {
            return this.each(function() {
                $(this).bind('selectstart.disableTextSelect', function() {
                    return false;
                });
            });
        };
        $.fn.enableTextSelect = function() {
            return this.each(function() {
                $(this).unbind('selectstart.disableTextSelect');
            });
        };
    } else {
        $.fn.disableTextSelect = function() {
            return this.each(function() {
		$(this).css({
			'cursor' : 'default'
		});
		$(this).bind('mousedown', function() {
		    $(this).focus();
                    return false;
                });
                //$(this).bind('mousedown.disableTextSelect', function() {
                  //  return false;
                //});
            });
        };
        $.fn.enableTextSelect = function() {
            return this.each(function() {
                $(this).unbind('mousedown.disableTextSelect');
            });
        };
    }
})(jQuery);
*/
