var frontproducts_list01 = { /* * 改变排列方 * 参数1:下拉列表对象 * 参数2:formid * 参数3:跳转连接 */ changeorderby:function (dom,formid,hrefpage){ //alert("href="+href); //alert("formid="+formid); //alert("actionurl="+actionurl); var order_str = dom.value; var theform = document.getelementbyid(formid); theform.orderby.value = order_str; try{ //高级搜索方式没有这个值 theform.action_page.value = hrefpage; }catch(e){ } theform.submit(); }, /* * 改变排列方 * 参数1:值(下拉列表对象、input输入框) * 参数2:formid * 参数3:跳转连接 */ changeorderby2:function (dom,formid,hrefpage){ //alert("href="+href); //alert("formid="+formid); //alert("actionurl="+actionurl); var order_str = dom; var theform = document.getelementbyid(formid); theform.orderby.value = order_str; try{ //高级搜索方式没有这个值 theform.action_page.value = hrefpage; }catch(e){ } theform.submit(); }, /* * 切换显示方式 * 参数1:viewpageid * 参数2:formid * 参数3:跳转连接 */ changeview:function (viewpageid,formid,hrefpage){ var theform = document.getelementbyid(formid); theform.sptype.value = viewpageid; try{ theform.action_page.value = hrefpage; }catch(e){ } theform.submit(); }, /* * 分会员级别显示价格 * 参数1:隐藏域name */ loadmemberlevelid:function (elmentname){ var memberlvid = document.getelementsbyname(elmentname); var cookiestring = document.cookie; var starindex = cookiestring.indexof('c_memberinfo='); if(starindex ==-1){ for(var i=0; i< memberlvid.length ;i++){ memberlvid[i].parentnode.style.display="none"; } return; } var endindex = cookiestring.indexof(';',starindex); if(endindex == -1){ endindex=cookiestring.length; } starindex = 'c_memberinfo'.length+1+starindex; var cookiecontent = unescape(cookiestring.substring(starindex,endindex)); for(var i=0; i 0) this.parent.calc(-1); } } /* //////////// ==== imageflow prototype ==== //////////// */ imageflow.prototype = { /* ==== targets ==== */ calc : function (inc) { if (inc) this.view += inc; var tw = 0; var lw = 0; var o = this.diapos[this.view]; if (o && o.loaded) { /* ---- reset ---- */ var ob = this.diapos[this.back]; if (ob && ob != o) { ob.img.classname = 'diapo'; ob.z1 = 1; } /* ---- update legend ---- */ this.title.replacechild(document.createtextnode(o.title), this.title.firstchild); this.legend.replacechild(document.createtextnode(o.text), this.legend.firstchild); /* ---- update hyperlink ---- */ if (o.url) { o.img.classname = 'diapo link'; window.status = 'hyperlink: ' + o.url; } else { o.img.classname = 'diapo'; window.status = ''; } /* ---- calculate target sizes & positions ---- */ o.w1 = math.min(o.iw, this.wh * .5) * o.z1; var x0 = o.x1 = (this.wh * .5) - (o.w1 * .5); var x = x0 + o.w1 + this.bdw; for (var i = this.view + 1, o; o = this.diapos[i]; i++) { if (o.loaded) { o.x1 = x; o.w1 = (this.ht / o.r) * this.size; x += o.w1 + this.bdw; tw += o.w1 + this.bdw; } } x = x0 - this.bdw; for (var i = this.view - 1, o; o = this.diapos[i]; i--) { if (o.loaded) { o.w1 = (this.ht / o.r) * this.size; o.x1 = x - o.w1; x -= o.w1 + this.bdw; tw += o.w1 + this.bdw; lw += o.w1 + this.bdw; } } /* ---- move scrollbar ---- */ if (!this.scr && tw) { var r = (this.ws - this.alw - this.arw - this.bw) / tw; this.bar.style.left = math.round(this.alw + lw * r) + 'px'; } /* ---- save preview view ---- */ this.back = this.view; } }, /* ==== mousewheel scrolling ==== */ scroll : function (sc) { if (sc < 0) { if (this.view < this.nf - 1) this.calc(1); } else { if (this.view > 0) this.calc(-1); } }, /* ==== resize ==== */ resize : function () { this.wh = this.oc.clientwidth; this.ht = this.oc.clientheight; this.ws = this.scrollbar.offsetwidth; this.calc(); this.run(true); }, /* ==== move all images ==== */ run : function (res) { var i = this.nf; while (i--) this.diapos[i].move(res); } } /* //////////// ==== diapo constructor ==== //////////// */ diapo = function (parent, n, src, title, text, url, target) { this.parent = parent; this.loaded = false; this.title = title; this.text = text; this.url = url; this.target = target; this.n = n; this.img = document.createelement('img'); this.img.src = src; this.img.parent = this; this.img.classname = 'diapo'; this.x0 = this.parent.oc.clientwidth; this.x1 = this.x0; this.w0 = 0; this.w1 = 0; this.z1 = 1; this.img.parent = this; this.img.onclick = function() { this.parent.click(); } this.parent.oc.appendchild(this.img); /* ---- display external link ---- */ if (url) { this.img.onmouseover = function () { this.classname = 'diapo link'; } this.img.onmouseout = function () { this.classname = 'diapo'; } } } /* //////////// ==== diapo prototype ==== //////////// */ diapo.prototype = { /* ==== html rendering ==== */ move : function (res) { if (this.loaded) { var sx = this.x1 - this.x0; var sw = this.w1 - this.w0; if (math.abs(sx) > 2 || math.abs(sw) > 2 || res) { /* ---- paint only when moving ---- */ this.x0 += sx * .1; this.w0 += sw * .1; if (this.x0 < this.parent.wh && this.x0 + this.w0 > 0) { /* ---- paint only visible images ---- */ this.visible = true; var o = this.img.style; var h = this.w0 * this.r; /* ---- diapo ---- */ o.left = math.round(this.x0) + 'px'; o.bottom = math.floor(this.parent.ht * .25) + 'px'; o.width = math.round(this.w0) + 'px'; o.height = math.round(h) + 'px'; /* ---- reflexion ---- */ if (this.flx) { var o = this.flx.style; o.left = math.round(this.x0) + 'px'; o.top = math.ceil(this.parent.ht * .75 + 1) + 'px'; o.width = math.round(this.w0) + 'px'; o.height = math.round(h) + 'px'; } } else { /* ---- disable invisible images ---- */ if (this.visible) { this.visible = false; this.img.style.width = '0px'; if (this.flx) this.flx.style.width = '0px'; } } } } else { /* ==== image onload ==== */ if (this.img.complete && this.img.width) { /* ---- get size image ---- */ this.iw = this.img.width; this.ih = this.img.height; this.r = this.ih / this.iw; this.loaded = true; /* ---- create reflexion ---- */ this.flx = createreflexion(this.parent.oc, this.img); if (this.parent.view < 0) this.parent.view = this.n; this.parent.calc(); } } }, /* ==== diapo onclick ==== */ click : function () { if (this.parent.view == this.n) { /* ---- click on zoomed diapo ---- */ if (this.url) { /* ---- open hyperlink ---- */ window.open(this.url, this.target); } else { /* ---- zoom in/out ---- */ this.z1 = this.z1 == 1 ? this.parent.zoom : 1; this.parent.calc(); } } else { /* ---- select diapo ---- */ this.parent.view = this.n; this.parent.calc(); } return false; } } /* //////////// ==== public methods ==== //////////// */ return { /* ==== initialize script ==== */ create : function (div, size, zoom, border) { /* ---- instanciate imageflow ---- */ var load = function () { var loaded = false; var i = instances.length; while (i--) if (instances[i].ocont == div) loaded = true; if (!loaded) { /* ---- push new imageflow instance ---- */ instances.push( new imageflow(div, size, zoom, border) ); /* ---- init script (once) ---- */ if (!imf.initialized) { imf.initialized = true; /* ---- window resize event ---- */ addevent(window, 'resize', function () { var i = instances.length; while (i--) instances[i].resize(); }); /* ---- stop drag n drop ---- */ addevent(document.getelementbyid(div), 'mouseout', function (e) { if (!e) e = window.event; var tg = e.relatedtarget || e.toelement; if (tg && tg.tagname == 'html') { var i = instances.length; while (i--) instances[i].oc.onmousemove = null; } return false; }); /* ---- set interval loop ---- */ setinterval(function () { var i = instances.length; while (i--) instances[i].run(); }, 16); } } } /* ---- window onload event ---- */ addevent(window, 'load', function () { load(); }); } } }();