<!doctype html>
<html>
<head>
<meta charset="gb2312">
<title><?=$title?></title>
<?=$css?>
<?=$js?>
</head>
<body>
    <?php $current_url ='http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
	echo form_open($current_url,$form_attributes);?>
    <div class="showBox" style="display:block;border:0;">
         <div class="inner">
            <h3>匹配房源</h3>
            <?php if(is_array($matched_data) && !empty($matched_data) ) :?>
            <?php foreach( $matched_data as $key =>$value) :
			?>
            <div class="list <?php if( $key % 2 == 0):?>odd<? endif;?> <?php if($value['isread'] == 0):?>unread<? endif;?>">
			<span class="chk">
				<input type="checkbox" value="<?php echo $value['match_id'];?>" name="rows_id" style="display: none;">
				<label class="checkbox"></label>
			</span>
                <? if( $want_type == 'buy') :?>
                 <?=($key + 1);?>：<?=$value['district']?><em class="t-line">|</em><?=$value['blockshowname']?><em class="t-line">|</em><?=strip_end_0($value['buildarea']);?>平米<em class="t-line">|</em><?=strip_end_0($value['price']);?>万<em class="t-line">|</em><?=$value['room']?>室<?=$value['hall']?>厅<em class="t-line">|</em><?=$value['fitment']?><em class="t-line">|</em><?=$value['subfloor']?$value['subfloor']."-":""?><?=$value['floor']?>/<?=$value['totalfloor']?>层<em class="t-line">|</em><?=$house['infofrom'][$value['infofrom']]?><a href="<?=get_sellinfo_url($value['id']);?>" onclick="change_match(<?php echo $value['match_id'];?>)" target='_blank' class="look-full">查看详细</a>
                <?php else: ?>
                <?=($key + 1);?>：<?=$value['district']?><em class="t-line">|</em><?=$value['blockshowname']?><em class="t-line">|</em><?=strip_end_0($value['buildarea']);?>平米<em class="t-line">|</em><?=strip_end_0($value['price']);?><?php if($value['priceunit']){ echo $priceunit[$value['priceunit']];}else{echo $priceunit[1]; }?><em class="t-line">|</em><?=$value['room']?>室<?=$value['hall']?>厅<em class="t-line">|</em><?=$value['renttype']?><em class="t-line">|</em><?=$value['fitment']?><em class="t-line">|</em><?=$value['subfloor']?$value['subfloor']."-":""?><?=$value['floor']?>/<?=$value['totalfloor']?>层<em class="t-line">|</em><?=$house['infofrom'][$value['infofrom']]?><a href="<?=get_rentinfo_url($value['id']);?>"  onclick="change_match(<?php echo $value['match_id'];?>)" target='_blank' class="look-full">查看详细</a>
                 <? endif; ?>
            </div>
            <? endforeach;?>
            <?php else: ?>
                <div>暂时无匹配房源信息</div>
            <? endif; ?>
        </div>
		<div class="handle handle02"> <a id="select-all-btn" class="handle-btn">
								<input type="checkbox" value="" style="display: none;">
								<label class="sel-all checkbox">全选</label>
								</a><a href="javascript:subcheckform()" id="del-select-btn" class="handle-btn">标为已读</a><a href="javascript:submit_all()" id="del-select-btn" class="handle-btn">删除</a> 
		</div>
        <?php if( !empty($pagination) ): ?>
        <!--分页-->
        <div class="cut-page"><?=$pagination?></div>
        <!--分页-->
        <? endif; ?>
    </div>
    <?=form_hidden('page', $page);?>
    <?=form_close()?>
    <script>
    function change_match(id){
     $.ajax({
     type: 'post',
     url : '<?php echo USER_CENTER;?>want/match_isread',
     data: 'match_type=<?php echo $want_type;?>&match_id='+id,
     dataType:'html',
     success: function(msg){
          setTimeout("location.reload()",3000);
     }

     })

    }
	
	function subcheckform(){
		var arr = new Array();
		$(".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;?>want/match_isread',
            data: 'match_type=<?php echo $want_type;?>&ids='+ids,
            dataType:'html',
            success: function(msg){
                
			     if(msg==1)
			     {
                    
				 setTimeout("location.reload()",3000);
				 }
                }
            }
        );
   }
		
		$(function(){
			$(".unread .look-full").live("click",function(){
					$(this).parent().removeClass("unread");
			})
		})
		
function submit_all(mark){
    var arr = new Array();
    $(".list").find("input:checked[name=rows_id]").each(function(i) {
    arr[i]=$(this).val();
    });
    var ids=arr.join(",");
    if(ids) {
    if(mark==1)
    {
     $.ajax({
     type: 'post',
     url : '<?php echo USER_CENTER;?>want/updatematch',
     data: 'ids='+ids+'&match_type=<?php echo $want_type;?>&id=<?php echo $this->uri->segment(4);?>',
     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">删除成功</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>
</body>
</html>