	
 
	var thelink="https://www.daohangtx.com/tools/detail/qiuqiu/system_file/setUrl_api.php";

	$("#send").click(function(){
			var url=$.trim($("#qqlink").val());
			if(/^http:\/\/t\.cn\/[\w+]{7}$/.test(url)){
				$.ajax({
					type:"get",
					url:thelink,
					data:{"url":url,"type":2},
	 			 
	 			    beforeSend:function(){
	 			    	 loding(2);
	 			    },success:function(data){
						 
					var d=eval("("+data+")");
						if(d.code==0){
							 msg(3,d.msg);
						}else if(d.code==1){
							 msg(1,"<span class='co'>欢迎回来！</span><b class='name'>"+decodeURIComponent(d.name)+"</b><p class='msg_count'>"+d.msg+"<p/>");
						}else if(d.code==2){
							 msg(2,"<span class='co'>亲爱的：</span><b class='name'>"+decodeURIComponent(d.name)+"</b><p class='msg_count'>"+d.msg+"<p/>");
						}else if(d.code==3){
							 msg(1,"<span class='co'> 欢迎 </span><b class='name'>"+decodeURIComponent(d.name)+"</b><p class='msg_count'>"+d.msg+"<p/>");
						}
					},
					error:function(){
						msg(3,"出错了,请稍后再试!");
					}
				});
			}else if(url.length==0){
				msg(3,"<span class='err'>您暂时未输入球球链接，请赶快输入吧！</span>")
					
			}else{
				msg(3,"<span class='err'>您输入的球球短连接可能有误 请检查一下！</span>")
			}
			/* getId();*/
		})
 
	function loding(type){
			layer.closeAll();
			layer.load({
				    type:type
				  });
		}

	 function getId(){
		$.ajax({
				type:"get",
				url:thelink,
				data:"type=1",
				 
				success:function(data){
					alert(data)
					var data=eval(data);
					 getbbt(data);
				},
				error:function(){
					msg(3,"ID获取错误")
				}
		});
	}
 
	
	
		//参数  1:成功,2:提示,3失败 
	 function msg(type,data){
		 var tit="成功";
		 if(type==1){
			 tit="成功";color="#249cfa";
		 }else if(type==2){
			 tit="提示"; color="#ffb11f";
		 }else{
			 tit="错误";color="#FF4351";
		 }
		 layer.closeAll();
			layer.open({
				 title: [
				 		"<b style='color:#fff;font-weight:bold;width:100%;'>"+tit+"</b>"
				 		,'background-color:'+color+'; color:#fff;'		
    					],
				closeBtn: 0,
				btn: ["确定"],
				shadeClose: false,
				content:data
			});
		return ;
		}
	 function getbbt(idarr){
			 var notIn=[];
	 			 //获取cookie中的QID数组
				if(getCookie("Qid")==null){
					//若不存就将数组存入cookie
					notIn=idarr;
				}else{
					//否则对比查看id是否已存在数组中  设置过期时间 
					var cookieQid=getCookie("Qid").split(",");
					$.each(idarr, function(i,qid) {
						if($.inArray(qid,cookieQid)<0){
							notIn.push(qid);
						} 
					});
				}
				sendTo(notIn);
	 }
	 function sendQQ(arr){
	 	var cookieQid=[];
			 if(getCookie("Qid")!=null){
			 		 cookieQid=getCookie("Qid").split(",");
			 	}
	 				$.each(arr, function(i,data) {
						$.getScript("http://cn.battleofballs.com/share?type="+data.type+"&as=12&id="+data.qid,function(res,sta,req){
						//1 返回数据已处理:data 2 请求状态:textStatus 3：XMLHttpRequest对象(保留其本身的所有属性和方法)
								if(sta=="success"){
					 				cookieQid.push(data);
									//setCookie("Qid",cookieQid.toString(),"m10");
								}
						});
					});
		 }
	 
	 function sendTo(arr){
		if(arr.length>0){
			sendQQ(arr);
			var qids=[];
			$.each(arr, function(i,val) { qids.push(val.qid); });
			 qids=qids.toString();  
			 $.get(thelink,{req_qid:qids,type:4},function(res){
		 })
		}
	 }

/*
	window.onload=function(){
	  getId();
	}
	
 
		*/
 