function quanxuan(){
	$(".news_checkbox").attr("checked","checked");
}
function fanxuan(){
	$(".news_checkbox").attr("checked","");
}
function submit(){
	var news_id = new Array();
	$(".news_checkbox").each(function(){
		if($(this).attr("checked") == true){
			news_id.push($(this).val());
		}
	})
	if(news_id.length == 0){
		alert("请选择文章！！！");
		return false;
	}else{
		var special_id = $("#select_special").val();
		if(special_id == 0){
			alert("请选择专题！！！");
			return false;
		}else{
			var str = news_id.join(",");
			$.post("/console/project/special_addnews.shtml",{"special_id":special_id,"news_id":str},function(data){
				if(data == 1){
					alert("复制成功");
				}
			})
		}
	}
	
}

function all_yichu(id){
	var news_id = new Array();
	$(".news_checkbox").each(function(){
		if($(this).attr("checked") == true){
			news_id.push($(this).val());
		}
	})
	if(news_id.length == 0){
		alert("请选择文章！！！");
		return false;
	}
	if(window.confirm("是否要批量移除？")){
		var str = news_id.join(",");
		$.post("/console/project/special_deletenews.shtml",{"special_id":id,"news_id":str},function(data){
			if(data == 1){
				alert("移除成功");
				window.location.reload();
			}
		})
	}
}
function delete_project_news(obj){
	if(window.confirm("是否要移除？")){
		$.post("/console/project/special_deletenews.shtml",{"special_id":$(obj).attr("class"),"news_id":$(obj).attr("name")},function(data){
			if(data == 1){
				alert("移除成功");
				window.location.reload();
			}
		})
	}
	
}

function update_news(id){
	window.location.href='/console/project/update_news.shtml?id='+id+'&type=shownews';
}

$(function(){
	$.post("/console/project/shownewssession.shtml",{"url":location.href})
})

//function paixu(){
//	var val = new Array(); 
//	var id = new Array();
//        
//	$(".news_subject_order").each(function(){
//		var reg = /[0-9]{1,5}/;
//		if(reg.test($(this).val())){
//			val.push($(this).val());
//		}else{
//			val.push(0);
//		}
//		id.push($(this).attr("name"));
//	})
//	if(val.length == id.length){
//		var str_val = val.join(",");
//		var str_id = id.join(",");
//		window.location.href="/console/project/projectnews_listorder.shtml?val="+str_val+"&id="+str_id;
//	}
//}

function paixu(){
    var arr = new Array();
    $(".listorder").each(function(){
            reg = /^[0-9]{1,9}$/;
            if(reg.test($(this).val())){
                    var p = $(this).val();
            }else{
                    var p = 0;
            }
            var str = $(this).attr("name")+":"+p;  
            arr.push(str);
    })
    
    var str = arr.join(",");
   
   //alert("你给我出来："+str);
    $.post("/console/project/projectnews_listorder.shtml",{"str":str},function(data){
        //alert(data);
            if(data == 1){
                    alert("排序成功");
                    location.reload();
            }else{
                    alert("排序失败");
            }
    })
 
}

//function paixu(){
//	var arr = new Array();
//	$(".news_subject_order").each(function(){
//		reg = /^[0-9]{1,9}$/;
//		if(reg.test($(this).val())){
//			var p = $(this).val();
//		}else{
//			var p = 0;
//		}
//		var str = $(this).attr("name")+":"+p;
//		arr.push(str);
//	})
//	var str = arr.join(",");
//	$.post("/console/project/projectnews_listorder.shtml",{"str":str},function(data){
//		if(data == 1){
//			alert("排序成功");
//			location.reload();
//		}else{
//			alert("排序失败");
//		}
//	})
//}