<?php if($this->bgkcrm->is_mobile()==1){ //手机端?>

<div style="height:60px;line-height:60px;clear:both;"></div>
<footer class="footer" id="footer">
  <ul class="footnav box-flex">
    <li><a href="/"><i class="fa fa-home"></i>首页</a></li>
    <li><a href="<?php echo site_url('kehu/index')?>"><i class="fa fa-users"></i><?php echo $this->bgkcrm->zf_kehu?></a></li>
    
    <?php if(INUSE_IM=='1'&&$this->bgkcrm->banben!='mfb'){?>
    <li><a href="<?php echo site_url('chat/mchat')?>"><i class="fa fa-address-book-o"></i>IM沟通</a></li>
    <?php }else{?>
    <li><a href="<?php echo site_url('tongxunlu/index')?>"><i class="fa fa-address-book-o"></i>通讯录</a></li>
    <?php }?>
    
    <li><a href="<?php echo site_url('message/index')?>"><i class="fa fa-commenting"></i>消息</a></li>
    <li><a href="<?php echo site_url('user/info')?>"><i class="fa fa-user-o"></i>我的</a></li>
  </ul>
</footer>

<script>

var zong_width=($(window).width()-10-10);
var dan_width=zong_width/3;

//编辑器
$(".bianjiqi").css("width","98%");

$(".icon-list").css("width",($(window).width()-5)+"px");
$(".icon-list li").css("width",dan_width+"px");


//展开高级搜索
$(".biaodan-list .input").css("min-width","80px");
$(".biaodan-list .input").css("width",(($(window).width()-100-20))+"px");
$(".biaodan-list input.rule-date-input").css("min-width","105px");
$(".biaodan-list input.rule-date-input").css("width",(($(window).width()-100-38)/2)+"px");


if($("#timo1 .btn-sou-gj").length>0) 
{ 

$(" #timo1 .btn-sou-ks").css("width","50px");
$(".icon-list #timo1 li.btn-sou-gj").css("width","90px");
$(".icon-list #timo1 li.btn-sou-input").css("width",($(window).width()-70-90-20)+"px");


}else{

$(" #timo1 .btn-sou-ks").css("width","70px");
$(".icon-list #timo1 li.btn-sou-input").css("width",($(window).width()-90-15)+"px");
	
}



if($("#timo2").length>0){  

	$("#timo2").append('<li><a class="btn2" href="/"><i class="fa fa-home"></i>返回主页</a></li>');  
	$("#timo2 li").removeAttr("style");
	
	$('.m_menu').click(function(){
		$("#timo2").toggle('slow');
	});  
	
}else{
	$(".m_right a .fa").removeClass("fa-bars");
	$(".m_right a .fa").addClass("fa-home");
	$('.m_menu').click(function(){
	self.location="/";
	}); 
}


$('.m_search').click(function(){
	$("#timo1").toggle('slow');
});


$('.view_btn').show();
$('.h30').hide();


/*$(function(){
//手机端图片放大弹出
$('.view_img').on('click',function(){
var maxwidth = $(window).width()-100;
var maxheight = $(window).height()*0.8;
var url = $(this).attr('src');
layer.open({
  type: 1,
  title: false,
  closeBtn: 0,
  area: ['auto'],
  skin: 'layui-layer-nobg', //没有背景色
  shadeClose: true,
  content: '<img src="'+url+'" width="'+maxwidth+'" />'
});
});
})*/

</script>

<?php }else{ //pc端?>

<style>
.body-content{ position:relative;}
.tooltip {
  position: absolute;
  display: none;
  z-index: 9900000;
  outline: none;
  padding: 5px;
  border-width: 1px;
  border-style: solid;
  border-radius: 5px;
  -moz-border-radius: 5px 5px 5px 5px;
  -webkit-border-radius: 5px 5px 5px 5px;
  border-radius: 5px 5px 5px 5px;
}
</style>

<script>

$(".body-content").each(function(){
$(this).attr("title",$(this).text())
})

$(".biaodan-list input.rule-date-input").css("max-width","150px");
$(".biaodan-list input.rule-date-input").css("min-width","105px");
$(".biaodan-list input.rule-date-input").css("width",(($(window).width()/3-32-100-15)/2)+"px");

function GetQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]);
    return null;
}

