var ie6 = !window.getComputedStyle && navigator.appVersion.indexOf("MSIE 7") == -1; window.onload = function(){ console = $("console"); init_menu(); init_pngs(); init_cart_images(); if(!window.Scroll){ return; } var scr = new Scroll( $("scroll-holder"), $("scroll-content"), { X: null, Y: { bar: $("scroll-bar"), bMinus: $("b-minus"), bPlus: $("b-plus"), track: $("track"), thumb: $("thumb") } }, tim ); } var console; var tim = new Timer(30); tim.start(); function init_menu(){ var root = $("menu"); if(!root){ return; } var items = $C("m-item", root, "DIV"); items.each(function(item){ var a = $T("A", item)[0]; if(a.className.indexOf("selected") != -1){ throw $continue; } item.className += " initializing"; var arr = $C_arr(["dropdown", "wrapper", "p-bgr", "p-content", "move-item", "line"], item, "DIV"); if(arr.length){ item.dropdown = arr.shift(); item.wrapper = arr.shift(); item.bgr = arr.shift(); item.content = arr.shift(); item.move_item = arr.shift(); item.line = arr.shift(); item.line.HIDDEN = true; //Style var content_height = item.content.offsetHeight; item.bgr.style.height = content_height - 15 + "px"; var _height = item.move_item.offsetHeight; var _width = item.move_item.offsetWidth; var stObject = { width: _width + 15, height: _height }; Style.setElementStyle(item.dropdown, stObject, null, true); stObject.overflow = "hidden"; Style.setElementStyle(item.wrapper, stObject, null, true); stObject = { left: -_width, top: -_height + 1, position: "absolute" } Style.setElementStyle(item.move_item, stObject, null, true); /////////////////////////////////// item.mov = new Movement(item.move_item, tim); item._width = _width; item._height = _height; item.STATE = 0;//closed item.hide_line = function(){ if(!this.line.HIDDEN){ this.line.style.display = "none"; this.line.HIDDEN = true; } //print(this.line.style.display, console); } item.show_line = function(){ if(this.line.HIDDEN){ this.line.style.display = "block"; this.line.HIDDEN = false; } } item.show = function(){ if(this.STATE){ return false; } this.className += " open"; this.STATE = 1;//is-opening this.dropdown.style.display = "block"; this.mov.onstop.register("start-new-movement", function(){ this.hide_line(); this.mov.onmove.register("show-line", function(){ this.show_line(); if(Math.abs(this.mov.Moveable.top) < this.mov.stepY + 1){ this.hide_line(); } }.bind(this)); this.mov.onstop.register("remove-all", function(){ this.STATE = 2;//open this.mov.onmove.remove("show-line"); this.hide_line(); }.bind(this), 1); setTimeout(function(){ this.mov.moveTo(this.mov.Moveable.left, this.mov.Moveable.top + this._height - 1, 10); }.bind(this), 1); }.bind(this), 1); this.mov.moveTo(this.mov.Moveable.left + this._width, this.mov.Moveable.top, 10); } item.hide = function(e) { var ev = window.event || e; var target = ev.toElement || ev.relatedTarget; if(!target || target == this || _isChild(target, this) || target == this.dropdown || _isChild(target, this.dropdown)){ return false; } if(this.STATE == 1){ this.mov.onstop.remove("start-new-movement"); this.mov.onstop.remove("remove-all"); this.mov.onmove.remove("show-line"); this.mov.onmove.remove("move-to"); this.mov.stop(); } var func = function(){ this.STATE = 0; this.hide_line(); this.mov.Moveable.moveTo(-this._width, -this._height + 1); this.dropdown.style.display = "none"; this.className = this.className.replace("open", ""); }.bind(this); setTimeout(func, 1); } item.onmouseover = item.show; item.onmouseout = item.hide; } item.className = item.className.replace("initializing", ""); }) } function init_pngs(){ if(!ie6){ return; } var imags = $T("IMG"); imags.each(function(img){ if(img.src.match(/.png$/)){ var src = img.src; img.style.width = img.width + "px"; img.style.height = img.height + "px"; img.src = wwwroot + "i/blank.gif"; img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='crop')"; } }) } function wo( link, ww, hh, title ) { w= window.open(link,'',(ww ? 'width='+ww+',' : '')+(hh ? 'height='+hh+',' : '')+'toolbar=0,scrollbars=0,resizable'); if (link.indexOf('.html')==-1) { if (document.layers) title=''; w.document.open(); w.document.write('