///
///
///* author: 冯某
jquery(document).ready(function () {
$(".tab_box").map(function () {
var t = $(this); if (t.length < 1) return;
tab(t.find(".list a"), t.find(".body"));
});
banner();
fxsubmenu();
columnitem();
scrollbar();
selectoption();
tabpic();
});
//切换图片
var tabpic = function () {
var list = $(".submenu ul li");
if (list.length < 0) return;
list.each(function () {
var t = $(this);
var a = t.find("dl dd");
var pic = t.find(".pic img");
var datasrc = pic.attr("src");
a.map(function () {
var src = $(this).find("a").attr("data-src");
$(this).bind({
mouseenter: function () { pic.attr("src", src); },
mouseleave: function () { pic.attr("src", datasrc); }
});
});
});
}
//fxyong 业界荣誉
var fxbox = function () {
$(".fxboxt").each(function () {
var t = $(this);
var arr = t.find(".arr");
var step = t.find(".list").width();
var ul = t.find(".list ul");
var li = ul.children("li");
var ulwidth = li.length * li.width();
ul.css({ width: ulwidth + 75 });
var eobj = 0;
var move = 0;
initialize();
function initialize() {
li.each(function (index) {
var o = $(this);
if (o.hasclass("current")) { eobj = index; fxsize(index); }
$(this).mouseenter(function () { fxsize(index, eobj); });
});
}
function fxsize(index, eo) {
li.eq(index).stop(true).animate({ width: 250, margintop: -33 }, 'fast');
li.eq(index).find("img").stop(true).animate({ width: 183, height: 250 }, 'fast');
li.eq(eo).stop(true).animate({ width: 175, margintop: 0 }, 'fast');
li.eq(eo).find("img").stop(true).animate({ width: 135, height: 185 }, 'fast');
eobj = index;
}
//左右点击
arr.click(function () {
if (ulwidth < step) return;
var a = $(this);
var sp = step;
if (a.hasclass("arr_right")) sp *= -1;
move = move + sp;
if (move > 0) move = 0;
if (move < step - ulwidth) move = step - ulwidth;
ul.stop(true).animate({ marginleft: move }, "slow");
});
});
}
//fxyong 业界荣誉
var fxyong = function (obj) {
obj.each(function () {
var t = $(this);
var arr = t.find(".arr");
var step = t.find(".list").width();
var ul = t.find(".list ul");
var li = ul.children("li");
var ulwidth = li.length * li.width();
ul.css({ width: ulwidth });
var move = 0;
//左右点击
arr.click(function () {
if (ulwidth < step) return;
var a = $(this);
var sp = step;
if (a.hasclass("arr_right")) sp *= -1;
move = move + sp;
if (move > 0) move = 0;
if (move < step - ulwidth) move = step - ulwidth;
ul.stop(true).animate({ marginleft: move }, "slow");
});
});
}
//fxtdbox
var fxtdbox = function () {
var obj = $(".fxtdbox"); if (obj.length < 1) return;
obj.each(function () {
var t = $(this);
var list = t.find("ul li");
var speed = 500;
initialize();
function initialize() {
list.map(function (index) {
var li = $(this);
if (li.hasclass("current")) fxfun(index);
li.click(function () {
fxfun(index);
});
});
}
function fxfun(index) {
//list.eq(index).css({ zindex: 3, left: 40, height: 300, width: 230 });
list.eq(index).stop(true).animate({ left: 150, top: 0, height: 300 }, speed).css({ zindex: 3 });
list.eq(index).find(".pic img").stop(true).animate({ height: 300, width: 230 }, speed, function () { list.eq(index).find(".des").show(); });
//list.eq(index - 1 < 0 ? 2 : index - 1).css({ zindex: 1, left: 0, height: 240, width: 184 });
var l1 = list.eq(index - 1 < 0 ? 2 : index - 1);
l1.stop(true).animate({ left: 0, height: 240, top: 30 }, speed).css({ zindex: 1 });
l1.find(".pic img").stop(true).animate({ height: 240, width: 184 }, speed);
l1.find(".des").hide();
//list.eq(index + 1 > 2 ? 0 : index + 1).css({ zindex: 1, left: 300, height: 240, width: 184 });
var l2 = list.eq(index + 1 > 2 ? 0 : index + 1);
l2.stop(true).animate({ left: 280, height: 240, top: 30 }, speed).css({ zindex: 1 });
l2.find(".pic img").stop(true).animate({ height: 240, width: 184 }, speed);
l2.find(".des").hide();
}
});
}
//产品中心=>视频切换
var gallery = function (obj) {
obj.each(function () {
var t = $(this); if (t.length != 1) return;
var show = t.find(".show");
var showa = show.children("a");
var showimg = show.find("img");
var indexobj = t.find(".indexobj");
var listbox = indexobj.children(".list");
var list = listbox.find("ul li");
var ul = listbox.children("ul");
var title = t.children(".title");
var liwidth = list.width();
var ulwidth = list.length * liwidth;
var step = listbox.width();
var move = 0;
//初始化
initialize();
function initialize() {
ul.css({ width: ulwidth });
if (ulwidth < step) ul.css({ marginleft: (step - ulwidth) / 2 });
}
//左右点击
indexobj.children(".arr").click(function () {
if (ulwidth < step) return;
var a = $(this);
var sp = step;
if (a.hasclass("arr_right")) sp *= -1;
move = move + sp;
if (move > 0) move = 0;
if (move < step - ulwidth) move = step - ulwidth;
ul.stop(true).animate({ marginleft: move }, "slow");
});
//点击图片切换
list.each(function (index) {
var li = $(this);
li.click(function () {
var oi = $(this);
if (oi.hasclass("current")) return;
list.removeclass("current");
oi.addclass("current");
var link = oi.attr("data-link");
var src = oi.attr("data-src");
var newimg = new image();
$(newimg).load(function () {
showimg.stop(true).hide().attr("src", src).fadein();
showa.attr("href", link);
//fxindexobj(oi, index);
if (title.length > 0) {
var txt = oi.find(".name").text();
title.children("span").text(txt);
}
});
newimg.src = src;
});
});
function fxindexobj(oi, index) {
move = (index - 2) * liwidth * -1;
if (move > 0) move = 0;
if (move < step - ulwidth) move = step - ulwidth;
ul.stop(true).animate({ marginleft: move }, "slow");
list.removeclass("current");
oi.addclass("current");
}
});
}
//滚动
var fxgrid = function (obj, listlenght, speed) {
obj.each(function () {
var t = $(this); if (t.length < 0) return;
var box = t.children(".show");
var ul = t.find(".show ul");
var li = ul.children("li");
var list = t.find(".tab .list");
var arr = t.find(".arr");
var len = li.length;
var liwidth = li.width();
var boxwidth = liwidth * listlenght;
var indexobj = null;
var indexlist = null;
var index = 0;
var ismove = true;
var speeds = speed = undefined ? 1500 : speed;
var mod = len % listlenght; //listlenght:显示的个数
var mathceil = math.ceil(len / listlenght);
initialize();
function initialize() {
ul.css({ width: len * liwidth });
if (list.length > 0) {
for (var i = 0; i < mathceil; i++) {
$("").attr("href", "javascript:").appendto(list);
}
}
}
indexlist = list.children("a");
indexlist.each(function (index) {
var io = $(this);
io.mouseover(function () { fxmove(index); });
});
if (arr.length > 0) {
arr.click(function () {
if ($(this).hasclass("arr_left")) {
index + 1 > mathceil - 1 ? fxmove(mathceil - 1) : fxmove(index + 1);
} else {
index - 1 < 0 ? fxmove(0) : fxmove(index - 1);
}
});
}
function fxmove(step) {
index = step;
indexlist.removeclass("current"); indexlist.eq(index).addclass("current");
if (mod > 0 && index == mathceil - 1) {
ul.stop(true).animate({ marginleft: -1 * (len * liwidth) + boxwidth }, speeds);
} else {
ul.stop(true).animate({ marginleft: boxwidth * index * -1 }, speeds);
}
}
});
}
//仿下拉选择表单(select)
var selectoption = function () {
var selectbox = jquery(".selectbox");
if (selectbox.length < 1) return;
selectbox.each(function () {
var t = $(this);
var select = t.children(".select");
var option = t.children(".select_option");
option.fadeout("slow"); //初始为收起来的状态
select.click(function () { option.stop(true).fadein('fast'); });
option.find("li").click(function () {
var li = $(this);
select.attr("value", li.text());
select.attr('option', li.attr('value'));
option.fadeout('fast');
var txt = t.prev("span.txt");
if (txt.length > 0) { txt.text(li.text()); }
});
t.focusout(function () { option.stop(true).fadeout('fast'); });
});
}
//滚动条
var scrollbar = function () {
$(".scrollbar").each(function () {
var t = $(this); if (t.length < 1) return;
t.jscrollpane({ showarrows: true, scrollbarwidth: 3, arrowsize: 5 });
fxover();
});
function fxover() {
var i = 0;
var j = $(".jscrollpanecontainer");
if (j.length == 0) {
if (i > 100) return;
fxover(); i++;
} else {
var bar = j.find(".jscrollpanetrack");
j.bind({
mouseenter: function () { bar.animate({ opacity: 1 }, 'fast'); },
mouseleave: function () { bar.animate({ opacity: 0.3 }, 'fast'); }
});
}
}
}
//columnitem
var columnitem = function () {
$(".columnitem .cbox a").each(function (index) {
if ($(this).length < 1) return;
if ($(this).hasclass("current")) {
var left = $(this).offset().left + $(this).width() / 2 - 5;
$(".columnitem span.dot").css({ left: left });
} else {
return;
}
});
}
//fxquestionlis
var fxquestionlist = function () {
var list = $(".fxquestionlist ul li");
list.each(function () {
var t = $(this); if (t.length < 1) return;
var at = t.find("dl dt a");
var dd = t.find("dl dd");
//初始化
var dheight = dd.height();
at.click(function () {
if (t.hasclass("current")) {
dd.stop(true).slideup('fast', function () { t.removeclass('current'); });
} else {
var e = list.closest("li.current");
e.find("dl dd").stop(true).slideup("fast", function () { e.removeclass("current"); });
dd.stop(true).slidedown('fast', function () { t.addclass("current"); });
}
});
if (!t.hasclass("current")) dd.slideup();
});
list.last().addclass("noborder");
}
//首页二级菜单
var fxsubmenu = function () {
$(".menu ul li.hover").each(function (index) {
var t = $(this); if (t.length < 1) return;
var sub = $(".submenu").eq(index);
var dot = sub.children(".dot");
//初始化
dot.css({ left: t.offset().left, width: t.width() + 52 });
var timer;
t.bind({
mouseenter: function () { cleartimeout(timer); t.addclass("current"); sub.show(); },
mouseleave: function () { timer = settimeout(function () { t.removeclass("current"); sub.hide(); }, 200); }
});
sub.bind({
mouseenter: function () { cleartimeout(timer); t.addclass("current"); sub.show(); },
mouseleave: function () { timer = settimeout(function () { t.removeclass("current"); sub.hide(); }, 200); }
});
});
}
//首页格子移动动画
function indexfxgrid() {
$(".indexblock2 .mbox").each(function () {
var t = $(this); if (t.length < 1) return;
tab(t.find(".tab ul li"), t.children(".body"));
//活动
t.find(".huodong .show").mpfxgrid({
number: 2,
list: function () { return t.find(".huodong .show ul li"); },
left: t.find(".huodong .arrdiv .arr_left"),
right: t.find(".huodong .arrdiv .arr_right"),
timer: 5000,
speed: 500
});
//新闻
t.find(".newsdiv .fxbox").mpfxgrid({
number: 1,
list: function () { return t.find(".newsdiv .fxbox ul li"); },
left: t.find(".newsdiv .fxbox .arr_left"),
right: t.find(".newsdiv .fxbox .arr_right"),
timer: 5000,
speed: 500
});
//视频
t.find(".videodiv .videolist .show").mpfxgrid({
number: 1,
list: function () { return t.find(".videodiv .videolist .show ul li"); },
left: t.find(".videodiv .videolist .arr_left"),
right: t.find(".videodiv .videolist .arr_right"),
timer: 5000,
speed: 500
});
//新浪微博
t.find(".weibodiv .weibolist .show").mpfxgrid({
number: 1,
list: function () { return t.find(".weibodiv .weibolist .show ul li"); },
left: t.find(".weibodiv .weibolist .arrdiv .arr_left"),
right: t.find(".weibodiv .weibolist .arrdiv .arr_right"),
timer: 5000,
speed: 500
});
t.find(".weibodiv .weibolist .show ul li").each(function (index) {
var li = $(this); if (li.length < 1) return;
li.find("dl dd").eq(0).addclass("border");
li.find("dl dd").eq(1).addclass("border");
});
});
}
//banner
var banner = function () {
$(".banner").each(function () {
var t = $(this); if (t.length < 1) return;
var indexlist = t.find(".indexobj .list span");
var list = t.find("ul li");
if (list.length <= 1) return;
var arr = t.find(".indexobj .icondot");
var ul = t.find("ul");
var eo = 0;
var index = 0;
indexlist.eq(0).addclass("first");
var liheight = list.height();
var timer = setinterval(function () { var index = $(indexlist.closest('.current')).index(); fxfun(index + 1); }, 8000);
list.hide();
t.hover(
function () { clearinterval(timer); },
function () { timer = setinterval(function () { fxfun($(indexlist.closest('.current')).index() + 1); }, 8000); }
);
indexlist.each(function (index) {
var dd = $(this);
if (dd.hasclass('current')) { fxfun(index); }
dd.mouseenter(function () { fxfun(index); });
});
arr.click(function () {
$(this).hasclass("arr_left") ? index-- : index++;
index < 0 ? index = list.length - 1 : null;
index >= list.length ? index = 0 : null;
fxfun(index);
});
function fxfun(index) {
if (index == list.length) index = 0;
var e = list.closest(".show");
indexlist.removeclass("current"); indexlist.eq(index).addclass("current");
e.removeclass("show");
e.stop(true).fadeout("slow");
list.eq(index).addclass("show");
list.eq(index).stop(true).fadein("slow");
//var move = (liheight * index) * -1;
//ul.stop(true).animate({ margintop: move }, 'slow');
}
fxfun(0);
});
}
var fxren = function () {
$(".blockbox2").each(function () {
var t = $(this);
var whitediv = t.children(".whitediv");
var movedot = whitediv.children("span");
var zhaopin = t.children(".zhaopin");
var list = zhaopin.find("ul li");
var width = 0, height = 0;
var index = 0;
initialize();
$(window).resize(function () { initialize(); fxdotfun(index); });
function initialize() {
width = zhaopin.offset().left + 197;
height = zhaopin.height() + 30;
//whitediv.stop(true).animate({ width: width, height: height }, 'slow');
whitediv.css({ width: width, height: height });
}
//dot动画
list.each(function (id) {
if ($(this).hasclass("current")) { index = id; fxdotfun(index); }
$(this).mouseenter(function () { fxdotfun(id); });
});
function fxdotfun(index) {
var top = 0;
for (var i = 0; i < index; i++) { top += list.eq(i).height(); }
//movedot.stop(true).animate({ top: top + 70 });
movedot.css({ top: top + 70 });
}
//
});
}
//菜单
function navfun(liselected) {
var lis = $("#nav>ul>li.menu2:not(.clear)");
selectfun(lis, liselected);
lis.each(function (i) {
var n = i + 1;
$(this).hover(function () {
$(this).addclass('current');
},
function () {
if (n != liselected) {
$(this).removeclass('current');
}
})
});
}
function selectfun(obj, selectedindex) {
obj.eq(selectedindex - 1).addclass('current')
}
function dozoom(obj_target, size) {
document.getelementbyid(obj_target).style.fontsize = size + "px";
}
var scurrimage = "";
//var scurrtext = "";
function showitem(sbig, w, h, text) {
//if (document.getelementbyid("imgshow")) {
// scurrimage = switchplay(sbig, w, h);
// //scurrtext = text;
// settimeout(showx, 10);
//}
if (ac_fl_runcontent == 0) {
alert("this page requires ac_runactivecontent.js.");
} else {
ac_fl_runcontent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
'width',w,
'height', h,
'src', '/jcplayer',
'quality', 'high',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'noscale',
'wmode', 'window',
'devicefont', 'false',
'id', 'jcplayer',
'bgcolor', '#ffffff',
'name', 'jcplayer',
'menu', 'true',
'allowfullscreen', 'true',
'allowscriptaccess', 'samedomain',
'flashvars', 'videourl=/upload/'+sbig+'&autoplay=true&startphotosource=&backgroundcolor1=0x333333&backgroundcolor2=0x222222',
'movie', '/jcplayer',
'salign', 'tl'
);
}
}
function showx() {
document.getelementbyid("imgshow").innerhtml = scurrimage;
//document.getelementbyid("imgtext").innerhtml = scurrtext;
}
function switchplay(url, p_width, p_height) {
var videowidth = p_width;
var videoheight = p_height;
var returnvalue = "";
if (url.indexof(".") != -1) {
var swf_width = p_width;
var swf_height = p_height;
var extypearr = url.split(".");
var extype = extypearr[extypearr.length - 1].tolowercase();
var sfwstring = ".swf";
var flvstring = ".flv";
var mpstring = ".mp3,.mp4,.wmv,.avi,.mpeg,.wma";
var rmstring = ".rm3,.rmvb";
var picstring = ".jpg,.gif,.bmp,.png";
if (sfwstring.indexof(extype) != -1) {
swf_width = videowidth;
swf_height = videoheight;
returnvalue = "