$(document).ready(function(){
	//右移
	$("#selectclear #right").click(function(){
		$("#select1 option:selected").appendTo("#select2");
	});
	//左移
	$("#selectclear #left").click(function(){
		$("#select2 option:selected").appendTo("#select1");
	});	
	//上移下移
	$("#selectclear #up,#selectclear #down").click(function() {   
		var $opt = $("#select2 option:selected:first");   
		if (!$opt.length){
			return;
		}   
		if (this.id == "up"){
			$opt.prev().before($opt);  
		}else{
			$opt.next().after($opt); 
		}
	});   
	
	//双击右移
	$("#selectclear #select1").dblclick(function(){
		$("#selectclear #select1 option:selected").appendTo("#select2");	
	});
	//双击左移
	$("#selectclear #select2").dblclick(function(){
		$("#selectclear #select2 option:selected").appendTo("#select1");	
	});
	//$("#add_all").click(function(){
	//	$("#select1 option").appendTo("#select2");
	//});
	
	//$("#remove_all").click(function(){
	//	$("#select2 option").appendTo("#select1");
	//});
    $("#selectclear2 #right2").click(function(){
        $("#select3 option:selected").appendTo("#select4");
    });
    //左移
    $("#selectclear2 #left2").click(function(){
        $("#select4 option:selected").appendTo("#select3");
    });
    //上移下移
    $("#selectclear2 #up2,#selectclear2 #down2").click(function() {
        var $opt = $("#select4 option:selected:first");
        if (!$opt.length){
            return;
        }
        if (this.id == "up2"){
            $opt.prev().before($opt);
        }else{
            $opt.next().after($opt);
        }
    });

    //双击右移
    $("#selectclear2 #select3").dblclick(function(){
        $("#selectclear2 #select3 option:selected").appendTo("#select4");
    });
    //双击左移
    $("#selectclear2 #select4").dblclick(function(){
        $("#selectclear2 #select4 option:selected").appendTo("#select3");
    });
});