<?php
require "../e/class/connect.php";
require "../e/class/db_sql.php";
require "../e/member/class/user.php";
$link=db_connect();
$empire=new mysqlquery;
require "class/fun.php";
$ur=user_returnlogin();
$userid=$ur[userid];
$usercheck=checklogin($userid);
$username=$ur[username];
$nickname=getnickname($ur[userid]);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>我的订阅 - 会员中心 -<?=$public_r[sitename]?></title>
<script type="text/javascript">
		function setupLabel(){
            if($('.label-checkbox input').length) {
                $('.label-checkbox').each(function(){
                    $(this).removeClass('label-checkbox-on');
                });
                $('.label-checkbox input:checked').each(function(){
                    $(this).parent('label').addClass('label-checkbox-on');
                });
            };
            if($('.label-radio input').length) {
                $('.label-radio').each(function(){
                    $(this).removeClass('label-radio-on');
                });
                $('.label-radio input:checked').each(function(){
                    $(this).parent('label').addClass('label-radio-on');
                });
            };
        }  
	</script>
<? include_once "temp/header.php"; ?>
<!-- // i-header end -->
<div id="content" class="layout">
  <div class="ui-box ui-qire fn-clear" id="i-box">
<? include_once "temp/left.php"; ?>
    <!-- // i-bar end -->
    <div class="i-box-cnt" id="i-cnt">
      <div id="i-favourite">
        <div class="ui-title i-tab-nav-box">
          <ul class="i-tab-nav" id="pids">
            <li class="current"><a href="class/ajax.php?action=getmyremind&t=" hidefocus>我的订阅</a></li>

          </ul><a class="i-button i-button-rsset" href="setremind.php">订阅更新设置</a>
        </div>
        <div class="ui-cnt">
          <ol class="user-img-list" id="xlist">
            <li class="loading"><img src="temp/images/loading.gif"/>正在努力为您加载中... </li>
          </ol>
          <!-- // pic-list End -->
          <div class="user-opera fn-clear" style="margin:15px 0 20px 0;border-top:1px solid #f5f5f5;" id="i-do">
            <div class="check-del fn-left">
              <label class="label-checkbox" for="checkall" hidefocus>
                <input type="checkbox" id="checkall" />
                全选</label>
              <form action="" method="post" id="delremindform">
                <input type="hidden" value="" id="delids" name="lid" />
                <a class="ui-edit ui-edit-short cleanup" href="javascript:;" data="1" id="delchecked">删除</a>
              </form>
            </div>
            <div id="xpage" class="fav-pic-page"></div>
          </div>
        </div>
      </div>
      <!-- // ui-box End -->
      <div id="i-hot-fav">
        <div class="ui-title i-tab-nav-box">
          <ul class="i-tab-nav">
            <li class="current">热门订阅</li>
          </ul>
        </div>
        <div class="ui-cnt">
          <ol class="user-img-list"  id="hotremind">
            <li class="loading"><img src="temp/images/loading.gif"/>正在努力为您加载中... </li>
          </ol>
          <!-- // pic-list End -->
        </div>
      </div>
      <!-- // ui-box End -->
    </div>
  </div>
  <!-- // i-cnt End -->
  <script type="text/javascript">
		function pagegoo(url){
			if(navigator.userAgent.indexOf('MSIE 6.0')>0||navigator.userAgent.indexOf('MSIE 9.0')>0){
				url=url+"&"+Math.random();
		    }
			$.ajax({url:url,success: function(data){
			    if(data.havedata){
					
					$("#xlist").html(data.ajaxtxt);
					$("#i-do").show();
					$("#checkall").click(function(e){
						if ($(this).is(":checked")) {
							$("#xlist [name = loveids]:checkbox").each(function () {
								$(this).attr('checked',true);
							});							 
						}else{
							$("#xlist [name = loveids]:checkbox").each(function () {
								$(this).attr('checked',false);
							});		
						}
					});
				}else{
					$("#xlist").html('<li class="kong">当前没有订阅，您可以点击下面的订阅</li>');
					$("#i-do").hide();
				}
				$("#xpage").html(data.pages);
				$("#xpage a").click(function (e){
					pagegoo(e.target);
					return false;
				});
				$(".fav-cancel").click(function(event){
					$.showfloatdiv({
						wantclose:2,
						succdo:function(r){
								if(parseInt(r.rcode)==1){
								pagegoo("class/ajax.php?action=getmyremind");
								$("#pids").html(r.dhtxt);
								$("#pids a").unbind();
								$("#pids a").click(
								function (e){
									$(this).parent('li').nextAll().removeClass('current');
									$(this).parent('li').prevAll().removeClass('current');
									$(this).parent('li').addClass('current');
									pagegoo($(this).attr('href'));
									return false;
								}
								);
							}
						},txt:'确认删除?'
					});
				});
			},dataType:'json'});
			return false;				
		}
		
		pagegoo("class/ajax.php?action=getmyremind");
		
		function gethot(url){
			$.ajax({ 
				url: url,  
				success: function(data){
				$("#hotremind").html(data);
				$('.fav-add').unbind();
				$('.fav-add').click(function (e){
				$.showfloatdiv({cssname:'loading'});
		    	var turl=$(this).attr('href');
			  $.get(
				turl,'',
				function(data){
					$.hidediv(data);
					if(parseInt(data.rcode)>0){
					gethot('class/ajax.php?action=gethotremind');
					pagegoo("class/ajax.php?action=getmyremind");
					$("#pids").html(data.dhtxt);

						$("#pids a").click(
						function (e){
							$(this).parent('li').nextAll().removeClass('current');
							$(this).parent('li').prevAll().removeClass('current');
							$(this).parent('li').addClass('current');
							pagegoo($(this).attr('href'));
							return false;
						}
						);
					}
				},
				'json'
			);
			return false;
		});
				},dataType:'html'});
		}
		gethot('class/ajax.php?action=gethotremind');
		$("#pids a").click(function (e){
			$(this).parent('li').nextAll().removeClass('current');
			$(this).parent('li').prevAll().removeClass('current');
			$(this).parent('li').addClass('current');
			pagegoo($(this).attr('href'));
			return false;
		});
		function delcheck(){
										$("#delchecked").unbind();
										$("#delchecked").click(
										function (e){
											var result = new Array();
											$("#xlist [name = loveids]:checkbox").each(function () {
												if ($(this).is(":checked")) {
													result.push($(this).attr("value"));
												}
											});							 
												$.showfloatdiv(
														{
														txt:'确定删除？',
														wantclose:2,
														suredo:function(e){
														$("#delids").attr('value',result);
														$("#delremindform").qiresub({
														curobj:$("#delchecked"),
														txt:'数据提交中,请稍后...',
														onsucc:function(result){
															$.hidediv(result);
															if(parseInt(result['rcode'])>0){
																	pagegoo("class/ajax.php?action=getmyremind");
																	$("#pids").html(result.dhtxt);
																	$("#pids a").unbind();
																	$("#pids a").click(
																	function (e){
																		$(this).parent('li').nextAll().removeClass('current');
																		$(this).parent('li').prevAll().removeClass('current');
																		$(this).parent('li').addClass('current');
																		pagegoo($(this).attr('href'));
																		return false;
																	}
																	);
																	$("#checkall").attr('checked',false);
																	}
														}
						 								}).post({url:'class/ajax.php?action=postdelremind'});
														$.closefloatdiv();
														return false;
														}
														}	
														);
											}
											);
		}
		delcheck();
		</script>
</div>
<!-- // maxBox End -->
</div>
<? include_once "temp/footer.php"; ?>
</body>
</html>