<%@ page language="java" import="java.util.*,java.text.*,com.letousky.lottery.delegate.WinsFlat,com.letousky.lottery.action.AuxiliaryData,com.letousky.lottery.util.InsiderCenterFormat" pageEncoding="UTF-8"%>
<%

String rootUrl=request.getContextPath();


String[] parmas=new String[]{"501","0","1"};
List list=new WinsFlat().wins(parmas);
Object[] obj=list.toArray();
InsiderCenterFormat  format  =  new InsiderCenterFormat();
String[] pm = null;
List winsItem = new AuxiliaryData().winsSel(pm);
Object[] ws = winsItem.toArray();

String[] parmas_leij = null;
String[] leiJiZhongJiang = new AuxiliaryData().buyWinningLJZ(parmas_leij); 
String money = String.valueOf((int)Double.parseDouble(leiJiZhongJiang[0]) + 90000000);
int lgs = 10 - money.length();
for(int j=0;j<lgs;j++){
	money = "0"+money; 
}
%>
<%@include file='/common/headtop.jsp' %>
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/css/member.css" />
<!-- ======================================投注记录==================================== -->
<SCRIPT type=text/javascript src="<%=request.getContextPath()%>/js/jquery.min.js"></SCRIPT>
<link href="<%=request.getContextPath()%>/letoula/user/css/account.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/letoula/useraccount/css/date_input.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/letoula/css/top.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/letoula/css/user_c.css" rel="stylesheet" type="text/css" />

<script type='text/javascript' src='<%=request.getContextPath()%>/letoula/js/plugin/library.js'></script>
<script type='text/javascript' src='<%=request.getContextPath()%>/letoula/js/plugin/date_input.js'></script>

<script type='text/javascript'>
		var url = '<%=request.getContextPath()%>';
</script>
<script type='text/javascript' src='<%=request.getContextPath()%>/letoula/js/public.js'></script>
</head>
<body>
<%@include file='/common/topLine.jsp' %>
<%@include file='/common/nav.jsp' %>
<script type='text/javascript'>
			var userid='<%=userAry[1] %>';
			var nikeName = '<%=userAry[2]%>';
</script>
<!-- ======================================投注记录==================================== -->
<div class="row mt10">
  <%@include file='/member/memberLeft.jsp' %>
  <div class="memberR fright">
      <div class="tabMember">
         <ul>
           <li id="myon0" onclick="javascript:tabMember(0,'<%=request.getContextPath()%>/member/costum.jsp')">我的定制</li>
           <li class="on" id="myon1" onclick="javascript:tabMember(1,'<%=request.getContextPath()%>/member/mycostum.jsp')">定制我的</li>
           <li id="myon2" onclick="javascript:tabMember(2,'<%=request.getContextPath()%>/member/costummy.jsp')">邀请我的</li>
         </ul>
      </div>
     <div style="display:block;" id="on0"> 
      	<!--================================加入内容============================== -->
   			<div id='contentRight'>
    			<div class='RightWidth_content'>
    				
    				<table class='RightWidth_contenttab01' align='center' id='dingzhi_my_list' border='0' cellspacing='0' cellpadding='0'>
    					<colgroup><col width="164"/><col width="183"/><col width="218" /><col /></colgroup>
  						<thead><tr><th>彩种</th><th>已定制人数</th><th>跟单总金额</th><th>操作</th></tr>
				  		</thead>
				  		<tbody>
				  		</tbody>
    				</table>
    				
    				<div class='page'>
    		      <span class='f_an_page'></span>
    	            </div>
    			</div>
    		</div>
    		<!--================================加入内容============================== -->
    		 </div>
    
    <div style="display:none;" id="on1">  </div>
    <div style="display:none;" id="on2">  </div>
  </div>
</div>
<%@include file='/common/footer.jsp' %>

<script type='text/javascript'>
  		$('.loding').show();
  		
  		//nikeName = encodeURIComponent(nikeName);
  		$.getJSON(url+'/letoula/data/tary_single_user.jsp?r='+Math.random(),{'userNikeName':nikeName},function(JSON){
  				var tr='';
  				if(JSON.items.length == 0) tr = '<tr><td colspan="10">没有找到相关的记录！</td></tr>';
  				$('.singleuser').empty();
  				if(JSON.result == '0000'){
  					
  					$(JSON.items).each(function(i,v){
  						var listBg = i % 2 == 0 ? 'WhiteBg' : 'ContentLight';
  						tr += '<tr class="'+listBg+'"><td><strong>'+lotName[v.lotName]+'</strong></td><td><b class="font_red">'+v.zdr+'</b>人</td><td><b class="font_red">'+v.price+'</b>元</td><td><a href="javascript:void(0)" class="star" onclick="show_tr(this);clearInput();">邀请网友</a></td></tr><tr style="display:none"><td class="custom-td" colspan="4" align="left">请输入用户名：<input type="text" id="taryName"  name="taryName" class="taryName"/><input type="button" class="d_blue" onclick=tartAddSingle("'+v.lotName+'","'+nikeName+'") value="提交"/></td></tr>';
  							
  					});
  					$('#dingzhi_my_list > tbody').html(tr);
  					$("input[name='taryName']").each(  //每次初始化都要清空input框
  			  				function(){  
  			  					$(this).val("");
  			  					 }  
  			  					)  ;
  				}else{
  					alert(JSON.result);
  				}
  			$('.loding').hide();
  		});
  		
  		function show_tr(_this){
  			
  			if(_this.className=='star') $(_this).removeClass('star').addClass('end').parents('tr').next('tr').show();
  			else $(_this).removeClass('end').addClass('star').parents('tr').next('tr').hide();
  			
  		}
  		
  		function  tartAddSingle(lotName,nikeName){
  			
  			var canyuNikeName =  $("input[name='taryName']").val();
  			var count=0;
  			$("input[name='taryName']").each(  
  				function(){  
  					 if($(this).val()!=null && $(this).val()!=''){
  	  					// alert("值 -"+($(this).val()!=null && $(this).val()!=''));
  						count++;
  						canyuNikeName=$(this).val();
  					    }
  					 }  
  					  
  					)  ;
				if(count>1){
					//alert(count);
					alert("一次只能选择一个进行定制跟单");
					return false;
				}else{
  			//alert(canyuNikeName);
  			$.getJSON(url+'/letoula/data/tary_AddSingle_user.jsp?r='+Math.random(),{'lotName':lotName,'userNikeName':nikeName,'canyuNikeName':canyuNikeName,'message':'message'},function(JSON){
  				
  				if(JSON.result!='0'){
  					
  					alert("添加成功");
  					$('.end').removeClass('end').addClass('star').parents('tr').next('tr').hide();
  				}
  				else{
  					alert("用户不存在");
  				}
  			});
				}
  		}
  	function clearInput(){
  		$("input[name='taryName']").each(  //每次点击邀请按钮都要清空input框
	  				function(){  
	  					$(this).val('');
	  					 }  
	  					)  ;
  	}	
  		
  </script>

