function c(){
if(document.getElementById("collection_product")){
		$.ajax({
	    url: "conn/f.php?action=check_collection&type=product&id="+$("#collection_product").attr("pid"),
	    type: 'get',
	    success:function(res){
		    if(res=="true"){
		    	$("#collection_product").html("★ 已加入收藏");
			}else{
				$("#collection_product").html("☆ 加入收藏 ");
			}	
		}
	  });
	}
	if(document.getElementById("collection_news")){
		$.ajax({
	    url: "conn/f.php?action=check_collection&type=news&id="+$("#collection_news").attr("nid"),
	    type: 'get',
	    success:function(res){
		    if(res=="true"){
		    	$("#collection_news").html("★ 已加入收藏");
			}else{
				$("#collection_news").html("☆ 加入收藏 ");
			}	
		}
	  });
	}
	if(document.getElementById("collection_course")){
		$.ajax({
	    url: "conn/f.php?action=check_collection&type=course&id="+$("#collection_course").attr("cid"),
	    type: 'get',
	    success:function(res){
		    if(res=="true"){
		    	$("#collection_course").html("★ 已加入收藏");
			}else{
				$("#collection_course").html("☆ 加入收藏 ");
			}	
		}
	  });
	}
	if(document.getElementById("collection_shop")){
		$.ajax({
	    url: "conn/f.php?action=check_collection&type=shop&id="+$("#collection_shop").attr("mid"),
	    type: 'get',
	    success:function(res){
		    if(res=="true"){
		    	$("#collection_shop").html("★ 已收藏店铺");
			}else{
				$("#collection_shop").html("☆ 收藏店铺 ");
			}
		}
	  });
	}
}
	function collect(type,id){
		$.ajax({
	    url: "conn/f.php?action=collect&type="+type+"&id="+id,
	    type: 'get',
	    success:function(res){
		    data=JSON.parse(res);
		    if(data.code=="error"){
		    	alert(data.msg);
		    	if(data.msg=="请登录会员后操作"){
		    		$("#clogin").html("[登录]");
		    	}
			}else{
				c();
			}
		}
	  });
	}
setTimeout(c,1000);