

function move_selected_list(lfrom,lto){
	
	var fid=__$('#'+lfrom).attr('value');
	
	if (!fid)return false;
	
	var cur_op=__$('#'+lfrom+' option[value='+fid+']');
	
	if (!cur_op)return false;
	
	var fvalue=cur_op.html();
	
	if (!fvalue)return false;
	
	cur_op_id=cur_op.attr('id');
	cur_op_id=cur_op_id.replace("cat_list_","");
	if (cur_op_id!=cur_op.attr('id')){
		if (__$("#cat_sel_"+cur_op_id).attr('value')){
			return;
		}else{
			__$("#"+lto).append('<option id="cat_sel_'+cur_op_id+'" value="'+fid+'">'+fvalue+'</option>');
			cur_op.hide();
		}
	}else{
		cur_op_id=cur_op.attr('id');
		
		cur_op_id=cur_op_id.replace("cat_sel_","");
		
		__$("#cat_list_"+cur_op_id).show();
		cur_op.remove();
	}
	__$('#'+lfrom+' option[disabled=""]:visible:first').attr({selected:"selected"});
	
	return true;
}

function multi_select_init(){

	__$("#form_upload input[type=submit]").each(function (e){ 
			
		var fnc=__$(this).attr("onclick");
		__$(this).attr({onclick: ""});
		__$(this).click(function(){
			__$(".cats_active_select").attr({multiple:"multiple"});
			
			__$(".cats_active_select option[disabled='']").attr({selected:"selected"});	
			return true;
		});
		if (fnc){
		 __$(this).click(fnc);
		}

	});
}

function on_cat_change(dis){
	if (dis.value=="suggest"){
		__$("#suggest_cat_div").show();
	}else{
		__$("#suggest_cat_div").hide();
	}
}

var rule_html="";
__$(document).ready(function(){
	
	multi_select_init();
	rule_html=__$('#rules_sec').html();

});
