var t = n = count = j = 0; $(function() { $(".banner").css("width",window.screen.width); $("#banner1").html("").addclass("banner1bak"); $("#bannerul").show(); $(".banner").hide().eq(0).show(); count = $("#bannerul li").size(); $("#bannerul li:first-child").css({ "background": "#00529a" }).siblings().css({ "background": "#c9cacc" }); $("#bannerul li").mouseover(function() { var i = $("#bannerul li").index(this); n = i; if (i >= count) return; var bannerli = $(this); tmout = settimeout(function(){$(".banner").fadeout("slow");$(".banner").eq(i).fadein("slow");bannerli.css({ "background": "#00529a" }).siblings().css({ "background": "#c9cacc" });},200); }); $("#bannerul li").mouseout(function(){cleartimeout(tmout);}); $("#bannerul li").click(function() { var i = $("#bannerul li").index(this); n = i; if (i >= count) return; $(".banner").fadeout("slow"); $(".banner").eq(i).fadein("slow"); $(this).css({ "background": "#00529a" }).siblings().css({ "background": "#c9cacc" }); }); $(".banner").click(function() { window.open($("#bannerimg a").eq(n).attr("href"), "_blank"); }); t = setinterval("showauto()", 4000); $("#banner").hover(function() { clearinterval(t) }, function() { t = setinterval("showauto()", 4000); }); $("#bannerul ul li").hover(function() { clearinterval(t) }, function() { t = setinterval("showauto()", 4000); }); $(".nav>ul>li>a").mouseover(function(){ clearinterval(t); }); $(".nav>ul>li>a").mouseout(function(){t = setinterval("showauto()", 4000); }); $(".nav .subnav").mouseover(function(){ clearinterval(t); }); $(".nav .subnav").mouseout(function(){t = setinterval("showauto()", 4000); }); $(".viewcontent").hover(function(){ timeout = settimeout("showviewcontent()",90); },function(){ cleartimeout(timeout); $(".viewopen").fadeout("fast");}); }); function showauto() { n = n >= (count - 1) ? 0 : n + 1; $("#bannerul li").eq(n).trigger('click'); } function showviewcontent(){ if ($.browser.msie && ($.browser.version == 6.0)) { $(".viewopen").css("top","-10px"); } if ($.browser.msie && ($.browser.version == 7.0)) { $(".viewopen").css("top","-10px"); } if ($.browser.msie && ($.browser.version == 8.0)) { $(".viewopen").css("top","-10px"); } $(".viewopen").fadein("fast"); } function getposition(obj) { var r = new array(); r['x'] = obj.offsetleft; r['y'] = obj.offsettop; while (obj = obj.offsetparent) { r['x'] += obj.offsetleft; r['y'] += obj.offsettop; } return r; }