$(document).ready(function(){
	$("#trusteeshipMark a").click(function(){
		$("#trusteeshipMark").slideUp("fast");
	})
})

$(document).ready(function(){
	$("#yes").click(function(){ $(".pubForm .i1,.pubForm .i1-b").show();  $(".pubForm .i2,.pubForm .i2-b").hide(); $(".pubForm .i0").hide(); $(".nowPub .buttonTaskPubOut").hide();})
	$("#not").click(function(){ $(".pubForm .i2,.pubForm .i2-b").show();  $(".pubForm .i1,.pubForm .i1-b").hide(); $(".pubForm .i0").hide(); $(".nowPub .buttonTaskPubOut").hide();})
})



//任务发布提示
$(function(){
	$("ul.publishFormDetail li p").hide();
	$("li.rwyq p").show();
	$("ul.publishFormDetail input, ul.publishFormDetail Select, ul.publishFormDetail Textarea").click(function(){
		$(this).addClass("inputNewi").siblings("p").show();
		$(this).parents().siblings("li").find("p").hide();
		$("li.rwyq p").show();
		$(this).parents().siblings("li").find("input, Textarea").removeClass("inputNewi");
	});
})

$(function(){
	$("#zo").change(function(){
		var index=$(this).val();
		if(index==1){ $("em.z1").show(); $("em.z1").siblings("em:visible").hide(); }
		else if(index==2){ $("em.z2").show(); $("em.z2").siblings("em:visible").hide(); }
		else if(index==3){ $("em.z3").show(); $("em.z3").siblings("em:visible").hide(); }
		else { $("em.z4").show(); $("em.z4").siblings("em:visible").hide(); }
	})
})

//托管100%、20%
$(function(){
	$("#trusteeshipAbout .trusteeship_100").click(function(){
		$(this).addClass("trusteeship_100_on");
		$(".trusteeship_20").removeClass("trusteeship_20_on");
		$("#trusteeshipDetailA").slideDown("600");
		$("#trusteeshipDetailB").slideUp("600");
		$(".trusteeshipGo_a").show();
		$(".trusteeshipGo_b").hide();
	});
	$("#trusteeshipAbout .trusteeship_20").click(function(){
		$(this).addClass("trusteeship_20_on");
		$(".trusteeship_100").removeClass("trusteeship_100_on");
		$("#trusteeshipDetailA").slideUp("600");
		$("#trusteeshipDetailB").slideDown("600");
		$(".trusteeshipGo_a").hide();
		$(".trusteeshipGo_b").show();
	});
})

$(function(){
	$("#asideHelpContent div").each(function(index){
		$(this).attr("id","asideHelp_"+index)
	})
});

//任务详细页
$(function(){
	$(".dh .collapsed").click(function(){
		$("ul.task_g").slideToggle("fast");
		$(this).toggleClass("collapsed_yes");
	})
})

$(function(){
	$(".menber_tab .dianji").click(function(){
		$("div.options").slideToggle("fast");
		$(this).toggleClass("collapsed_yes");
	})
})


$(function(){
	$("<div class='popBg toFavbg'></div>").insertBefore(".toFav ul");
	$("<div class='popBg sharebg'></div>").insertBefore(".formShare");
	$("<div class='popBg sendCombg'></div>").insertBefore(".sendCom");
	// 收藏
	$(".taskDetailTitle .toFav span").click(function(){
		var bgWidth=$(this).next(".popBg").next().width(); //获取前景层宽、高
		var bgHeight=$(this).next(".popBg").next().height();
		$(this).next(".popBg").css({width:bgWidth,height:bgHeight}); //定义背景层宽、高
		$(".toFav ul, .toFavbg").slideToggle("fast");
		$(this).toggleClass("active");
		$(".share span").removeClass("active");
		$(".formShare,.sharebg").hide();
	});
	// 分享
	$(".taskDetailTitle .share span").click(function(){
		var bgWidth=$(this).next(".popBg").next().width(); 
		var bgHeight=$(this).next(".popBg").next().height();
		$(this).next(".popBg").css({width:bgWidth,height:bgHeight}); 
		$(".formShare,.sharebg").slideToggle("fast");
		$(this).toggleClass("active");
		$(".toFav span").removeClass("active");
		$(".toFav ul,.toFavbg").hide();
	})
	// 任务交流
	$(".taskDraftArea .buttonBlue em").click(function(){
		var bgWidth=$(this).next(".popBg").next().width(); 
		var bgHeight=$(this).next(".popBg").next().height();
		$(this).next(".popBg").css({width:bgWidth,height:bgHeight}); 
		$(".sendCom,.sendCombg").show("fast");
		$(".sendCom .close").click(function(){
			$(".sendCom,.sendCombg").hide("fast");
		});
		$(".sendCom .buttonDefaultMes").click(function(){
			$(".sendCom,.sendCombg").hide();
		});
	})
	//我有异议
	$(".taskDraftArea .yiyi em").click(function(){
		var bgWidth=$(this).next(".popBg").next().width(); 
		var bgHeight=$(this).next(".popBg").next().height();
		$(this).next(".popBg").css({width:bgWidth,height:bgHeight}); 
		$(".sendCom,.sendCombg").show("fast");
		$(".sendCom .close").click(function(){
			$(".sendCom,.sendCombg").hide("fast");
		});
		$(".sendCom .buttonDefaultMes").click(function(){
			$(".sendCom,.sendCombg").hide();
		});
	})

	$("<div class='popBg space_sharebg'></div>").insertBefore(".space_share ul");
	$(".taskDetailTitle .space_share span").click(function(){
			var bgWidth=$(this).next(".popBg").next().width();
			var bgHeight=$(this).next(".popBg").next().height();
			$(this).next(".popBg").css({width:bgWidth,height:bgHeight});
			$(".space_share ul,.space_sharebg").slideToggle("fast");
			$(this).toggleClass("active");
			$(".toFav span,.share span").removeClass("active");
			$(".toFav ul,.toFavbg,.formShare").hide();
			})

})
//分享
function add_share(f){
	var notice=f.notice.value;
	var tId=f.tId.value;
	f.submit.value="正在通信..";
	f.submit.disabled=true;
	$.ajax({
type: "POST",
url: "/task/?mod=tasks&com=share",
data: "tId="+tId+"&notice="+notice,
success: function(msg){
if(msg==1){
alert('分享成功');
}else{
alert('登录后才能分享！');
}
$(".space_share ul,.space_sharebg").slideToggle("fast");
$(".space_share span").toggleClass("active");
$(".space_share ul").hide();
f.submit.value="完成";
return false;
}
});
//var share=document.getElementById("add_sare");
//share.onclick();
return false;
}


//任务交流
$(function(){$(".taskCom .communication li:even, .taskDraftContent .comment li:odd").addClass("even");});
$(function(){$('<div style="display:block;clear:both;"></div>').insertBefore(".draftAll .pages");});


