<?php require APPPATH_MVC.'views/header.php'; ?>

<div class="w960 clearfix mt10 pepcenterBox">
		<?php require APPPATH_MVC.'views/left.php'; ?>
		<!--会员左侧 End-->
		<div class="user-main user-main02">
				<div class="hd-bar pos-r">
						<h2>我的消息</h2>
				</div>
				<div class="user-main user-main03">
						<div class="mod-list my-messages source-manger03">
								<?php 
        if(is_array($message) && !empty($message)){
        $n=1;
        foreach($message as $key=>$value){
        ?>
								<div class="list-inner clearfix <?php if($n%2==0)echo 'odd';?>"> <span class="chk">
										<input type="checkbox" name="rows_id" value='<?php echo $value['id'];?>' />
										<label></label>
										</span>
										<div class="mes-inner <?php if($value['new'] == 1) echo 'read-over';?>"> <span class="mes-ico"></span>
												<div class="mes-con">
														<p class="mes-name" onclick="updateread(<?php echo $value['id'];?>,<?php echo $value['new'];?>)"><?php echo $value['subject'];?></p>
														<div class="mes-txt">
																<p><?php echo $value['message'];?></p>
														</div>
												</div>
										</div>
										<span class="mes-time"><?php echo date('Y-m-d',$value['creattime']);?></span> 
										<!-- <a href="javascript:void(0)" class="mes-look">详情</a>--> 
								</div>
								<?php 
        $n++;
        }}else{
        ?>
								<div class="mod-list h-source">
										<div class="no-result">目前您还没有消息哦。</div>
								</div>
								<?php } ?>
						</div>
						<?php 
        if(is_array($message) && !empty($message)){
        ?>
						<div class="solidDiv">&nbsp;</div>
					<?php } ?>
						<?php if(is_array($message) && !empty($message)){?>
						<div class="handle handle02"> <a class="handle-btn" id="select-all-btn">
								<input type="checkbox" value=''  />
								<label class="sel-all">全选</label>
								</a><a class="handle-btn" id="del-select-btn" href="javascript:subcheckform()">标为已读</a><a class="handle-btn" id="del-select-btn" href="javascript:submit_all()">删除</a> </div>
						<?php }?>
						<div class="cut-page"> <?php echo page_uri($page,$pages,USER_CENTER.'user/mymessage');?> </div>
				</div>
		</div>
		<!--会员右侧 End-->
		<form id="action_form" action="<?php echo USER_CENTER.'user/mymessage'?>" method="post" name="action_form">
				<input type="hidden" value="" name="actionid">
				<input type="hidden" value="del" name="muldel">
		</form>
</div>
<script>
function subcheckform(){
		var arr = new Array();
		$(".mod-list").find("input:checked[name=rows_id]").each(function(i) {
		arr[i]=$(this).val();
		});
		var ids=arr.join(",");
        $.ajax({
            type: 'post',
            url : '<?php echo USER_CENTER;?>user/updateread',
            data: 'ids='+ids,
            dataType:'html',
            success: function(msg){
			     if(msg==1)
			     {
				 setTimeout("location.reload()",3000);
				 }
                }
            }
        );
   }
   
   function updateread(id,is_new){
    if(is_new == 0)
    {
		 $.ajax({
            type: 'post',
            url : '<?php echo USER_CENTER;?>user/updateread',
            data: 'id='+id,
            dataType:'html',
            success: function(msg){
                }
            }
        );
   }
   }



function submit_all(mark){
    var arr = new Array();
    $(".mod-list").find("input:checked[name=rows_id]").each(function(i) {
    arr[i]=$(this).val();
    });
    var ids=arr.join(",");
    if(ids) {
    if(mark==1)
    {
     document.action_form.actionid.value=ids;
     $.ajax({
     type: 'post',
     url : '<?php echo USER_CENTER;?>user/mymessage',
     data: 'actionid='+ids+'&muldel=del',
     dataType:'html',
     success: function(msg){
         if(msg==1)
             $("#pop_win_1").hide();
            openWin('warning');
            setTimeout("location.reload()",3000);
        }
       });

    }else{
     openWin('pop_win_1');
    }
    
    }
}


