"use strict";

function IEVersion() {
	var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
	var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器
	var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器
	var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
	if(isIE) {
		var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
		reIE.test(userAgent);
		var fIEVersion = parseFloat(RegExp["$1"]);
		if(fIEVersion == 7) {
			return 7;
		} else if(fIEVersion == 8) {
			return 8;
		} else if(fIEVersion == 9) {
			return 9;
		} else if(fIEVersion == 10) {
			return 10;
		} else {
			return 6; //IE版本<=7
		}
	} else if(isEdge) {
		return 'edge'; //edge
	} else if(isIE11) {
		return 11; //IE11
	} else {
		return -1; //不是ie浏览器
	}
}

window.multiCarouse = {
	multiCarousel1: function(id, itemMdata) {
		var imgWidth = "";
		var ts = this;
		ts.id = id;
		ts.itemMdata = itemMdata;
		//var ul, len, index;
		/*
		    1）设置ul宽度，达到水平排列的效果
		    2）水平轮播效果
		    3）移入移出，清除轮播效果
		    4）添加分页效果
		        * 点击分页切换
		    5）无缝滚动
		        * 把第一张复制到最后
		        * 当滚动到复制那张图片时，瞬间重置回初始状态，并把index改成1
		*/
		if($('#' + id).find('ul li').length > 0) {
			ts.ul = $('#' + id).find('ul')[0];
			//console.log(ul.children)
			//ul.appendChild(ul.children[0].cloneNode(true));
			ts.len = ts.ul.children.length; //5

			//console.log(len)
			// 索引值
			ts.index = 0;
			imgWidth = parseInt($('#' + id).css('width'));

			// 1）设置ul宽度，达到水平排列的效果
			//$('#' + id).find('ul').css('width', imgWidth * len + 'px');
			// 生成页码
			if(itemMdata.curIndex != 3) {
				var page = document.createElement('div');
				ts.page = page;
				$(page).addClass('page');
				for(var i = 0; i < ts.len; i++) {
					var span = document.createElement('span');
					if(itemMdata.curIndex == 0) {
						span.innerText = i + 1;
					}
					if(i === 0) {
						$(span).addClass('active');
					}
					page.appendChild(span);
				}
				$('#' + id).find(".carousel-wrap")[0].appendChild(page);
				//debugger
				$('#' + id).on('click', '.page span', function() {
					ts.index = $(this).index();
					//show();
					ts.show(id, ts.index, ts.page, itemMdata, ts.len)
				})
			}
			// 2）水平轮播效果

			// alert(imgWidth);
			if(itemMdata.autoPlay == true) {
				ts.timer = setInterval(ts.autoPlay, 5000)
			}

			// 鼠标移入移出
			$('#' + id).on('mouseover', function() {
				clearInterval(ts.timer);
			})

			$('#' + id).on('mouseleave', function() {
				clearInterval(ts.timer);
				if(itemMdata.autoPlay == true) {
					ts.timer = setInterval(ts.autoPlay, 5000);
				}

			})

			if(itemMdata.curIndex == 3 || itemMdata.curIndex == 2) {
				var arrow = document.createElement('div');
				$(arrow).addClass('arrow');
				for(var j = 0; j < 2; j++) {
					var span = document.createElement('span');
					arrow.appendChild(span);
				}
				$('#' + id)[0].appendChild(arrow);
				arrow.children[0].onclick = function() {
					if(ts.index != 0) {
						ts.index--;
					} else {
						ts.index = ts.len - 1;
					}
					ts.show();
				};
				arrow.children[1].onclick = function() {
					if(ts.index != ts.len) {
						ts.index++;
					} else {
						ts.index = 0;
					}
					ts.show();
				};
				arrow.children[0].onmouseover = function() {
					// console.log($(this))
					$(this).css({
						'backgroundImage': 'url(' + itemMdata.activemulPre.url + ')'
					});
				};
				arrow.children[0].onmouseleave = function() {
					$(this).css({
						'backgroundImage': 'url(' + itemMdata.mulPre.url + ')'
					});
				};
				arrow.children[1].onmouseover = function() {
					$(this).css({
						'backgroundImage': 'url(' + itemMdata.activemulNext.url + ')'
					})
				};
				arrow.children[1].onmouseleave = function() {
					$(this).css({
						'backgroundImage': 'url(' + itemMdata.mulNext.url + ')'
					})
				};
			}
			var n = 0;

			//this.autoPlay(index, page, itemMdata);
			if(itemMdata.curIndex == 3 || itemMdata.curIndex == 2) {
				$('#' + id).find('.arrow').css({
					'width': '100%',
					'position': 'absolute',
					'left': '0',
					'top': '50%',
					'padding': '10px',
					'transform': 'translate(0,-50%)',
					'display': 'block',
					'box-sizing': 'border-box'
				});
				$('#' + id).find('.arrow span').css({
					'float': 'left',
					'display': 'inline-block',
					'width': itemMdata.spanStyle.width,
					'height': itemMdata.spanStyle.height,
					'line-height': itemMdata.spanStyle.height,
					'font-size': '25px',
					'background-color': 'rgba(0, 0, 0, 0.6)',
					'text-align': 'center',
					'color': '#fff',
					'border-radius': itemMdata.spanStyle.borderRadius,
					'box-shadow': ' 0 0 10px rgba(0, 0, 0, 0.5)',
					'backgroundImage': 'url(' + itemMdata.mulNext.url + ')',
					'background-position': 'center'
				});
				$('#' + id).find('.arrow span:first').css({
					'backgroundImage': 'url(' + itemMdata.mulPre.url + ')'
				});
				$('#' + id).find('.arrow span')[1].style.float = 'right';
			}
			if(itemMdata.curIndex != 3) {
				$('#' + id).find('.page').css({
					'position': 'absolute',
					'left': itemMdata.pageBg.left,
					'right': itemMdata.pageBg.right,
					'bottom': '0',
					'padding': '10px',
					'transform': itemMdata.pageBg.transform,
					'display': 'block',
					'box-sizing': 'border-box'
				});
				$('#' + id).find('.page span').css({
					'display': 'inline-block',
					'width': itemMdata.pageSpan.width,
					'height': itemMdata.pageSpan.height,
					'margin': '0 5px',
					'line-height': itemMdata.pageSpan.height,
					'font-size': itemMdata.pageSpan.fontSize,
					'background-color': itemMdata.pageBg.backgroudColor,
					'text-align': 'center',
					'color': itemMdata.pageBg.color,
					'border-radius': itemMdata.pageSpan.borderRadius,
					'box-shadow': ' 0 0 10px rgba(0, 0, 0, 0.5)'
				});
				if(itemMdata.curIndex != 0) {
					$('#' + id).find('.page span').css({
						'background-image': 'url(' + itemMdata.pageImg.url + ')'
					});
				}
			}
		}

		if(itemMdata.fullScreen && (window.location.host.indexOf("jdt-cn") == -1)) {
			if(window.location.host.indexOf(".100139") == -1 && window.location.host.indexOf(".100309") == -1) {
				if(window.location.host.indexOf(".100165") == -1) { //双牧林
					//setTimeout(function() {
					var $imgs = $('#' + id).find("img");
					$('#' + id).find(".activeimg img").height("auto");
					//debugger
					$imgs.one('load', function() {
						$('#' + id).find(".activeimg img").height("auto");
						var hei = $('#' + id).find(".activeimg img:visible").height();
						//debugger
						if(itemMdata.fullScreen && hei > 200) {
							$('#' + id).find(".activeimg").height(hei);
							$('#' + id).find(".activeimg").parent().height(hei).parent().height(hei).parent().height(hei).parent().height(hei).parent();
						}
					}).each(function() {
						if(this.complete) $(this).load();
					});
				}
			}
		}
	},
	timer: "",
	autoPlay: function() {
		var ts = multiCarouse;
		ts.index++;
		ts.show(ts.id, ts.index, ts.page, ts.itemMdata, ts.len);
	},
	show: function() {
		var ts = this;
		if(ts.index >= ts.len) { //0,1,2,3,4
			//ul.style.left = 0;
			ts.index = 0;
		}
		$("#" + ts.id).find('.activeimg li').hide();
		$("#" + ts.id).find('.activeimg li').eq(ts.index).fadeIn(500);

		if(ts.itemMdata.curIndex != 3) {
			// 页码高亮
			// 先清除所有高亮
			for(var i = 0; i < ts.len; i++) {
				ts.page.children[i].className = '';
				$('#' + ts.id).find('.page span').css({
					'display': 'inline-block',
					'width': ts.itemMdata.pageSpan.width,
					'height': ts.itemMdata.pageSpan.height,
					'margin': '0 5px',
					'line-height': ts.itemMdata.pageSpan.height,
					'font-size': ts.itemMdata.pageSpan.fontSize,
					'background-color': ts.itemMdata.pageBg.backgroudColor,
					'text-align': 'center',
					'color': ts.itemMdata.pageBg.color,
					'border-radius': ts.itemMdata.pageSpan.borderRadius,
					'box-shadow': '0 0 10px rgba(0, 0, 0, 0.5)'
				})
				if(ts.itemMdata.curIndex != 0) {
					$('#' + ts.id).find('.page span').css({
						'background-image': 'url(' + ts.itemMdata.pageImg.url + ')'
					})
				}
			}

			if(ts.index == ts.len) {
				$(ts.page.children[0]).addClass('active')
				$('#' + ts.id).find('.page span.active').css({
					'background-color': ts.itemMdata.activeBg.backgroudColor,
					'color': ts.itemMdata.activeBg.color
				})
				if(ts.itemMdata.curIndex != 0) {
					$('#' + ts.id).find('.page span.active').css({
						'background-image': 'url(' + ts.itemMdata.activeImg.url + ')'
					})
				}
			} else {
				$(ts.page.children[ts.index]).addClass('active');
				$('#' + ts.id).find('.page span.active').css({
					'background-color': ts.itemMdata.activeBg.backgroudColor,
					'color': ts.itemMdata.activeBg.color
				})
				if(ts.itemMdata.curIndex != 0) {
					$('#' + ts.id).find('.page span.active').css({
						'background-image': 'url(' + ts.itemMdata.activeImg.url + ')'
					})
				}
			}
		}
	},
	multiCarousel2: function(id, itemMdata) {
		var pagination = {
			el: '.swiper-pagination',
			type: "bullets", //
			clickable: true
		}
		var ft = false;
		if($("#" + id).parents(".conStyle:hidden").length) {
			ft = true;
			$("#" + id).parents(".conStyle").show();
		}

		if(itemMdata.curIndex == 0) {
			//itemMdata.swiperPagination = true;
			pagination.renderBullet = function(index, className) {
				return '<span class="set_det ' + className + '">' + (index + 1) + '</span>';
			}
		} else if(itemMdata.curIndex == 1) {
			// itemMdata.swiperPagination = true;
			pagination = {
				el: '.swiper-pagination',
				type: "bullets", //
				clickable: true
			}
		} else if(itemMdata.curIndex == 2) {
			pagination.renderBullet = function(index, className) {
				return '<span class="set_det ' + className + '"></span>';
			}
		} else if(itemMdata.curIndex == 3) {
			// itemMdata.swiperPagination = false;
		}
		//debugger
		var play = {
			delay: itemMdata.swiperDelay,
			stopOnLastSlide: true,
			disableOnInteraction: false
		};
		if(!itemMdata.autoPlay) {
			play = false;
		}
		var direction = 'horizontal',
			loop = true,
			mousewheel = false;
		if(itemMdata.amitDirect == 2) {
			direction = 'vertical';
			loop = true;
			mousewheel = false;
		}

		// console.log(IEVersion());
		if(6 < IEVersion() && IEVersion() < 10) {
			var mySwiper = new Swiper('#' + id, {
				//autoplay: itemMdata.autoplay, //可选选项，自动滑动
				autoplay: 20000,
				speed: 2000,
				loop: true,
				//mousewheel: true,
				keyboardControl: true,
				autoplayDisableOnInteraction: false,
				effect: itemMdata.effect || "slide",
				direction: direction || 'horizontal',
				allowTouchMove: true,
				paginationClickable: true,
				touchMoveStopPropagation: true,
				// 如果需要前进后退按钮
				navigation: {
					nextEl: '.swiper-button-next',
					prevEl: '.swiper-button-prev'
				}
			});
			//console.log("width：" + $(".swiper-wrapper img").width());
			//console.log("length：" + $(".swiper-wrapper img").length);
			//$(".swiper-wrapper").width($(".swiper-wrapper img").width()*$(".swiper-wrapper img").length)
			$('.swiper-container').hover(function() {
				if(itemMdata.amitDirect != 2) {
					mySwiper.autoplay.stop();
				}
			}, function() {
				if(itemMdata.amitDirect != 2) {
					mySwiper.autoplay.start();
				}
			});
			// $(".swiper-wrapper").width(30000);
		} else {
			// $(".swiper-wrapper").width(30000);
			if(itemMdata.fullScreen && (window.location.host.indexOf("jdt-cn") == -1)) {
				if(window.location.host.indexOf(".100139") == -1 && window.location.host.indexOf(".100309") == -1) {
					if(window.location.host.indexOf(".100165") == -1) { //双牧林
						//setTimeout(function() {
						var $imgs = $('#' + id).find("img");
						$('#' + id).find("img").height("auto");

						// debugger
						$imgs.one('load', function() {
							//$('#' + id).find(".activeimg img").height("auto");
							var hei = $('#' + id).find("img:visible").height();
							//debugger
							if(itemMdata.fullScreen && hei > 200) {
								$('#' + id).parent(".activeimg").height(hei);

								if(itemMdata.amitDirect == 2) {
									$('#' + id).height(hei);
									$('#' + id).find(".swiper-wrapper").height(hei);
								}

								$('#' + id).parent(".activeimg").parent().height(hei).parent().height(hei).parent().height(hei).parent().height(hei).parent();
							}
						}).each(function() {
							if(this.complete) $(this).load();
						});
					}
				}
			}


			var mySwiper = new Swiper('#' + id, {
				//autoplay: itemMdata.autoplay, //可选选项，自动滑动
				autoplay: play,
				speed: 2000,
				loop: loop,
				autoplayDisableOnInteraction: false,
				effect: itemMdata.effect || "slide",
				direction: direction || 'horizontal',
				allowTouchMove: true,
				mousewheel: mousewheel,
				keyboardControl: true,
				touchMoveStopPropagation: true,
				on: {
					slideNextTransitionStart: function() {
						var activeIndex = this.activeIndex;
						$("#" + id).find(".swiper-slide-duplicate-prev .txt").removeClass(itemMdata.txtAmit);
						$("#" + id).find(".swiper-slide-duplicate-next .txt").removeClass(itemMdata.txtAmit);
						//console.log("s:" + this.activeIndex); // 切换结束时，告诉我现在是第几个slide
						console.log("slideNextTransitionStart");
					},
					reachEnd: function() {
						/*var guid = $('body').data("guid");

						if(itemMdata.amitDirect == 2&&guid==429) {
							$("body").one("mousewheel",function(){
								setTimeout(function(){
									var t = document.body.clientHeight;
									window.scroll({top:t,left:0,behavior:'smooth' });
								},1000);

							});

						}*/
						//  alert('到了最后一个slide');
					},
					slideNextTransitionEnd: function() {
						var activeIndex = this.activeIndex;
						$("#" + id).find(".swiper-slide-active .txt").addClass(itemMdata.txtAmit);
						console.log("slideNextTransitionEnd"); // 切换结束时，告诉我现在是第几个slide
					}
				},
				// 如果需要分页器
				pagination: pagination || {
					el: '.swiper-pagination',
					type: "bullets", //
					clickable: true
				},
				// 如果需要前进后退按钮
				navigation: {
					nextEl: '.swiper-button-next',
					prevEl: '.swiper-button-prev'
				}
			});
			$('.swiper-container').hover(function() {
				if(itemMdata.amitDirect != 2) {
					mySwiper.autoplay.stop();
				}
			}, function() {
				if(itemMdata.amitDirect != 2) {
					mySwiper.autoplay.start();
				}
			});
			//debugger
		}

		//debugger
		if(ft) {
			$("#" + id).parents(".conStyle").hide();
		}

		//mySwiper.disableMousewheelControl()
	},
	multiCarousel3: function() {}
};

