锘縡unction load_nav(s) { var onav=$('#nav li a'); var CurPage=s; $('#nav li a').each(function(){ var t=$(this); if(CurPage==t.attr('t')) { t.addClass('hover'); } }); } //鑾峰彇椤甸潰鍙鍖哄煙瀹藉害銆侀珮搴︼紙涓嶅寘鍚竟妗嗭級 function fnGetDocumentClient() { return {width:top.document.documentElement.clientWidth||top.document.body.clientWidth,height:top.document.documentElement.clientHeight||top.document.body.clientHeight} } //鑾峰彇椤甸潰姝f枃鍖哄煙瀹藉害銆侀珮搴 function fnGetDocumentScroll() { return {width:top.document.documentElement.scrollWidth||top.document.body.scrollWidth,height:top.document.documentElement.scrollHeight||top.document.body.scrollHeight} } (function(){ y=window._={ onload:function(b){var c=window.onload;window.onload=typeof window.onload!="function"?b:function(){c();b()}}, scroll:function(o) { o=o||document.documentElement; return {w:o.scrollWidth,h:o.scrollHeight} }, client:function(o) { o=o||document.documentElement; return {w:o.clientWidth,h:o.clientHeight} }, init:function(e,b,d){b=b||{};d=d||{};for(var c in d)e[c]=b[c]||b[c]==0?b[c]:d[c]} }; })() String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g, "") }; String.prototype.format1 = function() { for (var a = arguments.length, b = this; a; ) b = b.replace(RegExp("\\{" + --a + "\\}", "g"), arguments[a]); return b }; String.prototype.format = function() { var args = arguments; return this.replace(/\{(\d+)\}/g, function(m, i) { return args[i]; }); }; String.prototype.trimStart = function(a) { a || (a = "\\s+"); return this.replace(RegExp("^(" + a + ")+", "g"), "") }; String.prototype.trimEnd = function(a) { a || (a = "\\s+"); return this.replace(RegExp("(" + a + ")+$", "g"), "") }; var floatFrame=function(pJso) { _.init(this,pJso,{ src:"",//妗嗘灦璺緞 param:"",//鍙傛暟 width:0,//妗嗘灦瀹藉害 height:0,//妗嗘灦楂樺害 title:'鎻愮ず淇℃伅', fnClose:this.hide//鍏抽棴鏃惰Е鍙戠殑鍑芥暟 }); this.fullDiv=top.document.getElementById("cFunllDiv")||top.document.createElement("div"); this.frameDiv=top.document.getElementById("cFrameDiv")||top.document.createElement("div"); this.frame=null; this.frameName='cFrame'; this.set(); } floatFrame.prototype= { set:function(){ this.frame=top.frames[this.frameName]; if(!this.frame) { this.fullDiv.style.cssText="position:absolute;top:0px;left:0px;display:none;background-color:#000;filter:alpha(opacity=10);-moz-opacity:0.1;opacity: 0.1"; this.frameDiv.style.cssText="position:absolute;display:none;background-color:#fff;z-index:99999"; this.frameDiv.innerHTML= '
' +'
' +'
' +'
' +'
' +'' +'
' +'
' +'
'; this.fullDiv.setAttribute("id","cFunllDiv"); top.document.body.appendChild(this.fullDiv); this.frameDiv.setAttribute("id","cFrameDiv"); top.document.body.appendChild(this.frameDiv); this.frame=top.frames[this.frameName]; } }, hide:function() { this.fullDiv.style.display="none"; this.frameDiv.style.display="none"; top.document.getElementById(this.frameName).src=""; }, show:function() { top.document.getElementById('float01-title').innerHTML= '
'+ '
'+ '
'+this.title+'
'+ '
'; top.document.getElementById("cClose").onclick=function(o){return function(){o.fnClose()}}(this); var iClientWidth=fnGetDocumentClient().width; var iClientHeight=fnGetDocumentClient().height; var iScrollWidth=fnGetDocumentScroll().width; var iScrollHeight=fnGetDocumentScroll().height; var iFullDivWidth=iScrollWidth; var iFullDivHeight=iScrollHeight>iClientHeight?iScrollHeight:iClientHeight with(this.fullDiv.style) { width=iFullDivWidth+"px" height=iFullDivHeight+"px"; display=""; } var iTop=(iClientHeight-this.height)*(1-0.818); var iLeft=(iClientWidth-this.width)*0.5; iTop=iTop>0?iTop:0; iLeft=iLeft>0?iLeft:0; var f=top.document.getElementById(this.frameName); var ttt=this; top.document.onkeydown=document.onkeydown=function(e) { e=e||top.event||event; if(e.keyCode==27) ttt.hide(); } if(this.frameDiv["attachEvent"])//ie { f.onreadystatechange=function() { if(f.readyState === "complete") { ttt.frame.document.onkeydown=function() { if(ttt.frame.event.keyCode==27) ttt.hide(); } } } } else { f.onload=function() { ttt.frame.document.onkeydown=function(e) { if(e.keyCode==27) ttt.hide(); } } } //alert(f) //alert(this.src+"?"+this.param) var u=this.src+"?"+this.param; //$(f).attr('src',u); f.src=u; /*f.width=this.width+"px"; f.height=this.height+"px"; */ with(this.frameDiv.style) { display="block"; } } } var FloatFrame=function(){}; FloatFrame.autoLocal=function() { var cFrame=top.document.getElementById('cFrame'); var cFloatDiv=top.document.getElementById('cFrameDiv'); var div_cFrame=top.document.getElementById('div_cFrame'); cFrame.style.width="1px"; cFrame.style.heght="1px"; var cur=_.scroll(); with(cFrame.style) { width=cur.w+'px'; height=cur.h+'px'; } var cli=_.client(top.document.documentElement); var iTop=(cli.h-cur.h)/2+(top.document.documentElement.scrollTop||top.document.body.scrollTop); var iLeft=(cli.w-cur.w)/2; iTop=iTop>0?iTop:0; iLeft=iLeft>0?iLeft:0; with(cFloatDiv.style) { top=iTop+"px"; left=iLeft+"px"; } var cur=_.scroll(); with(cFrame.style) { width=cur.w+'px'; height=cur.h+'px'; } with(div_cFrame.style) { width=(cur.w+30)+'px'; } }; var off; $(function(){ off=new floatFrame({title:'',src:''}); }); function alertFloat(url) { off.src=url; off.show(); } function alertUserLogin() { alertFloat('user_login.asp'); } function alertUserReg() { alertFloat('user_reg.asp'); } function alertFeedBack(id) { off.src='ajax/feedback.asp'; off.param='id='+id; off.show(); } function userExit() { $.ajax({ url:'ajax/user_exit.asp', type:'get', success:function(data){load_webbar();} }); } function addCart(id) { off.src='ajax/add_cart.asp'; off.param='id='+id off.show(); } function cartOrder() { alertFloat('ajax/cartorder.asp'); } function getCartCount() { $.ajax({url:'ajax/get_cartcount.asp',type:'get',success:function(data){$('#cartCount').html(data);}}); } function load_webbar() { $.ajax( { url:'ajax/web-bar.asp',type:'get',success:function(data){ $('#web_bar').html(data); } } ); } function countdown(sec_i,lastEvent,objName) { function run() { sec_i--; if(sec_i<1){ if(lastEvent()!='noclose') { top.off.hide(); } }else{ document.getElementById(objName).innerHTML=sec_i; setTimeout(run,1000); } } setTimeout(run,1000); } function piczoom() { $(function(){ //$("img.jqzoom").jqueryzoom(); $("img.jqzoom").jqueryzoom({ xzoom: 300, //zooming div default width(default width value is 200) yzoom: 300, //zooming div default width(default height value is 200) offset: 40, //zooming div default offset(default offset value is 10) position: "right" //zooming div position(default position value is "right") }); }); } function ajax_action(jso) { var ptext='ptext'; if(jso.flushName) { ptext=jso.flushName; } var t=$(this); jso.param.r=Math.random(); $.ajax({ url:jso.url, type:jso.type, data:jso.param, success:function(data){ $('#'+ptext).html(data); }, error:function(data){ alert('error:'+data.responseText); } }); } function loadevent(jso) { if(typeof(jso.click)=="undefined") click='click'; else click=jso.click; $('a[t='+jso.param.actionAjax+'],input[t='+jso.param.actionAjax+']')[click](function(){ var t=$(this); if(typeof(jso.event)!='undefined') { if(!jso.event(jso,t))//鎵ц楠岃瘉 { return; } } var url=jso.url; jso.param.id=t.attr('tid'); ajax_action({url:url,type:jso.type,param:jso.param,flushName:jso.flushName}); }); } function loadclick_cartdel(jso) { loadevent({url:jso.url,type:'post',param:{actionAjax:'del'},event:function(){return confirm('纭畾鍒犻櫎锛焅n鍒犻櫎鍚庝笉鍙仮澶嶃€?)}}); } function loadchange_cartnum(jso) { loadevent({url:jso.url,click:'change',type:'post',param:{actionAjax:'num'},event:function(j,o){ var v=o.val().trim(); if(v.length==0 || isNaN(v)) { alert('鎺掑簭鍊煎繀椤绘槸鏁板瓧鎴栧皬鏁?); return false; } j.param['num']=v; return true; }}); } //---------------------------------------- (function(){ y=window._={ get:function(b,c){c=c||document;if(typeof b==="string")b=c.getElementById(b);return b}, init:function(e,b,d){b=b||{};d=d||{};for(var c in d)e[c]=b[c]||b[c]==0?b[c]:d[c]}, scroll:function(o) { o=o||document.documentElement; return {w:o.scrollWidth,h:o.scrollHeight} }, client:function(o) { o=o||document.documentElement; return {w:o.clientWidth,h:o.clientHeight} } }; })(); /*鍥剧墖鍨傜洿灞呬腑锛岀瓑姣斾緥缂╂斁*/ //p1 jQuery.fn.loadthumb = function(options) { options = $.extend({ _img:'', maxW:100, maxH:100, model:3 },options); var src=options._img.attr('src'); var par=options._img.parent(); var _self = this; _self.hide(); var img = new Image(); $(img).load(function(){ imgDem = {}; imgDem.w = img.width; imgDem.h = img.height; imgDem = $.imgResize({"w": options.maxW ,"h": options.maxH},{"w":imgDem.w,"h":imgDem.h}); var imgMargins = $.imgCenter({"w": par.width() ,"h": par.height()},{"w":imgDem.w,"h":imgDem.h}); //options._img.css({width:imgDem.w,height:imgDem.h,marginLeft:imgMargins.l,marginTop:imgMargins.t}); if(options.model==1 || options.model==3) options._img.css({width:imgDem.w,height:imgDem.h}); if(options.model==2 || options.model==3) options._img.css({marginTop:imgMargins.t});//marginLeft:imgMargins.l, _self.attr("src", src); _self.fadeIn("slow"); }).attr("src", src); //.atte("src",options.src)瑕佹斁鍦╨oad鍚庨潰锛 return _self; } //閲嶇疆鍥剧墖瀹藉害锛岄珮搴︽彃浠 ( parentDem鏄埗鍏冪礌锛宨mgDem鏄浘鐗 ) //p1 jQuery.imgResize = function(parentDem,imgDem){ if(imgDem.w>0 && imgDem.h>0){ var rate = (parentDem.w/imgDem.w < parentDem.h/imgDem.h)?parentDem.w/imgDem.w:parentDem.h/imgDem.h; //濡傛灉 鎸囧畾楂樺害/鍥剧墖楂樺害 灏忎簬 鎸囧畾瀹藉害/鍥剧墖瀹藉害 锛 閭d箞锛屾垜浠殑姣斾緥鏁 鍙 鎸囧畾楂樺害/鍥剧墖楂樺害銆 //濡傛灉 鎸囧畾楂樺害/鍥剧墖楂樺害 澶т簬 鎸囧畾瀹藉害/鍥剧墖瀹藉害 锛 閭d箞锛屾垜浠殑姣斾緥鏁 鍙 鎸囧畾瀹藉害/鍥剧墖瀹藉害銆 if(rate <= 1){ imgDem.w = imgDem.w*rate; //鍥剧墖鏂扮殑瀹藉害 = 瀹藉害 * 姣斾緥鏁 imgDem.h = imgDem.h*rate; }else{// 濡傛灉姣斾緥鏁板ぇ浜?锛屽垯鏂扮殑瀹藉害绛変簬浠ュ墠鐨勫搴︺€ imgDem.w = imgDem.w; imgDem.h = imgDem.h; } } return imgDem; } //p2 jQuery.fn.loadthumbl = function(options) { options = $.extend({ _img:'', maxW:100, maxH:100, model:3 },options); var src=options._img.attr('src'); var par=options._img.parent(); var _self = this; _self.hide(); var img = new Image(); $(img).load(function(){ imgDem = {}; imgDem.w = img.width; imgDem.h = img.height; imgDem = $.imgResizel({"w": options.maxW ,"h": options.maxH},{"w":imgDem.w,"h":imgDem.h}); var imgMargins = $.imgCenter({"w": par.width() ,"h": par.height()},{"w":imgDem.w,"h":imgDem.h}); //options._img.css({width:imgDem.w,height:imgDem.h,marginLeft:imgMargins.l,marginTop:imgMargins.t}); if(options.model==1 || options.model==3) options._img.css({width:imgDem.w,height:imgDem.h}); if(options.model==2 || options.model==3) options._img.css({marginLeft:imgMargins.l,marginTop:imgMargins.t}); _self.attr("src", src); _self.fadeIn("slow"); }).attr("src", src); //.atte("src",options.src)瑕佹斁鍦╨oad鍚庨潰锛 return _self; } //p2 jQuery.imgResizel = function(parentDem,imgDem){ if(imgDem.w>0 && imgDem.h>0){ var ratw = parentDem.w/imgDem.w; var rath = parentDem.h/imgDem.h; var ratp = parentDem.w/parentDem.h; var ratm = imgDem.w/imgDem.h; if(ratp <= ratm){ imgDem.h = parentDem.h; imgDem.w = imgDem.w*rath; }else{ imgDem.w = parentDem.w; imgDem.h = imgDem.h*ratw; } } return imgDem; } //浣垮浘鐗囧湪鐖跺厓绱犲唴姘村钩锛屽瀭鐩村眳涓紝( parentDem鏄埗鍏冪礌锛宨mgDem鏄浘鐗 ) jQuery.imgCenter = function(parentDem,imgDem){ var left = (parentDem.w - imgDem.w)*0.5; var top = (parentDem.h - imgDem.h)*0.5; return { "l": left , "t": top}; } /*鍥剧墖妯悜婊氬姩 鍙偣鍑诲乏鍙虫粴鍔紝濡傜簿鍝佹帹鑽?/ jQuery.fn.imageScroller = function(params){ var p = params || { next:"buttonNext", prev:"buttonPrev", frame:"viewerFrame", width:100, pm:10, child:"a", auto:true }; var _btnNext = $("#"+ p.next); var _btnPrev = $("#"+ p.prev); var _imgFrame = $("#"+ p.frame); var _width = p.width; var _child = p.child; var _auto = p.auto; var _itv; _width=_imgFrame.find(_child+":first").width()+p.pm; var turnLeft = function(){ _btnPrev.unbind("click",turnLeft); if(_auto) autoStop(); _imgFrame.animate( {marginLeft:-_width}, 'slow', '', function(){ _imgFrame.find(_child+":first").appendTo( _imgFrame ); _imgFrame.css("marginLeft",0); _btnPrev.bind("click",turnLeft); if(_auto) autoPlay(); }); }; var turnRight = function(){ _btnNext.unbind("click",turnRight); if(_auto) autoStop(); _imgFrame.find(_child+":last").clone().show().prependTo( _imgFrame ); _imgFrame.css("marginLeft",-_width); _imgFrame.animate( {marginLeft:0}, 'slow' ,'', function(){ _imgFrame.find(_child+":last").remove(); _btnNext.bind("click",turnRight); if(_auto) autoPlay(); }); }; _btnNext.css("cursor","pointer").click( turnRight ); _btnPrev.css("cursor","pointer").click( turnLeft ); var autoPlay = function(){ _itv = window.setInterval(turnLeft, 5000); }; var autoStop = function(){ window.clearInterval(_itv); }; if(_auto) autoPlay(); }; /*鍥剧墖绾靛悜婊氬姩 鍙偣鍑讳笂涓嬫粴鍔?/ jQuery.fn.imageScrollerl = function(params){ var p = params || { next:"buttonNext", prev:"buttonPrev", frame:"viewerFramel", height:100, pm:10, child:"a", auto:true }; var _btnNext = $("#"+ p.next); var _btnPrev = $("#"+ p.prev); var _imgFrame = $("#"+ p.frame); var _height = p.height; var _child = p.child; var _auto = p.auto; var _itv; _height=_imgFrame.find(_child+":first").height()+p.pm; var turnTop = function(){ _btnPrev.unbind("click",turnTop); if(_auto) autoStop(); _imgFrame.animate( {marginTop:-_height}, 'slow', '', function(){ _imgFrame.find(_child+":first").appendTo( _imgFrame ); _imgFrame.css("marginTop",0); _btnPrev.bind("click",turnTop); if(_auto) autoPlay(); }); }; var turnDown = function(){ _btnNext.unbind("click",turnDown); if(_auto) autoStop(); _imgFrame.find(_child+":last").clone().show().prependTo( _imgFrame ); _imgFrame.css("marginTop",-_height); _imgFrame.animate( {marginTop:0}, 'slow' ,'', function(){ _imgFrame.find(_child+":last").remove(); _btnNext.bind("click",turnDown); if(_auto) autoPlay(); }); }; _btnNext.css("cursor","pointer").click( turnDown ); _btnPrev.css("cursor","pointer").click( turnTop ); var autoPlay = function(){ _itv = window.setInterval(turnTop, 5000); }; var autoStop = function(){ window.clearInterval(_itv); }; if(_auto) autoPlay(); }; /*鍨傜洿婊氬姩锛屽锛氬揩閫熷鑸粴鍔?/ (function($) { $.fn.extend({ Scroll: function(opt, callback) { var sc = new RunScroll({ name: this.attr('id'), line: opt.line, column: opt.column, speed: opt.speed, timer: opt.timer, action:opt.action }); sc.Run(); } }) })(jQuery); var __ScrollTimeID={}; function RunScroll(pJso) { _.init(this,pJso,{ line:1, column:1, speed:800, timer:5000, name:'', action:'Top' }); if(!this.name) { //alert('Unspecified tagID [name].') } this.jq=$('#'+this.name); } RunScroll.prototype = { Run: function() { var _this = this.jq.eq(0); //.find("ul:first"); var lineH; var line; if (this.action == 'Top' || this.action == 'Bottom') { lineH = _this.find("li:first").height(); //鑾峰彇琛岄珮 line = this.line ? parseInt(this.line, 10) : parseInt(this.jq.height() / lineH, 10); } else { lineH = _this.find("li:first").width(); //鑾峰彇琛岄珮 line = this.line ? parseInt(this.line, 10) : parseInt(this.jq.width() / lineH, 10); } var speed = this.speed ? parseInt(this.speed, 10) : 500; //鍗峰姩閫熷害锛屾暟鍊艰秺澶э紝閫熷害瓒婃參锛堟绉掞級 var timer = this.timer ? parseInt(this.timer, 10) : 3000; //婊氬姩鐨勬椂闂撮棿闅旓紙姣锛 var lineColumn = this.column ? parseInt(this.column, 10) : 1; //姣忚鏄剧ず鍑犲垪 if (line == 0) line = 1; var upHeight = -line * lineH / lineColumn; var animateAction; var animateAction1; switch (this.action) { case 'Top': animateAction = { marginTop: upHeight }; animateAction1 = { marginTop: 0 }; break; case 'Bottom': animateAction = { marginBottom: upHeight }; animateAction1 = { marginBottom: 0 }; break; case 'Left': animateAction = { marginLeft: upHeight }; animateAction1 = { marginLeft: 0 }; break; case 'Right': animateAction = { marginRight: upHeight }; animateAction1 = { marginRight: 0 }; break; } var scrollUp = function() { _this.animate(animateAction, speed, function() { for (i = 1; i <= line; i++) { _this.find("li:first").appendTo(_this); } _this.css(animateAction1); }); } //榧犳爣浜嬩欢缁戝畾 _this.hover(function() { clearInterval(this.timeID); }, function() { this.timeID = setInterval(scrollUp, timer); }).mouseout(); } } /*end 鍨傜洿婊氬姩锛屽锛氬揩閫熷鑸粴鍔?/ $(function(){ load_webbar(); //绮惧搧鎺ㄨ崘 $("#viewer").imageScroller({ next:"next", prev:"prev", frame:"viewerFrame", pm:parseInt($('#viewerFrame').attr('pm')), //闂磋窛 child:"li", auto:true//鏄惁鑷姩鎾斁 }); //鍨傜洿灞呬腑,绛夋瘮缂╂斁 $(function(){ $('img[t=p1]').each(function(){ var t=$(this); t.loadthumb({ '_img':t, 'maxW':t.width(), 'maxH':t.height(), model:3//1:绛夋瘮缂╂斁 2:鍨傜洿灞呬腑 3:鎵€鏈夊姛鑳 }); }); }) $(function(){ $('img[t=p2]').each(function(){ var t=$(this); t.loadthumbl({ '_img':t, 'maxW':t.width(), 'maxH':t.height(), model:3//1:绛夋瘮缂╂斁 2:鍨傜洿灞呬腑 3:鎵€鏈夊姛鑳 }); }); }) //蹇€熷鑸 $("ul[f=scroll1]").Scroll({ line: 1, column: 1, speed: 800, timer: 3000 }); $("ul[f=scroll2]").Scroll({ line: 5, column: 5, speed: 800, timer: 3000 }); }) /*banner鍥剧墖鍒囨崲*/ var timer = null; var offset = 2500; var index = -1; //澶у浘浜ゆ浛杞崲 function slideImage(i){ var id = 'image_'+ target[i]; $('#'+ id) .animate({opacity: 1}, 800, function(){ $(this).find('.word').animate({height: 'show'}, 'slow'); }).show() .siblings(':visible') .find('.word').animate({height: 'hide'},'fast',function(){ $(this).parent().animate({opacity: 0}, 800).hide(); }); } //bind thumb a function hookThumb(){ $('#thumbs li a') .bind('click', function(){ if (timer) { clearTimeout(timer); } var id = this.id; index = getIndex(id.substr(6)); rechange(index); slideImage(index); timer = window.setTimeout(auto, offset); this.blur(); return false; }); } //bind next/prev img function hookBtn(){ $('#thumbs li img').filter('#play_prev,#play_next') .bind('click', function(){ if (timer){ clearTimeout(timer); } var id = this.id; if (id == 'play_prev') { index--; if (index < 0) index = 3; }else{ index++; if (index > 3) index = 0; } rechange(index); slideImage(index); timer = window.setTimeout(auto, offset); }); } //get index function getIndex(v){ for(var i=0; i < target.length; i++){ if (target[i] == v) return i; } } function rechange(loop){ var id = 'thumb_'+ target[loop]; $('#thumbs li a.current').removeClass('current'); $('#'+ id).addClass('current'); } function auto(){ index++; if (index > 3){ index = 0; } rechange(index); slideImage(index); timer = window.setTimeout(auto, offset); } $(function(){ try{ //change opacity $('div.word').css({opacity: 0.85}); auto(); hookThumb(); hookBtn(); }catch(e){} }); /*end banner鍥剧墖鍒囨崲*/ $(function(){ $(".products .productstit").click(function(){ $(this).addClass("proclick").siblings().removeClass("proclick"); $(".product .productsnr").css({"display":"none"}); $(".product .productsnr").eq($(this).index()).css({"display":"block"}); if($(this).index()==0){ $(".products .productsmore a").attr("href","products-list.asp?h=1"); } else{ $(".products .productsmore a").attr("href","products-list.asp?t=1"); } }) }) $(function(){ $(".nav .cut ul li a,.topbox a,.search a,.jianjiebox .textbox a,.hezuobox .titl a,.zixunbox .titl a,.lianxibox .titl a,.ft_nav a").addClass("atm5"); $(".zixunbox .newsbox .cont ul li .text a img").remove(); })