<div id="centre" class="layout">
	<div class="broadCentre radius5">
		<div class="hd">
			<h3 class="h3">常用功能管理</h3>
			<p class="more"></p>
		</div>
		<div class="mod mod2"> 
			
			<!---->
			
			<div class="branchCommon radius5">
				<div class="title">
					<h3 class="h3">我的应用</h3>
				</div>
				<div class="main">
					<div class="mainInner">
                                            <form id = 'search_form' name='search_form' action ='' method='POST' > 
						<div id="jsMyApp" class="myApp clearfix" > 
						        <!--显示自定义的应用-->
								
							<?php
								$num_valid = 0;//有效应用数量
                               
							for($i = 0; $i < 12 ; $i++){  ?>
							<?php if( $i < count($app_arr) && array_key_exists($app_arr[$i],$app_custom_arr) ) { ?>
									<div class="item">
										<div class="img"><a href="<?=$app_custom_arr[$app_arr[$i]]['url']?>" class="lin"><img src="<?=STATIC_SOURCE_URL?>/zsb/images/v1.0/<?=$app_custom_arr[$app_arr[$i]]['icon']?>" id="<?=$app_arr[$i]?>"></a></div>
										<p class="name"><a href="<?=$app_custom_arr[$app_arr[$i]]['url']?>" class="link"><?=$app_custom_arr[$app_arr[$i]]['name']?></a>
										<input type='hidden' name='active_app[]' value='<?=$app_arr[$i]?>'>
										</p>
									</div>
								<?php 
									$num_valid ++;
								}?>
							<?php } ?>
							
							<?php  for($j = 0 ; $j < ( 12 - $num_valid);$j++){ ?>
							<div class="item">
								<div class="img"></div>
								<p class="name"></p>
							</div>
							<?php }?>
							
						</div>
                                            <input type='hidden' name='action' value='save_app_custom'>
                                          </form>
					</div>
				</div>
			</div>
			<!---->
			
			<div class="branchCommon radius5">
				<div class="title">
					<h3 class="h3">所有应用</h3>
				</div>
				<div class="main">
					<div class="mainInner">
						<div id="jsAllApp" class="allApp clearfix">
							
						 <?php if( is_array($app_custom_arr) && !empty($app_custom_arr) ){ ?>
						     <?php foreach ($app_custom_arr as $key=>$value){ ?>
							 <?php if($key=='block_expert'){ ?>
							  <div class="item <?php if( $is_pay == payStatus && $lowExpertLevelId <= $brokerLevelNum){?>jsItem  <?php }else{ ?> jsItemN itemN <?php } ?>">
							    <?php }elseif($key=='bid_house'){ ?>
                                                          <div class="item <?php if($is_pay == payStatus && $lowHouseLevelId <= $brokerLevelNum){?>  jsItem<?php }else{ ?>  jsItemN itemN<?php } ?>">
							    <?php }elseif(in_array($key,$no_show_app)){?>
                                                          <div class="item  jsItemN itemN ">
                                 <?php }else{?>
                                        <div class="item <?php if( $is_pay != payStatus && $value['auth'] == 'pay'){?> jsItemN itemN <?php }else{ ?> jsItem <?php } ?>">
							   <?php } ?>

								<div class="fl select">
									<?php unset($app_arr['12']);?>
									<span class="selectN <?php if(in_array($key,$app_arr)){?>selectT<?php } ?>"></span>
								</div>
								<div class="fl img"><img oNum="<?=$key?>" oUrl="<?=$value['url']?>" alt="<?=$value['description']?>" src="<?=STATIC_SOURCE_URL?>/zsb/images/v1.0/<?=$value['icon']?>" /></div>
								<div class="fl info">
									<h4 class="h4"><?=$value['name']?></h4>
									<p><?=$value['description']?></p>
								</div>
							</div>
						
                                                            <?php } ?>
                                                    <?php } ?>
                                                    
							
						</div>
					</div>
				</div>
			</div>
			
			<!----> 
			
			
			<div class="allAppBottom"><a id="save_button" href="####" class="btn btnCon radius5">保存</a><a class="btn btnCon radius5" href="<?=GB_WO_URL?>">返回首页</a></div>
			
			
		</div>
	</div>
</div>




<div id="jsDialogApp" class="dialog radius5" >
	<div class="hd">
		<h3 class="h3">提示</h3>
		<p class="close close-win" title="关闭">关闭 </p>
	</div>
	<div class="mod">
		<div class="textMod"><img alt="" src="<?=STATIC_SOURCE_URL?>/zsb/images/v1.0/dialog.png" > 您最多可以添加<b> 12 </b>个应用！</div>
		
		
	</div>
</div>


<div id="jsDialogAppqx" class="dialog radius5" >
	<div class="hd">
		<h3 class="h3">提示</h3>
		<p class="close close-win" title="关闭">关闭 </p>
	</div>
	<div class="mod">
		<div class="textMod"><img alt="" src="<?=STATIC_SOURCE_URL?>/zsb/images/v1.0/dialog.png" > 权限不够！</div>
		
		
	</div>
</div>



<script type="text/javascript">
$(function(){
	$("#jsAllApp").find(".jsItem").bind("click",function(){
		var oS = $(this).find(".selectN");
		var oImg = $("#jsMyApp").find(".img")
		var oSrc = $(this).find(".img").find("img").attr("src");
		var oUrl = $(this).find(".img").find("img").attr("oUrl");
		var id = $(this).find(".img").find("img").attr("oNum");
		var oTitle = $(this).find(".info").find("h4").text();
		if(! oS.hasClass("selectT"))
		{
			if($("#jsMyApp").find(".img").find("img").length>=12)
			{
				openWin("jsDialogApp");
				return false;
			}
			oS.addClass("selectT");
			oImg.each(function(index, element) {
				if(!$(this).find("img").length>0)
				{
					$("<a class='lin' href='"+oUrl+"'><img id='"+id+"' src='"+oSrc+"'/></a>").appendTo($(this));

					$("<a class='link' href='"+oUrl+"'>"+oTitle+"</a>").appendTo($(this).next(".name"));

					$("<input type='hidden' name='active_app[]' value="+id+">").appendTo($(this).next(".name"));

					return false;
				}
			});
		}
		else
		{
			oS.removeClass("selectT");
			$("#"+id).parents(".item").remove()
			$('<div class="item"><div class="img"></div><p class="name"></p></div>').appendTo("#jsMyApp")
		}
	});

		$("#jsAllApp").find(".jsItemN").bind("click mousemove mouseout",function(event){
		if(event.type=="click")
		{
			openWin("jsDialogAppqx");
		}
		else if(event.type=="mousemove")
		{
			if($("#coordinates").length <=0)
			{
				$("<div id='coordinates' class='radius5' >您当前的套餐无法使用此功能</div>").appendTo("body");
			}
			if($("#coordinates").length >=0)
			{  
				var oDiv=$("#coordinates");
				oDiv.css({left:event.pageX+4+'px',top:event.pageY+4+'px'})
			}
		}
		else
		{
		$("#coordinates").remove()
		}
		
	
	
})

})
</script>

<!--提交表单JS-->
<script>
$(function(){
	$('#save_button').click(function (){
	   $('#search_form').submit();
	})
});
</script>
</body>
</html>
