$(function(){
	if( jsondata.UrlData().id == "10" || jsondata.UrlData().id == "20" ){
      	$(".top-t p").css({"margin":".06rem 0 0 0",'font-size':'.24rem'});
      	$(".top-t-img").css("display","none");
    }
})

$(document).ready(function(){
	//banner图
	if( $("#lb1").length > 0 ){
		TouchSlide({ 
			slideCell:"#lb1",
			titCell:".hd ul", //开启自动分页 autoPage:true ，此时设置 titCell 为导航元素包裹层
			mainCell:".bd ul", 
			effect:"leftLoop", 
			autoPage:true //自动分页
		});
	}
	
		
	//品质传承	
	if( $("#lb2").length > 0 ){
		TouchSlide({ 
			slideCell:"#lb2",
			titCell:".hd ul", //开启自动分页 autoPage:true ，此时设置 titCell 为导航元素包裹层
			mainCell:".bd ul", 
			effect:"leftLoop", 
			autoPage:true //自动分页
		});
	}
	//专注细节
	if( $("#lb3").length > 0 ){
		TouchSlide({ 
			slideCell:"#lb3",
			titCell:".hd ul", //开启自动分页 autoPage:true ，此时设置 titCell 为导航元素包裹层
			mainCell:".bd ul", 
			effect:"leftLoop", 
			autoPage:true //自动分页
		});
	}


	if( $("#lb4").length > 0 ){
		TouchSlide({ 
			slideCell:"#lb4",
			titCell:".hd ul", //开启自动分页 autoPage:true ，此时设置 titCell 为导航元素包裹层
			mainCell:".bd ul", 
			effect:"leftLoop", 
			autoPage:true //自动分页
		});
	}
	//服务流程须知	
	if( $("#lc").length > 0 ){
		TouchSlide({ slideCell:"#lc", mainCell:".bd ul", effect:"leftLoop" });
	}

	$("#bottom").on("click", function(){
		$("html,body").animate({
			scrollTop: $(".main2").offset().top
		},1000)
	})

	// 滚动条
	$(window).load(function(){
        $(".g-ft-fwzx-dl2").mCustomScrollbar();
    });
	// 下拉菜单
	$("#g-ft-fwzx-dl").on("click", function(){
		if( $("#g-ft-fwzx-dl2").is(":hidden") ){
			$("#g-ft-fwzx-dl2").css("display","block");
		}else{
			$("#g-ft-fwzx-dl2").css("display","none");
		}
	})
	// 点击赋值
	$("#g-ft-fwzx-dl2 > dd").on("click", function(){
		$("#g-ft-fwzx-dl dt").text( $(this).text() );
		$("#g-ft-fwzx-dl2").css("display","none");
	})

	// logo去重
	if( jsondata.UrlData().id == "56" || jsondata.UrlData().id == "23" ){
		$(".fwpp").css("background-image","url(images/fwpp_bg2.png)");
	}
		
})	

$(function(){
	// 处理技师版块居中
	$(".jishi ul").width( $(".jishi ul li").width() * $(".jishi ul li").length + 2 );

	// 顶部导航吸附
	$.fn.smartFloat = function() {
		var position = function(element) {
			var top = element.position().top, pos = element.css("position");
			$(window).scroll(function() {
				var scrolls = $(this).scrollTop();
				if (scrolls > top) { //如果滚动到页面超出了当前元素element的相对页面顶部的高度
					if (window.XMLHttpRequest) { //如果不是ie6
						element.css({
							position: "fixed",
							top: "0"
						}).addClass("shadow");	
					} else { //如果是ie6
						element.css({
							top: scrolls
						});	
					}
				}else {
					element.css({
						position: pos,
						top: top
					}).removeClass("shadow");	
				}
			});
		};
		return $(this).each(function() {
			position($(this));						 
		});
	};
	$(function(){
		$("#g-nav").smartFloat();
	});


})