$(function() {
	//获取新闻详情的高度
	var productDes = $("#productDes");
	var mCaseDes = $("#mCaseDes");
	var newDes = $("#newDes");
	if(mCaseDes.length) {
		setTimeout(function() {
			$("#mCaseDes .detail").find("img").each(function() {
				if($(this).width() > 1200) {
					$(this).width("100%")
				}
			});
			var $imgs = mCaseDes.find("img");
			$imgs.one('load', function() {
				var mCaseDesHeight = mCaseDes.height();
				if(mCaseDes.closest(".resizable").length) {
					mCaseDesHeight = mCaseDesHeight + parseInt(mCaseDes.closest(".resizable").css('top'));
					mCaseDes.closest(".resizable").css('height', mCaseDesHeight + 'px');
				}

				mCaseDes.closest('.layout_inner').css('min-height', '500px');
				mCaseDes.closest('.freeContainer').css('min-height', '500px');

				if(mCaseDes.closest('.resizeMe').height() < mCaseDesHeight) {
					mCaseDes.closest('.layout_inner').css('height', mCaseDesHeight + 'px');
				}

				if(mCaseDes.closest('.resizeMe').height() < mCaseDesHeight) {
					mCaseDes.closest('.freeContainer').css('height', mCaseDesHeight + 'px') + 30;
				}

			}).each(function() {
				if(this.complete) $(this).load();
			});
			var mCaseDesHeight = mCaseDes.height();
			if(mCaseDes.closest(".resizable").length) {
				mCaseDesHeight = mCaseDesHeight + parseInt(mCaseDes.closest(".resizable").css('top')) + 30;
			}

			mCaseDes.closest('.layout_inner').css('min-height', '500px');
			mCaseDes.closest('.freeContainer').css('min-height', '500px');

			if(mCaseDes.closest('.resizeMe').height() < mCaseDesHeight) {
				mCaseDes.closest('.layout_inner').css('height', mCaseDesHeight + 'px');
			}

			if(mCaseDes.closest('.resizeMe').height() < mCaseDesHeight) {
				mCaseDes.closest('.freeContainer').css('height', mCaseDesHeight + 'px');
			}

		}, 600);
	}
	//debugger;
	if(newDes.length) {
		setTimeout(function() {
			var $imgs = newDes.find("img");
			$imgs.one('load', function() {
				// do stuff
				$(".newDes .detail").find("img").each(function() {
					if($(this).width() > 1200) {
						$(this).width("100%");
					}
				});
				var newsDesHeight = newDes.height();

				if(newDes.closest(".resizable").length) {
					newsDesHeight = newsDesHeight + parseInt(newDes.closest(".resizable").css('top'));
				}

				newDes.closest('.layout_inner').css('min-height', '500px');
				newDes.closest('.freeContainer').css('min-height', '500px');

				console.log(newDes.closest('.layout_inner').height());
				if(newDes.closest('.layout_inner').height() < newsDesHeight) {
					newDes.closest('.layout_inner').css('height', newsDesHeight + 'px');
				}

				if(newDes.closest('.freeContainer').height() < newsDesHeight) {
					newDes.closest('.freeContainer').css('height', newsDesHeight + 'px').parent(".columnLayoutInner").css("height", newsDesHeight + 'px');
				}
			}).each(function() {
				if(this.complete) $(this).load();
			});
			var newsDesHeight = newDes.height() + 30;
			if(newDes.closest(".resizable").length) {
				newsDesHeight = newsDesHeight + parseInt(newDes.closest(".resizable").css('top'));
			}

			// var n1 = parseInt(localStorage.getItem('Nlayout_inner'));
			// var n2 = parseInt(localStorage.getItem('NfreeContainer'));

			newDes.closest('.layout_inner').css('min-height', '500px');
			newDes.closest('.freeContainer').css('min-height', '500px');
			//debugger
			if(newDes.closest('.layout_inner').height() < newsDesHeight) {
				newDes.closest('.layout_inner').css('height', newsDesHeight + 'px');
			}

			if(newDes.closest('.freeContainer').height() < newsDesHeight) {
				newDes.closest('.freeContainer').css('height', newsDesHeight + 'px').parent(".columnLayoutInner").css("height", newsDesHeight + 'px');
			}

			$(".newDes .detail").find("img").each(function() {
				if($(this).width() > 1200) {
					$(this).width("100%");
				}
			});

		}, 600);
	}
	if(productDes.length) {
		setTimeout(function() {
			if(productDes.closest(".resizable").length) {
				productH = productH + parseInt(productDes.closest(".resizable").css('top'));
			}
			var $imgs = productDes.find("img");
			$imgs.one('load', function() {
				$(".productDes .detail").find("img").each(function() {
					if($(this).width() > 1200) {
						$(this).width("100%")
					}
				});
				var newsDesHeight = productDes.height();
				if(productDes.closest(".resizable").length) {
					newsDesHeight = newsDesHeight + parseInt(productDes.closest(".resizable").css('top')) + 50;
				}
				// debugger;
				productDes.closest('.layout_inner').css('min-height', '500px')
				productDes.closest('.freeContainer').css('min-height', '500px')

				if(productDes.closest('.layout_inner').height() < newsDesHeight) {
					productDes.closest('.layout_inner').css('height', newsDesHeight + 'px');
				}

				if(productDes.closest('.freeContainer').height() < newsDesHeight) {
					productDes.closest('.freeContainer').css('height', newsDesHeight + 'px').parent(".columnLayoutInner").css("height", newsDesHeight + 'px');
				}

			}).each(function() {
				if(this.complete) $(this).load();
			});

			var productH = productDes.height() + 30;
			productDes.closest('.freeContainer').css('min-height', '500px');
			productDes.closest('.layout_inner').css('min-height', '500px');
			var p1 = parseInt(localStorage.getItem('layout_inner'));
			var p2 = parseInt(localStorage.getItem('freeContainer'));
			if(productDes.closest('.freeContainer').height() < productH) {
				productDes.closest('.freeContainer').css('height', productH + 'px');
			}
			if(productDes.closest('.layout_inner').height() < productH) {
				productDes.closest('.layout_inner').css('height', productH + 'px');
			}
			//bottomDet
			$(".bottomDet").find("img").each(function() {
				if($(this).width() > 1200) {
					$(this).width("100%");
				}
			});

		}, 600);
	}

	var w = screen.width;
	//console.log(w)
	if(w < 1200) {
		$(".yq_container").css("width", 1200);
		$(".multiCarouselId").css("width", '1200px');
	} else if(w > 1200) {
		$(".multiCarouselId").css("width", '100%');
	}

});

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() {
	var root = 'https://api.xiaohucloud.com';
	if(window.location.host.indexOf("prediy.xiaohucloud") != -1) {
		root = 'https://preapi.xiaohucloud.com';
	} else if(window.location.host.indexOf("xiaohucloud.com") != -1) {
		root = 'https://api.xiaohucloud.com';
	} else if(window.location.host.indexOf("xiaohucloud.cn") != -1) {
		root = 'https://api.xiaohucloud.cn';
	} else if(window.location.host.indexOf("localhost") != -1) {
		root = 'https://api.xiaohucloud.com';
	}

	$.MsgBox = {
		Alert: function(id, dialogWidth, dialogHeight, flag) {
			var domain_url = GetQueryString("domain_url");
			var urld = "",
				lang = "";
			if(domain_url) {
				urld = domain_url;
			}
			lang = GetQueryString("lang");
			var url = root + "/api/front/getCompanyInfoByDomain?domain=" + (urld || window.location.host);
			$.ajax({
				type: "get",
				url: url,
				//data: params,
				//async: async,
				//crossDomain: true,
				//contentType: false,
				//processData: false,
				dataType: 'json',
				success: function(data) {
					data.data.company_id = data.data.company_id || $('body').data("cid");
					var dedicUrl = root + "/api/front/product?companyId=" + (data.data.company_id || "") + "&id=" + id + "&lang=" + lang;
					if(flag == "article") {
						dedicUrl = root + "/api/front/news?companyId=" + (data.data.company_id || "") + "&id=" + id + "&lang=" + lang;
					} else if(flag == "case") {
						dedicUrl = root + "/api/front/caseDetail?companyId=" + (data.data.company_id || "") + "&id=" + id + "&lang=" + lang;
					} else if(flag == "photo") {
						dedicUrl = root + "/api/front/photo?companyId=" + (data.data.company_id || "") + "&id=" + id + "&lang=" + lang;
					} else if(flag == "colomn") {
						GenerateHtml("alert", {
							name: "详情",
							content: id
						}, dialogWidth, dialogHeight);
						return;
					}

					$.ajax({
						type: "get",
						url: dedicUrl,
						//data: params,
						//async: async,
						//crossDomain: true,
						//contentType: false,
						//processData: false,
						dataType: 'json',
						success: function(data) {
							GenerateHtml("alert", data.data, dialogWidth, dialogHeight);
							btnOk();
							btnNo();
						},
						error: function(err) {
							//console.log("error")
							if(failure && typeof failure == "function") {
								failure(err);
							}
						}
					});
				},
				error: function(err) {
					//console.log("error")
					/*if(failure && typeof failure == "function") {
						failure(err);
					}*/
				}
			});

		},
		Confirm: function(data, dialogWidth, dialogHeight, callback) {
			GenerateHtml("confirm", data, dialogWidth, dialogHeight);
			btnOk(callback);
			btnNo();
		}
	}
	//生成Html
	var GenerateHtml = function(type, data, dialogWidth, dialogHeight) {
		//debugger
		var _html = "";
		_html += '<div id="mb_box"></div><div id="mb_con"><span id="mb_tit">' + data.name + '</span>';
		_html += '<a id="mb_ico">x</a><div id="mb_msg">' + data.content + '</div><div id="mb_btnbox">';
		if(type == "alert") {
			_html += '<input id="mb_btn_ok" type="button" value="关闭" />';
		}
		if(type == "confirm") {
			_html += '<input id="mb_btn_ok" type="button" value="' + data.ok + '" />';
			_html += '<input id="mb_btn_no" type="button" value="' + data.cancel + '" />';
		}
		_html += '</div></div>';
		// 必须先将_html添加到body，再设置Css样式
		$("body").append(_html);
		//生成Css
		//debugger
		GenerateCss(dialogWidth, dialogHeight, data);
	}

	//生成Css
	var GenerateCss = function(dialogWidth, dialogHeight, data) {
		$("#mb_box").css({
			width: '100%',
			height: '100%',
			zIndex: '99999',
			position: 'fixed',
			filter: 'Alpha(opacity=60)',
			backgroundColor: 'black',
			top: '0',
			left: '0',
			opacity: '0.6'
		});
		$("#mb_con").css({
			zIndex: '999999',
			width: dialogWidth || '600px',
			height: dialogHeight || "700px",
			position: 'fixed',
			backgroundColor: 'White',
			borderRadius: '5px'
		});
		$("#mb_tit").css({
			display: 'block',
			fontSize: '18px',
			textAlign: 'center',
			color: '#444',
			padding: '10px 15px',
			borderRadius: '5px 5px 0 0',
			borderBottom: '1px solid #ddd',
			fontWeight: 'bold'
		});

		$("#mb_msg").css({
			padding: '20px',
			height: data.height || "86%",
			overflow: "auto",
			lineHeight: '20px',
			borderBottom: '1px dashed #DDD',
			fontSize: '13px'
		});
		$("#mb_ico").css({
			display: 'block',
			position: 'absolute',
			right: '10px',
			top: '9px',
			fontSize: '31px',
			color: '#888',
			/*border: '1px solid Gray',*/
			width: '18px',
			height: '18px',
			textAlign: 'center',
			lineHeight: '16px',
			cursor: 'pointer',
			borderRadius: '12px',
			fontFamily: '微软雅黑'
		});
		$("#mb_btnbox").css({
			width: '90%',
			paddingRight: '5%',
			display: data.button || 'none',
			paddingBottom: '1%',
			position: 'absolute',
			bottom: 0,
			textAlign: 'right'
		});
		$("#mb_btn_ok,#mb_btn_no").css({
			width: '85px',
			height: '30px',
			color: 'white',
			border: 'none'
		});
		$("#mb_btn_ok").css({
			backgroundColor: '#168bbb'
		});
		$("#mb_btn_no").css({
			backgroundColor: 'gray',
			marginLeft: '20px'
		});
		//右上角关闭按钮hover样式
		/*$("#mb_ico").hover(function() {
			$(this).css({
				backgroundColor: 'Red',
				color: 'White'
			});
		}, function() {
			$(this).css({
				backgroundColor: '#DDD',
				color: 'black'
			});
		});*/
		var _widht = document.documentElement.clientWidth; //屏幕宽
		var _height = document.documentElement.clientHeight; //屏幕高
		var boxWidth = $("#mb_con").width();
		var boxHeight = $("#mb_con").height();
		//debugger;
		//让提示框居中
		$("#mb_con").css({
			top: "100px" || (_height - boxHeight) / 2 + "px",
			left: (_widht - boxWidth) / 2 + "px"
		});
	}
	//确定按钮事件
	var btnOk = function(callback) {
		$("#mb_btn_ok").click(function() {
			if(typeof(callback) == 'function') {
				callback();
			} else {
				$("#mb_box,#mb_con").remove();
			}

		});
	}
	//取消按钮事件
	var btnNo = function() {
		//console.log($("#mb_btn_no,#mb_ico,#mb_box").length);
		//debugger;
		$("#mb_btn_no,#mb_ico,#mb_box").click(function() {
			//	debugger;
			$("#mb_box,#mb_con").remove();
		});
	}
	$(".art_m_bg,.close_icon").click(function() {
		$(".popUpsLayout").hide();
	});
});
if(typeof String.prototype.endsWith != 'function') {
	String.prototype.endsWith = function(str) {
		return this.slice(-str.length) == str;
	};
}
window.productNav = {
	productSearch: function(id, itemMdata) {

		//debugger;

		$("#" + id).on("click", ".img_search", function() {
			$('.product_search .detail').animate({
				height: 'toggle'
			});
		}); //
		/*$("#" + id).on("mouseout", ".product_search", function() {
			$("#" + id).find(".keyword").hide();
			//debugger
		});*/
		$("#" + id).on("keyup", "input", function() {
			console.log("keydown:" + $('#' + id).find('.searchCon').val())
			// debugger
			if(itemMdata.content_hid) { //全站搜索
				$.ajax({
					url: 'https://api.xiaohucloud.com/api/front/search?keyword=' + $('#' + id).find('.searchCon').val() + '&companyId=' + $("body").data('cid'),
					type: "get",
					async: true,
					dataType: "json", //指定服务器返回的数据类型
					success: function(data) {
						//debugger
						if(data.data && data.data.list && data.data.list.length) {
							var sty = "";
							for(var i = 0; data.data.list.length > i; i++) {
								sty += '<li class="tio_item"><em>' + (i + 1) + '</em><span>' + data.data.list[i].name + '</span></li>'
							}
							$("#" + id).find(".smart_tips ul").html(sty);
							$("#" + id).find(".smart_tips").show();
						} else {
							$("#" + id).find(".smart_tips").hide().find("ul").html("");
						}
					}
				});
			} else {
				// 搜索产品
				$.ajax({
					url: 'https://api.xiaohucloud.com/api/front/productSearch?keyword=' + $('#' + id).find('.searchCon').val() + '&companyId=' + $("body").data('cid'),
					type: "get",
					async: true,
					dataType: "json", //指定服务器返回的数据类型
					success: function(data) {
						// debugger
						if(data.data && data.data.list && data.data.list.length) {
							var sty = "";
							for(var i = 0; data.data.list.length > i; i++) {
								sty += '<li class="tio_item"><em>' + (i + 1) + '</em><span>' + data.data.list[i].name + '</span></li>'
							}
							$("#" + id).find(".smart_tips").show();
							$("#" + id).find(".smart_tips ul").html(sty);
							$("#" + id).find(".keyword").hide();
							//keyword
						} else {
							$("#" + id).find(".smart_tips").hide();
							$("#" + id).find(".keyword").show();
						}

						// debugger
					}
				});
			}

			$("#" + id).on("click", ".smart_tips ul .tio_item", function() {
				var rt = $(this).find("span").html();
				$('#' + id).find('.searchCon').val(rt);
				setTimeout(function() {
					$('#' + id).find('button').trigger("click");
				}, 200);

				console.log("dft____dfgfg:" + rt)
			});

		});
	},
	initData: function(id, flag) {
		var proNav = $("#" + id);
		var $imgs = proNav.find(".detail").find("img");
		$imgs.each(function() {
			if($(this).width() > 1200) {
				$(this).width("100%");
			}
		});

		$imgs.one('load', function() {
			if($(this).width() > 1200) {
				$(this).width("100%");
			}
			var productH = proNav.height();

			if(proNav.closest(".resizable").length) {
				productH = productH + parseInt(proNav.closest(".resizable").css('top'));
			} else {
				productH = productH + parseInt(proNav.css('top'));
			}
			if(!flag && proNav.closest('.resizeMe').height() < productH) {
				proNav.closest('.resizeMe').css('height', productH + 'px');
				proNav.closest('.freeContainer').css('height', productH + 'px');
				proNav.closest('.layout_inner').css('height', productH + 'px');
			} else if(flag) {
				proNav.closest('.resizeMe').css('height', productH + 'px');
				proNav.closest('.freeContainer').css('height', productH + 'px');
				proNav.closest('.layout_inner').css('height', productH + 'px');
			}
		}).each(function() {
			if(this.complete) $(this).load();
		});
		// debugger
		var productH = proNav.height() + 30;
		if(proNav.closest(".resizable").length) {
			productH = productH + parseInt(proNav.closest(".resizable").css('top'));
		} else {
			productH = productH + parseInt(proNav.css('top'));
		}
		//debugger
		if(!flag && proNav.closest('.resizeMe').height() < productH) {
			proNav.closest('.resizeMe').css('height', productH + 'px');
			proNav.closest('.freeContainer').css('height', productH + 'px');
			proNav.closest('.layout_inner').css('height', productH + 'px');
		} else if(flag) {
			proNav.closest('.resizeMe').css('height', productH + 'px');
			proNav.closest('.freeContainer').css('height', productH + 'px');
			proNav.closest('.layout_inner').css('height', productH + 'px');

		}
		//debugger
	},
	download: function(id, itemMdata) {
		//debugger
		$("#" + id).on("click", "button.downLoad", function() {
			//debugger;
			var ad = $(this).data("download").split("|");
			if(ad[0] && ad[0] != "null") {
				//debugger
				//$.MsgBox.Alert(id, "500px", "300px");
				$.MsgBox.Confirm({
					name: itemMdata.langTitle[1],
					button: true,
					height: '57%',
					ok: itemMdata.langTitle[3],
					cancel: itemMdata.langTitle[4],
					content: '<input type="text" id="sdetSetr" value="" placeholder="' + itemMdata.langTitle[2] + '" class="searchAlert" />'
				}, "400px", "300px", function() {
					var daVlue = $("#sdetSetr").val();
					if(daVlue == ad[0]) {
						var myFrame = document.createElement('iframe');
						myFrame.src = ad[1];
						myFrame.style.display = 'none';
						document.body.appendChild(myFrame);
						$("#mb_box,#mb_con").remove();
					} else {
						alert(itemMdata.langTitle[5]);
					}
				})
			} else {
				var myFrame = document.createElement('iframe');
				myFrame.src = ad[1];
				myFrame.style.display = 'none';
				document.body.appendChild(myFrame);
			}
		});
	},
	deyloy: function(id, itemMdata) {
		// console.log("id:" + id);
		$("#" + id).on("click", "li .box", function() {

			var ts = $(this);
			if(ts.hasClass("box-equal")) {

        if(itemMdata.isProShow && itemMdata.isProShow==2){
          ts[0].className = "box box-equal";
          ts.parent().next().hide();
        }else{
          ts[0].className = "box box-width-equal";
          ts.parent().next().show();
        }
				ts.parents("li.mTypeli").siblings().each(function() {
					$(this).find("ul.sec_con").hide();
					$(this).find("div.box").addClass("box box-equal");
				});

			} else {
				ts[0].className = "box box-equal";
				ts.parent().next().hide();
			}
			productNav.initData(id);
			// console.log("sdsdsd");
		});
		// console.log($('#' + id).find("li"))
		$('#' + id + ' li .navTip').mouseover(function() {
			// console.log(334)
			$(this).css({
				backgroundColor: itemMdata.oneHoverStyle.backgroundColor,
				color: itemMdata.oneHoverStyle.color
			})
			//event.stopPropagation()
		});

		$('#' + id + ' li .twoLevel').mouseover(function() {
			//console.log(334)navTip
			$(this).css({
				backgroundColor: itemMdata.twoHoverStyle.backgroundColor,
				color: itemMdata.twoHoverStyle.color
			})
			//event.stopPropagation()
		});
		$('#' + id + ' li .third_item').mouseover(function() {

			//console.log(334)
			$(this).css({
				backgroundColor: itemMdata.thirdHoverStyle.backgroundColor,
				color: itemMdata.thirdHoverStyle.color
			})
			//event.stopPropagation()
		});
		$('#' + id + ' li .navTip').mouseout(function() {
			//console.log(33)
			//debugger;
			$(this).css({
				backgroundColor: itemMdata.oneStyle.backgroundColor || "transparent",
				color: itemMdata.oneStyle.color || "inherit"
			});
			//event.stopPropagation();
		});
		$('#' + id + ' li .twoLevel').mouseout(function() {
			$(this).css({
				backgroundColor: itemMdata.twoStyle.backgroundColor || "transparent",
				color: itemMdata.twoStyle.color || "inherit"
			});
		});
		$('#' + id + ' li .third_item').mouseout(function() {
			$(this).css({
				backgroundColor: itemMdata.thirdStyle.backgroundColor || "transparent",
				color: itemMdata.thirdStyle.color || "inherit"
			})
		});
		if($('#' + id + ' li.active').length) {
			$('#' + id + ' li.active .box').trigger("click");
		} else {
			$('#' + id + ' li:first .box').trigger("click");
		}

		$('#' + id + ' li.active').css({
			backgroundColor: itemMdata.twoHoverStyle.backgroundColor,
		}).parent().show("");
		$('#' + id + ' li.secTypeli.active .secTip').css({
			color: itemMdata.twoHoverStyle.color
		});
		$('#' + id + ' li.active .navTip').css({
			color: itemMdata.twoHoverStyle.color
		});
		$('#' + id + ' div.active').css({
			backgroundColor: itemMdata.thirdHoverStyle.backgroundColor,
			color: itemMdata.thirdHoverStyle.color
		}).parents().show("");

	},
	artPops: function(artId) {
		$("#" + artId).show();
		setTimeout(function() {
			online.mounted($("#" + artId + " .art_m_outer"), "move_art");
			online.autoCenter($('#' + artId + ' .art_m_outer')[0]);
			window.onresize = function() {
				online.autoCenter($('#' + artId + ' .art_m_outer')[0]);
			};
		}, 300);
	}
};