function changeURLArg(url,arg,arg_val){ 
   var pattern=arg+'=([^&]*)'; 
   var replaceText=arg+'='+arg_val; 
   if(url.match(pattern)){ 
	   var tmp='/('+ arg+'=)([^&]*)/gi'; 
	   tmp=url.replace(eval(tmp),replaceText); 
	   return tmp; 
   }else{ 
	   if(url.match('[\?]')){ 
		   return url+'&'+replaceText; 
	   }else{ 
		   return url+'?'+replaceText; 
	   } 
  } 
   return url+'\n'+arg+'\n'+arg_val; 
}

$("th a.paixu").each(function(){
    $(this).append('<span><i class="fa fa-caret-up"></i><i class="fa fa-caret-down"></i></span>');
	var url_pai = GetQueryString("pai");
	var url_xu = GetQueryString("xu");
	var data_pai = $(this).attr('ziduan');
	if(url_pai==data_pai){
	$(this).attr('paixu', url_xu);
	$(this).addClass('on_'+url_xu);
	}
});

$("th a.paixu").click(function(){
    var ziduan_name = $(this).attr('ziduan');
	var ziduan_paixu = $(this).attr('paixu');
	if(ziduan_paixu=='desc'){
		new_xu = 'asc';
	}else{
		new_xu = 'desc';
	}
	var old_url_full = $('.pagination .shouye a').attr('href');
	var new_url_full = changeURLArg(old_url_full,'pai',ziduan_name);
	new_url_full = changeURLArg(new_url_full,'xu',new_xu);
	self.location.href = new_url_full;

});


<?php if(intval($this->input->get('cid', TRUE))>0){?>
$('.toolbar').hide();
$('.head-name').hide();
$('.body-name').hide();
$('.mian-page-div').css("padding","0");
$('.location').hide();
$('.location_b').hide();
$('.footer').hide();
$('.view_btn').show();
<?php }?>

/*$(function(){
//PC端图片放大弹出
$('.view_img').on('click',function(){
var maxwidth = $(window).width()-100;
var maxheight = $(window).height()*0.8;
var url = $(this).attr('src');
layer.open({
  type: 1,
  title: false,
  closeBtn: 0,
  area: ['auto'],
  skin: 'layui-layer-nobg', //没有背景色
  shadeClose: true,
  content: '<img src="'+url+'" height="'+maxheight+'" />'
});
});
})*/

</script>

<?php }?>

