 var countSlidersAction = 1; var showButton = 'true'; function colorSel(c) { il_color=c; p4sel(); } function sortSel(i) { il_sort=i; p4sel(); } function amountSel(i) { il_amount=i; p4sel(); } function priceSel( ps ) { il_price=ps; p4sel(); } Event.observe(window, 'scroll', function() { loadAllPics(); }); var loadingStarted = false; function loadAllPics() { if (!loadingStarted) { loadingStarted = true; var src = ""; var pics = Array(); if ($('u_searchRes')) var pics = $('u_searchRes').select('img'); else { var ulResults = $('ulResults'); if (ulResults != null) var pics = ulResults.select('img'); } for (var i=0; i< pics.length; ++i) { var tmp = pics[i].className; tmp = tmp.split(" "); for (var j=0; j<1; ++j) { if (tmp[j].startsWith("imgSrc")) src = tmp[j]; } src = src.replace(/imgSrc_/g,''); if (src != "") { (pics[i]).src = src; imagesToBeLoaded[pics[i].id]=true; } } } } function p4sel() { var c = il_color +':'+ il_sort +':'+ il_amount +':'+ il_price; $('hideDivItemLayer').innerHTML='<img src="'+DOCROOT+'img/loading.gif">'; nav( undefined, il_color, il_sort, il_amount, il_price ); } lastLoaded=0; function loadPics(from) { var scriptPicArray = $('scriptPicArray').value; var a = new Array(scriptPicArray); var ai = 0; var count = parseInt( $('endItemNr').innerHTML ); for(b=maxDirectPics+lastLoaded;b<count;b++) { $('s_il_'+b).innerHTML= '<img src="'+DOCROOT+'pics/c'+picWidth+'/'+a[ai+lastLoaded]+'" style="cursor:pointer;">'; ai++; if(ai>10) { lastLoaded+=ai; setTimeout("loadPics("+lastLoaded+")",500); return; } } } function change_item(code,itemcode,imgid) { quickCalc.refreshQC(itemcode); var c = code; var id = imgid; if ($('top-angebot') && (code == '9076' || code == '10467')) { if (itemcode != '9076' && itemcode != '55693') new Effect.Fade('top-angebot', { duration: 0.5 }); else new Effect.Appear('top-angebot', { duration: 0.5 }); } classes = $('link_' + code).className.split(" "); for (i=0; i< classes.length; ++i) { if (classes[i].startsWith('cell_')) var cell = classes[i].replace('cell_',''); } new Ajax.Request ( "ajax/change_item.php", { method: 'post', parameters: { code:code, itemcode: itemcode }, onComplete: function (transport,code) { if (transport.responseText) var parts = transport.responseText.split("§"); $('link_'+c).href = parts[0]; $('link_'+c).title = parts[1]; $('link_'+c).className = parts[2] + ' cell_' + cell; new Effect.Fade(id, { duration: 0.5, afterFinish: function() { $(id).src = parts[3]; $(id).title = parts[4]; $(id).alt = parts[4]; new Effect.Appear(id, { duration: 0.5 } ); } } ); $('itemname_'+c).innerHTML = parts[5]; $('desc_'+c).title = parts[7]; $('desc_'+c).innerHTML = parts[6]; $('price_'+c).innerHTML = parts[8]; } } ); } function move_to_previous2(itemcode,max_left) { var the_left = $('item_colors_'+itemcode).style.left; the_left = parseInt(the_left.replace('px','')); if (the_left < 0) { if ((the_left % 26) == 0) { new Effect.Move('item_colors_'+itemcode, { x: 26, y: 0, duration: 0.2, transition: Effect.Transitions.sinoidal }); } } else { $('item_colors_'+itemcode).style.left = '0px'; } } function move_to_next2(itemcode,max_left) { var the_left = $('item_colors_'+itemcode).style.left; the_left = parseInt(the_left.replace('px','')); if (the_left > max_left || the_left == 0 || !the_left) { if ((the_left % 26) == 0) { new Effect.Move('item_colors_'+itemcode, { x: -26, y: 0, duration: 0.2, transition: Effect.Transitions.sinoidal }); } } else { new Effect.Move('item_colors_'+itemcode, { x: (max_left * -1), y: 0, duration: 0.2, transition: Effect.Transitions.sinoidal }); } } function getBody(w) { return (w.document.compatMode && w.document.compatMode == "CSS1Compat") ? w.document.documentElement : w.document.body || null; } function elementInViewport(el) { var top = el.offsetTop; var left = el.offsetLeft; var width = el.offsetWidth; var height = el.offsetHeight; while(el.offsetParent) { el = el.offsetParent; top += el.offsetTop; left += el.offsetLeft; } if (navigator.userAgent.toLowerCase().indexOf("msie") != -1) { obj = getBody(window); if (top < (obj.scrollTop + obj.clientHeight) && left < (obj.scrollLeft + obj.clientWidth) && (top + height) > obj.scrollTop && (left + width) > obj.scrollLeft) return true; else return false; } else { if (top < (window.pageYOffset + window.innerHeight) && left < (window.pageXOffset + window.innerWidth) && (top + height) > window.pageYOffset && (left + width) > window.pageXOffset) return true; else return false; } } function setFreshData(data){ freshData = data; } var quickCalc = { quickCalc: 'undefined', title: '', arrows: new Array(4), arrowStyle: new Array(4), shadowLeft: 'undefined', shadowRight: 'undefined', qcDetailView: 'undefined', oldId:0, id:1, pos: new Array(2), validPos: new Array(4), href: '', isTop: false, isOut: false, isOver: false, doActivate: true, doDeactivate: true, active: false, appearTimer: 'undefined', lastId: 0, insertHTML: function() { $('tooltip_itemcalc').insert({'before': '<div id="quickCalc" style="display:none">\ <div style="position: relative">\ <div id="qcShadowTop"></div>\ <div id="qcShadowLeft"></div>\ <div id="qcShadowRight"></div>\ <div id="qcQuit" onclick="quickCalc.doDeactivate = true; ignoreNewId=true; quickCalc.deactivateQC();" ></div>\ <div id="qcHead">\ <span id="qcTitle">' + "Schnell-Kalkulation" + '</span>\ <div id="qcArrLeft" ></div>\ <div id="qcArrRight"></div>\ <table cellpadding="0" cellspacing="0" border="0" id="lbButtonQC" >\ <tr>\ <td>\ <div id="qcbleft"></div>\ </td>\ <td>\ <a id="qcDetailView" href="javascript:;" >' + "Detailansicht" + '</a>\ </td>\ <td>\ <div id="qcbright"></div>\ </td>\ </tr>\ </table>\ </div>\ <div id="quickCalcDest"></div>\ <div style="height: 0px; font-size: 0px; clear:both"></div>\ <div id="quickCalcBottom">\ <div id="qcArrDownLeft" ></div>\ <div id="qcArrDownRight"></div>\ <div id="qcWKTxt1">' + "Ihr Warenkorb enthält" + ':&nbsp;</div>\ <div id="qcWKTxt2"></div>\ </div>\ <div id="qcShadowDown"></div>\ </div>\ </div>'}); }, activateQC: function(e, event) { var top_warenkorb = $('top_warenkorb'); if (top_warenkorb != null) { if (top_warenkorb.innerHTML != "") $('qcWKTxt2').innerHTML = top_warenkorb.innerHTML; else new Ajax.Updater('qcWKTxt2',DOCROOT+'ajax/warenkorb.php',{method:'post',evalScripts:true,parameters:''}); } else { $('qcWKTxt1').innerHTML = ""; } this.doActivate = true; this.active = true; this.lastId = itemlistId; e = e.up(); x = e.select('a.gallery'); a = x[0]; a.addClassName("ulResultsAActive"); this.newQC(a, event); setTimeout("quickCalc.activateQC2()", 500); }, activateQC2: function () { if (this.doActivate) { this.doDeactivate = false; this.quickCalc.style.display = "block"; this.appearQuickCalc(); } }, clearTimer: function() { this.doActivate = false; }, deactivateQC: function() { if (this.doDeactivate) { if (this.oldId != 0 && (this.id != this.oldId || (typeof(ignoreNewId) != "undefined" && ignoreNewId==true))) { $('qc' + this.oldId).style.display = "none"; $('outitem_' + this.oldId).removeClassName('outitemBorder'); ignoreNewId = false; } this.hideArrows(); this.quickCalc.style.display = "none"; this.active = false; } }, getIDFromHref: function(href) { var id = href.split("-"); id = id.pop(); return id.replace(".htm",""); }, hideArrows: function() { for (i=0; i<4; ++i) this.arrows[i].style.visibility = 'hidden'; }, hideQC: function(event) { var mPos = this.mouse_pos(event); if (((mPos[0] < this.validPos[0]) || (mPos[1] < this.validPos[1]) || (mPos[0] > this.validPos[2]) || (mPos[1] > this.validPos[3]) ) && (!this.isOver)) { if (outitems.length == 0) { outitems = $$('.outitem'); qcButtons = $$('.qcButton'); } outitems.each(function(o){$(o).removeClassName('outitemBorder');}); qcButtons.each(function(o){$(o).style.display="none";}); this.isOut = true; ignoreNewId = true; this.doDeactivate = true; this.deactivateQC(); this.oldId = 0; clearTimeout(this.appearTimer); } else { this.isOut = false; } this.doActivate = false; }, mouse_pos: function (e) { if(!e) e = window.event; var body = (window.document.compatMode && window.document.compatMode == "CSS1Compat") ? window.document.documentElement : window.document.body; return { 1: e.pageY ? e.pageY : e.clientY + body.scrollTop - body.clientTop, 0: e.pageX ? e.pageX : e.clientX + body.scrollLeft - body.clientLeft }; }, checkHide: function (e, event) { var id = e.id.replace("link_", ""); this.id = id; if (id != this.oldId) { this.doDeactivate = true; setTimeout("quickCalc.deactivateQC()", 150); } }, refreshQC: function (itemcode) { if (typeof(lastOpendQC) == "undefined") lastOpendQC = 0; new Ajax.Updater($('quickCalcDest'),DOCROOT+ "ajax/quickCalc.php",{method:'post',parameters:PG+'&DOCROOT=' + DOCROOT + '&itemcode=' + itemcode + '&lastOpendQC=' + lastOpendQC,evalScripts:true}); }, newQC: function(e, event) { var id = e.id.replace("link_", ""); var itemid = this.getIDFromHref(e.href); if (id == this.oldId) return; var pos = e.cumulativeOffset(); var yOffset = 60; this.href = e.href; classes = e.className.split(" "); for (i=0; i< classes.length; ++i) { if (classes[i].startsWith('cell_')) var cell = classes[i].replace('cell_',''); } if (((pos[1]- document.viewport.getScrollOffsets()['top'] ) + 540) > document.viewport.getHeight()) { yOffset = -200; this.isTop = true; } else { this.isTop = false; } this.hideArrows(); for (i=0; i<4; ++i) this.arrowStyle[i] = false; if ((cell==1) || (cell==2)) { if (cell == 1) x = pos[0] + 244; else if (cell == 2) x = pos[0] + 240; if (this.isTop) this.arrowStyle[2] = true; else this.arrowStyle[0] = true; } else { x= pos[0] - 345; if (this.isTop) this.arrowStyle[3] = true; else this.arrowStyle[1] = true; } if ((id != this.oldId) && (this.active)) { if (typeof(lastOpendQC) == "undefined") lastOpendQC = 0; this.oldId = id; new Ajax.Updater($('quickCalcDest'),DOCROOT+ "ajax/quickCalc.php",{method:'post',parameters:PG+'&DOCROOT=' + DOCROOT + '&itemcode=' + itemid + '&lastOpendQC=' + lastOpendQC,evalScripts:true}); } this.quickCalc.style.left = x + 'px'; this.quickCalc.style.top = pos[1] + yOffset + 'px'; }, appearQuickCalc: function() { for (i=0; i<4; ++i) { if (this.arrowStyle[i] == true) this.arrows[i].style.visibility = 'visible'; } setTimeout('quickCalc.appearQuickCalc2()', 500); }, appearQuickCalc2: function() { if (!this.isOut) { this.quickCalc.show(); } }, initNewItem: function() { this.href = this.href.replace(this.getIDFromHref(this.href), $('currItemcode').value); this.qcDetailView.href = this.href; }, go: function() { this.insertHTML(); this.quickCalc = $('quickCalc'); this.shadowLeft = $('qcShadowLeft'); this.shadowRight = $('qcShadowRight'); this.arrows[0] = $('qcArrLeft'); this.arrows[1] = $('qcArrRight'); this.arrows[2] = $('qcArrDownLeft'); this.arrows[3] = $('qcArrDownRight'); this.title = $('qcTitle'); this.qcDetailView = $('qcDetailView'); var itemLayer = $('hideDivItemLayer'); this.validPos = itemLayer.cumulativeOffset(); this.validPos[2] = itemLayer.getWidth() + this.validPos[0]; this.validPos[3] = itemLayer.getHeight() + this.validPos[1]; $('body').observe('mouseover',function(e){ quickCalc.hideQC(e); } ); $('quickCalc').observe('mouseover',function(e){ quickCalc.doDeactivate = false; quickCalc.isOver = true; show_border2(); } ); $('quickCalc').observe('mouseout',function(e){ quickCalc.isOver = false; } ); } } 