$(function(){

	// 导航
	if( $("#nav-btn").length > 0 ){
		// 
		$("#nav-btn").on("click", function(){
			$(".nav-box").show().animate({ marginLeft: 0}, 200);
			$(".left-option").css({"display":"block"})
			$(".Topnavhide").css({"top":"0"})
		});
		// 
		$(".nav-close").on("click", function(){
			$(".nav-box").animate({ marginLeft: "-6.4rem"}, 500).hide();
			$(".left-option").css({"display":"none"})
		});
		// 
		$(".left-option").on("click", function(){
			$(".nav-box").animate({ marginLeft: "-6.4rem"}, 500).hide();
			$(".left-option").css({"display":"none"})
		});
		//
		$("#href-map1").on("click", function(){
			$(".nav-box").animate({ marginLeft: "-6.4rem"}, 500).hide();
			$(".left-option").css({"display":"none"})
		});
		$("#bottom-map").on("click", function(){
			$(".nav-box").css({"marginLeft":"-6.4rem"})
		});
		//


		// 导航css适配
		var wapHeight = $(window).height(),
			wapWidth = $(window).width();
			w_h_b = wapHeight / wapWidth;

		if( w_h_b < 1.7 ){
			$('.nav-box .nav-box-ul li').css({"line-height":".75rem"});
		}
		
	}

})

// 地图
window.onload = function (){


		/*mapshow*/
		var mapBox = document.getElementById("container");
		
		var close = document.getElementById("close");
		var btMap = document.getElementById("bottom-map");
		var leftOption = document.getElementById("left-option");
		if(btMap){
			close.onclick = function(){				
				mapBox.style.display = 'none';
				close.style.display = 'none';
				leftOption.style.display = 'none';
			}
			btMap.onclick = function (){
				mapShow();
			}
			var mapBtn = document.getElementById("mapbtn");
			var href_map1 = document.getElementById("href-map1");
			var href_map2 = document.getElementById("href-map2");
			var href_map3 = document.getElementById("href-map3");
			if(mapBtn){
				mapBtn.onclick = function (){
					mapShow();
				}
			}
			if(href_map1){
				href_map1.onclick = function (){
					mapShow();
				}
			}
			if(href_map2){
				href_map2.onclick = function (){
					mapShow();
				}
			}
			if(href_map3){
				href_map3.onclick = function (){
					mapShow();
				}
			}
		}
		/**
		 * map展示
		 * @return {[type]} [description]
		 */
		function mapShow(){

			// 百度地图API功能
			mapBox.style.display = 'block';
			close.style.display = 'block';	
			map = new BMap.Map("container");
			var point = new BMap.Point(121.488953,31.242313);
			var marker = new BMap.Marker(point);  // 创建标注
			map.addOverlay(marker);              // 将标注添加到地图中
			map.centerAndZoom(point, 14);
			var opts = {
			  width : 120,     // 信息窗口宽度
			  height: 130,     // 信息窗口高度
			  title : "上海维修服务中心" , // 信息窗口标题
			  enableMessage:true,//设置允许信息窗发送短息
			  message:"名表维修服务中心"
			};
			msg = "<h3>地址：上海市黄浦区南京东路409号置地广场9楼918室</h3>";
			msg += "<h3>电话：400-998-6653</h3>";
			
			msg += "<button id=\"busSearchBtn\" onClick = \"window.location.href='https://map.baidu.com/mobile/webapp/place/linesearch/foo=bar/from=place&end=word%3D%25E4%25B8%258A%25E6%25B5%25B7%25E7%25BB%25B4%25E4%25BF%25AE%25E6%259C%258D%25E5%258A%25A1%25E4%25B8%25AD%25E5%25BF%2583%26point%3D13523428.985%252C3640187.92%26uid%3D20f553ac6ef8036b33f71dce&tab=line'\">获取路线</button>";

            msg +="</form>";
			var infoWindow = new BMap.InfoWindow(msg, opts);  // 创建信息窗口对象 
			map.openInfoWindow(infoWindow,point); 
			marker.addEventListener("click", function(){          
				map.openInfoWindow(infoWindow,point); //开启信息窗口
			});	
			map.openInfoWindow(infoWindow,point);
		}

	
};