<!--公用-->
<script src="/themes/layui/layui.js"></script> 
<script>
layui.use('upload', function(){
var upload = layui.upload;

<?php 
if (isset($ziduan_biaodan)&&is_array($ziduan_biaodan)&&count($ziduan_biaodan)>0) {
foreach($ziduan_biaodan as $arr=>$v) {
?>
<?php if($v['type']=='upload_img'||$v['type']=='upload_file'){ //上传 ?>
  //执行实例
  var uploadInst = upload.render({
    elem: '#<?php echo $v['name']?>'
    ,url: '/index.php/upload/ajax_upload'
	,exts: '<?php echo strtolower(UPLOADTYPE)?>'
    ,size: '<?php echo UPLOADSIZE ? UPLOADSIZE*1024 : 10*1024?>' //限制文件大小，默认10M
    ,done: function(res){
      //上传完毕回调
	  if(res.code==100){
		//layer.msg('上传成功');
		$('#<?php echo $v['name']?>_data').val(res.data.url);
		$('.Validform_checktip').text('');
		$('.Validform_checktip').removeClass('Validform_wrong');

		<?php if($v['type']=='upload_img'){ ?>
		$('#<?php echo $v['name']?>_view img').attr("src",res.data.url);
		$('#<?php echo $v['name']?>_view a').attr("href",res.data.url);
		<?php }else if($v['type']=='upload_file'){ ?>
		$('#<?php echo $v['name']?>_view').text(res.data.client_name);
		$('#<?php echo $v['name']?>_view a').attr("href",res.data.url);
		<?php }?>
		
		layer.msg('上传成功',{icon:1,time:1000});
		
	  }else{
		layer.msg('上传失败：'+res.data.error,{icon:5,time:3000});
	  }
    }
	,error: function(){
      //请求异常回调
	  layer.msg('上传异常',{icon:5,time:3000});
    }
  });
<?php }?>
<?php if($v['type']=='upload_imgs'||$v['type']=='upload_files'){ //上传 ?>
  //执行实例
  var uploadInst = upload.render({
    elem: '#<?php echo $v['name']?>'
    ,url: '/index.php/upload/ajax_upload'
	,exts: '<?php echo strtolower(UPLOADTYPE)?>'
    ,size: '<?php echo UPLOADSIZE ? UPLOADSIZE*1024 : 10*1024?>' //限制文件大小，默认10M
	,multiple: true
    ,done: function(res){
      //上传完毕回调
	  if(res.code==100){
		//layer.msg('上传成功');
		$('#<?php echo $v['name']?>_data').val(res.data.url);
		$('.Validform_checktip').text('');
		$('.Validform_checktip').removeClass('Validform_wrong');

		<?php if($v['type']=='upload_img'){ ?>
		$('#<?php echo $v['name']?>_view img').attr("src",res.data.url);
		$('#<?php echo $v['name']?>_view a').attr("href",res.data.url);
		<?php }else if($v['type']=='upload_file'){ ?>
		$('#<?php echo $v['name']?>_view').text(res.data.client_name);
		$('#<?php echo $v['name']?>_view a').attr("href",res.data.url);
		<?php }?>
		
		layer.msg('上传成功',{icon:1,time:1000});
		
	  }else{
		layer.msg('上传失败：'+res.data.error,{icon:5,time:3000});
	  }
    }
	,error: function(){
      //请求异常回调
	  layer.msg('上传异常',{icon:5,time:3000});
    }
  });
<?php }?>
<?php }}?>

});


$(function(){
	
$("dl.buguding").each(function(){
   height_max = $(this).find('dd').height()-30;
   $(this).find('dt').css("height",height_max+"px");
   $(this).find('dt').css("line-height",height_max+"px");
});

<?php if($this->input->get('cid', TRUE)>0){?>
$("#headmenu").hide();
//$(".pagepostion").hide();
<?php }?>

//防止重复提交
$("#submit").click(function(){
$(this).attr("disabled","true");
$(this).removeClass("submit");
$(this).addClass("close");
$("#form1").submit();
setTimeout("$('#submit').removeAttr('disabled')",5000);
})

$(".search-toggle").click(function(){
  $(".sousuo-gj").toggle();
  $(".daochu-gj").hide();
});

$(".daochu-toggle").click(function(){
  $(".daochu-gj").toggle();
  $(".sousuo-gj").hide();
});

//单选
$(".aids").click(function(){
if($(this).prop('checked')){
	var biaoji_yanse = $(this).parents('tr').attr('biaoji_yanse');
	if(biaoji_yanse == "" || biaoji_yanse == null || biaoji_yanse == undefined){
	$(this).parents('tr').css('background','#FFFED9');
	}
}else{
	var biaoji_yanse = $(this).parents('tr').attr('biaoji_yanse');
	if(biaoji_yanse == "" || biaoji_yanse == null || biaoji_yanse == undefined){
	$(this).parents('tr').css('background-color','');
	}
}
});


//多选
$("#checkall").click(function(){
if($(this).is(':checked')==true){

	$(".aids").each(function(){
		var biaoji_yanse = $(this).prop('checked', true).parents('tr').attr('biaoji_yanse');
		if(biaoji_yanse == "" || biaoji_yanse == null || biaoji_yanse == undefined){
		$(this).prop('checked', true).parents('tr').css('background','#FFFED9');
		}
	});

}
else{
	
	$(".aids").each(function(){
		var biaoji_yanse = $(this).prop('checked', false).parents('tr').attr('biaoji_yanse');
		if(biaoji_yanse == "" || biaoji_yanse == null || biaoji_yanse == undefined){
		$(this).prop('checked', false).parents('tr').css('background','');
		}
	});

}
});
	
//免费版链接处理
var banben="<?php echo $this->bgkcrm->banben?>";
if(banben=="mfb"){
$(".freeno a , a.freeno, .freeno").each(function(){
var newurl="/themes/free.htm";
$(this).attr("href",newurl);
$(this).attr("data-title","免费版不支持");
$(this).attr("data-width","590");
$(this).attr("data-height","480");
$(this).removeAttr("onclick");
});
}

var dq_width = $(".city-picker-span").width();
$(".city-picker-dropdown").css("width",dq_width+"px");


$('.users_select').select2();


})
//关闭后返回提示并刷新
<?php if(SUCCESSTIP==1){ //提示?>
function close_reload(tips){
	
if(tips.indexOf("失败")>=0){
icon = 2;
}else{
icon = 1;	
}
	
layer.msg(tips,{anim:5,maxWidth:500,icon:icon,time:1000,end:function(){location.reload()}})
}
<?php }else{?>
function close_reload(tips){
location.reload();
}
<?php }?>