</script> 
<script>
var openWin = function(obj){
	var winHeght = $(document).height() ;
	var winElemt = $('#'+ obj);
	
	var win = {
		
		height : function(){
			return winElemt.outerHeight();
		},
		
		width : function(){
			return winElemt.outerWidth();
		},
		
		show : function(){
			winElemt.css({
				'position':'absolute',
				'z-index':'9999902',
				'left':'50%',
				'margin-left':'-' + win.width() / 2 + 'px',
				'top':$(window).height()/2 - (win.height()/2) + $(window).scrollTop() + 'px'
			}).show();
		},
		
		hide : function(){
			winElemt.hide();
		}
	
	};
	win.show();
	$('.close-win').click(function(){
		win.hide();
	});
};
</script>
<div id="warning" class="pop" style=" display:none;z-index:100">
		<div class="hd">
				<h2>提示</h2>
				<a href="javascript:void(0)" class="close-win">关闭</a> </div>
		<div class="bd">
				<div class="warning-inner">
						<div class="war-bg" style="background:url(<?php echo USER_CENTER;?>images/pop-ico.gif)  0 0 no-repeat;"></div>
						<p class="war-text" id="war-text">消息删除成功</p>
				</div>
				<div class="pop-btn-area"><a href="javascript:location.reload();" class="close-win" style="background:#29B966;color:#fff;padding:7px 15px;margin:0 5px;border:1px solid #26AB5E">确定</a></div>
		</div>
</div>
<div style="display:none;width:390px;height:200px; position:absolute;left:50%;top:50%;margin-left:-85px;-moz-box-shadow: 0 0 34px #cacaca;-webkit-box-shadow: 0 0 34px #cacaca;box-shadow: 0 0 34px #cacaca; z-index:9999" id="pop_win_1" class="pop_win">
		<div style="height:40px;background:#FF8400" class="hd">
				<h2 style="font-size:14px;color:#fff;font-weight:800; position:absolute;left:10px;top:10px">提示</h2>
				<a style="display:block;width:30px;height:30px;background:url(<?php echo USER_CENTER;?>images/pop-ico.gif) 0 -80px no-repeat; position:absolute;right:10px;top:6px; text-indent:-999px; overflow:hidden" class="close-win" href="javascript:void(0)">关闭</a></div>
		<div style="background:#fff;height:160px" class="bd">
				<div style="width:70px;height:80px;background:url(<?php echo USER_CENTER;?>images/pop-ico.gif) no-repeat -2px -113px; position:absolute;left:70px;top:60px"></div>
				<p style="position:absolute;left:140px;top:85px;font-size:14px">你确定要删除选定的消息吗？</p>
				<div style="text-align:center;position:absolute;top:155px;width:100%"><a style="*position:relative;background:#29B966;color:#fff;padding:7px 15px;margin:0 5px;border:1px solid #26AB5E" class="refresh-ok" href="javascript:submit_all(1)">确定</a><a style="*position:relative;background:#F5F5F5;color:#666;padding:7px 15px;margin:0 5px;border:1px solid #CCCCCC" class="close-win" href="javascript:void(0)">取消</a></div>
		</div>
</div>

<?php
if($isa_website!=''){
?>
<script type="text/javascript">
	var isa_website = "<?=$isa_website?>";
	var isa_city = "<?=$isa_city?>";
	var isa_addones = "<?=$isa_addones?>";

	var _analyze365 = (('https:' == document.location.protocol) ? ' https://': ' http://');
	document.write(unescape('%3Cscript src="'+ _analyze365 + '<?=$isa_url?>" type="text/javascript"%3E%3C/script%3E'));
</script>
<?php
}
?>
<script type='text/javascript'>
	var website="2";
    var ga_city = "<?=$isa_city?>";
    var ga_channel = 'center';
    var ga_page= "/个人中心/我的站内信";
</script>
<script language="javascript" src="http://stat.house365.com/365count.js"></script>

<?php require APPPATH_MVC.'views/footer.php'; ?>
