function wbc_mouseX(e) { var posx = 0; if (!e) e = window.event; if (typeof(e.clientX) == 'number') posx = e.clientX; return posx; } function wbc_mouseY(e) { posy = 0; if (!e) e = window.event; if (typeof(e.clientY) == 'number') posy = e.clientY; return posy; } function wbc_GetInnerWidth() { if(window.innerWidth) return window.innerWidth; if(document.documentElement && document.documentElement.clientWidth) return document.documentElement.clientWidth; if(document.body) return document.body.offsetWidth; } function wbc_GetInnerHeight() { if(window.innerHeight) return window.innerHeight; if(document.documentElement && document.documentElement.clientHeight) return document.documentElement.clientHeight; if(document.body) return document.body.offsetHeight; } function wbc_GetScrollTop() { if (window.pageYOffset) return window.pageYOffset if(document.documentElement && document.documentElement.scrollTop) return document.documentElement.scrollTop; if(document.body) return document.body.scrollTop; } function wbc_GetScrollLeft() { if(window.pageXOffset)return window.pageXOffset; if(document.documentElement && document.documentElement.scrollLeft) return document.documentElement.scrollLeft; if(document.body) return document.body.scrollLeft; } /*function wbc_SetHvost(poshv, codeLayer) { var el = document.getElementById(codeLayer); var blocknum = codeLayer.substr(6, codeLayer.length - 6); // устанавливаем с нужной стороны хвост if (poshv == 'left') { // левый хвост document.getElementById('wbc_hvost_r' + blocknum).style.display = 'none'; document.getElementById('wbc_hvost_l' + blocknum).style.display = 'block'; } else { //правый хвост document.getElementById('wbc_hvost_l' + blocknum).style.display = 'none'; document.getElementById('wbc_hvost_r' + blocknum).style.display = 'block'; } }*/ var hvost_side = 'left'; function wbc_SetPosition(e, codeLayer) { var container = document.getElementById('bscontainer'); container.setAttribute('codeLayer', codeLayer); var sh = wbc_GetInnerHeight(); var sw = wbc_GetInnerWidth(); var oh = 134;// Block height var ow = 236;// Block width var aw = 10; // Arrow width var st = wbc_GetScrollTop(); var sl = wbc_GetScrollLeft(); var mx = wbc_mouseX(e); var my = wbc_mouseY(e); var px = 0; var py = 0; container.innerHTML = document.getElementById(codeLayer).innerHTML; if (mx > sw - ow + 10) { if (sw < ow) { px = mx + aw; /*hvost_side = 'left'; wbc_SetHvost('left', codeLayer);*/ } else { px = mx - ow - aw - 5; /*hvost_side = 'right'; wbc_SetHvost('right', codeLayer);*/ } } else { px = mx + aw; /*hvost_side = 'left'; wbc_SetHvost('left', codeLayer);*/ } py = Math.min(sh - oh + 5, Math.max(10, my - oh / 2)) + 5; container.style.left = px + sl + 'px'; container.style.top = py + st + 'px'; container.style.display = 'block'; return container; } var WBC_MouseX_OLD = 0; var WBC_MouseY_OLD = 0; var wbc_last_time = 0; function addhandler(id, codeLayer) { function wbc_addHandler(object, event, handler) { if (typeof object.addEventListener!= 'undefined') object.addEventListener(event, handler, false); else if (typeof object.attachEvent!= 'undefined') object.attachEvent('on' + event, handler); } function wbc_removeHandler(object, event, handler) { if (typeof object.removeEventListener!= 'undefined') object.removeEventListener(event, handler, false); else if (typeof object.detachEvent!= 'undefined') object.detachEvent('on' + event, handler); } var bodyel = document.getElementsByTagName('body')[0]; if (bodyel) { wbc_addHandler(bodyel, 'mousemove', bodyel_XDrag); function bodyel_XDrag(e) { try { wbc_removeHandler(bodyel, 'mousemove', bodyel_XDrag); if (Math.abs(new Date().getTime() - wbc_last_time) 20) || (Math.abs(e.clientY - WBC_MouseY_OLD) > 20)) return; if (document.getElementById('bscontainer').TMR) clearTimeout(document.getElementById('bscontainer').TMR); // если курсор наведен на блок который уже отображается не пересчитываем координаты HideBSLayer; var container = SetPosition(e, codeLayer); container.isFixed = false; } } catch(e) {} } } document.getElementById(id).onmousemove = function (e) { if (document.getElementById('bscontainer').TMR) clearTimeout(document.getElementById('bscontainer').TMR); // если курсор наведен на блок который уже отображается не пересчитываем координаты if ((document.getElementById('bscontainer').getAttribute('codeLayer') == codeLayer) && (document.getElementById('bscontainer').style.display == 'block')) return; var container = wbc_SetPosition(e, codeLayer); container.isFixed = false; } document.getElementById(id).onmouseover = function (e) { if (document.getElementById('bscontainer').TMR) clearTimeout(document.getElementById('bscontainer').TMR); // если курсор наведен на блок который уже отображается не пересчитываем координаты if ((document.getElementById('bscontainer').getAttribute('codeLayer') == codeLayer) && (document.getElementById('bscontainer').style.display == 'block')) return; var container = wbc_SetPosition(e, codeLayer); container.isFixed = false; return false; } document.getElementById(id).onclick = function (e) { // если курсор наведен на блок который уже отображается не пересчитываем координаты if (document.getElementById('bscontainer').style.display == 'block') return; var container = wbc_SetPosition(e, codeLayer); container.isFixed = true; return false; } document.getElementById('bscontainer').onmouseout = function (e) { var container = document.getElementById('bscontainer'); if (!container.isFixed) document.getElementById('bscontainer').TMR = setTimeout(HideBSLayer, 1000); } document.getElementById('bscontainer').onmouseover = function() { clearTimeout(document.getElementById('bscontainer').TMR); } } function HideBSLayer() { var container = document.getElementById('bscontainer'); container.style.display = 'none'; return false; } function hover_in(ct) { ct.className = ct.className + ' hover'; } function hover_out(ct) { ct.className = ct.className.replace(' hover',''); } function wbc_show_menu(hide_block) { var el = document.getElementById(hide_block); if (el == null) {} else { if (el.style.display == 'block') { el.style.display = 'none'; } else { el.style.display = 'block'; } } return false; } function wbc_settings(main_block, wbc_sett) { var el1 = document.getElementById(main_block); var el2 = document.getElementById(wbc_sett); if ((el1 == null) || (el2 == null)) {} else { el1.style.display = 'none'; el2.style.display = 'block'; } } function wbc_close(old_block, new_block) { var el1 = document.getElementById(old_block); var el2 = document.getElementById(new_block); if ((el1 == null) || (el2 == null)) {} else { el1.style.display = 'none'; el2.style.display = 'block'; } } // элемент, который вызвал второе окно настроек var parent_settings_element = null; function color_edit(old_block, new_block, parent_el) { parent_settings_element = parent_el; var el1 = document.getElementById(old_block); var el2 = document.getElementById(new_block); if ((el1 == null) || (el2 == null)) {} else { el1.style.display = 'none'; el2.style.display = 'block'; } } function wbc_settings2_close(old_block, new_block, parent_el) { if ((parent_settings_element) && (parent_el)) { parent_settings_element.id = parent_el.id; } var el1 = document.getElementById(old_block); var el2 = document.getElementById(new_block); if ((el1 == null) || (el2 == null)) {} else { el1.style.display = 'none'; el2.style.display = 'block'; } } function wbc_cancel(old_block, new_block) { var el1 = document.getElementById(old_block); var el2 = document.getElementById(new_block); if ((el1 == null) || (el2 == null)) {} else { el1.style.display = 'none'; el2.style.display = 'block'; } } function wbc_cancelby_this(old_this_block, new_block) { var el1 = null; var currel; currel = old_this_block.parentElement; for (var i = 0; i < 100; i++) { if (currel) { if (currel.id.indexOf('wbc_block') >= 0) { el1 = currel; break; } currel = currel.parentElement; } else { break; } } var el2 = document.getElementById(new_block); if ((el1 == null) || (el2 == null)) {} else { //SetHvost3(hvost_side, new_block.substr(15, new_block.length - 15)); el1.style.display = 'none'; el2.style.display = 'block'; } EnableScrollForContainer('3'); } function wbc_all_price(old_block, new_block) { var el1 = document.getElementById(old_block); var el2 = document.getElementById(new_block); if ((el1 == null) || (el2 == null)) {} else { //SetHvost2(hvost_side, new_block.substr(10, new_block.length - 10)); el1.style.display = 'none'; el2.style.display = 'block'; } EnableScrollForContainer('2'); } /*function SetHvost2(poshv, blocknum) { // устанавливаем с нужной стороны хвост if (poshv == 'left') { // левый хвост document.getElementById('wbc_hvost_r2' + blocknum).style.display = 'none'; document.getElementById('wbc_hvost_l2' + blocknum).style.display = 'block'; } else { //правый хвост document.getElementById('wbc_hvost_l2' + blocknum).style.display = 'none'; document.getElementById('wbc_hvost_r2' + blocknum).style.display = 'block'; } } function SetHvost3(poshv, blocknum) { // устанавливаем с нужной стороны хвост if (poshv == 'left') { // левый хвост document.getElementById('wbc_hvost_r3' + blocknum).style.display = 'none'; document.getElementById('wbc_hvost_l3' + blocknum).style.display = 'block'; } else { //правый хвост document.getElementById('wbc_hvost_l3' + blocknum).style.display = 'none'; document.getElementById('wbc_hvost_r3' + blocknum).style.display = 'block'; } }*/ function view_offername(ware_txt, block_id) { var block = document.getElementById(block_id); if (block!= null) { block.innerText = ware_txt; } } function wbc_get_elem(id) { return document.getElementById(id); } function EnableScrollForContainer(num_scroll) { wbc_sroll_container = wbc_get_elem('wbc_scroll-container' + num_scroll); wbc_track = wbc_get_elem('wbc_scroll-track' + num_scroll); wbc_scroll = wbc_get_elem('wbc_scroll' + num_scroll); wbc_content = wbc_get_elem('wbc_row_container' + num_scroll); wbc_scroll.style.top = 0 + "px"; wbc_containerHeight = wbc_sroll_container.offsetHeight; wbc_contentHeight = wbc_content.offsetHeight; wbc_trackHeight = wbc_track.offsetHeight; wbc_scrollHeight = wbc_scroll.offsetHeight; wbc_delta = (wbc_contentHeight - wbc_containerHeight) / (wbc_trackHeight - wbc_scrollHeight); if (wbc_delta wbc_trackHeight - wbc_scrollHeight) { wbc_scroll.style.top = wbc_trackHeight - wbc_scrollHeight + "px"; } else { wbc_scroll.style.top = 0 + "px"; } if (wbc_delta > 0) wbc_content.style.marginTop = Math.round(parseInt(wbc_scroll.style.top) * wbc_delta * (-1)) + "px"; return false; } function wbc_blockEvent(event) { if (!event) { event = window.event; } if (event.stopPropagation) event.stopPropagation(); else event.cancelBubble = true; if (event.preventDefault) event.preventDefault(); else event.returnValue = false; }
Поиск по сайту:
Все материалы представленные на сайте исключительно с целью ознакомления читателями и не преследуют коммерческих целей или нарушение авторских прав. Студалл.Орг (0.003 сек.) |