$('.body-mobile').each(function(){
var div_cid = $(this).parents('.div_info').attr('div_cid');
var div_mobile = $(this).parents('.div_info').attr('div_mobile');
//快捷发送短信
<?php if($this->bgkcrm_mysql->get_rows('config', array('isdel' => 0, 'name' => 'sms_on'), 'value')=='1'){?>
if(div_mobile&&div_mobile.length==11){
	$(this).html(div_mobile+' <i class="fa fa-envelope-o fabtn color5 alert1 freeno" href="<?php echo site_url('sms/send')?>?mobile='+div_mobile+'" data-title="发送短信" data-width="660" data-height="350" title="发送短信"></i>');
}
<?php }?>

//呼叫中心
<?php if(INUSE_CALL=='1'){?>
$(this).append(' <i class="fa fa-fax fabtn telbtn color6 freeno" cid="'+div_cid+'" mobile="'+div_mobile+'" title="拨打电话"></i>');
<?php }?>

<?php if($this->bgkcrm->is_mobile()==1){ //手机端?>
if(div_mobile){
	$(this).append('<a class="tel_btn" href="tel:'+div_mobile+'">一键拨号</a>');
}
<?php }?>


});


<?php if(INUSE_CALL=='1'){?>
$('.telbtn').on('click',function(){

	var cid = $(this).attr('cid');
	var mobile = $(this).attr('mobile');
	
	if(mobile==null){
	layer.alert("手机号码不能为空");
	return false
	}
	layer.confirm(mobile, {
	  title: '是否立即拨号？',
	  btn: ['拨号','取消'] //按钮
	}, function(index, layero){
	  Bohao(cid,mobile);
	  layer.close(index);
	}, function(){
	  
	});

});

function Bohao(cid,mobile){
	if(top!=this){
		parent.Bohao(cid,mobile)
	} 
}
<?php }?>

$(".zd_datetime").each(function(){
   zd_val = $(this).text();
   if(zd_val=="1970-01-01 08:00:00"){
     $(this).html('');
   }
});

$(".div_info dl dd").each(function(){
   zd_val = $.trim($(this).text());
   if(zd_val=="1970-01-01 08:00:00"){
     $(this).html('');
   }
});

$("input.rule-date-input").each(function(){
   zd_val = $(this).val();
   if(zd_val=="1970-01-01 08:00:00"){
     $(this).val('');
   }
});

$(".zd_yes").each(function(){
   zd_yes_val = $(this).text();
   if(zd_yes_val=="是"){
     $(this).html('<span class="yes_btn">'+zd_yes_val+'</span>');
   }
});

$('.zd_upload_file img,.zd_upload_img img,.zd_upload_files img,.zd_upload_imgs img').on('click',function(){

	var img_url = $(this).attr('src');
	
	if(img_url=='/themes/bgkcrm/images/nopic.png'){
	layer.msg("暂无图片")
	return false
	}
	ck_width = $(window).width();
	ck_width = ck_width-40;
	ck_height = $(window).height();
	ck_height = ck_height-40;
	layer.open({
	  type: 1,
	  title: false,
	  closeBtn: 1,
	  area: ['auto'],
	  skin: 'layui-layer-nobg', //没有背景色
	  shadeClose: true,
	  content: '<img src="'+img_url+'" style="max-width:'+ck_width+'px;max-height:'+ck_height+'px;">'
	});

});

	
</script>

