//收藏试题
function change(myLab){		
			
		    $.ajax({
			   type: "POST",
			   url: "/favorite/favorite.aspx",
			   data: {addType:'add',kaoid:0,examid:myLab,typeid:3},
			   processData: true,
			   success: function(data){
			var bg = document.getElementById("mylab"+myLab);
			if(bg.style.backgroundColor=="white" || bg.style.backgroundColor=="" || bg.style.backgroundColor=="yellow")
			{
				bg.style.backgroundColor="#D9FDDC";
			}
			else if (bg.style.background=="#D9FDDC"){				
				bg.style.backgroundColor="yellow";	
			}
			$("#bj"+myLab).val("已经收藏");
			$("#bj"+myLab).attr("disabled",true);
			}  
			});
}

//收藏试题
function change2(myLab){		
			
		    $.ajax({
			   type: "POST",
			   url: "/favorite/favorite.aspx",
			   data: {addType:'add',kaoid:0,examid:myLab,typeid:3},
			   processData: true,
			   success: function(data){
			$("#bj"+myLab).val("已经收藏");
			$("#bj"+myLab).attr("disabled",true);
			}  
			});
}
//收藏法条,教材
function favoriteb(myLab,typeid){		
$.ajax({
			   type: "POST",
			   url: "/favorite/favorite.aspx",
			   data: {addType:'add',lawid:myLab,typeid:typeid},
			   processData: true,
			   success: function(data){
			var bg = document.getElementById("mylab"+myLab);
			if(bg.style.backgroundColor=="white" || bg.style.backgroundColor=="" || bg.style.backgroundColor=="yellow")
			{
				bg.style.backgroundColor="#D9FDDC";
			}
			else if (bg.style.background=="#D9FDDC"){				
				bg.style.backgroundColor="yellow";	
			}
			$("#bj"+myLab).val("已经收藏");
			$("#bj"+myLab).attr("disabled",true);
			}  
			});
}
//移除收藏
function delefav(dataid,typeid)
{
$.ajax({
			   type: "POST",
			   url: "/favorite/delete.aspx",
			   data: {addType:'add',typeid:typeid,id:dataid},
			   processData: true,
			   success: function(data){
			$("#book"+dataid).html("");
			//$("#book"+dataid).slideDown();
		}
			});
}
//查看法条
function viewlaw(myLab,typeid){		
$.ajax({
			   type: "POST",
			   url: "/update/law.aspx?flag=3&bookid="+ myLab +"",
			   data: {addType:'add',lawid:myLab,typeid:typeid},
			   processData: true,
			   success: function(data){
			$("#law"+myLab).html(data);
			$("#law"+myLab).slideDown();
		}
			});
}
//做题时变色
function changeb(myLab){
			var bg = document.getElementById(myLab);
			if(bg.style.backgroundColor=="white"||bg.style.backgroundColor==""){
				bg.style.backgroundColor="yellow";
			}else{
				bg.style.backgroundColor="yellow";
			}
}
//做题时变色改变状态
function changebg(myLab){
			var bg = document.getElementById(myLab);
			if(bg.style.backgroundColor=="white"||bg.style.backgroundColor==""){
				bg.style.backgroundColor="yellow";
			}else{
				bg.style.backgroundColor="yellow";
			}
			document.getElementById("count"+myLab).value="1";
}
//查看正确答案
		function showMsgd(obj,id){
			var str = obj.id.substr(4);
			var count = document.getElementById("countmylab"+str).value;
			if(count==""){
				alert('请先答题才可以看正确答案');	
			}
			else
			{
				disabledinput(str);
				document.getElementById("countmylab"+str).value="2";				
				//var str="myDiv"+id;
				//shW(str);
				tipsWindown("正确答案解析","url:get?/update/examanswer.aspx?examid="+ id +"","500","300","true","","true","text");
			}
		}		
		function disabledinput(str){
			var insize = jQuery("#xx"+str).find("input").size();
				for(var i=0;i<insize;i++){
					if(jQuery("#xx"+str).find("input")[i].checked){
						jQuery("#xx"+str).find("input")[i].disabled=true;
						jQuery("#xx"+str).find("input")[i].checked=true;
						
					}else
						jQuery("#xx"+str).find("input")[i].disabled=true;
				}
		}
//功能：判断选择的radiobox选取的值
 function detect(obj){
    var checkValue = "" ;
	for(l=0;l<4;l++){
	   if(obj[l].checked){	   
		checkValue = checkValue + obj[l].value;		
		}
	}
	return checkValue ;
}
//弹出小窗口开始
function shW(id){
var html= document.getElementById(id).innerHTML;
ScreenConvert();    
DialogShow(html,250,120,400,350);
}
//关闭小窗口开始
function closeW(){
	DialogHide();
	location.href="/report/";
}
//评论
function reviewadd()
{
	if(document.formreview.rating.value=="")
	{
		alert("请选择评价级别！");
		return false;
	}
	if(document.formreview.rev_text.value=="")
	{
		alert("请填写评论内容！");
		document.formreview.rev_text.focus();
		return false;
	}
	return true;
}
//生成计划
function createplan(flag)
{
var typeid=$("#typeid").val();
$("#loading").html("<img src='/image/wait_s.gif' border=0 />正在生成日历计划表，请稍候...");
     		$.ajax({
			   type: "POST",
			   url: "/plan/createcalendar.aspx",
			   data: {typeid:typeid,flag:flag},
			   processData: true,
			   success: function(data)
			   {
				$("#loading").html(data)
			   }
	});
}
function upplan(flag)
{
var typeid=$("#typeid").val();
$("#loading").html("<img src='/image/wait_s.gif' border=0 />正在生成日历计划表，请稍候...");
     		$.ajax({
			   type: "POST",
			   url: "/plan/upcalendar.aspx",
			   data: {typeid:typeid,flag:flag},
			   processData: true,
			   success: function(data)
			   {
				$("#loading").html(data)
			   }
	});
}