window.productShow = {
	initLoad: function(company_id) {
		String.prototype.endWith = function(endStr) {
			var d = this.length - endStr.length;
			return(d >= 0 && this.lastIndexOf(endStr) == d);
		}

		$.ajax({
			url: 'https://api.xiaohucloud.com/xhyapi/webinfo/webinfoList?company_id=' + company_id,
			type: "get",
			async: true,
			dataType: "json", //指定服务器返回的数据类型
			success: function(data) {
				//debugger
				if(data.code != 0 || !data.data.config_code) {
					return;
				}　
				var dataStr = data.data.config_code.split(",");

				for(var i = 0; dataStr.length > i; i++) {
					var strUrl = dataStr[i];
					if(strUrl.endWith("js")) {
						/*var s = document.createElement('script');
						s.type = 'text/javascript';
						s.src = strUrl;
						document.body.appendChild(s);*/
					} else if(strUrl.endWith("json")) {
						var s = document.createElement('script');
						s.type = 'text/javascript';
						s.src = strUrl;
						document.body.appendChild(s);

					} else if(strUrl.endWith("css")) {
						var creatHead = $('head');
						creatHead.append('<link rel="stylesheet" href="' + strUrl + '">');
					}
				}
				// debugger
			}
		});
	},
	photoViewer: function(productSelected, index) {
		var items = [],
			options = {
				index: index
			};

		/*var s = document.createElement('script');
		s.type = 'text/javascript';
		s.src = "https://localhost:8083/static/js/photoviewer/photoviewer.min.js";
		document.body.appendChild(s);

		var creatHead = $('head'),
			strUrl = "https://localhost:8083/static/js/photoviewer/photoviewer.min.css";
		creatHead.append('<link rel="stylesheet" href="' + strUrl + '">');*/

		for(var i = 0; productSelected.length > i; i++) {
			items.push({
				src: productSelected[i].image
			});
		}

		new PhotoViewer(items, options);
	},
	productShow1: function(id, itemMdata) {
		$.fn.imgscroll2 = function(o) {
			var defaults = {
				speed: 2000,
				amount: 3000,
				width: 300,
				dir: "left"
			};

			o = $.extend(defaults, o);

			return this.each(function() {
				var _li = $("li", this);
				_li.parent().parent().css({
					overflow: "hidden",
					position: "relative"
				});
				_li.parent().css({
					margin: "0",
					padding: "0",
					overflow: "hidden",
					position: "relative",
					"list-style": "none"
				});
				_li.css({
					position: "relative",
					overflow: "hidden"
				}); //li
				if(o.dir == "left") _li.css({
					float: "left"
				});

				//初始大小
				var _li_size = 0;
				for(var i = 0; i < _li.size(); i++)
					_li_size += o.dir == "left" ? _li.eq(i).outerWidth(true) : _li.eq(i).outerHeight(true);

				//循环所需要的元素
				if(o.dir == "left") _li.parent().css({
					width: 9999 + "px"
				});
				_li.parent().empty().append(_li.clone());
				_li = $("li", this);

				//滚动
				var _li_scroll = 0;

				function goto() {
					_li_scroll += o.width;
					if(_li_scroll > _li_size - 100) {
						_li_scroll = -310;
						_li.parent().css(o.dir == "left" ? {
							left: -_li_scroll
						} : {
							top: -_li_scroll
						});
						_li_scroll += o.width;
					}
					_li.parent().animate(o.dir == "left" ? {
						left: -_li_scroll
					} : {
						top: -_li_scroll
					}, o.amount);
				}

				//开始
				var move = setInterval(function() {
					goto();
				}, o.speed);
				_li.parent().hover(function() {
					clearInterval(move);
				}, function() {
					clearInterval(move);
					move = setInterval(function() {
						goto();
					}, o.speed);
				});
			});
		};

		$(document).ready(function() {
			$(".slide2").imgscroll2({
				speed: 2000, //图片滚动速度
				amount: 3000, //图片滚动过渡时间
				width: 300, //图片滚动步数
				dir: "left"
			});
		});
		var productmain = $("#" + id).find(".slide1");
		var productslide = productmain.find(".slide-ul");
		var productlist = productslide.find("li");
		var productw = productlist.width();
		productslide.css({
			width: 9999
		});

		if(itemMdata.isDialog == 1) {
			var s = document.createElement('script');
			s.type = 'text/javascript';
			s.src = "https://img.xiaohucloud.com/static/js/photoviewer/photoviewer.min.js";
			document.body.appendChild(s);

			var creatHead = $('head'),
				strUrl = "https://img.xiaohucloud.com/static/js/photoviewer/photoviewer.min.css";
			creatHead.append('<link rel="stylesheet" href="' + strUrl + '">');
		}

		var productcurrentIndex = 0;
		//下一张
		$('#prev2').click(function() {
			productcurrentIndex--;
			productslide.animate({
				left: productcurrentIndex * -productw
			}, "slow");
			if(productcurrentIndex < 0) {
				alert("已经是第一项啦！");
				productcurrentIndex = 0;
				productslide.animate({
					left: 0
				}, "normal");
			}
		});
		//上一张
		$('#next2').click(function() {
			productcurrentIndex++;
			productslide.animate({
				left: productcurrentIndex * -productw
			}, "slow");
			if(productcurrentIndex > productlist.length - 1) {
				productcurrentIndex = 0;
				productslide.animate({
					left: 0
				}, "normal");
			}
		});
		var curPage = 1,
			curNum = 1;
		$("#" + id).find(".inst_ind:first").addClass("current");
		$("#" + id).find(".page").on("click", "p", function() {

			var pageNum = itemMdata.page.pageNum;
			var index = $(this).data("index");

			if(index == "up") {
				if(curPage != 1) {
					curPage--;
					$("#" + id).find(".current").prev().addClass("current").css({
						color: itemMdata.page.curColor,
						backgroundColor: itemMdata.page.curBackgroundColor
					}).siblings().css({
						color: itemMdata.page.color,
						backgroundColor: itemMdata.page.backgroundColor
					}).removeClass("current");
				}

			} else if(index == "down") {
				if(curPage != Math.ceil(itemMdata.page.talNum / itemMdata.page.pageNum)) {
					++curPage;
					$("#" + id).find(".current").next().addClass("current").css({
						color: itemMdata.page.curColor,
						backgroundColor: itemMdata.page.curBackgroundColor
					}).siblings().css({
						color: itemMdata.page.color,
						backgroundColor: itemMdata.page.backgroundColor
					}).removeClass("current");
				}

			} else if(index == "first") {
				curPage = 1;
				$("#" + id).find(".inst_ind:first").addClass("current").css({
					color: itemMdata.page.curColor,
					backgroundColor: itemMdata.page.curBackgroundColor
				}).siblings().css({
					color: itemMdata.page.color,
					backgroundColor: itemMdata.page.backgroundColor
				}).removeClass("current");
			} else if(index == "last") {
				curPage = Math.ceil(itemMdata.page.talNum / itemMdata.page.pageNum);
				$("#" + id).find(".inst_ind:last").addClass("current").css({
					color: itemMdata.page.curColor,
					backgroundColor: itemMdata.page.curBackgroundColor
				}).siblings().css({
					color: itemMdata.page.color,
					backgroundColor: itemMdata.page.backgroundColor
				}).removeClass("current");
			} else {
				curPage = Number($(this).data("index"));
				$(this).addClass("current").css({
					color: itemMdata.page.curColor,
					backgroundColor: itemMdata.page.curBackgroundColor
				}).siblings().css({
					color: itemMdata.page.color,
					backgroundColor: itemMdata.page.backgroundColor
				}).removeClass("current");
			}

			curNum = (curPage - 1) * pageNum;
			$("#" + id).find(".page p.inst_ind").hide();
			$("#" + id).find(".page p.current").show().prevAll().each(function(k, v) {
				if(k < 4) {
					$(v).show();
				}
			});
			$("#" + id).find(".page p.current").nextAll().each(function(k, v) {
				if(k < 4) {
					$(v).show();
				}
			});

			$("#" + id + " .productShow").find("li").hide();
			for(var i = 0; i < pageNum; i++) {
				$("#" + id + " .productShow").find("li:eq(" + (curNum + i) + ")").show();
			}
			//console.log(itemMdata.productDesListSelected);
		});
	}
};
//链接跳转
window.urlLink = {
	initLoad: function(company_id) {
		String.prototype.endWith = function(endStr) {
			var d = this.length - endStr.length;
			return(d >= 0 && this.lastIndexOf(endStr) == d);
		}
		$.ajax({
			url: 'https://api.xiaohucloud.com/xhyapi/webinfo/webinfoList?company_id=' + company_id,
			type: "get",
			async: true,
			dataType: "json", //指定服务器返回的数据类型
			success: function(data) {
				//debugger
				if(data.code != 0 || !data.data.config_code) {
					return;
				}　
				var dataStr = data.data.config_code.split(",");

				for(var i = 0; dataStr.length > i; i++) {
					var strUrl = dataStr[i];
					if(strUrl.endWith("js")) {
						/*var s = document.createElement('script');
						s.type = 'text/javascript';
						s.src = strUrl;
						document.body.appendChild(s);*/
					} else if(strUrl.endWith("json")) {
						var s = document.createElement('script');
						s.type = 'text/javascript';
						s.src = strUrl;
						document.body.appendChild(s);

					} else if(strUrl.endWith("css")) {
						var creatHead = $('head');
						creatHead.append('<link rel="stylesheet" href="' + strUrl + '">');
					}
				}

			}
		});
	},
	linkUrl: function(item, preview, param, id) {
		$(function() {
			$('#' + id).on('click', function() {
				var link = item.link;
				console.log(link)
				if(Number(link)) {
					console.log(link)
					if(item.target == '_blank') {
						console.log(link)
						window.open(preview + link + '?token=' + param.token + '&company_id=' + param.company_id + '&type=' + param.type + '&pc_version_id=' + param.pc_version_id + '&mobile_version_id=' + param.mobile_version_id);
					}
					if(item.target == '_self') {
						console.log(link)
						location.href = preview + link + '?token=' + param.token + '&company_id=' + param.company_id + '&type=' + param.type + '&pc_version_id=' + param.pc_version_id + '&mobile_version_id=' + param.mobile_version_id;
					}
					if(!item.target) {
						window.open(preview + link + '?token=' + param.token + '&company_id=' + param.company_id + '&type=' + param.type + '&pc_version_id=' + param.pc_version_id + '&mobile_version_id=' + param.mobile_version_id);
					}
				} else {
					if(link.indexOf("http") > -1 && item.target == '_blank') {
						window.open(link)
					} else if(link.indexOf("http") < 0 && item.target == '_blank') {
						window.open(preview + link + '?token=' + param.token + '&company_id=' + param.company_id + '&type=' + param.type + '&pc_version_id=' + param.pc_version_id + '&mobile_version_id=' + param.mobile_version_id)
					}
					if(link.indexOf("http") > -1 && item.target == '_self') {
						location.href = link
					} else if(link.indexOf("http") < 0 && item.target == '_self') {
						location.href = preview + link + '?token=' + param.token + '&company_id=' + param.company_id + '&type=' + param.type + '&pc_version_id=' + param.pc_version_id + '&mobile_version_id=' + param.mobile_version_id
					}
					if(link.indexOf("http") > -1 && !item.target) {
						window.open(link)
					} else if(link.indexOf("http") < 0 && !item.target) {
						window.open(preview + link + '?token=' + param.token + '&company_id=' + param.company_id + '&type=' + param.type + '&pc_version_id=' + param.pc_version_id + '&mobile_version_id=' + param.mobile_version_id)
					}
				}

			})
		});
	},
	commentHand: function(allId) {
		console.log(allId);
		$('#' + allId).on('click', ".comment", function(e) {
			console.log("comment");
			e.stopPropagation()
			$('#' + allId).find(".ty_con").hide();
			$(this).next().find(".ty_con").show();
		})
	},
	hoverNav: function() {
		//导航
		var timer; //定义定时器
		//恢复导航
		function setHeight() {
			$('.subHei').height(0);
			$(".subNav").removeClass("on");
		}
		//导航经过
		$(".nav li").hover(function() {
			clearTimeout(timer);

			var hei = $(".subNav" + $(this).index()).outerHeight();
			$(".subHei").height(hei)
			$(".subNav" + $(this).index()).addClass("on").siblings('.subNav').removeClass('on');
		}, function() {
			timer = setTimeout(setHeight, 300)
		});
		//下拉菜单经过
		$('.subHei').hover(function() {
			clearTimeout(timer);
		}, function() {
			timer = setTimeout(setHeight, 300)
		});
		//导航选中
		$("#nav1").addClass("on");
	},
	//显示小手图标
	showHand: function(id, item) {
		$(function() {
			var link = item.link;
			if(!$(".eMhoverModel").length) {
				$('#mimageu0xkl9xinz40000000').append($('<img class="eMhoverModel" src="https://img.xiaohucloud.com/res/100139/2019/02/22/100139-xsjJOS.jpg" />'));
				$('#mimageu0xkl9xinz40000000').parents('.columnLayout').css('zIndex', 150);
			}
			if(link != '') {
				$('#' + id).on('mouseover', function() {
					//console.log(id)
					$(this).css({
						'cursor': 'pointer'
					})
				})
				$('#' + id).on('mouseout', function() {
					//console.log(id)
					$(this).css({
						'cursor': 'auto'
					})
				})
			}
		})
	},
	autoCenter: function(el) {
		if(!el) {
			return;
		}
		//获取可见窗口大小
		var bodyW = document.documentElement.clientWidth;
		var bodyH = document.documentElement.clientHeight;
		//获取对话框宽、高
		var elW = el.offsetWidth;
		var elH = el.offsetHeight || el.clientHeight;
		//debugger
		el.style.left = (bodyW - elW) / 2 + 'px';
		el.style.top = (bodyH - elH) / 2 + 'px';
	},
	mounted: function(id, header) {
		//声明需要用到的变量
		var mx = 0,
			my = 0; //鼠标x、y轴坐标（相对于left，top）
		var dx = 0,
			dy = 0; //对话框坐标（同上）
		var isDraging = false; //不可拖动
		var ts = this;
		//console.log(this.$refs.mtDialog)
		document.onkeydown = function(e) {
			var key = window.event.keyCode;
			if(key == 13) {
				//v.editDial.isEdit = false;
			}
		}

		/*window.onresize = function() {
			ts.autoCenter($('#' + id)[0]);
		};*/
		//鼠标按下
		$('.move_part').on('mousedown', function(e) {
			var e = e || window.event;
			//console.log("move_part");
			e.stopPropagation();
			mx = e.pageX; //点击时鼠标X坐标
			my = e.pageY; //点击时鼠标Y坐标
			dx = $('#' + id).position().left;
			dy = $('#' + id).position().top;
			//console.log("dx:"+dx);
			//console.log("dy:"+dy);
			isDraging = true; //标记对话框可拖动
			document.onmousemove = function(e) {
				var e = e || window.event;
				var x = e.pageX; //移动时鼠标X坐标
				var y = e.pageY; //移动时鼠标Y坐标
				if(isDraging) { //判断对话框能否拖动
					var moveX = dx + x - mx; //移动后对话框新的left值
					var moveY = dy + y - my; //移动后对话框新的top值
					$('#' + id)[0].style.left = moveX + 'px'; //重新设置对话框的left
					$('#' + id)[0].style.top = moveY + 'px'; //重新设置对话框的top
					//设置拖动范围
					var pageW = document.documentElement.clientWidth;
					var pageH = document.documentElement.clientHeight;
					var dialogW = $('#' + id).width();
					var dialogH = $('#' + id).height();
					var maxX = pageW - dialogW; //X轴可拖动最大值
					var maxY = pageH - dialogH; //Y轴可拖动最大值
					moveX = Math.min(Math.max(0, moveX), maxX); //X轴可拖动范围
					moveY = Math.min(Math.max(0, moveY), maxY); //Y轴可拖动范围
					//console.log("id:"+id+"moveX:"+moveX);
					$('#' + id)[0].style.left = moveX + 'px'; //重新设置对话框的left
					$('#' + id)[0].style.top = moveY + 'px'; //重新设置对话框的top
				};
			};

		});
		//console.log(document.onmousemove);
		//鼠标离开
		document.addEventListener('mouseup', function() {
			isDraging = false;
		});
		//autoCenter($('mtDialog')[0]);
	},
	golink: function(id, itemMdata) {
		$("#" + id).click(function() {
			console.log(itemMdata.isJump)
			if(itemMdata.isJump == 1) {
				var url = "http://api.map.baidu.com/marker?";
				url += "location=" + itemMdata.point.lat + "," + itemMdata.point.lng;
				url += "&title=我的位置&content=" + itemMdata.addressCity + itemMdata.addressDetails;
				url += "&output=html&src=" + location.host;
				//debugger
				window.open(url);
			}

		});

	}
};
//返回顶部
window.goTop = {
	//在线客服
	serReturnTop: function(serviceOnlineId, itemMdata) {
		console.log(12);
		var ts = this;
		$(function() {
			var topH = document.documentElement.scrollTop || document.body.scrollTop;
			var timer = null;
			$('#' + serviceOnlineId).find('.returnTop').on('click', function() {
				// console.log(0)
				timer = setInterval(function() {
					var topH = document.documentElement.scrollTop || document.body.scrollTop;
					var stepLength = Math.ceil(topH / 5);
					document.documentElement.scrollTop = document.body.scrollTop = topH - stepLength;
					if(topH == 0) {
						clearInterval(timer);
					}
				}, 30);
			});

			var KF = $(".keifu");
			var wkbox = $(".keifu_box");
			var kf_close = $(".keifu .keifu_close");
			var icon_keifu = $(".icon_keifu");
			var kH = wkbox.height();
			var kW = wkbox.width();
			var wH = $(window).height();

			$(kf_close).click(function() {
				KF.animate({
					width: "0"
				}, 200, function() {
					wkbox.hide();
					icon_keifu.show();
					KF.animate({
						width: 26
					}, 300);
				});
			});

			$(icon_keifu).click(function() {
				$(this).hide();
				wkbox.show();
				KF.animate({
					width: kW
				}, 200);
			});
		});

		$('#topBack').hide();
		$(window).scroll(function() {
			if($(this).scrollTop() > 350) {
				$("#topBack").fadeIn();
			} else {
				$("#topBack").fadeOut();
			}
		})
		//置顶事件
		$('#topBack').click(function() {
			$('body,html').animate({
				scrollTop: 0
			}, 300);
		});
		//this.isWebSocket();
	}
};
window.hoverAction = {
	swiperHover: function(allId, itemMdata) {
		console.log("id:" + allId);
		var pagination = {
			el: '.swiper-pagination',
			type: "bullets", //
			clickable: true
		}
		// console.log("id:"+$('#'+allId).length);

		$("body").addClass("swiperHover");

		var mySwiper = new Swiper('#' + allId, {
			direction: 'vertical',
			paginationClickable: true,
			nextButton: '.swiper-button-next',
			keyboardControl: true,
			mousewheel: true,
			pagination: pagination || {
				el: '.swiper-pagination',
				type: "bullets", //
				clickable: true
			},
			on: {
				slideChangeTransitionStart: function() {
					//console.log(this.activeIndex);
					var activeIndex = this.activeIndex;
					var itemInner = itemMdata.labelTitle[activeIndex].curObj.item == 1 ? itemMdata.labelTitle[activeIndex].itemInner : itemMdata.labelTitle[activeIndex].columnTitle1;
					console.log(itemInner);
					for(var i = 0; itemInner.length > i; i++) {
						var firstitemInner = itemInner[i];
						if(firstitemInner.emitStr) {
							$("#" + firstitemInner.allId).removeClass(firstitemInner.emitStr)
						}
						if(firstitemInner.itemInner && firstitemInner.itemInner.length) {
							var childInner = firstitemInner.itemInner;
							//debugger
							for(var j = 0; childInner.length > j; j++) {
								var sun = childInner[j];
								//debugger
								if(sun.emitStr) {
									$("#" + sun.allId).removeClass(sun.emitStr)
								}
							}

						}
					}
				},
				slideChangeTransitionEnd: function() {
					var activeIndex = this.activeIndex;
					var itemInner = itemMdata.labelTitle[activeIndex].curObj.item == 1 ? itemMdata.labelTitle[activeIndex].itemInner : itemMdata.labelTitle[activeIndex].columnTitle1;
					//console.log(itemInner);
					for(var i = 0; itemInner.length > i; i++) {
						var firstitemInner = itemInner[i];
						console.log("firstitemInner:");
						console.log(firstitemInner);
						if(firstitemInner.emitStr) {
							$("#" + firstitemInner.allId).addClass(firstitemInner.emitStr)
						}
						if(firstitemInner.itemInner && firstitemInner.itemInner.length) {
							var childInner = firstitemInner.itemInner;
							console.log("sd:");
							console.log(childInner);
							for(var j = 0; childInner.length > j; j++) {
								var sun = childInner[j];
								if(sun.emitStr) {
									$("#" + sun.allId).addClass(sun.emitStr)
								}
							}

						}
					}
					console.log(this.activeIndex); // 切换结束时，告诉我现在是第几个slide
				}
			},
			mousewheelForceToAxis: true,
			autoplay: 3000
		});
	},
	// 文本交互效果--悬浮事件
	fontHover: function(fontId, itemMdata) {
		$(function() {
			$('#' + fontId).on("mouseover", function() {
				if($(this).css("color") && itemMdata.iStyle.isHover == true) {
					itemMdata.spanColor = $(this).find("p").css("color");
					var t = $(this)
					setTimeout(function() {
						t.find("p").css("color", itemMdata.iStyle.hoverColor);
					}, 1);

				}
				if($(this).find("span").css("color") && itemMdata.iStyle.isHover == true) {
					itemMdata.spanColor = $(this).find("span").css("color");
					setTimeout(function() {
						t.find("span").css("color", itemMdata.iStyle.hoverColor);
					}, 1);
				}
			});
			$('#' + fontId).on("mouseout", function() {
				if($(this).find("p").css("color") && itemMdata.iStyle.isHover == true) {
					$(this).find("p").css("color", itemMdata.spanColor);
				}
				if($(this).find("span").css("color") && itemMdata.iStyle.isHover == true) {
					$(this).find("span").css("color", itemMdata.spanColor);
				}
			})

		})
	},
	initDataZhaopin: function(zhaopinId, itemMdata) {
		var idx = 0;
		//productNav.initData(zhaopinId);
		$('#' + zhaopinId).on("click", ".btn_list span", function() {
			idx = $(this).index();
			$(this).find("button").css({
				background: itemMdata.hoverStyle.background,
				color: itemMdata.hoverStyle.color
			});

			$(this).siblings().find("button").css({
				background: itemMdata.jobtabStyle.background,
				color: itemMdata.jobtabStyle.color
			});

			$('#' + zhaopinId).find("tbody:eq(" + idx + ")").show().siblings("tbody").hide();
			$('#' + zhaopinId).find("tr.page_zhao:eq(" + idx + ")").show().siblings("tr.page_zhao").hide();
			productNav.initData("zhaopin", 1);
			// debugger
			if(!$("#" + zhaopinId).find(".page_zhao:visible").find(".inst_ind.current").length) {
				// debugger;
				$("#" + zhaopinId).find(".page_zhao:visible").find(".inst_ind:first").addClass("current");
			}
		});

		$('#' + zhaopinId).on("click", ".list_item", function() {
			if(itemMdata.isPullDownMode == 1) {
				var next = $(this).next();
				next.slideToggle(300).siblings(".jobContent").hide();
			}
			setTimeout(function() {
				productNav.initData("zhaopin", 1);
			}, 330);

		});
		var curPage = 1,
			curNum = 1;
		$("#" + zhaopinId).find(".inst_ind:first").addClass("current");
		$("#" + zhaopinId).find(".page").on("click", "p", function() {
			var pageNum = itemMdata.page.pageNum;
			var index = $(this).data("index");
			if(index == "up") {
				if(curPage != 1) {
					curPage--;
					$("#" + zhaopinId).find(".page_zhao:visible").find(".current").prev(".inst_ind").addClass("current").css({
						color: itemMdata.page.curColor,
						backgroundColor: itemMdata.page.curBackgroundColor
					}).siblings().css({
						color: itemMdata.page.color,
						backgroundColor: itemMdata.page.backgroundColor
					}).removeClass("current");
				}
			} else if(index == "down") {
				if(curPage != Math.ceil(itemMdata.pageArr[idx].talNum / itemMdata.page.pageNum)) {
					++curPage;
					$("#" + zhaopinId).find(".page_zhao:visible").find(".current").next(".inst_ind").addClass("current").css({
						color: itemMdata.page.curColor,
						backgroundColor: itemMdata.page.curBackgroundColor
					}).siblings().css({
						color: itemMdata.page.color,
						backgroundColor: itemMdata.page.backgroundColor
					}).removeClass("current");
				}
			} else if(index == "first") {
				curPage = 1;
				//debugger
				$("#" + zhaopinId).find(".page_zhao:visible").find(".inst_ind:first").addClass("current").css({
					color: itemMdata.page.curColor,
					backgroundColor: itemMdata.page.curBackgroundColor
				}).siblings().css({
					color: itemMdata.page.color,
					backgroundColor: itemMdata.page.backgroundColor
				}).removeClass("current");
			} else if(index == "last") {
				curPage = Math.ceil(itemMdata.pageArr[idx].talNum / itemMdata.page.pageNum);
				//debugger;
				$("#" + zhaopinId).find(".page_zhao:visible").find(".inst_ind:last").addClass("current").css({
					color: itemMdata.page.curColor,
					backgroundColor: itemMdata.page.curBackgroundColor
				}).siblings().css({
					color: itemMdata.page.color,
					backgroundColor: itemMdata.page.backgroundColor
				}).removeClass("current");
			} else {
				curPage = Number($(this).data("index"));
				$(this).addClass("current").css({
					color: itemMdata.page.curColor,
					backgroundColor: itemMdata.page.curBackgroundColor
				}).siblings().css({
					color: itemMdata.page.color,
					backgroundColor: itemMdata.page.backgroundColor
				}).removeClass("current");
			}
			curNum = (curPage - 1) * pageNum;
			$("#" + zhaopinId).find("tbody:visible").find("tr").hide();
			for(var i = 0; i < pageNum; i++) {
				$("#" + zhaopinId).find("tbody:visible").find("tr.list_item:eq(" + (curNum + i) + ")").show();
			}
		});

	},
	initDataZhaopinDetail: function() {
		var zhaopinDetail = $("#zhaopinDetail");
		if(zhaopinDetail.length) {
			setTimeout(function() {
				var zhaopinDetailHeight = zhaopinDetail.height();
				if(zhaopinDetail.closest(".resizable").length) {
					zhaopinDetailHeight = zhaopinDetailHeight + parseInt(zhaopinDetail.closest(".resizable").css('top'));
				}

				zhaopinDetail.closest('.layout_inner').css('min-height', '500px');
				zhaopinDetail.closest('.freeContainer').css('min-height', '500px');

				if(zhaopinDetail.closest('.layout_inner').height() < zhaopinDetailHeight) {
					zhaopinDetail.closest('.layout_inner').css('height', zhaopinDetailHeight + 'px');
				}

				if(zhaopinDetail.closest('.freeContainer').height() < zhaopinDetailHeight) {
					zhaopinDetail.closest('.freeContainer').css('height', zhaopinDetailHeight + 'px');
				}

			}, 200);
		}

	},
	initScroll: function(id, amit) {
		//debugger
		var layout_inner = $("#" + id);
		$(window).on("scroll", function() {
			var a = layout_inner.offset().top;
			var win = $(window);
			if(a >= win.scrollTop() && a < (win.scrollTop() + win.height())) {
				console.log("div在可视范围2");
				layout_inner.addClass(amit);
				layout_inner.css({
					"visibility": "visible"
				});
			} else {
				console.log(id + "在隐藏:");
				layout_inner.removeClass(amit);
				layout_inner.css("visibility", "hidden");
			}
		});

	},
	//按钮
	buttonHover: function(buttonId, itemMdata) {
		// `this` 指向 vm 实例
		var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
		var isOpera = userAgent.indexOf("Opera") > -1; //判断是否Opera浏览器
		var isFF = userAgent.indexOf("Firefox") > -1; //判断是否Firefox浏览器
		var isChrome = userAgent.indexOf("Chrome") > -1 && userAgent.indexOf("Safari") > -1; //判断Chrome浏览器
		var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera; //判断是否IE浏览器
		var str = itemMdata.buttonStyle.background;

		if(str && isIE) {
			str = str.replace("-webkit-", "-ms-");
			$("#" + buttonId).css({
				"background": str
			});
			// return '-ms-linear-gradient(bottom,' + this.color1 + ' 10%, ' + this.color2 + ')';
		} else if(isOpera) {
			str = str.replace("-webkit-", "-o-");
			$("#" + buttonId).css({
				"background": str
			});
		} else if(isFF) {
			str = str.replace("-webkit-", "-moz-");
			$("#" + buttonId).css({
				"background": str
			});
		}

		$(function() {
			$("#" + buttonId).css({
				"backgroundColor": itemMdata.buttonStyle.backgroundColor,
				"background": itemMdata.buttonStyle.background,
				"borderColor": itemMdata.buttonStyle.borderColor,
				"borderWidth": itemMdata.buttonStyle.borderWidth
			});
			//debugger
			$("#" + buttonId).on("mouseover", function() {
				if(itemMdata.setHover == true) {
					$(this).css({
						"backgroundColor": itemMdata.hoverStyle.backgroundColor,
						"borderColor": itemMdata.hoverStyle.borderColor,
						"background": itemMdata.hoverStyle.background,
						"borderWidth": itemMdata.hoverStyle.borderWidth
					});
					//	debugger
					$(this).find('i').css({
						"color": itemMdata.hoverStyle.color
					});
				}
			});
			$("#" + buttonId).on("mouseout", function() {
				// itemMdata.hoverS = 2;
				$(this).css({
					"backgroundColor": itemMdata.buttonStyle.backgroundColor,
					"background": itemMdata.buttonStyle.background,
					"borderColor": itemMdata.buttonStyle.borderColor,
					"borderWidth": itemMdata.buttonStyle.borderWidth
				});
				$(this).find('i').css({
					"color": itemMdata.iStyle.color
				});
			});
		})
	},
	photoSHover: function(id, itemMdata) {
		if(itemMdata.isPhotoModel == 2) {
			setTimeout(function() {
				$('.gallery-item').ma5gallery({
					preload: true,
					fullscreen: false
				});
				setTimeout(function() {
					productNav.initData("newDes");
					//debugger
				}, 100);
			}, 700);
		}

	},
	//图片
	imageHover: function(imageId, itemMdata) {
		$(function() {
			var imgP = $('.imgP');
			var imgs = $('.imgsModel');
			//debugger
			$("#" + imageId).on("mouseover", function() {
				if(itemMdata.isHover == true) {
					$(this).css('width', $(this).find('.imgsModel').outerWidth());
					$(this).css('height', $(this).find('.imgsModel').outerHeight());
					$(this).find('.imgsModel').css({
						'borderColor': itemMdata.hoverStyle.borderColor
					});
					$(this).find('.imgsModel').css({
						'border-style': itemMdata.hoverStyle.borderStyle
					});
					//console.log(itemMdata.hoverStyle.borderStyle)
				}
				console.log(itemMdata.isTxt)
				//debugger
				if(itemMdata.isTxt == true) {
					if(imgP.style) {
						imgP.style.display = 'flex';
					}
					$(this).find('.imgP').css('height', $(this).find('.imgsModel').outerHeight());
				}

				if(itemMdata.isRotate == true && itemMdata.isImg == true) {
					//$(this).css('willChange', 'transform')
					//$(this).css('transform', 'rotateY(180deg)');
					$(this).find('.front').css({
						'transform': 'rotateY(0deg)'
					});
					$(this).find('.back').css({
						'transform': 'rotateY(-180deg)'
					});
				}
				// debugger
				if(itemMdata.isImg == true && itemMdata.isRotate == false) {
					//$(this).css('willChange', 'auto')
					//$(this).css('transform', 'rotateY(0deg)');
					/*$(this).find('.front').css({
						'transform': 'rotateY(0deg)'
					});
					$(this).find('.back').css({
						'transform': 'rotateY(0deg)'
					});*/
					$(this).find('.front').css({
						'dispaly': 'block'
					});
				}
			});
			$("#" + imageId).on("mouseout", function() {
				$(this).find('.imgsModel').css({
					'borderColor': ''
				}, {
					'borderStyle': ''
				});

				imgP.css('display', 'none');
				if(itemMdata.isRotate == true && itemMdata.isImg == true) {
					$(this).find('.front').css({
						'transform': 'rotateY(180deg)'
					});

					$(this).find('.back').css({
						'position': 'absolute',
						'transform': 'rotateY(0deg)'
					});
				}
			});

		})
	},
	oUl: "",
	itemMdata: {},
	aLi: "",
	//多图列表
	columnPictureHover: function(columnPictureId, itemMdata) {
		var currentIndex = 0;
		var marginleft = 0;
		var $t = $(this);
		if(!itemMdata.stylethree) {
			$("#" + columnPictureId).on("mouseover", "li", function() {
				//console.log($(this))
				if(itemMdata.isImg == true) {
					$t.find(".colimgHover").css('willChange', 'transform');
					$t.find(".colimgHover").find(".front").show();
					$t.find(".colimgHover")[0].style.transform = 'rotateY(180deg)';
				}
				if(itemMdata.setnumber == true) {
					$t.css('backgroundImage', itemMdata.liStyleH.backgroundImage);
					if($t.find(".colimgHover").next('.pW')) {
						$t.find(".colimgHover").next('.pW').find('span:first').css('color', itemMdata.liStyle.color);
						$t.find(".colimgHover").next('.pW').find('span:last').css('color', itemMdata.liStyleH.color);
					}
					if(columnPictureId.indexOf('productShowId')) {
						$t.find(".colimgHover").children('p').css('color', itemMdata.liStyle.color);
					}
				}
			});
			$("#" + columnPictureId).on("mouseout", "li", function() {
				if(itemMdata.isImg == true) {
					$t.find(".colimgHover")[0].style.transform = 'rotateY(0)';
					$t.find(".colimgHover").find(".front").hide();
				}

				$t.css('backgroundImage', itemMdata.liStyle.backgroundImage);

				if($t.find(".colimgHover").next('.pW')) {
					$t.find(".colimgHover").next('.pW').find('span:first').css('color', itemMdata.pStyle.color);
					$t.find(".colimgHover").next('.pW').find('span:last').css('color', itemMdata.hoverP.color);
				}

				if(columnPictureId.indexOf('productShowId')) {
					$t.find(".colimgHover").children('p').css('color', itemMdata.pStyle.color);
				}
			});
		}
		//轮播轮播
		if(itemMdata.stylethree) {
      var html =$("#" + columnPictureId).find('.marquee-wrap').find('ul').html();
                $("#" + columnPictureId).find('.marquee-wrap').find('ul').append(html);
			var oDiv = $("#" + columnPictureId).find('.marquee-wrap')[0];
			var oUl = $("#" + columnPictureId).find('.marquee-wrap').find('ul')[0];
			var aLi = $("#" + columnPictureId).find('.marquee-wrap').find('li');
			var speed = -2;

			oUl.style.width = aLi.first().outerWidth(true) * aLi.length + 'px';

			if(aLi.first().width() < 1) {

				$("#" + columnPictureId).parents(".conStyle").show();
				oUl.style.width = aLi.first().outerWidth(true) * aLi.length + 'px';
				setTimeout(function() {
					$("#" + columnPictureId).parents(".conStyle").hide();
				}, 100)

			}

			var timer = setInterval(function() {
				if(oUl.offsetLeft < - aLi.first().outerWidth(true) * aLi.length / 2 ) {
					oUl.style.left = '0';
				}

				if(oUl.offsetLeft > 0) {
					oUl.style.left = -oUl.offsetWidth / 2 + 'px';
				}

				oUl.style.left = oUl.offsetLeft + speed + 'px';
			}, 30);
			oDiv.onmouseover = function() {
				clearInterval(timer);
			};
			oDiv.onmouseout = function() {
				timer = setInterval(function() {
					if(oUl.offsetLeft < -aLi.first().outerWidth(true) * aLi.length / 2 ) {
						oUl.style.left = '0';
					}
					if(oUl.offsetLeft > 0) {
						oUl.style.left = -oUl.offsetWidth / 2 + 'px';
					}
					oUl.style.left = oUl.offsetLeft + speed + 'px';
				}, 30);
			};
		}

		var curPage = 1,
			curNum = 1;
		$("#" + columnPictureId).find(".inst_ind:first").addClass("current");
		$("#" + columnPictureId).find(".page").on("click", "p", function() {
			//debugger
			var pageNum = itemMdata.page.pageNum;
			var index = $(this).data("index");

			if(index == "up") {
				if(curPage != 1) {
					curPage--;
					$("#" + columnPictureId).find(".current").prev().addClass("current").css({
						color: itemMdata.page.curColor,
						backgroundColor: itemMdata.page.curBackgroundColor
					}).siblings().css({
						color: itemMdata.page.color,
						backgroundColor: itemMdata.page.backgroundColor
					}).removeClass("current");
				}
			} else if(index == "down") {
				if(curPage != Math.ceil(itemMdata.page.talNum / itemMdata.page.pageNum)) {
					++curPage;
					$("#" + columnPictureId).find(".current").next().addClass("current").css({
						color: itemMdata.page.curColor,
						backgroundColor: itemMdata.page.curBackgroundColor
					}).siblings().css({
						color: itemMdata.page.color,
						backgroundColor: itemMdata.page.backgroundColor
					}).removeClass("current");
				}
			} else if(index == "first") {
				curPage = 1;
				$("#" + columnPictureId).find(".inst_ind:first").addClass("current").css({
					color: itemMdata.page.curColor,
					backgroundColor: itemMdata.page.curBackgroundColor
				}).siblings().css({
					color: itemMdata.page.color,
					backgroundColor: itemMdata.page.backgroundColor
				}).removeClass("current");
			} else if(index == "last") {
				curPage = Math.ceil(itemMdata.page.talNum / itemMdata.page.pageNum);
				$("#" + columnPictureId).find(".inst_ind:last").addClass("current").css({
					color: itemMdata.page.curColor,
					backgroundColor: itemMdata.page.curBackgroundColor
				}).siblings().css({
					color: itemMdata.page.color,
					backgroundColor: itemMdata.page.backgroundColor
				}).removeClass("current");
			} else {
				curPage = Number($(this).data("index"));
				$(this).addClass("current").css({
					color: itemMdata.page.curColor,
					backgroundColor: itemMdata.page.curBackgroundColor
				}).siblings().css({
					color: itemMdata.page.color,
					backgroundColor: itemMdata.page.backgroundColor
				}).removeClass("current");
			}
			curNum = (curPage - 1) * pageNum;

			$("#" + columnPictureId).find(".article_ui").find("li").hide();

			for(var i = 0; i < pageNum; i++) {
				$("#" + columnPictureId).find(".article_ui").find("li:eq(" + (curNum + i) + ")").show();
			}
		});

	},
	colPreNext: function(columnPictureId, itemMdata) {
		//debugger
		$(function() {
			var liWidth = itemMdata.imgW + parseInt(itemMdata.liStyle.marginLeft) + parseInt(itemMdata.liStyle.marginRight);
			//debugger
			$("#" + columnPictureId).on('click', '.next1', function() { //右切换
				var i;
				if(itemMdata.showbtnP == 0) {
					i = $(this).parent().prev('.width').children('ul');
				} else {
					i = $(this).parent().parent().find('.width').children('ul');
				}
				i.css({
					"margin-left": "0px"
				}).find("li:first").appendTo(i);
				i.stop().animate({
					"margin-left": -liWidth + "px"
				}, 800, function() {
					//326是一个li元素的width，先将ul整体向左移出一个li
					//将移出的那个li**剪切**到ul的末尾，然后将ul的margin-left设为0
				});

			});

			$("#" + columnPictureId).on('click', '.pre1', function() { //左切换
				//console.log($(this))
				var i;
				if(itemMdata.showbtnP == 0) {
					i = $(this).parent().prev('.width').children('ul');
					//console.log($self)
				} else {
					i = $(this).parent().parent().find('.width').children('ul');
					//console.log($self)
				}
				//	console.log($self)
				i.css({
					"margin-left": -liWidth + "px"
				}).find("li:last").prependTo(i);
				i.stop().animate({
					"margin-left": "0px"
				}, 800, function() {

					//将ul的最后一个li剪切到ul的第一个li，然后将其margin-left设为-326。

				}); //显示
			});
			if(itemMdata.autoPlay) {
				itemMdata.carouse = setInterval(autoPlay, 2000);

			} else {
				clearInterval(itemMdata.carouse);
			}

			function autoPlay() {
				var i;
				if(itemMdata.showbtnP == 0) {
					i = $("#" + columnPictureId).find('.next1').parent().prev('.width').children('ul');
					//$self = $("#" + columnPictureId).find('.next1').parent().prev('.width').children('ul')
				} else {
					i = $("#" + columnPictureId).find('.next1').parent().parent().find('.width').children('ul');
					//$self = $("#" + columnPictureId).find('.next1').parent().parent().find('.width').children('ul')
				}
				//console.log($self)
				//console.log(i)
				i.css({
					"margin-left": "0px"
				}).find("li:first").appendTo(i);
				i.stop().animate({
					"margin-left": -liWidth + "px"
				}, 2000, function() {
					//326是一个li元素的width，先将ul整体向左移出一个li

					//将移出的那个li**剪切**到ul的末尾，然后将ul的margin-left设为0。

				});
			}
			$("#" + columnPictureId).on('mouseover', '.slideUl', function() {
				//console.log($(this))
				if(itemMdata.autoPlay) {
					clearInterval(itemMdata.carouse);
				}
			})
			$("#" + columnPictureId).on('mouseout', '.slideUl', function() {
				//	console.log($(this))
				if(itemMdata.autoPlay) {
					itemMdata.carouse = setInterval(autoPlay, 2000);
				}
			})
		});
	},
	//产品列表
	productShowHover: function(productShowId, itemMdata) {
		var ts = this;
		ts.productShowId = productShowId;
		$(function() {
			var currentIndex = 0;
			var marginleft = 0;

			$("#" + productShowId).on("mouseover", ".colimgHover", function() {
				//debugger
				if($(this).parent('.mouseenterFour')) {
					$(this).find('.hid').css('background', itemMdata.hidStyle.background);

					if(itemMdata.liImgBgH) {
						$(this).find('.hid').css('background', 'url(' + itemMdata.liImgBgH + ') no-repeat');
					}
					if(itemMdata.setnumber == true) {
						$(this).find('.hid p').css('width', '100%');
					}
				}

				if(itemMdata.isImg == true) {
					$(this).css('willChange', 'transform');
					$(this)[0].style.transform = 'rotateY(180deg)';
				}
				//debugger;
				if(itemMdata.setHover) {
					$(this).parent('li').css('background-image', itemMdata.liStyleH.backgroundImage);
					$(this).parent('li').css('background-color', itemMdata.liStyleH.backgroundColor);
					if(itemMdata.liStyle.color) {
						$(this).find('h3.pStyle').css('color', itemMdata.liStyle.color);
					}
					if(itemMdata.liStyleH.color) {
						$(this).find('p.desStyle').css('color', itemMdata.liStyleH.color);
					}

					$(this).find('p.contentStyle').css('color', itemMdata.hoverP.color);

				}
				//debugger
				var layout_inner = $("#" + productShowId).closest('.layout_inner').css('height');
				var freeContainer = $("#" + productShowId).closest('.freeContainer').css('height');
				localStorage.setItem('layout_inner', layout_inner);
				localStorage.setItem('freeContainer', freeContainer);

				localStorage.setItem('layout_inner', layout_inner);
				localStorage.setItem('freeContainer', freeContainer);
			});

			$("#" + productShowId).on("mouseout", ".colimgHover", function() {

				if($(this).parent('.mouseenterFour')) {
					$(this).find('.hid').css('background', 'none');

					$(this).find('.hid p').css('width', '0');
				}

				if(itemMdata.isImg == true) {
					$(this)[0].style.transform = 'rotateY(0)';
				}

				$(this).parent('li').css('background-image', itemMdata.liStyle.backgroundImage);
				$(this).parent('li').css('background-color', itemMdata.liStyle.backgroundColor);
				$(this).find('h3.pStyle').css('color', itemMdata.pStyle.color);
				$(this).find('p.desStyle').css('color', itemMdata.desStyle.color);
				$(this).find('p.contentStyle').css('color', itemMdata.contentStyle.color);

			});

			//轮播轮播
			if(itemMdata.stylethree) {
				var speed = 10;
				var MyMar = 1;

				$("#" + productShowId).find('.threeStyle .tableBox .new')[0].innerHTML = $("#" + productShowId).find('.threeStyle .tableBox .old')[0].innerHTML;

				if(itemMdata.stylethree == true) {
					MyMar = setInterval(function() {
						if($("#" + productShowId).find('.threeStyle .tableBox')[0].scrollLeft > $("#" + productShowId).find('.threeStyle .tableBox .old')[0].scrollWidth) {
							$("#" + productShowId).find('.threeStyle .tableBox')[0].scrollLeft = 0;

						} else {

							$("#" + productShowId).find('.threeStyle .tableBox')[0].scrollLeft++;
						}
					}, speed);
				}

				$("#" + productShowId).find('.threeStyle .tableBox').on('mouseover', function() {
					clearInterval(MyMar);
				});

				$("#" + productShowId).find('.threeStyle .tableBox').on('mouseout', function() {
					MyMar = setInterval(function() {
						if($("#" + productShowId).find('.threeStyle .tableBox')[0].scrollLeft > $("#" + productShowId).find('.threeStyle .tableBox .old')[0].scrollWidth) {
							$("#" + productShowId).find('.threeStyle .tableBox')[0].scrollLeft = 0;
						} else {
							$("#" + productShowId).find('.threeStyle .tableBox')[0].scrollLeft++;
						}
					}, speed);
				});

			}

		})
	},
	productShowId: "",
	areaFlvInitPage: function(id, itemMdata) {
		var curPage = 1,
			curNum = 1;
		//	debugger
		$("#" + id).find(".inst_ind:first").addClass("current");
		$("#" + id).find(".page").on("click", "p", function() {
			//debugger
			var pageNum = itemMdata.page.pageNum;
			var index = $(this).data("index");

			if(index == "up") {
				if(curPage != 1) {
					curPage--;
					$("#" + id).find(".current").prev().addClass("current").css({
						color: itemMdata.page.curColor,
						backgroundColor: itemMdata.page.curBackgroundColor
					}).siblings().css({
						color: itemMdata.page.color,
						backgroundColor: itemMdata.page.backgroundColor
					}).removeClass("current");
				}
			} else if(index == "down") {
				if(curPage != Math.ceil(itemMdata.page.talNum / itemMdata.page.pageNum)) {
					++curPage;
					$("#" + id).find(".current").next().addClass("current").css({
						color: itemMdata.page.curColor,
						backgroundColor: itemMdata.page.curBackgroundColor
					}).siblings().css({
						color: itemMdata.page.color,
						backgroundColor: itemMdata.page.backgroundColor
					}).removeClass("current");
				}
			} else if(index == "first") {
				curPage = 1;
				$("#" + id).find(".inst_ind:first").addClass("current").css({
					color: itemMdata.page.curColor,
					backgroundColor: itemMdata.page.curBackgroundColor
				}).siblings().css({
					color: itemMdata.page.color,
					backgroundColor: itemMdata.page.backgroundColor
				}).removeClass("current");
			} else if(index == "last") {
				curPage = Math.ceil(itemMdata.page.talNum / itemMdata.page.pageNum);
				$("#" + id).find(".inst_ind:last").addClass("current").css({
					color: itemMdata.page.curColor,
					backgroundColor: itemMdata.page.curBackgroundColor
				}).siblings().css({
					color: itemMdata.page.color,
					backgroundColor: itemMdata.page.backgroundColor
				}).removeClass("current");
			} else {
				curPage = Number($(this).data("index"));
				$(this).addClass("current").css({
					color: itemMdata.page.curColor,
					backgroundColor: itemMdata.page.curBackgroundColor
				}).siblings().css({
					color: itemMdata.page.color,
					backgroundColor: itemMdata.page.backgroundColor
				}).removeClass("current");
			}
			curNum = (curPage - 1) * pageNum;

			$("#" + id).find(".areaflv_ul").find("li").css('display', "none");

			for(var i = 0; i < pageNum; i++) {
				$("#" + id).find(".areaflv_ul").find("li:eq(" + (curNum + i) + ")").css('display', "inline-block");
			}
		});
	},
	productShowPreNext: function(productShowId, itemMdata) {
		// debugger
		$(function() {
			var liWidth = itemMdata.imgW + parseInt(itemMdata.liStyle.marginLeft) + parseInt(itemMdata.liStyle.marginRight);
			$("#" + productShowId).on('click', '.next1', function() { //右切换
				//console.log($(this))
				var i;
				if(itemMdata.showbtnP == 0) {
					i = $(this).parent().prev('.width').children('ul');
				} else {
					i = $(this).parent().parent().find('.width').children('ul');
				}
				//console.log(i)
				i.css({
					"margin-left": "0px"
				}).find("li:first").appendTo(i);
				i.stop().animate({
					"margin-left": -liWidth + "px"
				}, 800, function() {

				});

			});

			$("#" + productShowId).on('click', '.pre1', function() { //左切换
				// console.log($(this))
				var i;
				if(itemMdata.showbtnP == 0) {
					i = $(this).parent().prev('.width').children('ul');
					//console.log($self)
				} else {
					i = $(this).parent().parent().find('.width').children('ul');
					//console.log($self)
				}

				i.css({
					"margin-left": -liWidth + "px"
				}).find("li:last").prependTo(i);
				i.stop().animate({
					"margin-left": "0px"
				}, 800, function() {
					//将ul的最后一个li剪切到ul的第一个li，然后将其margin-left设为-326
				}); //显示
			});
		});
	},
	//产品详情
	productDesPreNxt: function(productDesId, itemMdata) {
		var moveLeft;
		$('#' + productDesId).on('click', '.preImg', function() {
			moveLeft = $('#' + this.productDesId).find('.moveImg .con_img img').outerWidth();
			//console.log($('#' + this.productDesId).find('.moveImg .con_img img').outerWidth())
			$(this).next().find('.moveImg').css({
				"margin-left": -moveLeft + "px"
			}).find('.con_img:last').prependTo($(this).next().find('.moveImg'));
			$(this).next().find('.moveImg').stop().animate({
				"margin-left": "0px"
			}, 800, function() {

			});
		})

		$('#' + productDesId).on('click', '.nextImg', function() {
			moveLeft = $('#' + this.productDesId).find('.moveImg .con_img img').outerWidth();
			// console.log($('#' + this.productDesId).find('.moveImg .con_img img').outerWidth())
			$(this).prev().find('.moveImg').css({
				"margin-left": "0px"
			}).find(".con_img:first").appendTo($(this).prev().find('.moveImg'));
			$(this).prev().find('.moveImg').stop().animate({
				"margin-left": -moveLeft + "px"
			}, 800, function() {

			});
		})

		$('#' + productDesId).on('click', '.h_chanmenu li', function() {
			// console.log("dd");
			$(this).addClass("active").siblings().removeClass("active");
			var index = $(this).index();
			$(this).css({
				"background": itemMdata.labelTitleStyleHover.background,
				"color": itemMdata.labelTitleStyleHover.color,
				"border-color": itemMdata.labelTitleStyleHover.borderColor,
				"border-width": itemMdata.labelTitleStyleHover.borderWidth,
				"border-style": itemMdata.labelTitleStyleHover.borderStyle
			});
			$(this).siblings().each(function() {
				$(this).css({
					"background": itemMdata.labelTitleStyle.background,
					"color": itemMdata.labelTitleStyle.color,
					"border-color": itemMdata.labelTitleStyle.borderColor,
					"border-width": itemMdata.labelTitleStyle.borderWidth,
					"border-style": itemMdata.labelTitleStyle.borderStyle
				});
			});
			$('#' + productDesId).find(".h_chanmenucon").find("li.conli:eq(" + index + ")").addClass("show").siblings().removeClass("show");
			var productDes = $("#productDes");
			if(productDes.length) {
				setTimeout(function() {
					var productH = productDes.height();
					if(productDes.closest(".resizable").length) {
						productH = productH + parseInt(productDes.closest(".resizable").css('top'));
					}
					productDes.closest('.freeContainer');
					productDes.closest('.layout_inner');
					var p1 = parseInt(localStorage.getItem('layout_inner'));
					var p2 = parseInt(localStorage.getItem('freeContainer'));
					if(productDes.closest('.freeContainer').height()) {
						productDes.closest('.freeContainer').css('height', productH + 'px');
					}
					if(productDes.closest('.layout_inner').height()) {
						productDes.closest('.layout_inner').css('height', productH + 'px');
					}
				}, 400);
			}
		})

	},
	//标签
	labelHover: function(v, itemMdata) {
		var index = 0;
		$(v).find("li.labelList").each(function() {
			if($(this).hasClass("cur")) {
				index = $(this).index();
				$(this).css({
					"background": itemMdata.labelTitleStyleHover.background,
					"color": itemMdata.labelTitleStyleHover.color,
					"border-color": itemMdata.labelTitleStyleHover.borderColor,
					"border-width": itemMdata.labelTitleStyleHover.borderWidth,
					"border-style": itemMdata.labelTitleStyleHover.borderStyle
				});
			}
		});

		$(v).find(".tit_con").find(".conStyle").eq(index).show().siblings().hide();

		if(itemMdata.labelStyle == 2) {

			$(v).find("li>p.title").hover(function() {

				$(this).css({
					"background": itemMdata.labelTitleStyleHover.background,
					"color": itemMdata.labelTitleStyleHover.color,
					"border-color": itemMdata.labelTitleStyleHover.borderColor,
					"border-width": itemMdata.labelTitleStyleHover.borderWidth,
					"border-style": itemMdata.labelTitleStyleHover.borderStyle
				});

			}, function() {

				$(this).css({
					"background": "",
					"color": itemMdata.labelTitleStyle.color,
					"border-color": "",
					"border-width": "",
					"border-style": ""
				});

			});
		}
		//	console.log(itemMdata.labelStyle)

		$(v).on("mouseover", "li.labelList", function() {
			if(itemMdata.labelStyle == 1) {
				index = $(this).index();
				$(this).css({
					"background": itemMdata.labelTitleStyleHover.background,
					"color": itemMdata.labelTitleStyleHover.color,
					"border-color": itemMdata.labelTitleStyleHover.borderColor,
					"border-width": itemMdata.labelTitleStyleHover.borderWidth,
					"border-style": itemMdata.labelTitleStyleHover.borderStyle
				});
				// console.log("dsdsds")
				$(this).siblings(".labelList").each(function() {
					//console.log("dsdsds")
					$(this).removeClass("cur");
					$(this).css({
						"background": itemMdata.labelTitleStyle.background,
						"color": itemMdata.labelTitleStyle.color,
						"border-color": itemMdata.labelTitleStyle.borderColor,
						"border-width": itemMdata.labelTitleStyle.borderWidth,
						"border-style": itemMdata.labelTitleStyle.borderStyle
					});
				});
				$(this).addClass("cur");
				$(this).parents(".titlbl").siblings(".lbl_con").find(".conStyle").eq(index).show().siblings().hide();
			}
		});

		$(v).on("click", "li.labelList", function() {
			var $t = $(this);
			if(itemMdata.labelStyle == 2) {
				index = $t.index();
				//debugger;
				$t.addClass("cur");

				$t.css({
					"background": itemMdata.labelTitleStyleHover.background,
					"color": itemMdata.labelTitleStyleHover.color,
					"border-color": itemMdata.labelTitleStyleHover.borderColor,
					"border-width": itemMdata.labelTitleStyleHover.borderWidth,
					"border-style": itemMdata.labelTitleStyleHover.borderStyle
				});

				$t.siblings(".labelList").each(function(i, v) {
					$(v).css({
						"background": itemMdata.labelTitleStyle.background,
						"color": itemMdata.labelTitleStyle.color,
						"border-color": itemMdata.labelTitleStyle.borderColor,
						"border-width": itemMdata.labelTitleStyle.borderWidth,
						"border-style": itemMdata.labelTitleStyle.borderStyle
					}).removeClass("cur");
				});

				$t.parents(".titlbl").siblings(".lbl_con").find(".conStyle").eq(index).show().siblings().hide();
			}
		});
	},
	popUpsInit: function(id, itemMdata) {
		$("#" + id).on("click", ".close_icon", function() {
			$("#" + id).hide();
			//console.log("dd");
		});
		//console.log("popUpsInit:"+id);
		//console.log(itemMdata);
	},
	//魔方多图
	photoMoreCard: function(itemMdata, photoMoreCardId) {
		$(function() {
			$('#' + photoMoreCardId).on('mouseover', '.positionR', function() {
				if(itemMdata.mouseenterNumber == 1) {
					$(this).find('.hid').css('display', 'block');
					itemMdata.hidStyle.background = "#fff";
					$(this).find('.hid').find('i').css('display', 'none');
				}
				if(itemMdata.mouseenterNumber == 2) {
					$(this).find('.hid').css('display', 'block');
					itemMdata.hidStyle.borderColor = "#fff";
					itemMdata.hidStyle.background = "#fff";
					$(this).find('.hid').find('i').css('display', 'block');
				}
				if(itemMdata.mouseenterNumber == 3) {
					$(this).find('.hid').css('display', 'block');
					itemMdata.hidStyle.borderColor = "#fff";
					$(this).find('.hid').find('i').css('display', 'none');
				}
			})
			$('#' + photoMoreCardId).on('mouseout', '.positionR', function() {
				if(itemMdata.mouseenterNumber == 1 || itemMdata.mouseenterNumber == 2 || itemMdata.mouseenterNumber == 3) {
					$(this).find('.hid').css('display', 'none');
				}
			})
		});
	},
	initNavData: function(moduleNavId, itemMdata) {
		var bt = $(document.body).width();
		$("#" + moduleNavId + " .nav_lifirth").find(" .sec_con_bg").each(function() {
			$(this).width(bt).css({
				left: '50%',
				marginLeft: -bt / 2 - itemMdata.parentStyle.left / 2
			});
		});
	},
	//栏目导航
	moduleNavHover: function(moduleNavId, itemMdata) {
		//debugger
		//一级导航
		$("#" + moduleNavId).on("mouseover", "li.nav_lifirth", function() {
			//tit_i1
			$(this).css({
				background: itemMdata.hoverColor.backgroundColor,
				color: itemMdata.hoverColor.color,
				border: itemMdata.hoverColor.border
			});
			//this.style.background = itemMdata.hoverColor.backgroundColor;
			//this.style.color = itemMdata.hoverColor.color;
			//this.style.border = itemMdata.hoverColor.border;
			//console.log("mouseover1");
		}).on('mouseout', 'li.nav_lifirth', function() {
			//console.log("mouseout1");
			$(this).css({
				background: "",
				color: itemMdata.layoutOuterStyle.color,
				border: "none"
			});
			//this.style.background = '';
			//this.style.color = itemMdata.layoutOuterStyle.color;
			//this.style.border = "none";
		});
		//二级导航
		$("#" + moduleNavId).on("mouseover", ".sec_con>li .tit_i2", function() {
			$(this).css({
				background: itemMdata.hoverSec.backgroundColor,
				color: itemMdata.hoverSec.color,
				border: itemMdata.hoverSec.border
			});
			///debugger
			//this.style.background = itemMdata.hoverSec.backgroundColor;
			//this.style.color = itemMdata.hoverSec.color;
			//this.style.border = itemMdata.hoverSec.border;
		}).on('mouseout', '.sec_con>li .tit_i2', function() {
			$(this).css({
				background: "",
				color: itemMdata.hoverSecBg.color,
				border: "none"
			});
			//this.style.background = '';
			//this.style.color = itemMdata.hoverSecBg.color;
			//this.style.border = "none";
		});
		//三级导航
		$("#" + moduleNavId).on("mouseover", "div.third_con>div", function() {
			//event.stopPropagation();
			$(this).css({
				background: itemMdata.hoverThr.backgroundColor,
				color: itemMdata.hoverThr.color,
				border: itemMdata.hoverThr.border
			});
			//this.style.background = itemMdata.hoverThr.backgroundColor;
			//this.style.color = itemMdata.hoverThr.color;
			//this.style.border = itemMdata.hoverThr.border;
			//console.log("mouseover3");
		}).on('mouseout', 'div.third_con>div', function(event) {
			//console.log("mouseout3");
			event.stopPropagation();
			$(this).css({
				background: "",
				color: itemMdata.hoverThrBg.color,
				border: "none"
			});
			//this.style.background = '';
			//this.style.color = itemMdata.hoverThrBg.color;
			//this.style.border = "none";
		});

		$("#" + moduleNavId).find(".sec_con_bg").each(function() {
			$(this).width($(document.body).width());
			// console.log($(document.body).width());
		});

		$(".moduleAreaNav ").parents(".columnLayout").css("zIndex", 100);
	},
	//新闻列表
	articleSHover: function(articleId, itemMdata) {
		$(function() { //articleLi
			$('#' + articleId).on("mouseover", ".articleLi", function() {
				if(itemMdata.setHover == true) {
					var t = $(this);
					t.css('background', itemMdata.textStyleH.background);
					t.find('.title').css('color', itemMdata.titleStyleH.color);
					t.find('.time').css('color', itemMdata.timeStyleH.color);
					t.find('.describe').css('color', itemMdata.describeStyleH.color);
				}
				var layout_inner = $("#" + articleId).closest('.layout_inner').css('height');
				var freeContainer = $("#" + articleId).closest('.freeContainer').css('height');
				localStorage.setItem('Nlayout_inner', layout_inner);
				localStorage.setItem('NfreeContainer', freeContainer);
			});
			$('#' + articleId).on("mouseout", ".articleLi", function() {
				// console.log($(this))
				// debugger
				$(this).css('background', itemMdata.liStyle.background || 'transparent');
				$(this).find('.title').css('color', itemMdata.titleStyle.color);
				$(this).find('.time').css('color', itemMdata.timeStyle.color);
				$(this).find('.describe').css('color', itemMdata.describeStyle.color);
			})
		});
		var curPage = 1,
			curNum = 1;

		$("#" + articleId).find(".inst_ind:first").addClass("current");
		$("#" + articleId).find(".page").on("click", "p", function() {

			var pageNum = itemMdata.page.pageNum;
			var index = $(this).data("index");

			if(index == "up") {
				if(curPage != 1) {
					curPage--;
					$("#" + articleId).find(".current").prev().addClass("current").css({
						color: itemMdata.page.curColor,
						backgroundColor: itemMdata.page.curBackgroundColor
					}).siblings().css({
						color: itemMdata.page.color,
						backgroundColor: itemMdata.page.backgroundColor
					}).removeClass("current");
				}

			} else if(index == "down") {
				if(curPage != Math.ceil(itemMdata.page.talNum / itemMdata.page.pageNum)) {
					++curPage;
					$("#" + articleId).find(".current").next().addClass("current").css({
						color: itemMdata.page.curColor,
						backgroundColor: itemMdata.page.curBackgroundColor
					}).siblings().css({
						color: itemMdata.page.color,
						backgroundColor: itemMdata.page.backgroundColor
					}).removeClass("current");
				}

			} else if(index == "first") {
				curPage = 1;
				$("#" + articleId).find(".inst_ind:first").addClass("current").css({
					color: itemMdata.page.curColor,
					backgroundColor: itemMdata.page.curBackgroundColor
				}).siblings().css({
					color: itemMdata.page.color,
					backgroundColor: itemMdata.page.backgroundColor
				}).removeClass("current");
			} else if(index == "last") {
				curPage = Math.ceil(itemMdata.page.talNum / itemMdata.page.pageNum);
				$("#" + articleId).find(".inst_ind:last").addClass("current").css({
					color: itemMdata.page.curColor,
					backgroundColor: itemMdata.page.curBackgroundColor
				}).siblings().css({
					color: itemMdata.page.color,
					backgroundColor: itemMdata.page.backgroundColor
				}).removeClass("current");
			} else {
				curPage = Number($(this).data("index"));
				$(this).addClass("current").css({
					color: itemMdata.page.curColor,
					backgroundColor: itemMdata.page.curBackgroundColor
				}).siblings().css({
					color: itemMdata.page.color,
					backgroundColor: itemMdata.page.backgroundColor
				}).removeClass("current");
			}

			curNum = (curPage - 1) * pageNum;
			$("#" + articleId).find(".page p.inst_ind").hide();
			$("#" + articleId).find(".page p.current").show().prevAll().each(function(k, v) {
				if(k < 4) {
					$(v).show();
				}
			});
			$("#" + articleId).find(".page p.current").nextAll().each(function(k, v) {
				if(k < 4) {
					$(v).show();
				}
			});
			//debugger
			//$("#" + id).find("li").hide();
			$("#" + articleId).find(".article_ui").find("li").hide();

			for(var i = 0; i < pageNum; i++) {
				$("#" + articleId).find(".article_ui").find("li:eq(" + (curNum + i) + ")").show();
			}

			//console.log(itemMdata.productDesListSelected);
		});

	},
	searchResults: function(articleId, itemMdata) {
		var curPage = 1,
			curNum = 1;

		$("#" + articleId).find(".inst_ind:first").addClass("current");
		//debugger
		$("#" + articleId).find(".page").on("click", "p", function() {
			//debugger
			var pageNum = itemMdata.page.pageNum;
			var index = $(this).data("index");

			if(index == "up") {
				if(curPage != 1) {
					curPage--;
					$("#" + articleId).find(".current").prev().addClass("current").css({
						color: itemMdata.page.curColor,
						backgroundColor: itemMdata.page.curBackgroundColor
					}).siblings().css({
						color: itemMdata.page.color,
						backgroundColor: itemMdata.page.backgroundColor
					}).removeClass("current");
				}

			} else if(index == "down") {
				if(curPage != Math.ceil(itemMdata.page.talNum / itemMdata.page.pageNum)) {
					++curPage;
					$("#" + articleId).find(".current").next().addClass("current").css({
						color: itemMdata.page.curColor,
						backgroundColor: itemMdata.page.curBackgroundColor
					}).siblings().css({
						color: itemMdata.page.color,
						backgroundColor: itemMdata.page.backgroundColor
					}).removeClass("current");
				}

			} else if(index == "first") {
				curPage = 1;
				$("#" + articleId).find(".inst_ind:first").addClass("current").css({
					color: itemMdata.page.curColor,
					backgroundColor: itemMdata.page.curBackgroundColor
				}).siblings().css({
					color: itemMdata.page.color,
					backgroundColor: itemMdata.page.backgroundColor
				}).removeClass("current");
			} else if(index == "last") {
				curPage = Math.ceil(itemMdata.page.talNum / itemMdata.page.pageNum);
				$("#" + articleId).find(".inst_ind:last").addClass("current").css({
					color: itemMdata.page.curColor,
					backgroundColor: itemMdata.page.curBackgroundColor
				}).siblings().css({
					color: itemMdata.page.color,
					backgroundColor: itemMdata.page.backgroundColor
				}).removeClass("current");
			} else {
				curPage = Number($(this).data("index"));
				$(this).addClass("current").css({
					color: itemMdata.page.curColor,
					backgroundColor: itemMdata.page.curBackgroundColor
				}).siblings().css({
					color: itemMdata.page.color,
					backgroundColor: itemMdata.page.backgroundColor
				}).removeClass("current");
			}

			curNum = (curPage - 1) * pageNum;
			$("#" + articleId).find("li").hide();
			$("#" + articleId).find("tr").hide();
			//debugger
			for(var i = 0; i < pageNum; i++) {
				$("#" + articleId).find("li:eq(" + (curNum + i) + ")").show();
				$("#" + articleId).find("tr:eq(" + (curNum + i) + ")").show();
			}

			console.log(itemMdata.productDesListSelected);
		});

	},
	//友情链接
	friendLinkHover: function(friendLinkId, itemMdata) {
		$(function() {
			$('#' + friendLinkId).on('mouseover', 'li .text', function() {
				$(this).css({
					"backgroundColor": itemMdata.timeStyle.backgroundColor
				});
				$(this).find('.title').css({
					"color": itemMdata.timeStyle.colorT
				});
				$(this).find('.describe').css({
					"color": itemMdata.timeStyle.colorD
				});
			})
			$('#' + friendLinkId).on('mouseout', 'li .text', function() {
				$(this).css({
					"backgroundColor": itemMdata.textStyle.backgroundColor
				});
				$(this).find('.title').css({
					"color": itemMdata.titleStyle.color
				});
				$(this).find('.describe').css({
					"color": itemMdata.describeStyle.color
				});
			})
			productNav.initData(friendLinkId);

		})
	},
	accorSide: function(itemMdata) {

		//script.type = "text/javascript";

		if(itemMdata.dataScript) {
			var script = $('<script type = "text/javascript">' + itemMdata.dataScript + '</script>');
			$("body").append(script);
			//script.append(document.createTextNode(itemMdata.dataScript));
		}

		if(itemMdata.dataCss) {
			var style = $('<style type="text/css">' + itemMdata.dataCss + '</style>');
			$("body").append(style);
		}

		//$("body").append(style);
	},
	//侧边栏
	accordion: function(sidebarId, itemMdata) {
		$(function() {
			//console.log(sidebarId)
			$('#' + sidebarId + ' .twoUl li .twoLevel').mouseover(function(event) {
				//console.log(334)
				$(this).css({
					backgroundColor: itemMdata.twoHoverStyle.backgroundColor,
					color: itemMdata.twoHoverStyle.color
				});
				event.stopPropagation()
			});
			$('#' + sidebarId + ' .twoUl li .third_item').mouseover(function(event) {
				//console.log(334)

				$(this).css({
					backgroundColor: itemMdata.thirdHoverStyle.backgroundColor,
					color: itemMdata.thirdHoverStyle.color
				});
				event.stopPropagation();
			});
			$('#' + sidebarId + ' .twoUl li .twoLevel').mouseout(function(event) {
				//console.log(33)
				//debugger;
				$(this).css({
					backgroundColor: itemMdata.twoStyle.backgroundColor || "transparent",
					color: itemMdata.twoStyle.color
				});
				event.stopPropagation();
			});
			$('#' + sidebarId + ' .twoUl li .third_item').mouseout(function(event) {
				//console.log(334)
				$(this).css({
					backgroundColor: itemMdata.thirdStyle.backgroundColor,
					color: itemMdata.thirdStyle.color
				});
				event.stopPropagation();
			});
		});
		//debugger
		$('#' + sidebarId + ' .twoUl li .twoLevel').click(function() {
			//console.log($(this).next(".third_con").slideToggle("slow").parent("li").siblings())
			///debugger;
			$(this).next(".third_con").slideToggle("slow").parent("li").siblings().find(".third_con").hide();
		});
		$('#' + sidebarId + ' li.active div.twoLevel').css({
			backgroundColor: itemMdata.twoHoverStyle.backgroundColor,
			color: itemMdata.twoHoverStyle.color
		}).parent().show("");
		$('#' + sidebarId + ' div.active').css({
			backgroundColor: itemMdata.thirdHoverStyle.backgroundColor,
			color: itemMdata.thirdHoverStyle.color
		}).parent().show("");
		//debugger
		setTimeout(function() {
			productNav.initData(itemMdata.allId);
		}, 200)
	}
};
// 在线表单、留言提交
window.siteForm = {
	//提交表单
	submitBtn: function(itemMdata, siteFormId, data) {
		console.log('dongdong')
		console.log(itemMdata)
		//var v = this;
		var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
		var isOpera = userAgent.indexOf("Opera") > -1; //判断是否Opera浏览器
		var isFF = userAgent.indexOf("Firefox") > -1; //判断是否Firefox浏览器
		var isChrome = userAgent.indexOf("Chrome") > -1 && userAgent.indexOf("Safari") > -1; //判断Chrome浏览器
		var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera; //判断是否IE浏览器
		var str = itemMdata.buttonEdit.buttonStyle.background;
		//console.log(str.replace("-webkit-","-ms-"));
		if(isIE) {
			str = str.replace("-webkit-", "-ms-");
			$("#" + siteFormId).find(".btn").css({
				"background": str
			});
		} else if(isOpera) {
			str = str.replace("-webkit-", "-o-");
			$("#" + siteFormId).find(".btn").css({
				"background": str
			});
		} else if(isFF) {
			str = str.replace("-webkit-", "-moz-");
			$("#" + siteFormId).find(".btn").css({
				"background": str
			});
		}

		$(function() {
			$('#' + siteFormId).on('click', '.btn', function() {

				var str = '';
				var textArr = $('#' + siteFormId).find('input[type="text"]:visible');
				var moreArr = $('#' + siteFormId).find('.moreTxt');
				var hiddenArr = $('#' + siteFormId).find('.det_d input[type="hidden"]');
				var selectArr = $('#' + siteFormId).find('.dt_select');

				var province = $("#province:visible").find("option:selected").text() || "";
				var city = $("#city:visible").find("option:selected").text() || "";
				var area = $("#area:visible").find("option:selected").text() || "";
				var obj = {};
				//文本域
				var textareaArr = $('#' + siteFormId).find('textarea:visible');
				//验证码
				var verail = $('#' + siteFormId).find('input[name="verail"]:visible');
				// debugger;
				// console.log("is_require:selectArr" + selectArr.data("is_require"));
				if(selectArr && selectArr.data("is_require") && selectArr.length) {
					for(var i = 0; i < selectArr.length; i++) {
						if(!selectArr[i].value) {
							alert(itemMdata.langTitle[5]);
							return;
						}

						str = str + selectArr[i].name + '=' + selectArr[i].value + '&';
					}
				}

				for(var k = 0; k < hiddenArr.length; k++) {
					str = str + hiddenArr[k].name + '=' + hiddenArr[k].value + '&';
				}

				for(var i = 0; i < moreArr.length; i++) {
					if(moreArr[i].value) {
						obj[moreArr[i].name] = (obj[moreArr[i].name] ? obj[moreArr[i].name] + "," : "") + moreArr[i].value;
						// $(moreArr[i]).parent().find(".rdoTxt").val(moreArr[i].value);
						moreArr[i].value = "";
						// return;
					}
					// str = str + selectArr[i].name + '=' + selectArr[i].value + '&';
				}

				//多行文本
				for(var j = 0; j < textareaArr.length; j++) {
					if(!textareaArr[j].value && $(textareaArr[j]).data("is_require")) {
						alert(itemMdata.langTitle[5]);
						return;
					}

				}
				//单行文本
				for(var j = 0; j < textArr.length; j++) {
					//console.log("is_require:" + );
					if(!textArr[j].value && $(textArr[j]).data("is_require") && !$(textArr[j]).hasClass("moreTxt")) {
						alert(itemMdata.langTitle[5]);
						return;
					}
					if($(textArr[j]).hasClass("rdoTxt") && obj[textArr[j].name]) {
						textArr[j].value = textArr[j].value + obj[textArr[j].name];
					}
					if($(textArr[j]).hasClass("adress")) {
						var strFlag = "";
						if(province.indexOf("请选择") == -1) {
							strFlag = province + " ";
						}
						if(city.indexOf("请选择") == -1) {
							strFlag = strFlag + city + " ";
						}
						if(area.indexOf("请选择") == -1) {
							strFlag = strFlag + area + " ";
						}
						textArr[j].value = strFlag + textArr[j].value;
					}

					// var moreStr = textArr[j].value;

					if(textArr[j].value && !$(textArr[j]).hasClass("moreTxt")) {
						str = str + textArr[j].name + '=' + textArr[j].value + '&';
					}

				}
				//debugger
				var mailbox_input = $('#' + siteFormId).find('.mailbox_input') && $('#' + siteFormId).find('.mailbox_input input').val();

				if(mailbox_input && !(/^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/.test(mailbox_input))) {
					alert("邮箱格式有误，请重填");
					return false;
				}
				var phone = $('#' + siteFormId).find('.phone') && $('#' + siteFormId).find('.phone input').val();

				if(phone && !(/^1[0-9]\d{9}$|^\d{3,4}-?\d{3,9}$/.test(phone))) {
					alert("电话或手机号码有误，请重填");
					return false;
				}
				//验证码
				if(verail.length && !verail[0].value) {
					alert('请输入验证码!');
					return;
				}
				//console.log(obj);

				if(data) {
					for(var y = 0; y < data.length; y++) {
						if(data[y].control_type == 2) {
							var da = $('#' + siteFormId).find('input[name="id' + data[y].id + '"]:checked').val();
							str = str + 'id' + data[y].id + "=" + da + '&';
						} else if(data[y].control_type == 3) {
							var da = $('#' + siteFormId).find('input[name="id' + data[y].id + '"]:checked');
							var stv = "";
							$.each(da, function() {
								stv = stv + $(this).val() + ",";
							});
							str = str + 'id' + data[y].id + "=" + stv + '&';
						}
					}
				}

				str = str.slice(0, str.length - 1);
				var domain = $('#' + siteFormId).find('input[name="domain"]').val();
				str = str + "&domain=" + domain;
				/*var fileUrl = $('#' + siteFormId).find('input[name="fileUrl"]').val();
				 debugger;
				if(fileUrl) {
					str = str + "&fileUrl=" + fileUrl;
				}
				*/

				var lang = $('#' + siteFormId).find('input[name="lang"]').val();
				str = str + "&lang=" + lang;
				if($('#' + siteFormId).find("textarea").length) {
					str = str + "&" + $('#' + siteFormId).find("textarea")[0].name + '=' + $('#' + siteFormId).find('textarea')[0].value;
				}

				var formAction = $('#' + siteFormId).find('input[name="formAction"]').val();

				$.ajax({
					url: formAction + '?form_id=' + itemMdata.formTitle.id + '&' + str,
					type: "post",
					dataType: "jsonp", //指定服务器返回的数据类型
					success: function(data) {
						console.log(data)
						if($('#' + siteFormId).find('input[name="verailUrl"]').length) {
							var root = $('#' + siteFormId).find('input[name="verailUrl"]').val();    
							$('#' + siteFormId).find('.vailImg').attr("src", root + "?t=" + new Date);                        
							siteForm.vailImg(siteFormId, root);                        
						}
						if(data.data.result_code == 0) {

							alert(itemMdata.langTitle[6]);
							verail[0].value = ""
							return;
						}

						for(var k = 0; k < textArr.length; k++) {
							textArr[k].value = "";
						}
						for(var j = 0; j < textareaArr.length; j++) {
							textareaArr[j].value = "";
						}

						//debugger;
						alert(itemMdata.langTitle[7]);
					}
				});
			});
			$('#' + siteFormId).on('click', '.vailImg', function() {
				var root = $('#' + siteFormId).find('input[name="verailUrl"]').val(); 
				siteForm.vailImg(siteFormId, root);
			});
			$('#' + siteFormId).on('click', '.colse_icon', function() {
				$(this).parent().remove();
				console.log("siteFormId");
			});
		});
	},
	vailImg: function(msgSubmitId, root) {
		$('#' + msgSubmitId).on('click', '.vailImg', function() {
			$(this).attr("src", root + "?t=" + new Date);
		});
	},
	getAdress: function(siteFormId, itemMdata) {
		$.ajax({
			url: 'https://api.xiaohucloud.com/api/front/getAreaCode?lang=' + GetQueryString('lang'),
			type: "get",
			dataType: "json", //指定服务器返回的数据类型
			success: function(data) {
				if(data.data.result_code == 0) {
					//alert(itemMdata.langTitle[9]);
					return;
				}　
				//$("#province").prepend("<option selected value='0'>请选择</option>"); //添加第一个option值			　　　　
				for(var i = 0; i < data.data.length; i++) {　　　　　
					$("#province").append("<option value = " + data.data[i].no + ">" + $.trim(data.data[i].areaname) + "</option>");
				}
			}
		});

		$("#province").on("change", function() {
			// console.log($(this).val());
			$("#city").find("option").remove();
			$("#area").find("option").remove();
			$.ajax({
				url: 'https://api.xiaohucloud.com/api/front/getAreaCode?topno=' + $(this).val() + '&lang=' + GetQueryString('lang'),
				type: "get",
				dataType: "json", //指定服务器返回的数据类型
				success: function(data) {
					if(data.data.result_code == 0) {
						//alert(itemMdata.langTitle[9]);
						return;
					}　
					$("#city").prepend("<option selected value='0'>" + itemMdata.langTitle[9] + "</option>"); //添加第一个option值
					$("#area").prepend("<option value='0'>" + itemMdata.langTitle[9] + "</option>"); //添加第一个option值	　　　　
					for(var i = 0; i < data.data.length; i++) {　　　　　
						$("#city").append("<option value = " + data.data[i].no + ">" + $.trim(data.data[i].areaname) + "</option>");
					}
				}
			});
		});

		$("#city").on("change", function() {
			// console.log($(this).val());
			$("#area").find("option").remove();
			$.ajax({
				url: 'https://api.xiaohucloud.com/api/front/getAreaCode?topno=' + $(this).val() + '&lang=' + GetQueryString('lang'),
				type: "get",
				dataType: "json", //指定服务器返回的数据类型
				success: function(data) {
					if(data.data.result_code == 0) {
						//alert(itemMdata.langTitle[9]);
						return;
					}　
					$("#area").prepend("<option value='0'>" + itemMdata.langTitle[9] + "</option>"); //添加第一个option值			　　　　
					for(var i = 0; i < data.data.length; i++) {　　　　　
						$("#area").append("<option value = " + data.data[i].no + ">" + $.trim(data.data[i].areaname) + "</option>");
					}
				}
			});
		});
	},
	// 留言提交
	msgBtn: function(itemMdata, msgSubmitId) {
		$(function() {
			// debugger
			$('#' + msgSubmitId).on('click', '.btn', function() {
				var str = '';
				var textArr = $('#' + msgSubmitId).find('input[type="text"]:visible');

				for(var i = 0; i < textArr.length; i++) {
					if(!textArr[i].value) {
						alert(itemMdata.langTitle[2]);
						return;
					}
					str = str + textArr[i].name + '=' + textArr[i].value + '&'
				}


				var phone = $('#' + msgSubmitId).find('input[name="mobilePhone"]').val();
				if(!(/^1[3456789]\d{9}$/.test(phone))) {
					alert(itemMdata.langTitle[5] || "手机号码有误，请重填");
					return false;
				}
				var email = $('#' + msgSubmitId).find('input[name="email"]').val();
				if(!(/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(email))) {
					alert(itemMdata.langTitle[6] || "邮箱格式有误，请重填");
					return false;
				}
				str = str + $('#' + msgSubmitId).find("textarea")[0].name + '=' + $('#' + msgSubmitId).find('textarea')[0].value;
				str = str.slice(0, str.length - 1);
				console.log(str);
				var formAction = $('#' + msgSubmitId).find('input[name="formAction"]').val();
				var domain = $('#' + msgSubmitId).find('input[name="domain"]').val();
				str = str + "&domain=" + domain;
				//if()
				$.ajax({ // 'https://119.29.226.11:88/api/data/addForm?token=' + token +
					url: formAction + '?' + str,
					type: "post",
					dataType: "jsonp", //指定服务器返回的数据类型
					success: function(data) {
						if(data.data.result_code == 0) {
							alert(itemMdata.langTitle[4]);
							return;
						}
						if($('#' + msgSubmitId).find('input[name="verail"]').length) {
							var root = $('#' + msgSubmitId).find('input[name="verail"]')[0].value;
							siteForm.vailImg(msgSubmitId, root);
						}

						for(var i = 0; i < textArr.length; i++) {
							textArr[i].value = "";
						}

						alert(itemMdata.langTitle[4]);
						$('#' + msgSubmitId).find('textarea')[0].value = "";
					}
				});
			});
		});
	},
	scrollBox: function(msgSubmitId) {
		var $uList = $(".scroll-box ul");
		var timer = null;

		$uList.hover(function() {
				clearInterval(timer);
			},
			function() { //离开启动定时器
				timer = setInterval(function() {
					scrollList($uList);
				}, 3000);
			}).trigger("mouseleave"); //自动触发触摸事件
		//滚动动画
		function scrollList(obj) {
			//获得当前<li>的高度
			var scrollHeight = $("ul li:first").height();
			//滚动出一个<li>的高度
			$uList.stop().animate({
					marginTop: -scrollHeight
				}, 600,
				function() {
					//动画结束后，将当前<ul>marginTop置为初始值0状态，再将第一个<li>拼接到末尾。
					$uList.css({
						marginTop: 0
					}).find("li:first").appendTo($uList);
				});
		}
	},
	//产品搜索
	goProduct: function(productSearchId, param, preview, paramUrl) {
		$('#' + productSearchId).on('click', '.searchBtn', function() {
			// console.log($(this));
			window.open(preview + paramUrl + '?token=' + param.token + '&company_id=' + param.company_id + '&type=' + param.type +
				'&pc_version_id=' + param.pc_version_id + '&mobile_version_id=' + param.mobile_version_id);
		});
	}
};
