a",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="
");n.customDirectionNav?n.directionNav=n.customDirectionNav:n.controlsContainer?($(n.controlsContainer).append(e),n.directionNav=$("."+i+"direction-nav li a",n.controlsContainer)):(n.append(e),n.directionNav=$("."+i+"direction-nav li a",n)),f.directionNav.update(),n.directionNav.bind(o,function(e){e.preventDefault();var t;""!==l&&l!==e.type||(t=$(this).hasClass(i+"next")?n.getTarget("next"):n.getTarget("prev"),n.flexAnimate(t,n.vars.pauseOnAction)),""===l&&(l=e.type),f.setToClearWatchedEvent()})},update:function(){var e=i+"disabled";1===n.pagingCount?n.directionNav.addClass(e).attr("tabindex","-1"):n.vars.animationLoop?n.directionNav.removeClass(e).removeAttr("tabindex"):0===n.animatingTo?n.directionNav.removeClass(e).filter("."+i+"prev").addClass(e).attr("tabindex","-1"):n.animatingTo===n.last?n.directionNav.removeClass(e).filter("."+i+"next").addClass(e).attr("tabindex","-1"):n.directionNav.removeClass(e).removeAttr("tabindex")}},pausePlay:{setup:function(){var e=$('
');n.controlsContainer?(n.controlsContainer.append(e),n.pausePlay=$("."+i+"pauseplay a",n.controlsContainer)):(n.append(e),n.pausePlay=$("."+i+"pauseplay a",n)),f.pausePlay.update(n.vars.slideshow?i+"pause":i+"play"),n.pausePlay.bind(o,function(e){e.preventDefault(),""!==l&&l!==e.type||($(this).hasClass(i+"pause")?(n.manualPause=!0,n.manualPlay=!1,n.pause()):(n.manualPause=!1,n.manualPlay=!0,n.play())),""===l&&(l=e.type),f.setToClearWatchedEvent()})},update:function(e){"play"===e?n.pausePlay.removeClass(i+"pause").addClass(i+"play").html(n.vars.playText):n.pausePlay.removeClass(i+"play").addClass(i+"pause").html(n.vars.pauseText)}},touch:function(){function e(e){e.stopPropagation(),n.animating?e.preventDefault():(n.pause(),t._gesture.addPointer(e.pointerId),T=0,c=d?n.h:n.w,f=Number(new Date),l=v&&u&&n.animatingTo===n.last?0:v&&u?n.limit-(n.itemW+n.vars.itemMargin)*n.move*n.animatingTo:v&&n.currentSlide===n.last?n.limit:v?(n.itemW+n.vars.itemMargin)*n.move*n.currentSlide:u?(n.last-n.currentSlide+n.cloneOffset)*c:(n.currentSlide+n.cloneOffset)*c)}function a(e){e.stopPropagation();var a=e.target._slider;if(a){var n=-e.translationX,i=-e.translationY;return T+=d?i:n,m=T,y=d?Math.abs(T)500)&&(e.preventDefault(),!p&&a.transitions&&(a.vars.animationLoop||(m=T/(0===a.currentSlide&&0>T||a.currentSlide===a.last&&T>0?Math.abs(T)/c+2:1)),a.setProps(l+m,"setTouch"))))}}function i(e){e.stopPropagation();var t=e.target._slider;if(t){if(t.animatingTo===t.currentSlide&&!y&&null!==m){var a=u?-m:m,n=a>0?t.getTarget("next"):t.getTarget("prev");t.canAdvance(n)&&(Number(new Date)-f<550&&Math.abs(a)>50||Math.abs(a)>c/2)?t.flexAnimate(n,t.vars.pauseOnAction):p||t.flexAnimate(t.currentSlide,t.vars.pauseOnAction,!0)}r=null,o=null,m=null,l=null,T=0}}var r,o,l,c,m,f,g,h,S,y=!1,x=0,b=0,T=0;s?(t.style.msTouchAction="none",t._gesture=new MSGesture,t._gesture.target=t,t.addEventListener("MSPointerDown",e,!1),t._slider=n,t.addEventListener("MSGestureChange",a,!1),t.addEventListener("MSGestureEnd",i,!1)):(g=function(e){n.animating?e.preventDefault():(window.navigator.msPointerEnabled||1===e.touches.length)&&(n.pause(),c=d?n.h:n.w,f=Number(new Date),x=e.touches[0].pageX,b=e.touches[0].pageY,l=v&&u&&n.animatingTo===n.last?0:v&&u?n.limit-(n.itemW+n.vars.itemMargin)*n.move*n.animatingTo:v&&n.currentSlide===n.last?n.limit:v?(n.itemW+n.vars.itemMargin)*n.move*n.currentSlide:u?(n.last-n.currentSlide+n.cloneOffset)*c:(n.currentSlide+n.cloneOffset)*c,r=d?b:x,o=d?x:b,t.addEventListener("touchmove",h,!1),t.addEventListener("touchend",S,!1))},h=function(e){x=e.touches[0].pageX,b=e.touches[0].pageY,m=d?r-b:r-x,y=d?Math.abs(m)t)&&(e.preventDefault(),!p&&n.transitions&&(n.vars.animationLoop||(m/=0===n.currentSlide&&0>m||n.currentSlide===n.last&&m>0?Math.abs(m)/c+2:1),n.setProps(l+m,"setTouch")))},S=function(e){if(t.removeEventListener("touchmove",h,!1),n.animatingTo===n.currentSlide&&!y&&null!==m){var a=u?-m:m,i=a>0?n.getTarget("next"):n.getTarget("prev");n.canAdvance(i)&&(Number(new Date)-f<550&&Math.abs(a)>50||Math.abs(a)>c/2)?n.flexAnimate(i,n.vars.pauseOnAction):p||n.flexAnimate(n.currentSlide,n.vars.pauseOnAction,!0)}t.removeEventListener("touchend",S,!1),r=null,o=null,m=null,l=null},t.addEventListener("touchstart",g,!1))},resize:function(){!n.animating&&n.is(":visible")&&(v||n.doMath(),p?f.smoothHeight():v?(n.slides.width(n.computedW),n.update(n.pagingCount),n.setProps()):d?(n.viewport.height(n.h),n.setProps(n.h,"setTotal")):(n.vars.smoothHeight&&f.smoothHeight(),n.newSlides.width(n.computedW),n.setProps(n.computedW,"setTotal")))},smoothHeight:function(e){if(!d||p){var t=p?n:n.viewport;e?t.animate({height:n.slides.eq(n.animatingTo).innerHeight()},e):t.innerHeight(n.slides.eq(n.animatingTo).innerHeight())}},sync:function(e){var t=$(n.vars.sync).data("flexslider"),a=n.animatingTo;switch(e){case"animate":t.flexAnimate(a,n.vars.pauseOnAction,!1,!0);break;case"play":t.playing||t.asNav||t.play();break;case"pause":t.pause()}},uniqueID:function(e){return e.filter("[id]").add(e.find("[id]")).each(function(){var e=$(this);e.attr("id",e.attr("id")+"_clone")}),e},pauseInvisible:{visProp:null,init:function(){var e=f.pauseInvisible.getHiddenProp();if(e){var t=e.replace(/[H|h]idden/,"")+"visibilitychange";document.addEventListener(t,function(){f.pauseInvisible.isHidden()?n.startTimeout?clearTimeout(n.startTimeout):n.pause():n.started?n.play():n.vars.initDelay>0?setTimeout(n.play,n.vars.initDelay):n.play()})}},isHidden:function(){var e=f.pauseInvisible.getHiddenProp();return e?document[e]:!1},getHiddenProp:function(){var e=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var t=0;tn.currentSlide?"next":"prev"),m&&1===n.pagingCount&&(n.direction=n.currentItemn.limit&&1!==n.visible?n.limit:S):h=0===n.currentSlide&&e===n.count-1&&n.vars.animationLoop&&"next"!==n.direction?u?(n.count+n.cloneOffset)*c:0:n.currentSlide===n.last&&0===e&&n.vars.animationLoop&&"prev"!==n.direction?u?0:(n.count+1)*c:u?(n.count-1-e+n.cloneOffset)*c:(e+n.cloneOffset)*c,n.setProps(h,"",n.vars.animationSpeed),n.transitions?(n.vars.animationLoop&&n.atEnd||(n.animating=!1,n.currentSlide=n.animatingTo),n.container.unbind("webkitTransitionEnd transitionend"),n.container.bind("webkitTransitionEnd transitionend",function(){clearTimeout(n.ensureAnimationEnd),n.wrapup(c)}),clearTimeout(n.ensureAnimationEnd),n.ensureAnimationEnd=setTimeout(function(){n.wrapup(c)},n.vars.animationSpeed+100)):n.container.animate(n.args,n.vars.animationSpeed,n.vars.easing,function(){n.wrapup(c)})}n.vars.smoothHeight&&f.smoothHeight(n.vars.animationSpeed)}},n.wrapup=function(e){p||v||(0===n.currentSlide&&n.animatingTo===n.last&&n.vars.animationLoop?n.setProps(e,"jumpEnd"):n.currentSlide===n.last&&0===n.animatingTo&&n.vars.animationLoop&&n.setProps(e,"jumpStart")),n.animating=!1,n.currentSlide=n.animatingTo,n.vars.after(n)},n.animateSlides=function(){!n.animating&&e&&n.flexAnimate(n.getTarget("next"))},n.pause=function(){clearInterval(n.animatedSlides),n.animatedSlides=null,n.playing=!1,n.vars.pausePlay&&f.pausePlay.update("play"),n.syncExists&&f.sync("pause")},n.play=function(){n.playing&&clearInterval(n.animatedSlides),n.animatedSlides=n.animatedSlides||setInterval(n.animateSlides,n.vars.slideshowSpeed),n.started=n.playing=!0,n.vars.pausePlay&&f.pausePlay.update("pause"),n.syncExists&&f.sync("play")},n.stop=function(){n.pause(),n.stopped=!0},n.canAdvance=function(e,t){var a=m?n.pagingCount-1:n.last;return t?!0:m&&n.currentItem===n.count-1&&0===e&&"prev"===n.direction?!0:m&&0===n.currentItem&&e===n.pagingCount-1&&"next"!==n.direction?!1:e!==n.currentSlide||m?n.vars.animationLoop?!0:n.atEnd&&0===n.currentSlide&&e===a&&"next"!==n.direction?!1:!n.atEnd||n.currentSlide!==a||0!==e||"next"!==n.direction:!1},n.getTarget=function(e){return n.direction=e,"next"===e?n.currentSlide===n.last?0:n.currentSlide+1:0===n.currentSlide?n.last:n.currentSlide-1},n.setProps=function(e,t,a){var i=function(){var a=e?e:(n.itemW+n.vars.itemMargin)*n.move*n.animatingTo,i=function(){if(v)return"setTouch"===t?e:u&&n.animatingTo===n.last?0:u?n.limit-(n.itemW+n.vars.itemMargin)*n.move*n.animatingTo:n.animatingTo===n.last?n.limit:a;switch(t){case"setTotal":return u?(n.count-1-n.currentSlide+n.cloneOffset)*e:(n.currentSlide+n.cloneOffset)*e;case"setTouch":return u?e:e;case"jumpEnd":return u?e:n.count*e;case"jumpStart":return u?n.count*e:e;default:return e}}();return-1*i+"px"}();n.transitions&&(i=d?"translate3d(0,"+i+",0)":"translate3d("+i+",0,0)",a=void 0!==a?a/1e3+"s":"0s",n.container.css("-"+n.pfx+"-transition-duration",a),n.container.css("transition-duration",a)),n.args[n.prop]=i,(n.transitions||void 0===a)&&n.container.css(n.args),n.container.css("transform",i)},n.setup=function(e){if(p)n.slides.css({width:"100%","float":"left",marginRight:"-100%",position:"relative"}),"init"===e&&(r?n.slides.css({opacity:0,display:"block",webkitTransition:"opacity "+n.vars.animationSpeed/1e3+"s ease",zIndex:1}).eq(n.currentSlide).css({opacity:1,zIndex:2}):0==n.vars.fadeFirstSlide?n.slides.css({opacity:0,display:"block",zIndex:1}).eq(n.currentSlide).css({zIndex:2}).css({opacity:1}):n.slides.css({opacity:0,display:"block",zIndex:1}).eq(n.currentSlide).css({zIndex:2}).animate({opacity:1},n.vars.animationSpeed,n.vars.easing)),n.vars.smoothHeight&&f.smoothHeight();else{var t,a;"init"===e&&(n.viewport=$('').css({overflow:"hidden",position:"relative"}).appendTo(n).append(n.container),n.cloneCount=0,n.cloneOffset=0,u&&(a=$.makeArray(n.slides).reverse(),n.slides=$(a),n.container.empty().append(n.slides))),n.vars.animationLoop&&!v&&(n.cloneCount=2,n.cloneOffset=1,"init"!==e&&n.container.find(".clone").remove(),n.container.append(f.uniqueID(n.slides.first().clone().addClass("clone")).attr("aria-hidden","true")).prepend(f.uniqueID(n.slides.last().clone().addClass("clone")).attr("aria-hidden","true"))),n.newSlides=$(n.vars.selector,n),t=u?n.count-1-n.currentSlide+n.cloneOffset:n.currentSlide+n.cloneOffset,d&&!v?(n.container.height(200*(n.count+n.cloneCount)+"%").css("position","absolute").width("100%"),setTimeout(function(){n.newSlides.css({display:"block"}),n.doMath(),n.viewport.height(n.h),n.setProps(t*n.h,"init")},"init"===e?100:0)):(n.container.width(200*(n.count+n.cloneCount)+"%"),n.setProps(t*n.computedW,"init"),setTimeout(function(){n.doMath(),n.newSlides.css({width:n.computedW,marginRight:n.computedM,"float":"left",display:"block"}),n.vars.smoothHeight&&f.smoothHeight()},"init"===e?100:0))}v||n.slides.removeClass(i+"active-slide").eq(n.currentSlide).addClass(i+"active-slide"),n.vars.init(n)},n.doMath=function(){var e=n.slides.first(),t=n.vars.itemMargin,a=n.vars.minItems,i=n.vars.maxItems;n.w=void 0===n.viewport?n.width():n.viewport.width(),n.h=e.height(),n.boxPadding=e.outerWidth()-e.width(),v?(n.itemT=n.vars.itemWidth+t,n.itemM=t,n.minW=a?a*n.itemT:n.w,n.maxW=i?i*n.itemT-t:n.w,n.itemW=n.minW>n.w?(n.w-t*(a-1))/a:n.maxWn.w?n.w:n.vars.itemWidth,n.visible=Math.floor(n.w/n.itemW),n.move=n.vars.move>0&&n.vars.moven.w?n.itemW*(n.count-1)+t*(n.count-1):(n.itemW+t)*n.count-n.w-t):(n.itemW=n.w,n.itemM=t,n.pagingCount=n.count,n.last=n.count-1),n.computedW=n.itemW-n.boxPadding,n.computedM=n.itemM},n.update=function(e,t){n.doMath(),v||(en.controlNav.length?f.controlNav.update("add"):("remove"===t&&!v||n.pagingCountn.last&&(n.currentSlide-=1,n.animatingTo-=1),f.controlNav.update("remove",n.last))),n.vars.directionNav&&f.directionNav.update()},n.addSlide=function(e,t){var a=$(e);n.count+=1,n.last=n.count-1,d&&u?void 0!==t?n.slides.eq(n.count-t).after(a):n.container.prepend(a):void 0!==t?n.slides.eq(t).before(a):n.container.append(a),n.update(t,"add"),n.slides=$(n.vars.selector+":not(.clone)",n),n.setup(),n.vars.added(n)},n.removeSlide=function(e){var t=isNaN(e)?n.slides.index($(e)):e;n.count-=1,n.last=n.count-1,isNaN(e)?$(e,n.slides).remove():d&&u?n.slides.eq(n.last).remove():n.slides.eq(e).remove(),n.doMath(),n.update(t,"remove"),n.slides=$(n.vars.selector+":not(.clone)",n),n.setup(),n.vars.removed(n)},f.init()},$(window).blur(function(t){e=!1}).focus(function(t){e=!0}),$.flexslider.defaults={namespace:"flex-",selector:".slides > li",animation:"fade",easing:"swing",direction:"horizontal",reverse:!1,animationLoop:!0,smoothHeight:!1,startAt:0,slideshow:!0,slideshowSpeed:7e3,animationSpeed:600,initDelay:0,randomize:!1,fadeFirstSlide:!0,thumbCaptions:!1,pauseOnAction:!0,pauseOnHover:!1,pauseInvisible:!0,useCSS:!0,touch:!0,video:!1,controlNav:!0,directionNav:!0,prevText:"Previous",nextText:"Next",keyboard:!0,multipleKeyboard:!1,mousewheel:!1,pausePlay:!1,pauseText:"Pause",playText:"Play",controlsContainer:"",manualControls:"",customDirectionNav:"",sync:"",asNavFor:"",itemWidth:0,itemMargin:0,minItems:1,maxItems:0,move:0,allowOneSlide:!0,start:function(){},before:function(){},after:function(){},end:function(){},added:function(){},removed:function(){},init:function(){}},$.fn.flexslider=function(e){if(void 0===e&&(e={}),"object"==typeof e)return this.each(function(){var t=$(this),a=e.selector?e.selector:".slides > li",n=t.find(a);1===n.length&&e.allowOneSlide===!1||0===n.length?(n.fadeIn(400),e.start&&e.start(t)):void 0===t.data("flexslider")&&new $.flexslider(this,e)});var t=$(this).data("flexslider");switch(e){case"play":t.play();break;case"pause":t.pause();break;case"stop":t.stop();break;case"next":t.flexAnimate(t.getTarget("next"),!0);break;case"prev":case"previous":t.flexAnimate(t.getTarget("prev"),!0);break;default:"number"==typeof e&&t.flexAnimate(e,!0)}}}(jQuery);;// END OF /scripts/flexslider/jquery.flexslider-min.js
// STARTS OF /scripts/jQuery/jquery.validate.min.js
/*! jQuery Validation Plugin - v1.11.1 - 3/22/2013\n* https://github.com/jzaefferer/jquery-validation
* Copyright (c) 2013 Jörn Zaefferer; Licensed MIT */(function(t){t.extend(t.fn,{validate:function(e){if(!this.length)return e&&e.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."),void 0;var i=t.data(this[0],"validator");return i?i:(this.attr("novalidate","novalidate"),i=new t.validator(e,this[0]),t.data(this[0],"validator",i),i.settings.onsubmit&&(this.validateDelegate(":submit","click",function(e){i.settings.submitHandler&&(i.submitButton=e.target),t(e.target).hasClass("cancel")&&(i.cancelSubmit=!0),void 0!==t(e.target).attr("formnovalidate")&&(i.cancelSubmit=!0)}),this.submit(function(e){function s(){var s;return i.settings.submitHandler?(i.submitButton&&(s=t("").attr("name",i.submitButton.name).val(t(i.submitButton).val()).appendTo(i.currentForm)),i.settings.submitHandler.call(i,i.currentForm,e),i.submitButton&&s.remove(),!1):!0}return i.settings.debug&&e.preventDefault(),i.cancelSubmit?(i.cancelSubmit=!1,s()):i.form()?i.pendingRequest?(i.formSubmitted=!0,!1):s():(i.focusInvalid(),!1)})),i)},valid:function(){if(t(this[0]).is("form"))return this.validate().form();var e=!0,i=t(this[0].form).validate();return this.each(function(){e=e&&i.element(this)}),e},removeAttrs:function(e){var i={},s=this;return t.each(e.split(/\s/),function(t,e){i[e]=s.attr(e),s.removeAttr(e)}),i},rules:function(e,i){var s=this[0];if(e){var r=t.data(s.form,"validator").settings,n=r.rules,a=t.validator.staticRules(s);switch(e){case"add":t.extend(a,t.validator.normalizeRule(i)),delete a.messages,n[s.name]=a,i.messages&&(r.messages[s.name]=t.extend(r.messages[s.name],i.messages));break;case"remove":if(!i)return delete n[s.name],a;var u={};return t.each(i.split(/\s/),function(t,e){u[e]=a[e],delete a[e]}),u}}var o=t.validator.normalizeRules(t.extend({},t.validator.classRules(s),t.validator.attributeRules(s),t.validator.dataRules(s),t.validator.staticRules(s)),s);if(o.required){var l=o.required;delete o.required,o=t.extend({required:l},o)}return o}}),t.extend(t.expr[":"],{blank:function(e){return!t.trim(""+t(e).val())},filled:function(e){return!!t.trim(""+t(e).val())},unchecked:function(e){return!t(e).prop("checked")}}),t.validator=function(e,i){this.settings=t.extend(!0,{},t.validator.defaults,e),this.currentForm=i,this.init()},t.validator.format=function(e,i){return 1===arguments.length?function(){var i=t.makeArray(arguments);return i.unshift(e),t.validator.format.apply(this,i)}:(arguments.length>2&&i.constructor!==Array&&(i=t.makeArray(arguments).slice(1)),i.constructor!==Array&&(i=[i]),t.each(i,function(t,i){e=e.replace(RegExp("\\{"+t+"\\}","g"),function(){return i})}),e)},t.extend(t.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:t([]),errorLabelContainer:t([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(t){this.lastActive=t,this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,t,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(t)).hide())},onfocusout:function(t){this.checkable(t)||!(t.name in this.submitted)&&this.optional(t)||this.element(t)},onkeyup:function(t,e){(9!==e.which||""!==this.elementValue(t))&&(t.name in this.submitted||t===this.lastElement)&&this.element(t)},onclick:function(t){t.name in this.submitted?this.element(t):t.parentNode.name in this.submitted&&this.element(t.parentNode)},highlight:function(e,i,s){"radio"===e.type?this.findByName(e.name).addClass(i).removeClass(s):t(e).addClass(i).removeClass(s)},unhighlight:function(e,i,s){"radio"===e.type?this.findByName(e.name).removeClass(i).addClass(s):t(e).removeClass(i).addClass(s)}},setDefaults:function(e){t.extend(t.validator.defaults,e)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:t.validator.format("Please enter no more than {0} characters."),minlength:t.validator.format("Please enter at least {0} characters."),rangelength:t.validator.format("Please enter a value between {0} and {1} characters long."),range:t.validator.format("Please enter a value between {0} and {1}."),max:t.validator.format("Please enter a value less than or equal to {0}."),min:t.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function e(e){var i=t.data(this[0].form,"validator"),s="on"+e.type.replace(/^validate/,"");i.settings[s]&&i.settings[s].call(i,this[0],e)}this.labelContainer=t(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||t(this.currentForm),this.containers=t(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var i=this.groups={};t.each(this.settings.groups,function(e,s){"string"==typeof s&&(s=s.split(/\s/)),t.each(s,function(t,s){i[s]=e})});var s=this.settings.rules;t.each(s,function(e,i){s[e]=t.validator.normalizeRule(i)}),t(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",e).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",e),this.settings.invalidHandler&&t(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),t.extend(this.submitted,this.errorMap),this.invalid=t.extend({},this.errorMap),this.valid()||t(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var t=0,e=this.currentElements=this.elements();e[t];t++)this.check(e[t]);return this.valid()},element:function(e){e=this.validationTargetFor(this.clean(e)),this.lastElement=e,this.prepareElement(e),this.currentElements=t(e);var i=this.check(e)!==!1;return i?delete this.invalid[e.name]:this.invalid[e.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),i},showErrors:function(e){if(e){t.extend(this.errorMap,e),this.errorList=[];for(var i in e)this.errorList.push({message:e[i],element:this.findByName(i)[0]});this.successList=t.grep(this.successList,function(t){return!(t.name in e)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){t.fn.resetForm&&t(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(t){var e=0;for(var i in t)e++;return e},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{t(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(e){}},findLastActive:function(){var e=this.lastActive;return e&&1===t.grep(this.errorList,function(t){return t.element.name===e.name}).length&&e},elements:function(){var e=this,i={};return t(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){return!this.name&&e.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in i||!e.objectLength(t(this).rules())?!1:(i[this.name]=!0,!0)})},clean:function(e){return t(e)[0]},errors:function(){var e=this.settings.errorClass.replace(" ",".");return t(this.settings.errorElement+"."+e,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=t([]),this.toHide=t([]),this.currentElements=t([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(t){this.reset(),this.toHide=this.errorsFor(t)},elementValue:function(e){var i=t(e).attr("type"),s=t(e).val();return"radio"===i||"checkbox"===i?t("input[name='"+t(e).attr("name")+"']:checked").val():"string"==typeof s?s.replace(/\r/g,""):s},check:function(e){e=this.validationTargetFor(this.clean(e));var i,s=t(e).rules(),r=!1,n=this.elementValue(e);for(var a in s){var u={method:a,parameters:s[a]};try{if(i=t.validator.methods[a].call(this,n,e,u.parameters),"dependency-mismatch"===i){r=!0;continue}if(r=!1,"pending"===i)return this.toHide=this.toHide.not(this.errorsFor(e)),void 0;if(!i)return this.formatAndAdd(e,u),!1}catch(o){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+e.id+", check the '"+u.method+"' method.",o),o}}return r?void 0:(this.objectLength(s)&&this.successList.push(e),!0)},customDataMessage:function(e,i){return t(e).data("msg-"+i.toLowerCase())||e.attributes&&t(e).attr("data-msg-"+i.toLowerCase())},customMessage:function(t,e){var i=this.settings.messages[t];return i&&(i.constructor===String?i:i[e])},findDefined:function(){for(var t=0;arguments.length>t;t++)if(void 0!==arguments[t])return arguments[t];return void 0},defaultMessage:function(e,i){return this.findDefined(this.customMessage(e.name,i),this.customDataMessage(e,i),!this.settings.ignoreTitle&&e.title||void 0,t.validator.messages[i],"Warning: No message defined for "+e.name+"")},formatAndAdd:function(e,i){var s=this.defaultMessage(e,i.method),r=/\$?\{(\d+)\}/g;"function"==typeof s?s=s.call(this,i.parameters,e):r.test(s)&&(s=t.validator.format(s.replace(r,"{$1}"),i.parameters)),this.errorList.push({message:s,element:e}),this.errorMap[e.name]=s,this.submitted[e.name]=s},addWrapper:function(t){return this.settings.wrapper&&(t=t.add(t.parent(this.settings.wrapper))),t},defaultShowErrors:function(){var t,e;for(t=0;this.errorList[t];t++){var i=this.errorList[t];this.settings.highlight&&this.settings.highlight.call(this,i.element,this.settings.errorClass,this.settings.validClass),this.showLabel(i.element,i.message)}if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(t=0;this.successList[t];t++)this.showLabel(this.successList[t]);if(this.settings.unhighlight)for(t=0,e=this.validElements();e[t];t++)this.settings.unhighlight.call(this,e[t],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return t(this.errorList).map(function(){return this.element})},showLabel:function(e,i){var s=this.errorsFor(e);s.length?(s.removeClass(this.settings.validClass).addClass(this.settings.errorClass),s.html(i)):(s=t("<"+this.settings.errorElement+">").attr("for",this.idOrName(e)).addClass(this.settings.errorClass).html(i||""),this.settings.wrapper&&(s=s.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(s).length||(this.settings.errorPlacement?this.settings.errorPlacement(s,t(e)):s.insertAfter(e))),!i&&this.settings.success&&(s.text(""),"string"==typeof this.settings.success?s.addClass(this.settings.success):this.settings.success(s,e)),this.toShow=this.toShow.add(s)},errorsFor:function(e){var i=this.idOrName(e);return this.errors().filter(function(){return t(this).attr("for")===i})},idOrName:function(t){return this.groups[t.name]||(this.checkable(t)?t.name:t.id||t.name)},validationTargetFor:function(t){return this.checkable(t)&&(t=this.findByName(t.name).not(this.settings.ignore)[0]),t},checkable:function(t){return/radio|checkbox/i.test(t.type)},findByName:function(e){return t(this.currentForm).find("[name='"+e+"']")},getLength:function(e,i){switch(i.nodeName.toLowerCase()){case"select":return t("option:selected",i).length;case"input":if(this.checkable(i))return this.findByName(i.name).filter(":checked").length}return e.length},depend:function(t,e){return this.dependTypes[typeof t]?this.dependTypes[typeof t](t,e):!0},dependTypes:{"boolean":function(t){return t},string:function(e,i){return!!t(e,i.form).length},"function":function(t,e){return t(e)}},optional:function(e){var i=this.elementValue(e);return!t.validator.methods.required.call(this,i,e)&&"dependency-mismatch"},startRequest:function(t){this.pending[t.name]||(this.pendingRequest++,this.pending[t.name]=!0)},stopRequest:function(e,i){this.pendingRequest--,0>this.pendingRequest&&(this.pendingRequest=0),delete this.pending[e.name],i&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(t(this.currentForm).submit(),this.formSubmitted=!1):!i&&0===this.pendingRequest&&this.formSubmitted&&(t(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(e){return t.data(e,"previousValue")||t.data(e,"previousValue",{old:null,valid:!0,message:this.defaultMessage(e,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(e,i){e.constructor===String?this.classRuleSettings[e]=i:t.extend(this.classRuleSettings,e)},classRules:function(e){var i={},s=t(e).attr("class");return s&&t.each(s.split(" "),function(){this in t.validator.classRuleSettings&&t.extend(i,t.validator.classRuleSettings[this])}),i},attributeRules:function(e){var i={},s=t(e),r=s[0].getAttribute("type");for(var n in t.validator.methods){var a;"required"===n?(a=s.get(0).getAttribute(n),""===a&&(a=!0),a=!!a):a=s.attr(n),/min|max/.test(n)&&(null===r||/number|range|text/.test(r))&&(a=Number(a)),a?i[n]=a:r===n&&"range"!==r&&(i[n]=!0)}return i.maxlength&&/-1|2147483647|524288/.test(i.maxlength)&&delete i.maxlength,i},dataRules:function(e){var i,s,r={},n=t(e);for(i in t.validator.methods)s=n.data("rule-"+i.toLowerCase()),void 0!==s&&(r[i]=s);return r},staticRules:function(e){var i={},s=t.data(e.form,"validator");return s.settings.rules&&(i=t.validator.normalizeRule(s.settings.rules[e.name])||{}),i},normalizeRules:function(e,i){return t.each(e,function(s,r){if(r===!1)return delete e[s],void 0;if(r.param||r.depends){var n=!0;switch(typeof r.depends){case"string":n=!!t(r.depends,i.form).length;break;case"function":n=r.depends.call(i,i)}n?e[s]=void 0!==r.param?r.param:!0:delete e[s]}}),t.each(e,function(s,r){e[s]=t.isFunction(r)?r(i):r}),t.each(["minlength","maxlength"],function(){e[this]&&(e[this]=Number(e[this]))}),t.each(["rangelength","range"],function(){var i;e[this]&&(t.isArray(e[this])?e[this]=[Number(e[this][0]),Number(e[this][1])]:"string"==typeof e[this]&&(i=e[this].split(/[\s,]+/),e[this]=[Number(i[0]),Number(i[1])]))}),t.validator.autoCreateRanges&&(e.min&&e.max&&(e.range=[e.min,e.max],delete e.min,delete e.max),e.minlength&&e.maxlength&&(e.rangelength=[e.minlength,e.maxlength],delete e.minlength,delete e.maxlength)),e},normalizeRule:function(e){if("string"==typeof e){var i={};t.each(e.split(/\s/),function(){i[this]=!0}),e=i}return e},addMethod:function(e,i,s){t.validator.methods[e]=i,t.validator.messages[e]=void 0!==s?s:t.validator.messages[e],3>i.length&&t.validator.addClassRules(e,t.validator.normalizeRule(e))},methods:{required:function(e,i,s){if(!this.depend(s,i))return"dependency-mismatch";if("select"===i.nodeName.toLowerCase()){var r=t(i).val();return r&&r.length>0}return this.checkable(i)?this.getLength(e,i)>0:t.trim(e).length>0},email:function(t,e){return this.optional(e)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(t)},url:function(t,e){return this.optional(e)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(t)},date:function(t,e){return this.optional(e)||!/Invalid|NaN/.test(""+new Date(t))},dateISO:function(t,e){return this.optional(e)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(t)},number:function(t,e){return this.optional(e)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(t)},digits:function(t,e){return this.optional(e)||/^\d+$/.test(t)},creditcard:function(t,e){if(this.optional(e))return"dependency-mismatch";if(/[^0-9 \-]+/.test(t))return!1;var i=0,s=0,r=!1;t=t.replace(/\D/g,"");for(var n=t.length-1;n>=0;n--){var a=t.charAt(n);s=parseInt(a,10),r&&(s*=2)>9&&(s-=9),i+=s,r=!r}return 0===i%10},minlength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||r>=s},maxlength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||s>=r},rangelength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||r>=s[0]&&s[1]>=r},min:function(t,e,i){return this.optional(e)||t>=i},max:function(t,e,i){return this.optional(e)||i>=t},range:function(t,e,i){return this.optional(e)||t>=i[0]&&i[1]>=t},equalTo:function(e,i,s){var r=t(s);return this.settings.onfocusout&&r.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){t(i).valid()}),e===r.val()},remote:function(e,i,s){if(this.optional(i))return"dependency-mismatch";var r=this.previousValue(i);if(this.settings.messages[i.name]||(this.settings.messages[i.name]={}),r.originalMessage=this.settings.messages[i.name].remote,this.settings.messages[i.name].remote=r.message,s="string"==typeof s&&{url:s}||s,r.old===e)return r.valid;r.old=e;var n=this;this.startRequest(i);var a={};return a[i.name]=e,t.ajax(t.extend(!0,{url:s,mode:"abort",port:"validate"+i.name,dataType:"json",data:a,success:function(s){n.settings.messages[i.name].remote=r.originalMessage;var a=s===!0||"true"===s;if(a){var u=n.formSubmitted;n.prepareElement(i),n.formSubmitted=u,n.successList.push(i),delete n.invalid[i.name],n.showErrors()}else{var o={},l=s||n.defaultMessage(i,"remote");o[i.name]=r.message=t.isFunction(l)?l(e):l,n.invalid[i.name]=!0,n.showErrors(o)}r.valid=a,n.stopRequest(i,a)}},s)),"pending"}}}),t.format=t.validator.format})(jQuery),function(t){var e={};if(t.ajaxPrefilter)t.ajaxPrefilter(function(t,i,s){var r=t.port;"abort"===t.mode&&(e[r]&&e[r].abort(),e[r]=s)});else{var i=t.ajax;t.ajax=function(s){var r=("mode"in s?s:t.ajaxSettings).mode,n=("port"in s?s:t.ajaxSettings).port;return"abort"===r?(e[n]&&e[n].abort(),e[n]=i.apply(this,arguments),e[n]):i.apply(this,arguments)}}}(jQuery),function(t){t.extend(t.fn,{validateDelegate:function(e,i,s){return this.bind(i,function(i){var r=t(i.target);return r.is(e)?s.apply(r,arguments):void 0})}})}(jQuery);
;jQuery.validator.addMethod("CellPhone", function (value, element, params) {
var reg = /^[1][358]\d{9}$/;
return this.optional(element) || reg.test(value.replace(/\s/ig,""));
}, "例13800138000");
jQuery.validator.addMethod("isTel", function (value) {
var tel = /((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/;
return value ? tel.test(value) : true;
}, "例0757-82345678");
jQuery.validator.addMethod("CkDN", function (value) {
var reg = /^([a-zA-Z0-9\u4e00-\u9fa5][-a-zA-Z0-9\u4e00-\u9fa5]{0,62}(\.[a-zA-Z0-9\u4e00-\u9fa5][-a-zA-Z0-9\u4e00-\u9fa5]{0,62})+\.?)/;
return value ? reg.test(value) : true;
}, "输入域名的域名不正确!");;// END OF /scripts/jQuery/jquery.validate.min.js
// STARTS OF /share/jquery.vticker-min.js
/*
* vertical news ticker
* Tadas Juozapaitis ( kasp3rito@gmail.com )
* http://plugins.jquery.com/project/vTicker
*/
(function (a) { a.fn.vTicker = function (b) { var c = { speed: 700, pause: 4000, showItems: 3, animation: "", mousePause: true, isPaused: false, direction: "up", height: 0 }; var b = a.extend(c, b); moveUp = function (g, d, e) { if (e.isPaused) { return } var f = g.children("ul"); var h = f.children("li:first").clone(true); if (e.height > 0) { d = f.children("li:first").height() } f.animate({ top: "-=" + d + "px" }, e.speed, function () { a(this).children("li:first").remove(); a(this).css("top", "0px") }); if (e.animation == "fade") { f.children("li:first").fadeOut(e.speed); if (e.height == 0) { f.children("li:eq(" + e.showItems + ")").hide().fadeIn(e.speed) } } h.appendTo(f) }; moveDown = function (g, d, e) { if (e.isPaused) { return } var f = g.children("ul"); var h = f.children("li:last").clone(true); if (e.height > 0) { d = f.children("li:first").height() } f.css("top", "-" + d + "px").prepend(h); f.animate({ top: 0 }, e.speed, function () { a(this).children("li:last").remove() }); if (e.animation == "fade") { if (e.height == 0) { f.children("li:eq(" + e.showItems + ")").fadeOut(e.speed) } f.children("li:first").hide().fadeIn(e.speed) } }; return this.each(function () { var f = a(this); var e = 0; f.css({ overflow: "hidden", position: "relative" }).children("ul").css({ position: "absolute", margin: 0, padding: 0 }).children("li").css({ margin: 0, padding: 0 }); if (b.height == 0) { f.children("ul").children("li").each(function () { if (a(this).height() > e) { e = a(this).height() } }); f.children("ul").children("li").each(function () { a(this).height(e) }); f.height(e * b.showItems) } else { f.height(b.height) } var d = setInterval(function () { if (b.direction == "up") { moveUp(f, e, b) } else { moveDown(f, e, b) } }, b.pause); if (b.mousePause) { f.bind("mouseenter", function () { b.isPaused = true }).bind("mouseleave", function () { b.isPaused = false }) } }) } })(jQuery);;// END OF /share/jquery.vticker-min.js
// STARTS OF /share/global.js
function isDomain(str){
if(/^[0-9a-z\.]+[0-9a-z\-0-9a-z]+[\.]+[0-9a-z]+$/.test(str)==false) return false;
else return true;
}
function isEmail(s){
var regx = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
return regx.test(s);
}
function isTel(s){
var regx = /^(86\-)?\d{2,4}\-\d{6,10}(\-\d+)?$/;
return regx.test(s);
}
function isMobile(s){
var regx = /^(0)?(1)\d{10}$/;
// 非简体中文站走国际验证,只需验证是否按指定字符组合即可,不再验证格式
if (getCookie('Lang') != 'cn') {
regx = /^[\(\)\+\-\d]{8,17}$/;
}
return regx.test(s);
}
function isPostCode(s){
var regx = /^\d{6}$/;
return regx.test(s);
}
function isChinese(s){
var rxp = /^[\u4e00-\u9fa5]+$/g;
return rxp.test(s);
}
function isPostCode(str)
{
var reg = /^[0-9]{6}$/;
return (reg.test(str));
}
function isNumber(s)
{
var rxp = /^(-|\+)?\d+(\.\d+)?$/;
return rxp.test(s);
}
function isInt(s)
{
var rxp = /^\d+$/
return rxp.test(s);
}
function isIdCard(idCard) {
idCard = trim(idCard.replace(/ /g, "")); //去掉字符串头尾空格
if (idCard.length == 15) {
return isValidityBrithBy15IdCard(idCard); //进行15位身份证的验证
} else if (idCard.length == 18) {
var a_idCard = idCard.split(""); // 得到身份证数组
if (isValidityBrithBy18IdCard(idCard) && isTrueValidateCodeBy18IdCard(a_idCard)) { //进行18位身份证的基本验证和第18位的验证
return true;
} else {
return false;
}
} else {
return false;
}
}
function isValidityBrithBy15IdCard(idCard15) {
var year = idCard15.substring(6, 8);
var month = idCard15.substring(8, 10);
var day = idCard15.substring(10, 12);
var temp_date = new Date(year, parseFloat(month) - 1, parseFloat(day));
// 对于老身份证中的你年龄则不需考虑千年虫问题而使用getYear()方法
if (temp_date.getYear() != parseFloat(year)
|| temp_date.getMonth() != parseFloat(month) - 1
|| temp_date.getDate() != parseFloat(day)) {
return false;
} else {
return true;
}
}
function isTrueValidateCodeBy18IdCard(a_idCard) {
var Wi = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1]; // 加权因子
var ValideCode = [1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2]; // 身份证验证位值.10代表X
var sum = 0; // 声明加权求和变量
if (a_idCard[17].toLowerCase() == 'x') {
a_idCard[17] = 10; // 将最后位为x的验证码替换为10方便后续操作
}
for (var i = 0; i < 17; i++) {
sum += Wi[i] * a_idCard[i]; // 加权求和
}
valCodePosition = sum % 11; // 得到验证码所位置
if (a_idCard[17] == ValideCode[valCodePosition]) {
return true;
} else {
return false;
}
}
function isValidityBrithBy18IdCard(idCard18) {
var year = idCard18.substring(6, 10);
var month = idCard18.substring(10, 12);
var day = idCard18.substring(12, 14);
var temp_date = new Date(year, parseFloat(month) - 1, parseFloat(day));
// 这里用getFullYear()获取年份,避免千年虫问题
if (temp_date.getFullYear() != parseFloat(year)
|| temp_date.getMonth() != parseFloat(month) - 1
|| temp_date.getDate() != parseFloat(day)) {
return false;
} else {
return true;
}
}
function trim(str) {
return str.replace(/(^\s*)|(\s*$)/g, "");
}
function GetEvent(){
if(document.all) return window.event;//如果是ie
func = GetEvent.caller;
while(func != null){
var arg0 = func.arguments[0];
if(arg0)
{
if((arg0.constructor == Event || arg0.constructor == MouseEvent) ||(typeof(arg0) == "object" && arg0.preventDefault && arg0.stopPropagation))
{
return arg0;
}
}
func = func.caller;
}
return null;
}
//trim()
String.prototype.trim = function() {
return (this.replace(/^\s+|\s+$/g,""));
}
//ltrim()
String.prototype.ltrim = function() {
return (this.replace(/^\s*/,""));
}
//rtrim()
String.prototype.rtrim = function() {
return (this.replace(/\s*$/,""));
}
//delete html tags
String.prototype.stripTags = function() {
return this.replace(/<\/?[^>]+>/gi, '');
}
function numberCeil(num, digit) {
digit = parseInt(digit);
if (isNaN(digit)) {
digit = 0;
}
if (digit < 0)
throw Exception('digit must be greater or equal than 0');
var scale = 1;
for (var i = 0; i < digit; i++) {
scale *= 10;
}
return Math.ceil(num * scale) / scale;
}
//重载 setTimeout
var _st = window.setTimeout;
window.setTimeoutEx = function(fRef, mDelay)
{
if(typeof(fRef) == 'function')
{
var argu = Array.prototype.slice.call(arguments,2);
var f = (function(){ fRef.apply(null, argu);});
return _st(f, mDelay);
}
return _st(fRef,mDelay);
}
// end of 重载 setTimeout
//重载 setInterval
var _setInterval = window.setInterval;
window.setIntervalEx = function(fRef, mDelay)
{
if(typeof(fRef) == 'function')
{
var argu = Array.prototype.slice.call(arguments,2);
var f = (function(){ fRef.apply(null, argu);});
return _setInterval(f, mDelay);
}
return _setInterval(fRef,mDelay);
}
// end of 重载 setInterval
/*
Cookie 相关函数
*/
function getCookieVal(offset)
{
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1) endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function getCookie(cname)
{
var cookie = {};
var all = document.cookie;
if (all === "") {
return cookie;
}
var list = all.split("; ");
for (var i = 0; i < list.length; i++) {
var temp = list[i];
var pos = temp.indexOf("=");
var name = temp.substring(0, pos);
var value = temp.substring(pos + 1);
try{
value = decodeURIComponent(value);
}catch(ex){
console.log(ex);
}
cookie[name] = value;
}
return cookie[cname];
// var arg = name + "=";
// var alen = arg.length;
// var clen = document.cookie.length;
// var i = 0;
// var cookieArr = document.cookie.split(';'),
// cookieLen = cookieArr.length;
// for(var i; i ').appendTo('head'); });
else $('').appendTo('head');
window.addedCss[path] = true;
}
//判断一个变量是否是对象
function isObject(obj) {
if (obj && typeof obj == "object" && (obj instanceof Array) == false) {
return true;
}
return false;
}
//判断一个变量是否是数组
function isArray(obj) {
if (obj && typeof obj == "object" && (obj instanceof Array) == true) {
return true;
}
return false;
}
(function ($) {
$.fn.extend({
"addrSelector":function(options){
var defaults = {
loadDefaultAddr: null,
selectAddr: $.noop,
createNewAddr: $.noop,
selectedAddrID: 0,
isShowIdCardNo: false,
isManagePage:false//是不是地址管理页面 by hui
};
var opts = $.extend({}, defaults, options);
return this.each(function () {
if (typeof opts.loadDefaultAddr == 'function') {
$.getJSON('/index.php?c=front/Useraddr&a=GetDefaultAddr', {}, function (json) {
if (!json.success) {
alert(json.msg);
return;
}
opts.loadDefaultAddr(json.addr);
if (json && json.addr && !isNaN(Number(json.addr.ID)) && parseInt(json.addr.ID) > 0) {
opts.selectedAddrID = parseInt(json.addr.ID);
}
});
}
if(opts.isManagePage){
getUserAddrList(opts);
}else{
$(this).off('click.showAddrSelector').on('click.showAddrSelector', function () {
getUserAddrList(opts);
})
}
});
}
});
var getUserAddrList = function(opts){
if ($('#userAddrContent').length == 0) {
$.extend({
selectAddr: function (addr) {
if (typeof opts.selectAddr == 'function')
opts.selectAddr(addr);
},
createNewAddr: function (addr) {
if (typeof opts.createNewAddr == 'function')
opts.createNewAddr(addr);
},
selectedAddrID: opts.selectedAddrID,
isShowIdCardNo: opts.isShowIdCardNo,
isManagePage:opts.isManagePage
});
$.ajax({
type: 'get',
url: '/index.php?c=front/Useraddr',
dataType: 'html',
success: function (msg) {
$(msg).hide().appendTo('body');
$('#userAddrContent').stop().fadeIn();
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest.responseText);
}
})
} else {
// $('#userAddrContent .addrList .addr .selectbtn').css('display','none');
// $('#userAddrContent .addrList .addr[addrID=' + $.selectedAddrID + '] .selectbtn').css('display','inline-block');
$('#userAddrContent .addrList .addr .select-status').hide();
$('#userAddrContent .addrList .addr[addrID=' + $.selectedAddrID + '] .select-status').show();
$('#userAddrContent').stop().fadeIn();
}
};
})(window.jQuery);
(function ($) {
$.fn.extend({
"districtSeletor": function (options) {
if (options == 'setValue') {
dataBind(arguments[1] || {}, this);
return this;
} else {
return this.each(function () {
var opts = $.extend({}, defaults, options);
var $this = $(this);
var sHtml = '';
sHtml = ''
sHtml += '';
sHtml += '';
sHtml += '';
sHtml += '';
$this.html(sHtml).addClass('districtSelector')//.attr('relid=' + relid);
if (opts.showCountry) {
$this.find('.level1').show();
} else {
$this.find('.level1').hide();
}
$this.find('.level1').on('change', function () {
if ($(this).val() == 1) {
$(this).nextAll('select').show();
getNextLevelList(this);
} else {
$(this).nextAll('select').hide();
}
})
$this.find('.level2, .level3').on('change', function () {
getNextLevelList(this);
});
dataBind(opts, $this);
});
}
}
});
var defaults = {
countryID: 1,
provinceID: null,
cityID: null,
districtID: null,
showCountry: 1
};
var getNextLevelList = function (selectElem) {
selectElem = $(selectElem);
var id = parseInt(selectElem.val());
if (isNaN(id)) return;
var level = parseInt(selectElem.attr('level'));
selectElem.nextAll('select').html('');
if (id <= 0) return;
$.ajax({
type: 'get',
url: '/index.php?c=front/district&a=getChildrenList',
data: { act: 'getChildrenList', id: id },
async: false,
dataType: 'json',
success: function (json) {
if (!json.success) {
alert(json.msg);
return;
}
var targetSelectElem = selectElem.nextAll('.level' + (level + 1));
var list = json.list || [];
for (var i = 0; i < list.length; i++) {
targetSelectElem.append('');
}
if (list.length == 0) {
targetSelectElem.hide();
targetSelectElem.nextAll('.level' + (level + 2)).hide();
targetSelectElem.nextAll('.level' + (level + 3)).hide();
} else {
targetSelectElem.show();
targetSelectElem.nextAll('.level' + (level + 2)).show();
targetSelectElem.nextAll('.level' + (level + 3)).show();
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest.responseText);
}
})
};
var dataBind = function (opts, $this) {
if (opts.countryID && parseInt(opts.countryID) > 0) {
$this.find('.level1').val(opts.countryID).change();
} else {
$this.find('.level1').val(-1).change();
}
if (opts.provinceID && parseInt(opts.provinceID) > 0) {
$this.find('.level2').val(opts.provinceID).change();
}
if (opts.cityID && parseInt(opts.cityID) > 0) {
$this.find('.level3').val(opts.cityID).change();
}
if (opts.districtID && parseInt(opts.districtID) > 0) {
$this.find('.level4').val(opts.districtID).change();
}
};
$.fn.districtSeletor.setValue = function (opts) {
dataBind(opts);
}
})(window.jQuery);
// 获取当前页面url参数
if (!window.location.getQueryString) window.location.getQueryString = function (name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return (r[2]); return null;
}
var Base64 = {
// private property
_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
// public method for encoding
encode: function(input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = Base64._utf8_encode(input);
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
}
return output;
},
// public method for decoding
decode: function(input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) {
enc1 = this._keyStr.indexOf(input.charAt(i++));
enc2 = this._keyStr.indexOf(input.charAt(i++));
enc3 = this._keyStr.indexOf(input.charAt(i++));
enc4 = this._keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
}
output = Base64._utf8_decode(output);
return output;
},
// private method for UTF-8 encoding
_utf8_encode: function(string) {
string = string.replace(/\r\n/g, "\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
} else if ((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
} else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
},
// private method for UTF-8 decoding
_utf8_decode: function(utftext) {
var string = "";
var i = 0;
var c = c1 = c2 = 0;
while (i < utftext.length) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
} else if ((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i + 1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
} else {
c2 = utftext.charCodeAt(i + 1);
c3 = utftext.charCodeAt(i + 2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
}
};// END OF /share/global.js
// STARTS OF /share/JScript.js
$(function () {
if (getCookie("SiteType") == "1") {
$(window).resize(function (e) {
if (e.target === window) {
showhideNav();
computeFreeModulePosition();
computeJiuGondHeight();
}
});
$(window).load(function () {
showhideNav();
computeFreeModulePosition();
});
}
$(window).load(function () {
initHoverAnimate();
});
doSomeWhanPreview();
keepFullScreenModules100Width();
//广告
if ($("#ChargeTips").height()) {
$("body > .ModuleItem").each(function (i, item) {
$(item).css("top", parseInt($(item).css("top")) + $("#ChargeTips").height());
});
}
setMobileNav();
matchNavAndFootNavBgColor();
setModuleCls();
NewsList();
TopNewLoad();
BindPagerAction(); //接管模块的分页链接,用ajax请求
SetImageWidth();
setZonePadding();
var $container = $('.masonry-container');
if ($container.length > 0) {
$container.imagesLoaded(function () {
$container.masonry({
columnWidth: '.productItem',
itemSelector: '.productItem'
});
});
}
replaceNewShopUrl(); // 强行改变建站的URL
clearCancelorRedoData();
});
function clearCancelorRedoData() {
if (typeof(CanDesign) == 'undefined' || CanDesign != "True") return false;
$.ajax(
{
url: "/index.php?c=Front/CancelOrRedo&a=clearData",
dataType: "json",
success: function (json) {
var status = !window.cancelOrRedoObj
addScript('/scripts/CancelOrRedo.js', function () {
if (status) {
window.cancelOrRedoObj = new cancelorredo();
}
window.cancelOrRedoObj.cancellist = [];
window.cancelOrRedoObj.redolist = [];
window.cancelOrRedoObj.tempdata = [];
});
}
});
}
function isMobileBroswer() {
var sUserAgent = navigator.userAgent.toLowerCase();
var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
var bIsMidp = sUserAgent.match(/midp/i) == "midp";
var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
var bIsAndroid = sUserAgent.match(/android/i) == "android";
var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
var bIsWeixin = sUserAgent.match(/micromessenger/i) == "micromessenger";
if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM || bIsWeixin) {
return true;
} else {
return false;
}
}
function setZonePadding() {
if ($("#BodyLeftZone").length > 0 && $("#BodyLeftZone").css("display") != "none") $("#BodyMain1Zone,#BodyMain2Zone,#BodyMain3Zone,#BodyMain4Zone").css({"padding-left": "3px"});
else $("#BodyMain1Zone,#BodyMain2Zone,#BodyMain3Zone,#BodyMain4Zone").css({"padding-left": "0px"});
if ($("#BodyRightZone").length > 0 && $("#BodyRightZone").css("display") != "none") $("#BodyMain1Zone,#BodyMain2Zone,#BodyMain3Zone,#BodyMain4Zone").css({"padding-right": "3px"});
else $("#BodyMain1Zone,#BodyMain2Zone,#BodyMain3Zone,#BodyMain4Zone").css({"padding-right": "0px"});
if (typeof CanDesign != 'undefined' && CanDesign == "True" && SiteType == "0") setTimeout(setZonePadding, 300);
}
function hasAbsoluteObj() {
var flag = false;
if (SiteType == "1") {
$("#BodyHeaderZone,#BodyMain1Zone,#BodyFooterZone").find(".ModuleItem:visible").each(function (i, item) {
if ($(item).css("position") == "absolute") {
flag = true;
}
});
}
return flag;
}
function isJiFenPage() {
if ($('#isJiFen').val() === '1') {
return 1;
} else {
return 0;
}
}
// 详情页面重新计算区域高度
function computeZoneHeight(zoneElem) {
var oZone = $(zoneElem);
resizeZone(oZone);
if (oZone.find(".ModuleProductDetail, .ModuleNewsDetail, .ModuleDownDetail").length > 0) {
$(zoneElem).find('img').each(function () {
this.onload = function () {
resizeZone(oZone);
}
});
}
if (!oZone.hasClass('ModuleTabsContent')) {
setTimeout(function () {
resizeZone(zoneElem)
}, 500);
setTimeout(function () {
resizeZone(zoneElem)
}, 1000);
setTimeout(function () {
resizeZone(zoneElem)
}, 2000);
setTimeout(function () {
resizeZone(zoneElem)
}, 4000);
}
}
//h5 计算自由模块的横坐标
function zoneHasAbsoluteObj(zone) {
var hasAbsolute = false;
$(zone).find(".ModuleItem:visible").each(function (i, item) {
if ($(item).css("position") == "absolute") {
hasAbsolute = true;
}
});
return hasAbsolute;
}
function computeFreeModulePosition(module) {
if (SiteType != "1") return;
window.nodelayimg = true; //H5站混合静态和自由模块时,不能使用图片延时加载,因为图片延时加载会改变页面的高度
if (module) {
var m = null;
if (typeof module == 'object') m = $(module);
else m = $('#' + module);
var parent = m.closest("#HeaderZone,#FooterZone,#BodyMain1Zone");
if ($(window).width() > 993) {
if (m.attr('float') == 'free') {
var helperid = 'freemodulehelper';
var helper = $("#" + helperid);
var left = helper.offset().left + parseInt(m.attr('floatx'));
m.css({'visibility': 'visible', 'display': 'block', 'left': left + "px"});
}
m.parent().find('.ModuleGridContainer').each(function (i, grid) {
$(grid).css('min-width', $(grid).css('max-width'));
});
//处理产品列表模块的响应横版PAD的功能
m.parent().find('.productsBox').each(function (i, prolist) {
for (var k = 1; k < 11; k++) {
$(prolist).removeClass('col-md-' + k);
$(prolist).removeClass('col-sm-' + k);
$(prolist).removeClass('col-xs-' + k);
}
$(prolist).addClass('col-xs-' + $(prolist).attr('pc-col'));
});
computeZoneHeight(parent);
} else {
m.css({'visibility': 'hidden', 'display': 'none'});
if (!zoneHasAbsoluteObj(parent)) parent.css("height", "auto");
m.parent().find('.ModuleGridContainer').each(function (i, grid) {
$(grid).css('min-width', '0');
});
}
} else {
var modules = $(".ModuleItem[float=free]");
$.each(modules, function (i, item) {
computeFreeModulePosition(item);
});
}
}
function resizeZone(oZone) {
var iZoneHeight = 0;
//var padscale = isPad();
oZone.children('.ModuleItem:visible').each(function () {
iZoneHeight = Math.max(iZoneHeight, $(this).outerHeight(false) + $(this).position().top);
});
oZone.css('height', iZoneHeight);
if (getCookie("SiteType") == "1" && !zoneHasAbsoluteObj(oZone)) {
$(oZone).css('height', 'auto');
}
}
//让图片根据上级容器的尺寸自动适应大小
function resizeImage(imgo) {
var img = new Image();
img.src = $(imgo).prop('src');
// 按比例缩放,原图小于外框不操作
var bw = $(imgo).parent().width();
var bh = $(imgo).parent().height();
var ow = img.width;
var oh = img.height;
var nw, nh;
if (ow > bw || oh > bh) {
if (ow / oh >= bw / bh) {
nw = bw;
nh = nw * oh / ow;
} else if (ow / oh < bw / bh) {
nh = bh;
nw = nh * ow / oh;
}
} else {
nw = ow;
nh = oh;
}
$(imgo).width(nw);
$(imgo).height(nh);
$(imgo).css({'margin-top': (bh - $(imgo).outerHeight(false)) / 2 + 'px'});
}
function SetImageWidth() {
if (SiteType == "1") {
$("img").each(function () {
if ($(this).closest('.ModuleNewsDetail').length > 0 || $(this).closest('.ModuleJiuGong,.ModuleJiuGongV2').length > 0) return true;
// $(this).css('max-width', '100%');
});
$('.goods-detail-content table').each(function () {
if ($(this).width() > $("#pagebody").width()) {
$(this).css('width', '100%');
}
});
}
$("img").each(function () {
if ($(this).closest('.ModuleNewsDetail').length > 0 || $(this).hasClass('vCodeImg')) return true;
if ($(this).width() > $("#pagebody").width() && $("#pagebody").length > 0) {
var oldh = $(this).height();
var oldw = $(this).width();
try {
var offsetp = $(this).closest(".ModuleItem").offset().left;
var offset = $(this).offset().left;
var offsetx = offset - offsetp;
if (offsetx < 0) offsetx = 0;
} catch (e) {
}
var w = parseInt($("#pagebody").width() * 0.95) - offsetx;
var h = parseInt(oldh / (oldw / w));
if (SiteType == 0) $(this).css({"width": w, "height": h});
}
if ($(this).closest('.PIMG').length == 0) {
$(this).prop("src", $(this).attr("src"));
$(this).on('load', function () {
if ($(this).width > $("#pagebody").width()) {
var oldh = $(this).height();
var oldw = $(this).width();
try {
var offsetp = $(this).closest(".ModuleItem").offset().left;
var offset = $(this).offset().left;
var offsetx = offset - offsetp;
if (offsetx < 0) offsetx = 0;
} catch (e) {
}
var w = parseInt($("#pagebody").width() * 0.95) - offsetx;
var h = parseInt(oldh / (oldw / w));
$(this).css({"width": w, "height": h});
}
});
}
});
}
function showhideNav() {
if ($("#MobileFootNav").attr("enable") == 1 && $("#pagebody").width() >= 751) {
$('#MobileFootNav,#MobileFootNavRenderElem').hide();
} else if ($("#MobileFootNav").attr("enable") == 1 && $("#pagebody").width() < 751) {
$('#MobileFootNav,#MobileFootNavRenderElem').show();
} else if ($("#MobileFootNav").attr("enable") == 0) {
$('#MobileFootNav,#MobileFootNavRenderElem').hide();
}
if ($("#MobileNav").attr("enable") == 1 && $("#pagebody").width() >= 1200 || $("#MobileNav").attr("enable") == 1 && ($("#pagebody").width() >= 975 && $("#pagebody").width() < 1200)) {
$('#MobileNav,#MobileNavRenderElem,#MobileNavFloatLayer,#MobileNavMask').hide();
$('#pagebody').css("left", "0rem");
$("#MobileFootNav").removeClass("showFloatNav");
} else if ($("#MobileNav").attr("enable") == 1 && ($("#pagebody").width() >= 751 && $("#pagebody").width() < 975) || $("#MobileNav").attr("enable") == 1 && $("#pagebody").width() < 740) {
$('#MobileNav,#MobileNavRenderElem,#MobileNavFloatLayer,#MobileNavMask').show();
if ($("#MobileNav").attr("navnum") == 4 || $("#MobileNav").attr("navnum") == 6 || $("#MobileNav").attr("navnum") == 7) {
$('#MobileNavRenderElem').hide();
} else {
$('#MobileNavRenderElem').show();
}
if ($("#MobileNavFloatLayer").hasClass("showFloatNav") == false) {
$('#pagebody').css("left", "0rem");
$("#MobileFootNav").removeClass("showFloatNav");
} else {
if ($("#MobileNav").attr("navnum") == 5) {
$('#pagebody').css("left", "6.25rem");
$("#MobileFootNav").addClass("showFloatNav");
} else if ($("#MobileNav").attr("navnum") == 1) {
$('#pagebody').css("left", "10rem");
$("#MobileFootNav").addClass("showFloatNav");
}
}
} else if ($("#MobileNav").attr("enable") == 0 && $("#pagebody").width() > 1200 || $("#MobileNav").attr("enable") == 0 && ($("#pagebody").width() >= 975 && $("#pagebody").width() < 1200) || $("#MobileNav").attr("enable") == 0 && ($("#pagebody").width() >= 751 && $("#pagebody").width() < 975) || $("#MobileNav").attr("enable") == 0 && $("#pagebody").width() < 740) {
$('#MobileNav,#MobileNavRenderElem,#MobileNavFloatLayer,#MobileNavMask').hide();
}
if ($('#MobileNav').attr('navnum') == 4) {
if ($("#pagebody").width() < 740) {
$('#MobileNavFloatLayer').css("left", "18.9%")
} else if ($("#pagebody").width() > 500 && $("#pagebody").width() <= 751) {
$('#MobileNavFloatLayer').css("left", "13%")
} else if ($("#pagebody").width() > 751 && $("#pagebody").width() <= 975) {
$('#MobileNavFloatLayer').css("left", "11.5%")
} else {
$('#MobileNavFloatLayer').css("left", "8%")
}
}
if ($("#pagebody").width() > 768) {
$(".FootNavMask,.FootNavQRCodeImg,.QQList").hide();
$(".goods-btn").show();
} else {
$(".FootNavMask,.FootNavQRCodeImg,.QQList").show();
$(".goods-btn").hide();
}
if ($("#MobileFootNav").length > 0) {
if ($("#MobileFootNav").is(":hidden")) {
$('#pagebody').css('padding-bottom', "0")
} else {
$('#pagebody').css('padding-bottom', $("#MobileFootNav").height());
}
}
$(".FootNavQRCodeImg").css({
"width": "192px",
"height": "192px",
"top": "initial",
"bottom": $('#MobileFootNav').innerHeight(),
"left": ($('body').outerWidth() / 2 - $(".FootNavQRCodeImg").outerWidth() / 2)
});
}
function TopNewLoad() {
$(".TopNews").each(function () {
var repNum = Number($(this).attr("lang"));
var iWidth = ($(this).width() / repNum) - (repNum * 10); //($(this).find("li").width() / repNum) - (repNum * 10);
$(this).find("li>span").css({"width": iWidth + "px", "margin-right": "8px"});
$(this).find("li").each(function () {
if ($(this).children("span").toArray().length > 1) {
$(this).children("span").last().css({"margin-right": "0px", "float": "right"});
}
});
});
}
function NewsList() {
$(".BodyCenterNews").each(function () {
var repNum = parseInt($(this).attr("RepeatNum")) > 0 ? parseInt($(this).attr("RepeatNum")) : 1;
var iWidth = ($(this).find("li").width() / repNum) - (repNum * 9);
$(this).find("i").css({/*"width": iWidth + "px",*/"margin-right": "5px", "overflow": "hidden"});
$(this).find("li").each(function () {
if ($(this).children("i").length > 1) {
$(this).children("i").last().css({"margin-right": "0px", "float": "right"});
}
});
if ($(this).attr("value") !== "") {
var itemHeight = $(this).find(".vTicker").find("li").height();
var iHeight = $(this).find(".vTicker>ul").height();
var showItems = parseInt(iHeight / itemHeight);
$(this).find(".vTicker").vTicker({
speed: 500,
pause: 3000,
direction: $(this).attr("value"),
mousePause: true,
showItems: showItems
}).css({"height": iHeight + "px"}).find("li").css({"padding": "0 5px"});
}
});
}
function ProductList() {
$(".ModuleProductList").each(function () {
if ($(this).find(".myslider").attr("value") !== "") {
$(this).find(".myslider").easySlider({
auto: true,
continuous: true,
vertical: false,
controlsShow: false
});
}
});
}
function SetProductListImage(module, sitetype) {
if (typeof(module) != "object") module = $('#module_' + module);
module.find('.PIMG>img').each(function () {
var src = $(this).attr("src");
$(this).attr("src", '');
$(this).on('load', function () {
resizeProductListImageSize(this);
});
$(this).attr("src", src);
});
initProductListEffect(module, sitetype);
}
function resizeProductListImageSize(img) {
$(img).css({'width': 'auto', 'height': 'auto'}); //先清除图片的高宽
var picWrapper = $(img).closest('.PicWrapper');
var imgParent = $(img).parent();
var imgp_pl = parseFloat(imgParent.css('padding-left') ? imgParent.css('padding-left') : 0);
var imgp_pr = parseFloat(imgParent.css('padding-right') ? imgParent.css('padding-right') : 0);
var imgp_pt = parseFloat(imgParent.css('padding-top') ? imgParent.css('padding-top') : 0);
var imgp_pb = parseFloat(imgParent.css('padding-bottom') ? imgParent.css('padding-bottom') : 0);
var imgp_bl = parseFloat(imgParent.css('border-left') ? imgParent.css('border-left') : 0);
var imgp_br = parseFloat(imgParent.css('border-right') ? imgParent.css('border-right') : 0);
var imgp_bt = parseFloat(imgParent.css('border-top') ? imgParent.css('border-top') : 0);
var imgp_bb = parseFloat(imgParent.css('border-bottom') ? imgParent.css('border-bottom') : 0);
var bw = picWrapper.innerWidth() - imgp_pl - imgp_pr - imgp_bl - imgp_br;
var bh = picWrapper.innerHeight() - imgp_pt - imgp_pb - imgp_bt - imgp_bb;
var ow = img.width;
var oh = img.height;
var nw, nh;
if (ow > bw || oh > bh) {
if (ow / oh >= bw / bh) {
nw = bw;
nh = nw * oh / ow;
} else if (ow / oh < bw / bh) {
nh = bh;
nw = nh * ow / oh;
}
} else {
nw = ow;
nh = oh;
}
$(img).css({
width: nw + 'px',
height: nh + 'px'
});
$(img).css({'margin-top': (bh - $(img).outerHeight(false)) / 2 + 'px'});
if ($(img).parent().css('text-align').toLowerCase() != 'center') {
$(img).css({'margin-left': (bw - $(img).outerWidth(false)) / 2 + 'px'});
}
}
function initProductListEffect(module, sitetype) {
if (typeof(module) != "object") module = $('#module_' + module);
var oProductList = $(module).find('.ProductList');
var showstyle = oProductList.attr('showstyle');
var direction = oProductList.attr('direction');
var countPerGroup = oProductList.attr('repeatnum');
if (CanDesign == "True" && showstyle > 0) {
module.resize(function () {
if (module.css("position") != 'absolute') oProductList.parent().css({
'position': 'relative',
overflow: 'hidden',
'width': module.width() + "px"
});
});
}
if (sitetype == 1) {
// 修复手机下,描述文字不确定导致".PDetail"高度不齐的的bug
if (!module.attr("haschangedetail")) {
iRepeatnum = parseFloat(oProductList.attr('repeatnum'));
if (iRepeatnum == 0 || showstyle == 1 || showstyle == 2) {
var iMaxHeight = 0;
module.find('.PDetail').each(function () {
iMaxHeight = Math.max(iMaxHeight, $(this).height());
})
module.find('.PDetail').css('height', iMaxHeight);
} else {
var iTotalLine = Math.ceil(module.find('.PDetail').length / iRepeatnum);
var oPDetails = module.find('.PDetail');
for (var i = 0; i < iTotalLine; i++) {
var iMaxHeight = 0;
oPDetails.each(function (j) {
if (i * iRepeatnum <= j && j < (i + 1) * iRepeatnum) {
iMaxHeight = Math.max(iMaxHeight, $(this).height());
}
})
oPDetails.slice(i * iRepeatnum, (i + 1) * iRepeatnum).css('height', iMaxHeight);
}
}
module.attr("haschangedetail", "1");
}
}
if (window['effectInterval_' + module.attr('id')]) {
clearInterval(window['effectInterval_' + module.attr('id')]);
}
if (module.length > 0) {
if (showstyle == 1) { // 连续滚动
var oProductBoxes = oProductList.children('.ProductBox').css({float: 'left'});
if (sitetype == 1) {
oProductList.find('center').css('display', 'inline-block');
// 手机实际width通常是带小数的,但jquery所有方法返回宽度都是向下取的整数,所以为了计算准确,+1px
oProductBoxes.css({width: 'auto'}).css({width: oProductBoxes.width() + 1});
}
var listWidth = module.width();
oProductList.parent().css({'position': 'relative', overflow: 'hidden', 'width': module.width() + "px"});
var iWidth = oProductBoxes.outerWidth(true) * oProductBoxes.length * 2;
var iHeight = oProductBoxes.outerHeight(true);
oProductList.css({
position: 'relative',
left: '0px',
width: iWidth + 'px',
height: iHeight + 'px',
overflow: 'hidden'
});
if (module.width() > iWidth) return;
if (module.attr('hasinit') != 1) {
oProductList.append(oProductList.clone(true).children());
module.attr('hasinit', 1);
}
;
var iRefreshInterval = 40;
var iStep = 1;
if (window['effectInterval_' + module.attr('id')]) {
clearInterval(window['effectInterval_' + module.attr('id')])
}
window['effectInterval_' + module.attr('id')] = setInterval(function () {
if (oProductList.attr('ishovering') == 1 && oProductList.attr('hoverstop') == 1) {
return;
}
if (direction == 'left') {
if (oProductList.position().left <= -oProductList.innerWidth() / 2) {
oProductList.css('left', (oProductList.position().left + oProductList.innerWidth() / 2) + 'px');
}
oProductList.css('left', (oProductList.position().left - parseInt(oProductList.parent().css('padding-left')) - iStep) + 'px');
} else {
if (oProductList.position().left >= 0) {
oProductList.css('left', (-oProductList.innerWidth() / 2) + 'px');
}
oProductList.css('left', (oProductList.position().left - parseInt(oProductList.parent().css('padding-left')) + iStep) + 'px');
}
}, iRefreshInterval);
} else if (showstyle == 2) { // 一屏屏滚动
var oProductBoxes = module.find('.ProductBox');
var iGroupCount = Math.ceil(oProductBoxes.length / countPerGroup);
for (var i = 0; i < iGroupCount; i++) {
$(oProductBoxes.slice(i * countPerGroup, i * countPerGroup + countPerGroup)).wrapAll('');
}
if (sitetype == 1) {
oProductBoxes.css({width: 'auto', height: 'auto', padding: '2px'});
}
oProductList.parent().css({'position': 'relative', overflow: 'hidden', 'width': module.width() + "px"});
var oProductGroups = module.find('.ProductGroup');
if (!oProductGroups.parent().is('.ProductGroupList')) {
oProductGroups.wrapAll('');
}
var oProductGroupList = module.find('.ProductGroupList');
if (module.css("position") != "absolute") {
iHeight = $(oProductBoxes[0]).height();
}
oProductGroupList.css({
position: 'relative',
top: '0px',
width: module.innerWidth() * iGroupCount + 'px',
overflow: 'hidden'
});
oProductGroups.css({float: 'left', width: module.innerWidth() + 'px', height: module.innerHeight() + 'px'});
if (iGroupCount <= 1) {
return;
}
if (direction == 'left') {
oProductGroupList.css({left: '0px', right: 'auto'});
} else {
for (var i = 0; i < iGroupCount; i++) {
oProductGroups = module.find('.ProductGroup');
oProductGroups.eq(-1).insertBefore(oProductGroups.eq(i));
}
oProductGroupList.css({left: 'auto', right: module.innerWidth() * (iGroupCount - 1) + 'px'});
}
module.find('.PDetail').css('width', module.find('.PicWrapper').width());
window['effectInterval_' + module.attr('id')] = setInterval(function () {
if (module.find('.ProductList').attr('ishovering') == 1 && module.find('.ProductList').attr('hoverstop') == 1) {
return;
}
var oProductGroupList = module.find('.ProductGroupList');
var oProductGroups = module.find('.ProductGroup');
if (direction == 'left') {
oProductGroupList.animate({
left: '-=' + oProductGroups.outerWidth(true) + 'px'
}, 1000, function () {
oProductGroups.eq(0).insertAfter(oProductGroups.eq(-1));
oProductGroupList.css('left', 0);
});
} else {
oProductGroupList.animate({
right: '-=' + oProductGroups.outerWidth(true) + 'px'
}, 1000, function () {
oProductGroups.eq(-1).insertBefore(oProductGroups.eq(0));
oProductGroupList.css('right', oProductGroups.outerWidth(true) * (iGroupCount - 1) + 'px');
});
}
}, 6000);
}
}
}
function showShopModal(productid, e, productShowType, DetailUrl, Param_Target) {
if (DetailUrl.indexOf('http') > -1) {
window.open(DetailUrl, Param_Target);
return false;
}
e = e || window.event;
e.stopPropagation && e.stopPropagation();
e.preventDefault && e.preventDefault();
e.cancelBubble = true;
if (!productid) {
return false;
}
if (typeof productShowType == 'undefined') {
productShowType = 0;
}
var productSkus = [];
$.ajax({
url: '/index.php?c=Front/ProductData',
type: 'get',
data: {id: productid, productShowType: productShowType},
dataType: 'json',
async: false,
cache: false,
success: function (json) {
if (!json) {
alert('无此商品');
return;
}
var lg = json.lg;//多语言
var windowWidth = $(window).width();
productShowType = json.productShowType;
productSkus = json.productSkus || [];
var html = '';
html += '';
var dialog = bootbox.dialog({
title: lg.quick_purchase,
message: html,
show: false,
className: 'shopCartModal',
buttons: {}
}).on('shown.bs.modal', function () {
$('.pro_appeal').height($('.pro_appeal').width());
}).on('hidden.bs.modal', function () {
if (!window.CanDesign) {
$('.swiper-container').each(function () {
$(this)[0].swiper.startAutoplay();
});
}
}).modal('show');
$('.shopCartModal').css('z-index', '10000');
var surplus = parseInt(json.surplus);
if (isNaN(surplus) || surplus == 0) {
$('.shopCartModal .Shtml').hide();
} else {
$('.shopCartModal .Shtml').show();
}
function checkValid() {
if (!/^\d+$/.test($('#ShopModalProNum').val() + '')) {
alert(lg.file_in_quantity);
return;
}
var enableInventory = $('.shopCartModal [name=enableInventory]').val();
if (enableInventory) {
var productQuantity = parseInt($('.shopCartModal .productQuantity').attr('productQuantity'));
if (!isNaN(productQuantity) && parseInt($('#ShopModalProNum').val()) > productQuantity) {
alert(lg.not_exceed_stock);
return false;
}
}
if (productSkus.length > 0 && !$('.shopCartModal [name="skuid"]').val()) {
alert(lg.select_spec);
return false;
}
return true;
}
$('.shopCartModal .pro_amount').disableSelection();
$('.shopCartModal .sys_spec_text>li').off().on('click', function () {
if ($(this).hasClass('outOfStock')) {
return;
}
if ($(this).hasClass('selected')) {
$(this).removeClass('selected');
} else {
var attrkeyid = $(this).attr('attrkeyid');
$('[attrkeyid=' + attrkeyid + ']').not(this).removeClass('selected');
$(this).addClass('selected');
}
var attrkeycount = $('.shopCartModal .sys_spec_text').length;
var attrvalselectedcount = $('.shopCartModal .sys_spec_text>li.selected').length;
if (attrkeycount - attrvalselectedcount == 1 || attrkeycount == attrvalselectedcount) {
$('.shopCartModal .sys_spec_text>li').removeClass('outOfStock');
var elemAttrVals = $('.shopCartModal .sys_spec_text>li').not('.selected');
elemAttrVals.each(function () {
var path = '';
var elemAttrValInOtherKeys = $('.shopCartModal .sys_spec_text').not($(this).closest('.shopCartModal .sys_spec_text')).find('li.selected');
elemAttrValInOtherKeys.each(function () {
path += $(this).attr('attrvalid') + ',';
});
path += $(this).attr('attrvalid');
path = path.split(',').sort().join(',');
for (var i = 0; i < productSkus.length; i++) {
var sku = productSkus[i];
var skuPath = (sku.Path || '').split(',').sort().join(',');
if (skuPath == path) {
if (sku.ProductQuantity <= 0) {
$(this).addClass('outOfStock');
} else {
$(this).removeClass('outOfStock');
}
break;
}
}
});
} else {
$('.shopCartModal .sys_spec_text>li').removeClass('outOfStock');
}
if (attrkeycount == attrvalselectedcount) {
var attrkeyid = $(this).attr('attrkeyid');
$('[attrkeyid=' + attrkeyid + ']').not(this).removeClass('selected');
$(this).addClass('selected');
var path = '';
$('.shopCartModal .sys_spec_text>li.selected').each(function () {
path += $(this).attr('attrvalid') + ',';
});
path = path.replace(/(^,)|(,$)/g, '');
path = path.split(',').sort().join(',');
var price = 0;
var point = 0;
var skuid = 0;
var surplus = 0;
var productQuantity = 0;
for (var i = 0; i < productSkus.length; i++) {
if (path == productSkus[i].Path.split(',').sort().join(',')) {
point = productSkus[i].Jf_convert;
price = productSkus[i].Price;
skuid = productSkus[i].SkuID;
surplus = productSkus[i].surplus;
productQuantity = productSkus[i].ProductQuantity;
break;
}
}
var priceHtml = '';
if (productShowType == 1) {
point = parseFloat(point).toFixed(2);
surplus = parseFloat(surplus).toFixed(2);
$('.shopCartModal .price').text(point).data('singlePrice', price);
$(".shopCartModal .Shtml").attr('surplus', surplus).html(lg.pay_extra + '¥' + surplus);
var surplus = parseInt(json.surplus);
if (isNaN(surplus) || surplus == 0) {
$('.shopCartModal .Shtml').hide();
} else {
$('.shopCartModal .Shtml').show();
}
priceHtml = point;
} else {
price = parseFloat(price).toFixed(2);
$('.shopCartModal .price').text('¥' + price).data('singlePrice', price);
}
$(".shopCartModal input[name=skuid]").val(skuid);
$('.shopCartModal .productQuantity').text(productQuantity).attr('productQuantity', productQuantity);
} else {
var minVal = -1, maxVal = 0, productQuantity = 0;
for (var i = 0; i < productSkus.length; i++) {
var val = 0;
if (productShowType == 1) {
val = parseFloat(productSkus[i].Jf_convert);
} else {
val = parseFloat(productSkus[i].Price);
}
minVal = minVal == -1 ? val : Math.min(minVal, val);
maxVal = maxVal == -1 ? val : Math.max(maxVal, val);
productQuantity += parseInt(productSkus[i].ProductQuantity);
}
var pHtml = minVal.toFixed(2);
if (minVal != maxVal) {
pHtml = minVal.toFixed(2) + ' - ' + maxVal.toFixed(2);
}
if (productShowType != 1) {
pHtml = '¥' + pHtml;
}
$(".shopCartModal .Shtml").hide();
$('.shopCartModal .price').text(pHtml);//.data('singlePrice', price);
$(".shopCartModal input[name=skuid]").val(skuid);
$('.shopCartModal .productQuantity').text(productQuantity).attr('productQuantity', productQuantity);
}
});
$('.shopCartModal .sys_spec_text>li:nth-child(1)').each(function () {
$(this).click();
});
$(".shopCartModal .reduce").off().on('click', function () {
var num = parseInt($("#ShopModalProNum").val());
if (num == 1) return;
else $("#ShopModalProNum").val(num - 1);
var price = $('.shopCartModal .price').data('singlePrice');
});
$(".shopCartModal .add").off().on('click', function () {
var num = parseInt($("#ShopModalProNum").val());
$("#ShopModalProNum").val(num + 1);
var price = $('.shopCartModal .price').data('singlePrice');
});
$(".shopCartModal #ShopModalProNum").off().on('change', function () {
var num = parseInt($("#ShopModalProNum").val());
var price = $('.shopCartModal .price').data('singlePrice');
});
if (json.isSingleNorm) {
$('.shopCartModal .price').data('singlePrice', json.price);
}
$('.shopCartModal .ShopCart,.shopCartModal .Buy').off().on('click', function () {
var islocation = $(this).attr('islocation');
var skuid = $("form[name=ShopModalForm]").find("input[name=skuid]").val();
var num = $("form[name=ShopModalForm]").find("input[name=Num]").val();
if (!checkValid()) return false;
$('.add-cart-result').remove();
var hintHtml = '
');
}
$(item).closest(".page-more").replaceWith(page_more);
$("#module_" + moduleId).find(".PageNavigate,.page-nav").replaceWith($(request.responseText).find(".PageNavigate,.page-nav"));
} else {
$("#module_" + moduleId).replaceWith(request.responseText);
}
BindPagerAction();
if (typeof CanDesign != 'undefined' && CanDesign != "True") {
var bodyClientHeight = document.documentElement.clientHeight // 因为有DOCTYPE
if (bodyClientHeight == 0) bodyClientHeight = window.innerHeight;
var bodySrollTop = $('body').scrollTop();
if (bodySrollTop == 0) bodySrollTop = $(window).scrollTop();
var relModule = $("#module_" + moduleId).eq(0);
var originModuleHeight = relModule.height();
if (relModule.length > 0) {
if (!ispagemore) {
if (SiteType == 0) {
if (originModuleHeight > bodyClientHeight || getElementTop(relModule[0]) < bodySrollTop) {
$('body,html').animate({scrollTop: getElementTop(relModule[0])}, 1000);
}
} else {
window.location.href = "#module_" + moduleId;
}
}
}
}
//加载完成后 重新调用一下该模块的init方法
if (window["initFunc" + moduleId]) {
window["initFunc" + moduleId]();
}
}
});
return false;
}
}
}
function getElementTop(obj) {
var i = obj.offsetTop;
if (obj.offsetParent != null) i += getElementTop(obj.offsetParent);
return i;
}
function getElementLeft(obj) {
var i = obj.offsetLeft;
if (obj.offsetParent != null) i += getElementLeft(obj.offsetParent);
return i;
}
function getElementTopWithBorder(obj) {
var i = obj.offsetTop + parseFloat($(obj).css('border-top-width'));
if (obj.offsetParent != null) i += getElementTopWithBorder(obj.offsetParent);
return i;
}
function getElementLeftWithBorder(obj) {
var i = obj.offsetLeft + parseFloat($(obj).css('border-left-width'));
if (obj.offsetParent != null) i += getElementLeftWithBorder(obj.offsetParent);
return i;
}
function AddFavorite(sURL, sTitle) {
if (!sURL) sURL = location.href;
if (!sTitle) sTitle = document.title;
try {
window.external.addFavorite(sURL, sTitle);
} catch (e) {
try {
window.sidebar.addPanel(sTitle, sURL, "");
} catch (e) {
alert("加入收藏失败,请使用Ctrl+D进行添加");
}
}
}
function SetHome() {
if (document.all) {
document.body.style.behavior = 'url(#default#homepage)';
document.body.setHomePage(window.location.href);
} else if (window.sidebar) {
if (window.netscape) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
} catch (e) {
alert("该操作被浏览器拒绝,如果想启用该功能,请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值改为true");
}
}
var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
prefs.setCharPref('browser.startup.homepage', window.location.href);
} else {
alert('您的浏览器不支持自动自动设置首页, 请使用浏览器菜单手动设置!');
}
}
/************
2015年3月24日14:21:59 创建人:郑江 主要针对模块的高级功能的js
************/
//图片的半透明效果
function ShowTransparent(obj) {
$(obj).animate({
opacity: 0.7
}, 300, function () {
});
}
//图片不透明
function HideTransparent(obj) {
$(obj).animate({
opacity: 1
}, 300, function () {
});
}
//浮影
var oSetTimeout = null;
function ImgShade(obj, type) {
var oDiv = $(obj).parent().find("div[name='shade']");
$(obj).parent().css("position", "relative");
if ($(obj).parent().is("a")) $(obj).parent().css("display", "block");
if (oDiv.length == 0) {
oDiv = $("
" + $(obj).attr('alt') + "
").appendTo($(obj).parent()).css('height', 0);
}
var bc = $(obj);
var module = $(obj).closest('.ModuleItem');
var top = bc.position().top;
var left = bc.offset().left - $(obj).closest('.BodyCenter').offset().left;
var w = bc.width();
var h = bc.height();
if (type == 'ShadeTop') {
$(oDiv).attr("class", "showShadeTop").css({'width': w, 'left': left, 'top': 0}).show();
} else if (type == 'ShadeBottom') {
$(oDiv).attr("class", "showShadeBottom").css({'width': w, 'left': left, 'bottom': 0}).show();
} else {
$(oDiv).attr("class", "showShadeTop").css({'width': w, 'left': left, 'top': 0}).show();
}
var isShadeAll = type == 'Shade';
if (isShadeAll) $(oDiv).css({'line-height': h + 'px', 'font-size': '18px'});
$(oDiv).stop().animate({height: (isShadeAll ? h + 'px' : "50px")}, (isShadeAll ? 100 : 200), function () {
});
//2015年6月1日17:44:45 郑江 当鼠标进入div(浮影)的时候关掉定时器
$(oDiv).mouseenter(function () {
clearTimeout(oSetTimeout);
});
$(oDiv).mouseleave(function () {
divZoom(oDiv, type);
});
}
function unImgShade(obj, type) {
if ($(obj).parent().find("div[name='shade']").length == 0) $(obj).parent().append("
" + $(obj).attr('alt') + "
");
var oDiv = $(obj).parent().find("div[name='shade']");
oSetTimeout = setTimeout(function () {
divZoom(oDiv, type);
}, 200);
}
//2015年6月2日14:19:10 郑江 隐藏div动画
function divZoom(obj, type) {
$(obj).stop().animate({
height: "0px"
}, 200, function () {
if (type == 'ShadeTop') $(obj).attr("class", "hideShadeTop").hide();
else $(obj).attr("class", "hideShadeBottom").hide();
});
}
function moduleImageHover(obj) {
var width = $(obj).width();
$(obj).stop().animate({opacity: 0}, 250, function () {
$(this).css('visibility', 'hidden');
});
$(obj).parent().css('position', 'relative');
if (!$(obj).parent().is('.BodyCenter')) {
$(obj).parent().css('display', 'block');
}
var left = ($(obj).parent().width() - $(obj).width()) / 2;
$(obj).siblings('img').stop().show().css({
'visibility': 'visible',
'box-sizing': 'border-box',
'top': '0',
'left': left + 'px',
'padding-top': $(obj).parent().css('padding-top') || 0,
'padding-left': $(obj).parent().css('padding-left') || 0,
'padding-bottom': $(obj).parent().css('padding-bottom') || 0,
'padding-right': $(obj).parent().css('padding-right') || 0
}).animate({opacity: 1}, 250);
}
function moduleImageUnHover(obj) {
$(obj).stop().animate({opacity: 0}, 250, function () {
$(this).css('visibility', 'hidden');
});
$(obj).siblings('img').stop().show().css('visibility', 'visible').animate({opacity: 1}, 250);
}
function ImgZoom(obj) {
var scale = $(obj).width() > 500 ? 1.02 : 1.10;
var step = $(obj).width() > 500 ? 0.001 : 0.005;
var curscale = 1;
$(obj).attr('zoom-step', step);
$(obj).parent().attr('zoom-overflow', $(obj).parent().css('overflow'));
$(obj).parent().css({'overflow': 'hidden'});
if ($(obj).parent().is('a')) $(obj).parent().css({'display': 'block'});
var f = function () {
$(obj).attr('zoom-scale', curscale);
$(obj).css({
'-webkit-transform': 'scale(' + curscale + ')',
'-ms-transform': 'scale(' + curscale + ')',
'-moz-transform': 'scale(' + curscale + ')',
'-o-transform': 'scale(' + curscale + ')',
'transform': 'scale(' + curscale + ')'
});
curscale += step;
if (curscale < scale) setTimeout(f, 10);
}
f();
}
function unImgZoom(obj) {
var scale = 1;
var curscale = parseFloat($(obj).attr('zoom-scale'));
var step = parseFloat($(obj).attr('zoom-step'));
var f = function () {
$(obj).css({
'-webkit-transform': 'scale(' + curscale + ')',
'-ms-transform': 'scale(' + curscale + ')',
'-moz-transform': 'scale(' + curscale + ')',
'-o-transform': 'scale(' + curscale + ')',
'transform': 'scale(' + curscale + ')'
});
curscale -= step;
if (curscale > scale) setTimeout(f, 10);
else $(obj).parent().css('overflow', $(obj).parent().attr('zoom-overflow'));
}
f();
}
/* start of 图文自动隐藏 */
function moduleImageTextHide(option) {
//多语言处理
if (!window.lang && typeof option != 'undefined') {
window.lang = {};
window.lang.show_more = option.lang.show_more;
}
var show_more = '显示更多';
if (typeof option != 'undefined') {
show_more = option.lang.show_more;
} else if (window.lang) {
show_more = window.lang.show_more;
}
//如果有绝对定位的模块,那自动隐藏就会有问题
if (SiteType == "1") {
$(".ModuleImageText,.ModuleImageTextV2,.ModuleImageTextGiant").each(function (i, item) {
var normalWidth = window.innerWidth;
var id = eachImageTextNode(i, item, show_more)
$(window).off('resize.moduleImageTextHide' + id).on('resize.moduleImageTextHide' + id, function () {
if (window.innerWidth < 768 && normalWidth != window.innerWidth) {
normalWidth = window.innerWidth
eachImageTextNode(i, item, show_more)
} else if (window.innerWidth >= 768 && normalWidth != window.innerWidth) {
normalWidth = window.innerWidth
moduleImageTextShow(id)
}
});
});
}
}
function eachImageTextNode(i, item, show_more) {
var m = $(item).closest(".ModuleItem");
var textcontainer = $(item).find(".imageTextContainer");
var id = m.attr('id');
var referwidth = $('#pagebody').width(); //m.width();
var hidew = 800;
if (textcontainer.attr('hidewidth')) hidew = parseInt(textcontainer.attr('hidewidth'));
var hideh = 150;
if (textcontainer.attr('hideheight')) hideh = parseInt(textcontainer.attr('hideheight'));
if ((m.css("position") == 'static' || m.css("position") == '')) {
if (referwidth < hidew && textcontainer.attr('autohide') == '1' && textcontainer.attr('hasResponsive') == '1' && textcontainer.attr('hasshow') != '1') {
if (m.find('.showHandle').length == 0) {
var $bodyc = m.find(".BodyCenter");
$bodyc.css({'height': hideh + 'px', 'overflow': 'hidden'});
$bodyc.parent().append("
");
}
}
else if (referwidth > hidew) {//添加到分栏时 编辑状态下 显示有问题 换为pagebody的宽度做比较
moduleImageTextShow(id);
}
}
return id
}
function moduleImageTextShow(id) {
var m = $("#" + id);
m.find(".showHandle").remove();
m.find(".BodyCenter").css({'height': 'auto', 'overflow': 'visible'});
}
/* end of 图文自动隐藏 */
function showSubMenu(obj, direction, subItemLocation) {
setTimeout(function(){
var oModuleNav = $(obj).closest('.ModuleNav,.ModuleNavGiant');
var oModuleItem = $(obj).closest('.ModuleItem');
var oContent = $(obj).closest('.main-nav-content');
var oNavSubMenu = $(obj).children('.NavSubMenu,.sub-nav-item-group');
var subAlign = $(obj).closest('.pre_nav').attr('SubAlign'); //left:左对齐,right:右对齐, auto: 根据主菜单的在屏幕中的相对位置对齐
var subHolder = $(obj).closest('.pre_nav').attr('SubHolder');
$(obj).addClass('on').siblings().removeClass('on');
var timeoutId = "moduleNavTimeout";
if (typeof direction == 'undefined') direction = $(obj).closest('.pre_nav').attr('data-direction');
if (typeof subItemLocation == 'undefined') subItemLocation = $(obj).closest('.pre_nav').attr('data-subitem-location');
if (window[timeoutId]) {
clearTimeout(window[timeoutId]);
}
oModuleNav.find('.NavSubMenu,.sub-nav-item-group').not(oNavSubMenu).hide();
oModuleNav.find('.navMainItem,.main-nav-item').not($(obj).children('.navMainItem,.main-nav-item')).removeClass('navMainItemHover');
$(obj).children('.navMainItem,.main-nav-item').addClass('navMainItemHover');
if ($('.moduleNavFloatSubMenu').attr('submenuid') != $(obj).attr('id')) {
$('.moduleNavFloatSubMenu').remove();
}
if (oNavSubMenu.children().length == 0) return;
if (oModuleNav.is(".ModuleNavGiant") && oNavSubMenu.find(".sub-nav-item").length == 0) return;
var navSubMenuClone = $(obj).clone(true).attr('onmouseover', null);
var classes = oModuleItem.find(">div").attr('class');
$(".moduleNavFloatSubMenu").remove();
$(".sub-nav-holder").hide();
var html = '
';
html += '
';
html += '
';
html += '
';
html += '
';
html += '
';
html += '
';
html += '
';
html += '
';
html += '
';
var floatSubMenu = $(html);
if (window.isDesignMode == true) {
floatSubMenu.appendTo('#pagebody');
} else {
floatSubMenu.appendTo('body');
}
var originOpacity = oModuleItem.css('opacity');
floatSubMenu.css('opacity', '1'); // 透明度不为1,会有bug。。。
navSubMenuClone.find('.NavSubMenu,.sub-nav-item-group').css('opacity', originOpacity);
floatSubMenu.find('dl').append(navSubMenuClone);
floatSubMenu.find('.pre_nav').addClass($(obj).closest('.pre_nav').attr('class'));
floatSubMenu.find('.navMainItem,.main-nav-item').remove();
floatSubMenu.css({position: 'static', height: 0, overflow: 'hidden'});
floatSubMenu.on('mouseenter', function () {
//debugger
if (window[timeoutId]) {
clearTimeout(window[timeoutId]);
}
});
$(subHolder).mouseenter(function () {
if (window[timeoutId]) clearTimeout(window[timeoutId]);
}).mouseleave(function () {
hideSubMenu(obj)
});
var iSubMenuMarginLeft = (floatSubMenu.find('.NavSubMenu,.sub-nav-item-group').outerWidth() - $(obj).find('.navMainItem,.main-nav-item').outerWidth()) / 2;
var isAlignRight = false;
if (subAlign == 'left') iSubMenuMarginLeft = 0;
if (subAlign == 'auto') {
if ($(obj).offset().left < (oModuleNav.offset().left + oModuleNav.width() / 2)) iSubMenuMarginLeft = 0;
else isAlignRight = true;
}
// 测试中。。
floatSubMenu.find('.NavSubMenu,.sub-nav-item-group').css({
position: 'absolute',
display: 'block',
zIndex: '999999'
});
floatSubMenu.find('.main-nav-content').css('position', 'static');
//全屏的子菜单背景(layout-109 专用 )
//$(subHolder).css({"top":($(obj).offset().top + $(obj).height()) + "px","position":"absolute","left":"0","width":"100%"}).show();
if (direction == '1' && subItemLocation == '0') {
floatSubMenu.find('.NavSubMenu,.sub-nav-item-group').css({
left: $(obj).offset().left - floatSubMenu.find('.NavSubMenu,.sub-nav-item-group').outerWidth(),
top: $(obj).offset().top,
marginTop: $(obj).find('.navMainItem,.main-nav-item').css('margin-top')
});
} else if (direction == '1' && subItemLocation == '1') {
floatSubMenu.find('.NavSubMenu,.sub-nav-item-group').css({
position: 'absolute',
display: 'block',
left: $(obj).offset().left + $(obj).outerWidth(),
top: $(obj).offset().top,
marginTop: $(obj).find('.navMainItem,.main-nav-item').css('margin-top')
});
} else if (direction == '0' && subItemLocation == '0') {
floatSubMenu.find('.NavSubMenu,.sub-nav-item-group').css({
top: $(obj).offset().top - floatSubMenu.find('.NavSubMenu,.sub-nav-item-group').outerHeight(),
left: $(obj).offset().left + (parseInt($(obj).css('padding-left')) || 0),
marginLeft: -iSubMenuMarginLeft
});
} else {
if (getCookie("SiteType") == "1") {
if (false && window.isDesignMode == true) {
var top = 0;
var left = 0;
var elem = $(obj)[0];
while (elem != null && $(elem).closest('#pagebody').length > 0 && !$(elem).is('#pagebody')) {
top += elem.offsetTop;
left += elem.offsetLeft;
elem = $(elem)[0].offsetParent;
}
floatSubMenu.find('.NavSubMenu,.sub-nav-item-group').css({
top: top + $(obj).outerHeight(),
left: left,
marginLeft: -iSubMenuMarginLeft
});
} else {
// 如果是居右的
var positLeft = $(obj).find('.sub-nav-side-group').children().length > 0 ? $(obj).find('.OneRow').offset().left : $(obj).find('.sub-nav-side-group').hasClass('nav-giant-layout-112') ? $(obj).offset().left - 20 : $(obj).offset().left;
var marLeft = $(obj).find('.sub-nav-side-group').hasClass('nav-giant-layout-112') ? 0 : -iSubMenuMarginLeft;
if (isAlignRight && oModuleNav.hasClass('layout-109')) {
positLeft = $(obj).find('.OneRow').offset().left;
marLeft = 0
}
floatSubMenu.find('.NavSubMenu,.sub-nav-item-group').css({
top: $(obj).offset().top + $(obj).outerHeight(),
left: positLeft,
marginLeft: marLeft,
maxWidth: window.innerWidth
});
}
floatSubMenu.find('.nav').show().css({height: 0});
} else {
floatSubMenu.find('.NavSubMenu,.sub-nav-item-group').css({
top: $(obj).offset().top + $(obj).outerHeight(),
left: $(obj).offset().left + (parseInt($(obj).css('padding-left')) || 0),
marginLeft: -iSubMenuMarginLeft
});
}
}
if (isAlignRight && !floatSubMenu.find('.sub-nav-item-group').hasClass('nav-giant-layout-112') && !oModuleNav.hasClass('layout-109')) {
floatSubMenu.find('.NavSubMenu,.sub-nav-item-group').css({"left": $(obj).offset().left + $(obj).width() - floatSubMenu.find('.NavSubMenu,.sub-nav-item-group').outerWidth(true)});
}
//解决子菜单背景根据二级导航换行而自适应高度 by Kong 2017/8/1
var diffHeight = 0;
var subItemHeight = 40;
var treeNavHeight = 13;
if (floatSubMenu.find('.sub-nav-item').length > 0) {
//2级菜单的高度
diffHeight = floatSubMenu.find('.sub-nav-item:last').offset().top - floatSubMenu.find('.sub-nav-item:first').offset().top;
subItemHeight = floatSubMenu.find('.sub-nav-item:first').outerHeight();
//如果存在三级菜单
if (floatSubMenu.find('.sub-nav-side-group.nav-giant-layout-112').children().length > 0) {
var objs = floatSubMenu.find('.sub-nav-side-group');
treeNavHeight += objs.eq(0).outerHeight();
$.each(objs, function (idx, obj) {
//当前这个ui的高度是否大于上一次ul的高度
if (idx > 0) {
if ($(obj).outerHeight() > objs.eq(idx - 1).outerHeight()) {
treeNavHeight += $(obj).outerHeight();
}
}
});
} else {
treeNavHeight = 0;
}
}
// layout-111
if (floatSubMenu.find('.sub-nav-item-group').hasClass('nav-giant-layout-111')) {
// 当前菜单距右的偏移
var navGiantOffsetRight = Math.abs($(window).width() - $(obj).offset().left);
// 当前菜单的二级菜单的总宽度
var navGiantWidth = floatSubMenu.find('.sub-nav-item-group.nav-giant-layout-111').children('.sub-menu-box').length *
parseInt(floatSubMenu.find('.sub-nav-item-group.nav-giant-layout-111').children('.sub-menu-box').eq(0).css('width')) +
parseInt(floatSubMenu.find('.sub-nav-item-group.nav-giant-layout-111').children('.sub-menu-box').eq(0).css('padding-right'));
// 判断对齐方向
if (oContent.css('text-align')) {
var navGiantStyleObj = '';
// 子菜单面板可能的最大宽度
var navGiantContentWidth = navGiantOffsetRight;
switch (oContent.css('text-align')) {
// left 对齐
case 'left':
// 如果右边已经满了,但是左边还有空隙
var navGiantContentStyleLeft = $(obj).offset().left
if (navGiantContentWidth < navGiantWidth) {
if (navGiantWidth < window.innerWidth) {
navGiantContentStyleLeft = window.innerWidth - navGiantWidth
} else {
navGiantContentStyleLeft = parseInt(floatSubMenu.find('.sub-nav-item-group.nav-giant-layout-111').children('.sub-menu-box').eq(0).css('width')) / 4
}
}
navGiantContentWidth += (navGiantContentStyleLeft * 6)
navGiantStyleObj = {
left: navGiantContentStyleLeft
}
break;
// center 对齐
case 'center':
navGiantContentWidth += (navGiantContentStyleLeft * 6)
navGiantStyleObj = {
marginLeft: 0
}
break;
// right 对齐
case 'right':
navGiantStyleObj = {
left: '',
right: navGiantOffsetRight - $(obj).width(),
marginLeft: 0
}
navGiantContentWidth = $(obj).offset().left
break;
}
}
// 当前二级菜单个数
var subMenuBoxItem = floatSubMenu.find('.sub-nav-item-group>.sub-menu-box').length;
// 用于储存每个二级列表下的三级列表个数
var threeItem = [];
// 查找每个二级列表下的三级列表个数
floatSubMenu.find('.sub-nav-item-group>.sub-menu-box').each(function () {
threeItem.push($(this).find('.three-nav-item-group>p').length)
});
// 判断个数
if (threeItem.length > 1) {
// 获取三级列表数组的个数最大值
var threeItemMAX = Math.max.apply(null, threeItem);
// 用子菜单面板可能的最大宽度跟当前菜单的二级菜单的总宽度来判断是否满足换行
if (navGiantContentWidth < navGiantWidth) {
// 重置圆角
floatSubMenu.find('.sub-nav-item-group>.sub-menu-box').eq(0).css('border-radius', '0px')
// 循环判断是从第几个开始换行
for (var i = 0, len = subMenuBoxItem; i < len; i++) {
if (navGiantContentWidth < (i * floatSubMenu.find('.sub-nav-item-group.nav-giant-layout-111').children('.sub-menu-box').eq(0).width() + 25)) {
break;
}
}
// 重新设置换行后的圆角
floatSubMenu.find('.sub-nav-item-group>.sub-menu-box').eq(i).css('border-radius', '0px 0px 0px 16px')
// 判断是否需要补齐换行的宽度
if ((subMenuBoxItem / 2) < i) {
// 补全缺失的宽度
for (var j = 0, len = (i - (subMenuBoxItem - i)); j < len; j++) {
floatSubMenu.find('.sub-nav-item-group').append('
')
}
}
}
}
floatSubMenu.find('.sub-nav-item-group').css(navGiantStyleObj)
}
if (floatSubMenu.find('.sub-nav-item-group').hasClass('nav-giant-layout-112')) {
//已经放满
if (window.innerWidth - (floatSubMenu.find('.sub-nav-item-group.nav-giant-layout-112').offset().left + floatSubMenu.find('.sub-nav-item-group.nav-giant-layout-112').outerWidth()) < 168) {
if (window.innerWidth - (floatSubMenu.find('.nav-list').length + 1) * 168 > 0) {
floatSubMenu.find('.sub-nav-item-group.sub-nav-item-group').css('left', window.innerWidth - (floatSubMenu.find('.nav-list').length + 1) * 168)
} else {
floatSubMenu.find('.sub-nav-item-group.sub-nav-item-group').css('left', 0)
}
} else {
floatSubMenu.find('.sub-nav-item-group').css('left', $(obj).offset().left + 'px');
}
diffHeight = floatSubMenu.find('.sub-nav-item:last').offset().top - floatSubMenu.find('.sub-nav-item:first').offset().top;
}
$(subHolder).css({
"top": ($(obj).offset().top + $(obj).height()) + "px",
"position": "absolute",
"left": "0",
"width": "100%",
"height": +(subItemHeight + diffHeight + treeNavHeight) + "px"
}).show();
},20);
}
function hideSubMenu(obj, evt) {
var oModuleNav = $(obj).closest('.ModuleNav,.ModuleNavGiant');
var oModuleItem = $(obj).closest('.ModuleItem');
var subHolder = $(obj).closest('.pre_nav').attr('SubHolder');
var timeoutId = "moduleNavTimeout";
evt = evt || window.event || arguments.callee.caller.arguments[0];
var relatedTarget = evt.relatedTarget || evt.toElement;
if ($(relatedTarget).is('.moduleNavFloatSubMenu') || $(relatedTarget).closest('.moduleNavFloatSubMenu').length > 0) {
return false;
}
if (window[timeoutId]) {
clearTimeout(window[timeoutId]);
}
window[timeoutId] = setTimeout(function () {
$('.moduleNavFloatSubMenu').remove();
oModuleNav.find('.navMainItem').removeClass('navMainItemHover');
//全屏的子菜单背景(layout-109 专用 )
$(subHolder).hide();
$('.main-nav-item-group').removeClass('on').siblings().removeClass('on');
}, 100);
}
function isHorizontalPad() {
if (CanDesign != "True" && window.CanEditFront == "True") return false;
var padscale = false;
if (SiteType == "1" && CanDesign != "True") {
if (navigator.userAgent.toLowerCase().indexOf("pad") > -1 || window.location.toString().indexOf("testpad") > -1 || ($(window).height() > 768 && $(window).width() > 768 && $(window).height() <= 1024 && $(window).width() <= 1024)) { //横向pad的分辨率一般都在7以上
padscale = true;
}
}
return padscale;
}
function showMobileNavFloatLayer(elem) {
var iCurNum = $('#MobileNav').attr('navnum') || 1;
if (iCurNum == 1 || iCurNum == 5) {
$("#pagebody").css({
"-ms-transition": "0.5s",
"-webkit-transition": "0.5s",
"-khtml-transition": "0.5",
"-o-transition": "0.5s",
"-moz-transition": "0.5s",
"transition": "0.5s"
});
var iTranslateX = 0;
$('#pagebody').css('left', iTranslateX);
} else {
$("#pagebody").css({
"-ms-transition": "",
"-webkit-transition": "",
"-khtml-transition": "",
"-o-transition": "",
"-moz-transition": "",
"transition": ""
});
}
$('#MobileNav').toggleClass('showFloatNav');
$('#MobileNavRenderElem').toggleClass('showFloatNav');
$('#MobileNavFloatLayer').toggleClass('showFloatNav');
$('#pagebody').toggleClass('showFloatNav');
$('#MobileFootNav').toggleClass('showFloatNav');
$('#MobileNavMask').toggleClass('showFloatNav');
}
function setMobileNav() {
if ($('#MobileNav').length > 0) {
var iCurNum = $('#MobileNav').attr('navnum') || 1;
var iCurColor = $('#MobileNav').attr('navcolor') || 'black';
var iItemType = $('#MobileNav').attr('navitemtype') || 0;
var iEnable = $('#MobileNav').attr('enable') || 0;
$('#MobileNav').attr('class', 'mobileNav mobileNav_' + iCurNum + ' ' + iCurColor);
$('#MobileNavRenderElem').attr('class', 'mobileNavRenderElem mobileNavRenderElem_' + iCurNum + ' ' + iCurColor);
$('#MobileNavFloatLayer').attr('class', 'mobileNavFloatLayer mobileNavFloatLayer_' + iCurNum + ' ' + iCurColor + ' itemType' + iItemType);
$('#pagebody').attr('class', $('#pagebody').attr('class').replace(/(pagebody_nav(_\d+)?)|(showFloatNav)/ig, '') + ' pagebody_nav pagebody_nav_' + iCurNum);
if ($('#MobileFootNav').length > 0) {
$('#MobileFootNav').attr('class', $('#MobileFootNav').attr('class').replace(/(mobileFootNav(_\d+)?)|(showFloatNav)/ig, '') + ' mobileFootNav_' + iCurNum);
}
$('#MobileNavMask').attr('class', 'mobileNavMask mobileNavMask_' + iCurNum).off('click').on('click', function () {
showMobileNavFloatLayer();
}).off('touchstart').on('touchstart', function () {
evt = window.event || evt;
evt.preventDefault();
showMobileNavFloatLayer();
return false;
})
$('#MobileNavFloatLayer').off('click');
$('#MobileNavFloatLayer').off('touchstart');
$('#MobileNavFloatLayer').off('touchmove');
// 分开写是因为pagebody scale后,会影响pagebody同级的100%高度的元素的高度
if ($.inArray(iCurNum, ["1", "2", "5", "8"]) > -1) {
$('#MobileNavFloatLayer').off().on('touchstart', function (evt) {
evt = window.event || evt;
iStartPosY = evt.targetTouches[0].pageY;
var top = $(this).children('.itemList').css('top');
if (top == 'auto' || top == '') top = 0;
iMobileNavItemListStartTop = parseInt(top);
}).on('touchmove', function (evt) {
if ($(window).height() > $(this).children('.itemList').outerHeight()) {
evt.preventDefault();
return false;
}
evt = window.event || evt;
evt.preventDefault();
iEndPosY = evt.targetTouches[0].pageY;
iSlideDistance = iEndPosY - iStartPosY;
var iTop = iMobileNavItemListStartTop + iSlideDistance;
if (iTop > 0) iTop = 0;
var iHiddenHeight = $(window).height() - $(this).children('.itemList').outerHeight() - $('#MobileNavFloatLayer').position().top - parseInt($(this).children('.itemList').css('margin-top'));
if (iTop < iHiddenHeight) iTop = iHiddenHeight;
if (typeof(window.top.frames['pageframe']) == 'undefined') $('#MobileNavFloatLayer .itemList').css('top', iTop + "px");
return false;
});
}
if ($.inArray(iCurNum, ["2", "3", "8"]) > -1) {
$('#MobileNavFloatLayer').css("top", $(".mobileNav").height())
}
if ($.inArray(iCurNum, ["1", "5"]) > -1) {
try {
if (typeof(window.top.frames['pageframe']) != 'undefined') $('#MobileNavFloatLayer').css("top", '0');
} catch (ex) {
}
}
if (iEnable != 1 || $.inArray(iCurNum, ["4", "6", "7"]) > -1) {
$('#MobileNavRenderElem').hide();
} else {
//$('#MobileNavRenderElem').show();
}
if ($.inArray(iCurNum, ["4"]) > -1) {
$('#MobileNavFloatLayer').off().on('touchstart', function (evt) {
evt = window.event || evt;
iStartPosY = evt.targetTouches[0].pageY;
iMobileNavItemListStartTop = parseInt($(this).children('.itemList').css('top'));
}).on('touchmove', function (evt) {
if ($(this).height() > $(this).children('.itemList').outerHeight()) {
evt.preventDefault();
return false;
}
evt = window.event || evt;
evt.preventDefault();
iEndPosY = evt.targetTouches[0].pageY;
iSlideDistance = iEndPosY - iStartPosY;
var iTop = iMobileNavItemListStartTop + iSlideDistance;
if (iTop > 0) iTop = 0;
var iHiddenHeight = $(this).height() - $(this).children('.itemList').outerHeight();
if (iTop < iHiddenHeight) iTop = iHiddenHeight;
$('#MobileNavFloatLayer .itemList').css('top', iTop + "px");
return false;
});
}
if (iCurNum == 6) {
if (typeof isDesignMode != 'undefined' && isDesignMode === true) {
$('#MobileNavFloatLayer').on('click', function () {
showMobileNavFloatLayer();
})
}
$('#MobileNavFloatLayer').on('touchstart', function (evt) {
evt = window.event || evt;
var curTarget = $(evt.targetTouches[0].target);
if (curTarget.is('.itemLink') || curTarget.is('.icon') || curTarget.is('.menuName')) {
return true;
}
evt.preventDefault();
showMobileNavFloatLayer();
return false;
});
}
if (iCurNum == 7) {
$('#MobileNavFloatLayer').on('touchstart', function (evt) {
evt = window.event || evt;
iStartPosX = evt.targetTouches[0].pageX;
iMobileNavFloatLayerItemListStartPosX = parseInt($(this).children('.itemList').css('left'));
});
$('#MobileNavFloatLayer').on('touchmove', function (evt) {
evt = window.event || evt;
if ($(this).width() > $(this).children('.itemList').outerWidth()) {
evt.preventDefault();
return false;
}
evt.preventDefault();
iEndPosX = evt.targetTouches[0].pageX;
iSlideDistance = iEndPosX - iStartPosX;
var iItemListLeft = iMobileNavFloatLayerItemListStartPosX + iSlideDistance;
if (iItemListLeft > 0) iItemListLeft = 0;
var iHiddenWidth = $(this).width() - $(this).children('.itemList').outerWidth();
if (iItemListLeft < iHiddenWidth) iItemListLeft = iHiddenWidth;
$('#MobileNavFloatLayer .itemList').css('left', iItemListLeft + "px");
return false;
});
} else {
$('#MobileNavFloatLayer .itemList').css({
width: ''
});
}
}
}
function matchNavAndFootNavBgColor() {
setInterval(function () {
if ($('#MobileFootNav').attr('bgcolorrelatedtomobilenav') == 0) {
var bgcolor = $('.ModuleMobileNavGiant #header').length > 0 ? $('.ModuleMobileNavGiant #header').css('background-color') : $('#MobileNav').css('background-color');
if ($('#MobileFootNav .foot-nav-list').css('background-color') != bgcolor)
$('#MobileFootNav .foot-nav-list').css('background-color', bgcolor);
}
}, 50);
}
function doSomeWhanPreview() {
if (window.location.getQueryString('view') == '1') {
$("body").find('a').each(function (i, elm) {
if (/^(javascript|#)/i.test($(this).attr('href'))) {
return true;
}
if ($(this).prop('href').indexOf(location.protocol + "//" + location.hostname) == 0) {
var url = $(this).attr('href');
if (url) {
if ($(this).hasClass("ui-tabs-anchor") == false) {
url = url.replace(/^([^\?#]*)(\??)([^#]*)(#?)/, '$1\?$3&view=1$4');
}
}
$(this).attr('href', url);
$(this).attr('target', '_self');
}
});
$('.ModuleUserLogin [registerurl]').off().on('click', function (evt) {
var url = $(this).attr('registerUrl');
window.location = url.indexOf("?") > -1 ? url + "&view=1" : url + "?view=1";
evt.preventDefault();
return false;
});
}
}
function doLoginWithUserNamePassword(obj) {
obj = $(obj);
var url = $(obj).attr('action');
var data = $(obj).serializeArray();
if (obj.length > 0) {
$.ajax({
type: "post",
url: url,
cache: false,
data: data,
dataType: "json",
success: function (data) {
if (!data.success) {
alert(data.msg);
return;
}
if (data.msg) {
window.location.href = decodeURIComponent(data.msg);
}
},
error: function (req) {
alert(req.responseText);
}
});
}
}
function AjaxResetPassword(obj) {
if (obj) {
var data = $(obj).serialize() + '&act=resetpassword'
$.ajax({
type: "POST",
url: $(obj).attr('action'),
cache: false,
beforeSend: function (XMLHttpRequest) {
$('input[type="submit"]', $(obj)).hide();
$('.Loading', $(obj)).show();
},
dataType: "json",
data: data,
success: function (data) {
if (data) {
if (!data.success) {
$('input[type="submit"]', $(obj)).show();
}
$('.Loading', $(obj)).hide();
$(".container", $(obj)).show();
$(".errorMsg", $(obj)).html(data.msg);
}
},
complete: function (XMLHttpRequest, textStatus) {
$('input[type="submit"]', $(obj)).show();
$('.Loading', $(obj)).hide();
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
$('input[type="submit"]', $(obj)).show();
$('.Loading', $(obj)).hide();
}
});
}
};
//弹出微信扫码支付的对话框
function WxScanPay(orderid) {
if (!-[1,]) { // ie7,8不允许
alert('很抱歉,当前浏览器不支持微信扫码支付,请升级或更换其他浏览器重试。');
return;
}
$("#WxScanPayDiv").remove();
var WxScanPayDiv = $('');
$("body").append(WxScanPayDiv);
$(WxScanPayDiv).dialog({
title: '微信支付 - Pay', modal: true, width: 500, position: 'center',
resizable: false,
buttons: {
"取消": function () {
$(this).dialog("close");
}
},
close: function () {
$("#WxScanPayDiv").remove();
}
});
}
// 全屏模块绝对定位100%宽度取的是屏幕的可视宽度,当设置的站点宽度超过屏幕可视宽度时候,全屏模块右侧留白,所以定时器设它门一个固定宽度
function keepFullScreenModules100Width() {
if (getCookie("SiteType") == "1") return;
setInterval(function () {
$('body>.ModuleItem').each(function (i, item) {
if (!$(this).attr('float')) $(this).css('width', $('#pagebody').width()); //非浮动模块保持全屏
});
}, 200);
}
function runSlide(id, pattern, time, imageready) {
var module = $("#module_" + id);
var mm = module.clone();
var text = $('#txt_' + id);
// 判断是否存在,存在则替换最新内容,不存在则添加
if (text.length == 0) {
var text = $("");
$("body").append(text);
} else {
var text = text.val(module[0].outerHTML)
}
var obj = $("#myFocus" + id);
// 以下特殊字符必须处理,防止myfocus解析错误
obj.find('img').each(function () {
$(this).attr('alt', ($(this).attr('alt') || '').replace(/[<>&"]/g, function (c) {
return {'<': '<', '>': '>', '&': '&', '"': '"'}[c];
}));
$(this).attr('text', ($(this).attr('text') || '').replace(/[<>&"]/g, function (c) {
return {'<': '<', '>': '>', '&': '&', '"': '"'}[c];
}));
});
var readyCallback = function () {
// 修复mF_ladyQ风格下,标题文字在第一次循环不显示的bug
if (pattern == "mF_ladyQ") {
module.find('.txt li').css({
'-webkit-transition': 'none',
'-moz-transition': 'none',
'-o-transition': 'none'
});
}
}
if (module.css("position") != "absolute") {
var width = module.parent().width() - parseInt(module.parent().css("padding-left")) - parseInt(module.parent().css("padding-right"));
if (!obj.attr("hasreload")) {
obj.find("*[name=slideImg]").each(function (i, item) {
var src = $(item).attr("src");
$(item).src = '';
$(item).on("load", function () {
if (obj.attr("hasreload")) return;
if ($(item).height() == 0) return;
obj.height($(item).height());
module.height($(item).height());
obj.width(width);
module.width(width);
obj.attr("hasreload", "1");
myFocus.set({id: "myFocus" + id, pattern: pattern, loadIMGTimeout: 0, time: time}, readyCallback);
});
$(item).src = src;
});
}
} else {
myFocus.set({id: "myFocus" + id, pattern: pattern, loadIMGTimeout: 0, time: time}, readyCallback);
var $Img = module.find('img[name=slideImg]');
if (pattern == 'mF_slide3D') {
$Img.attr({'style': null, 'width': null});
setTimeout(function () {
$('.mF_slide3D_wrap').css({'padding': 0});
}, 150)
} else if (pattern == 'mF_YSlider') {
var imgHeight = module.height();
$Img.attr({'style': 'height:' + imgHeight + 'px'});
} else if (pattern == 'mF_shutters') {
var imgHeight = module.height();
var imgWidth = module.width();
$Img.attr({'style': 'height:' + imgHeight + 'px', 'width': imgWidth});
}
}
module.attr({"mid": id, "pattern": pattern, "time": time});
}
function runMobileSlide(moduleid) {
$(window).load(function () {
$('#swiper' + moduleid).width($('#module_' + moduleid).parent().width());
$('#module_' + moduleid).resize(function () {
$('#swiper' + moduleid).width($('#module_' + moduleid).parent().width());
window['swiper' + moduleid].destroy(false);
window['swiper' + moduleid] = new Swiper('#swiper' + moduleid, {
autoplay: 3000,
loop: true,
pagination: '.SNum' + moduleid
});
});
window['swiper' + moduleid] = new Swiper('#swiper' + moduleid, {
autoplay: 3000,
loop: true,
pagination: '.SNum' + moduleid
});
});
}
// 调整幻灯片模块显示样式
function adjustModuleSlide(obj) {
if (!obj) {
var moduleSlides = $('.ModuleSlide').parent();
for (var i = 0; i < moduleSlides.length; i++) {
adjustModuleSlide(moduleSlides[i]);
}
}
obj = $(obj);
if (obj.children().is('.ModuleSlide') && SiteType == 0) {
var moduleid = obj.attr('id').replace(/module_/i, '');
var aa = $("#txt_" + moduleid);
var mm = $(aa.val().replace("runSlide", ""));
mm.css({
"position": obj.css("position"),
"left": obj.css("left"),
"top": obj.css("top"),
"width": obj.width() + "px",
"height": obj.height() + "px"
});
var myfocusObj = mm.find('#myFocus' + moduleid);
var moduleHead = mm.find('.ModuleHead').get(0);
var moduleHeadHeight = moduleHead ? mm.find('.ModuleHead').get(0).offsetHeight : 0;
myfocusObj.height(mm.height() - moduleHeadHeight);
myfocusObj.width(mm.width());
$(obj).replaceWith(mm);
var id = obj.attr("mid");
var pattern = obj.attr("pattern");
var time = obj.attr("time");
runSlide(id, pattern, time);
}
}
//显示产品、文章等子分类
function setModuleCls(obj) {
var strCls = ".ModuleProductCls,.ModuleNewsCls,.ModuleDownCls,.ModuleNewsClsV2,.ModuleProductClsV2";
if (!obj) {
var moduleCls = $(strCls);
for (var i = 0; i < moduleCls.length; i++) {
setModuleCls(moduleCls[i]);
}
}
obj = $(obj);
var showStyle = obj.find("[class*=ModuleClsShowStyle]").attr('showstyle');
if (showStyle == 0) {
var hidesubTimer = new Object();
obj.find(".SHOWSUB>li").mouseover(function () {
var moduleid = $(this).closest('.ModuleItem').attr("id").replace('module_', '');
var id = 'subclass' + $(this).children("ul").attr("id");
var obj = $(this).get(0);
var type = '';
var moduleClasses = $(this).closest(strCls).attr('class').split(/\s+/);
var clsClasses = strCls.split(',');
for (var i = 0; i < moduleClasses.length; i++) {
for (var j = 0; j < clsClasses.length; j++) {
if (clsClasses[j].replace(/\s|\./g, '') == moduleClasses[i]) {
type = moduleClasses[i];
break;
}
}
if (type) break;
}
$(obj).removeClass("SubMaskColor");
$(obj).removeClass("SubMaskBorder1");
$("#mask" + id).remove();
$("#" + id).remove();
if (!$(this).children("ul").html()) return;
var obj = $(this).get(0);
var p = $("");
p.append($(this).children("ul").clone());
p.children("ul").css("display", "block");
p.off().mouseenter(function () {
clearTimeout(hidesubTimer[id]);
}).mouseleave(function () {
$("#" + id).remove();
$("#mask" + id).remove();
$(obj).removeClass("SubMaskColor");
$(obj).removeClass("SubMaskBorder1");
});
$("body").append(p);
var zindex = parseInt($(this).css("z-index"));
if (isNaN(zindex)) zindex = 0;
$("body").append("");
$(this).addClass("SubMaskColor");
$(this).addClass("SubMaskBorder1");
var borderwidth = parseInt($("#" + id).css("border-top-width"));
if (isNaN(borderwidth)) borderwidth = 0;
var func = function () {
$("#" + id).css({
"display": "block",
"top": $(obj).offset().top,
"left": ($(obj).offset().left + $(obj).width())
});
$("#mask" + id).css({
"top": $(obj).offset().top + borderwidth,
"left": ($(obj).offset().left + $(obj).width() - 3)
});
};
func();
setTimeout(func, 50); //因为如果从一个分类快速切换到另一个分类,原分类会延时50ms才会消失,这时如果原分类有border,会占了几个像素的高度,会导致后面的分类位置计算不准,这里延时50ms重新计算一下解决了这个问题
}).mouseleave(function () {
$(this).children("ul").hide();
var id = 'subclass' + $(this).children("ul").attr("id");
var obj = $(this).get(0);
hidesubTimer[id] = setTimeout(function () {
$(obj).removeClass("SubMaskColor");
$(obj).removeClass("SubMaskBorder1");
$("#mask" + id).remove();
$("#" + id).remove();
}, 50);
});
} else if (showStyle == 3) {
obj.find('.MainClassItem:last-child').css({
borderBottom: '0px'
});
} else if (showStyle == 7) {
obj.find('.clsAllList > .clsItem').off().on('mouseenter', function () {
var moduleItem = $(this).closest('.ModuleItem');
var moduleid = moduleItem.attr('id');
moduleid = moduleid.replace('module_', '');
var floatElem = $('').append('');
floatElem.children('.clsAllList').append($(this).find('.clsItemList').clone());
$('body').append(floatElem);
$('body').append('');
var moduleZIndex = parseFloat(moduleItem.css('z-index'));
if (isNaN(moduleZIndex)) moduleZIndex = 0;
moduleZIndex++;
moduleZIndex = 9999;
var floatElemMinHeight = moduleItem.find('.clsAllList').height();
moduleItem.find('.clsAllList > .clsItem').removeClass('hover');
$(this).addClass('hover');
floatElem.css({
position: 'absolute',
top: getElementTopWithBorder(moduleItem[0]),
left: getElementLeftWithBorder(moduleItem[0]) + moduleItem.outerWidth(false),
zIndex: moduleZIndex
});
floatElem.find('.clsItemList').css({
position: 'static',
minHeight: floatElemMinHeight
}).show();
$('.ModuleProductClsStyle7_Mask').css({
position: 'absolute',
left: Math.ceil((getElementLeftWithBorder(this) + $(this).width()).toFixed(2)) * 100 / 100 - 1,
top: getElementTopWithBorder(this),
zIndex: moduleZIndex,
width: parseFloat(moduleItem.find('.clsAllList').css('border-right-width')) + parseFloat(moduleItem.css('border-right-width')) + parseFloat(floatElem.find('.clsAllList').css('border-left-width')) + 1,
height: parseFloat(moduleItem.find('.clsItem').height())
});
$('.ModuleClsShowStyle7_floatElem').off().on('mouseleave', function (evt) {
$('.ModuleClsShowStyle7_floatElem').remove();
$('.ModuleProductClsStyle7_Mask').remove();
$('#module_' + $(this).attr('relatedmoduleid')).find('.clsAllList > .clsItem').removeClass('hover');
});
$('.ModuleProductClsStyle7_Mask').off().on('mouseleave', function (evt) {
var relatedTarget = evt.toElement || evt.relatedTarget;
if (!$(relatedTarget).closest('.ModuleClsShowStyle7').hasClass('ModuleClsShowStyle7_floatElem')
&& !$(relatedTarget).hasClass('ModuleProductClsStyle7_Mask')) {
$('.ModuleClsShowStyle7_floatElem').remove();
$('.ModuleProductClsStyle7_Mask').remove();
$('#module_' + $(this).attr('relatedmoduleid')).find('.clsAllList > .clsItem').removeClass('hover');
}
});
}).on('mouseleave', function (evt) {
var relatedTarget = evt.toElement || evt.relatedTarget;
if (!$(relatedTarget).closest('.ModuleClsShowStyle7').hasClass('ModuleClsShowStyle7_floatElem')
&& !$(relatedTarget).hasClass('ModuleProductClsStyle7_Mask')) {
$('.ModuleClsShowStyle7_floatElem').remove();
$('.ModuleProductClsStyle7_Mask').remove();
$(this).removeClass('hover');
}
});
}
}
/**
* 克隆元素样式
* @author tang bin
* @version 0.1
* @see http://www.planeart.cn/?p=1499
* @param {HTMLElement} 被克隆的元素
* @param {Boolean} 是否启用缓存(默认true)
* @return {String} css类名
*/
var cloneStyle = (function (doc) {
var rstyle = /^(number|string)$/,
cloneName = '${cloneName}',
sData = {},
addHeadStyle = function (content) {
var style = sData[doc];
if (!style) {
style = sData[doc] = doc.createElement('style');
doc.getElementsByTagName('head')[0].appendChild(style);
}
;
style.styleSheet && (style.styleSheet.cssText += content) || style.appendChild(doc.createTextNode(content));
},
getStyle = 'getComputedStyle' in window ? function (elem, name) {
return getComputedStyle(elem, null)[name];
} : function (elem, name) {
return elem.currentStyle[name];
};
return function (source, cache) {
if (!cache && source[cloneName]) return source[cloneName];
var className, name,
cssText = [],
sStyle = source.style;
for (name in sStyle) {
var val = getStyle(source, name);
if (val !== '' && rstyle.test(typeof val)) {
name = name.replace(/([A-Z])/g, "-$1").toLowerCase();
cssText.push(name);
cssText.push(':');
cssText.push(val);
cssText.push(';');
}
;
}
;
cssText = cssText.join('');
source[cloneName] = className = 'clone' + (new Date).getTime();
addHeadStyle('.' + className + '{' + cssText + '}');
return className;
};
}(document));
function runAllAnimate(list) {
if (!list) list = $(".ModuleItem");
$(list).each(function (i, item) {
var html = $(item)[0].outerHTML;
var animatename = $(item).attr("animate");
if (!animatename) {
var match = html.match(/wow\s+([a-z]+)/gi);
if (match) {
animatename = match[0].replace(/wow\s+/, '');
}
}
if (animatename) {
if (html.indexOf("ModuleFullSwitch") > -1) return;
$(item).removeClass(animatename);
var duration = $(item).attr("data-wow-duration");
var delay = $(item).attr("data-wow-delay");
var animate = {"animation-name": animatename};
if (duration) animate["animation-duration"] = duration;
if (delay) animate["animation-delay"] = delay;
$(item).css({"animation-name": 'aaa'});
setTimeout(function () {
$(item).css({"animation-name": animatename, "animation-duration": duration, "animation-delay": delay});
}, 10);
$(item).attr("animate", animatename);
}
});
}
// pc相册
function adjustModuleSiteGallery(moduleID) {
// TODO box-sizing: content-box 计算margin
var iSingleItemWidth = $("#module_" + moduleID + " .imgItem").outerWidth();
var iModuleWidth = $("#module_" + moduleID).width();
var iModuleHeight = $("#module_" + moduleID).height();
var iColCount = Math.floor(iModuleWidth / iSingleItemWidth);
var iTotalCount = $("#module_" + moduleID + " .imgItem").length;
$("#module_" + moduleID + " .imgItem").each(function (i) {
if (i % iColCount == 0) {
$(this).css({marginLeft: 0});
} else if (i % iColCount == iColCount - 1) {
$(this).css({marginRight: 0});
}
if (i < iColCount) {
$(this).css({marginTop: 0});
} else if (i > iTotalCount - iColCount) {
$(this).css({marginBottom: 0});
}
});
}
// 初始化pc相册
function setModuleSiteGallery(obj) {
var defaults = {
padding: 0,
prevEffect: 'fade',
nextEffect: 'fade',
viewDetails: '查看详情',
closeBtn: true,
openOpacity: true,
helpers: {
overlay: {
css: {'background': 'rgba(0,0,0, 0.9)'},
closeClick: false
},
title: {type: 'outside'},
//buttons: {},
thumbs: {
width: 50,
height: 50,
position: 'bottom'
}
},
modal: false,
tpl: {
next: '',
prev: ''
},
beforeLoad: function () {
if (this.element) {
var oImg = $(this.element).children('img');
var sLink = '';
if (oImg.attr('redirectUrl') + '' != '') {
sLink = '' + obj.viewDetails + '';
}
this.title = oImg.attr('alt') + sLink;
} else {
var sLink = '';
if (this.url) {
sLink = '' + obj.viewDetails + '';
}
this.title = this.title + sLink;
}
},
afterShow: function () {
if ($('.fancybox-overlay>.fancybox-prev').length == 0) {
$('.fancybox-outer>.fancybox-prev').appendTo('.fancybox-overlay');
} else {
$('.fancybox-outer>.fancybox-prev').remove();
}
if ($('.fancybox-overlay>.fancybox-next').length == 0) {
$('.fancybox-outer>.fancybox-next').appendTo('.fancybox-overlay');
} else {
$('.fancybox-outer>.fancybox-next').remove();
}
if ($('.fancybox-overlay>.fancybox-close').length == 0) {
$('.fancybox-skin>.fancybox-close').appendTo('.fancybox-overlay').css({
right: "0px",
top: "0px"
});
} else {
$('.fancybox-skin>.fancybox-close').remove();
}
//更新前一张和下一张的遮盖高度,不遮住下面的超链接
var fancyboxInner = $(".fancybox-inner").eq(0);
var fancyboxWrap = $(".fancybox-wrap").eq(0);
if (fancyboxInner && fancyboxWrap) {
var top = parseInt(fancyboxWrap.css("top").replace("px", ""));
var height = fancyboxInner.height();
$(".fancybox-next").css("height", height + top);
$(".fancybox-prev").css("height", height + top);
}
}
}
if (obj.effectID != 0) delete defaults.helpers.thumbs;
$("#module_" + obj.moduleID + " .imgBox img").css('position', 'relative');
if (obj.isExpandDir == 0) {
$("#module_" + obj.moduleID + " .imgBox").off().click(function () {
$.fancybox.open(obj.galleryItems[$("#module_" + obj.moduleID + " .imgBox").index(this) + 1], defaults);
return false;
});
} else {
$("#module_" + obj.moduleID + " .imgBox").off().click(function () {
var items = obj.galleryItems[1] || [];
for (var i = 0; i < items.length; i++) {
if (($(this).prop('href') + '').replace(/\?.*$/, '').indexOf((items[i].href + '').replace(/\?.*$/, '')) > -1) {
break;
}
}
var opts = $.extend({}, defaults);
opts.index = i;
$.fancybox.open(obj.galleryItems[1], opts);
return false;
});
}
$("#module_" + obj.moduleID + " .imgBox img").each(function () {
var sSrc = $(this).attr('src');
$(this).attr('src', '');
$(this).off('load').on('load', function () {
$(this).attr('originWidth', $(this).parent().width());
$(this).attr('originHeight', $(this).parent().height());
});
$(this).attr('src', sSrc);
});
$("#module_" + obj.moduleID + " .imgBox img").off('mouseover').on('mouseover', function () {
var oZoomImage = $(this);
var iOriginWidth = oZoomImage.attr('originWidth') || $(this).parent().width();
var iOriginHeight = oZoomImage.attr('originHeight') || $(this).parent().height();
var iZoomPx = 50;
oZoomImage.stop().animate({
left: -iZoomPx / 2 + 'px',
top: -iZoomPx / 2 + 'px',
width: parseInt(iOriginWidth) + iZoomPx + 'px',
height: parseInt(iOriginHeight) + iZoomPx + 'px'
}, 600);
$('.imgMask').remove();
var iLeft = parseFloat($(this).closest('.imgItem').css('padding-left'));
var iTop = parseFloat($(this).closest('.imgItem').css('padding-top'));
$('
').css({
left: iLeft + 'px',
top: iTop + 'px',
width: iOriginWidth + 'px',
height: iOriginHeight + 'px'
}).insertAfter(this).off().on('mouseleave', function () {
var oZoomImage = $(this).closest('.imgItem').find('.imgBox img');
var iOriginWidth = oZoomImage.attr('originWidth');
var iOriginHeight = oZoomImage.attr('originHeight');
oZoomImage.stop().animate({
left: '0',
top: '0',
width: iOriginWidth + 'px',
height: iOriginHeight + 'px'
}, 600);
$('.imgMask').remove();
}).on('click', function () {
})
});
}
function setMobileModuleSiteGallery(obj) {
if (obj.isExpandDir == 0) {
$("#module_" + obj.moduleID + " .grid-cont").off().click(function () {
$(this).lightGallery({
dynamic: true,
thumbnail: true,
dynamicEl: obj.galleryItems[$("#module_" + obj.moduleID + " .grid-cont").index(this) + 1]
});
return false;
});
}
}
// 初始化音乐模块
function initModuleMusic(opts) {
var bgMusicFilePath = opts.bgMusicFilePath;
var moduleid = opts.moduleid;
var siteType = opts.siteType;
var isAutoPlay = opts.isAutoPlay;
var isLoop = opts.isLoop;
var canPlay = opts.canPlay;
if (canPlay) {
var ua = navigator.userAgent.toLowerCase();
var elem = $('#module_' + moduleid);
if (siteType == 0) {
if (ua.match(/msie ([\d.]+)/)) {
$(elem).find('#music' + moduleid).html('');
} else if (ua.match(/firefox\/([\d.]+)/)) {
$(elem).find('#music' + moduleid).html('');
} else if (ua.match(/chrome\/([\d.]+)/)) {
$(elem).find('#music' + moduleid).html('');
} else if (ua.match(/opera.([\d.]+)/)) {
$(elem).find('#music' + moduleid).html('