// 商务通
document.writeln("<!-- 弹窗开始 -->");
document.writeln("	<div class=\"swttc\">");
document.writeln("		<div class=\"swtbg\">");
document.writeln("			<div class=\"swt_shadow\">");
document.writeln("				<a class=\"cls_swttc\" title=\"关闭\">&times;</a>");
document.writeln("				<a href=\"tel:400-998-6653\" class=\"cls_swtta\">");
document.writeln("				<div class=\"swt_logo2\">&nbsp;</span></div>");
document.writeln("				<div class=\"swt_tit2\">您已进入<span>上海维修服务中心</span></div>");
document.writeln("				<div class=\"swt_line\"></div>");
document.writeln("				<div class=\"swt_rz\">维修技师一对一现场维修<span></span></div>");
document.writeln("				<ul class=\"swt_ys\">");
document.writeln("					<li><img src=\"images/swt/swt_ico1.png\"><span>原厂品质</span></li>");
document.writeln("					<li><img src=\"images/swt/swt_ico2.png\"><span>瑞士标准</span></li>");
document.writeln("					<li><img src=\"images/swt/swt_ico3.png\"><span>延保一年</span></li>");
document.writeln("				</ul>");
document.writeln("				</a>");
document.writeln("				<div class=\"swt_zx\">");
document.writeln("					<a href=\"tel:400-998-6653\"  title=\"在线咨询\"><img src=\"images/swt/swt_zx1.png\">在线咨询</a>");
document.writeln("					<a href=\"tel:400-998-6653\"><img src=\"images/swt/swt_zx2.png\">电话拨号</a>");
document.writeln("				</div>");
document.writeln("			</div>");
document.writeln("		</div>");
document.writeln("	</div>");
document.writeln("<!-- 弹窗结束 -->");

document.writeln("<style>");
document.writeln(".swttc {width:6.4rem; position: fixed; left:50%;margin-left: -3.2rem; top:0; display: none; z-index: 11000; } ");
document.writeln(".swtbg {width: 4.2rem; height: 4.6rem; margin: auto; position: relative; border-radius: .2rem; box-shadow: 0.08rem 0.08rem 0.2rem #999; background: #fff; } ");
document.writeln(".swt_shadow {width: 4.2rem; height: 4.6rem; margin: auto; position: relative; border-radius: .2rem; box-shadow: -0.08rem -0.08rem 0.2rem #999; } ");
document.writeln(".cls_swttc { width: .4rem;line-height: .36rem;height: .36rem; font-size: .4rem;padding-bottom: .04rem; text-align: center;  border-radius: 50%; color: #fff; font-family:\"微软雅黑\"; position:absolute; background: #333333; right:.1rem; top:.1rem; cursor: pointer; display: inline-block; } ");
document.writeln(".swt_logo2 {line-height: .4rem;text-align: center; padding-top: .3rem; } ");
document.writeln(".swt_logo2 img {width:.4rem; vertical-align: middle; margin-right: .1rem; } ");
document.writeln(".swt_logo2 span {font-size:.24rem; color: #5a585b; } ");
document.writeln(".swt_tit2 {text-align:center; font-size:.28rem; color: #000000; margin-top:.25rem;margin-bottom: .2rem; line-height:.3rem;  } ");
document.writeln(".swt_tit2 span {display:block;     padding-top: .05rem;text-align: center;line-height: .3rem;} ");
document.writeln(" .swt_line {width:3.7rem; height:.04rem; border-top:1px solid #e6e2d9; border-bottom:1px solid #e6e2d9; margin:.05rem auto 0; } ");
document.writeln(".swt_rz {width:4rem; line-height: .3rem; font-size:.24rem; color: #010101; margin:.17rem auto 0; position: relative; text-align: center;  } ");
document.writeln(".swt_rz a {width:4rem; position:absolute; left:0;font-size: .24rem; } ");
document.writeln(".swt_rz span {position:absolute; right: 0; } ");
document.writeln(".swt_ys {text-align: center; margin-top:.2rem; } ");
document.writeln(".swt_ys li {display:inline-block; margin: 0 .15rem; } ");
document.writeln(" .swt_ys li img {width:.66rem; height:.66rem; display: block; } ");
document.writeln(".swt_ys li span {display: block; line-height: .42rem; color: #333333; font-size:.2rem; } ");
document.writeln(".swt_zx {margin-top:.1rem; line-height: .4rem;text-align: center; padding-bottom:.3rem; } ");
document.writeln(".swt_zx a {color: #5a585b; font-size:.24rem; display: inline-block; margin: 0 .3rem; } ");
document.writeln(".swt_zx a img {width:.3rem; vertical-align:middle; margin-right:.1rem; }");
document.writeln("</style>");

$(function(){
	if( $(".slideTxtBox").length > 0 ){
		jQuery(".slideTxtBox").slide();
	}
})

var h=($(window).height()-$(".swtbg").height())/2;
var st=setTimeout("showswt()",8000);
function showswt(){
	$(".swttc").animate({top:h},1000).show();
}
$(".cls_swttc").click(function(){
	$(".swttc").hide().css("top",-100);
	clearTimeout(st);
	st=setTimeout("showswt()",25000);
})