Element.Properties.mouseisover = { get: function(){ return this.mouseisover; }, set: function(value){ this.mouseisover = !!value; this.setAttribute('mouseisover', !!value); } }; Array.prototype.in_array = function(needle) { for(var i=0; i < this.length; i++) if(this[ i] === needle) return true; return false; }; document.onmousemove = null; document.ondragstart=new Function("return false;"); var ddDimensionsSearch = new Class({ initialize: function(searchFormId, searchResultId, profileId) { this.searchForm = $(searchFormId); this.searchFormId = searchFormId; this.searchResult = $(searchResultId); this.searchResultId = searchResultId; this.searchMode = 'default'; this.profileId = profileId this.count=0; this.loadedCount = 0; this.currentLeft = 0; this.currentStart = 0; this.dimensionTypes = new Array(); this.currentDimensionType = 0; this.scrollMove = false; this.scrollLeft = 0; this.mouseScrollerOffset = 0; this.dimensionsInCart = new Array(); this.dimensionIdsInCart = new Array(); $('chooseAlloysLink').addEvent('click', function() { this.searchMode = 'default'; this.loadAlloys(); }.bind(this)); this.dimensionSelects = $$('.dimensionSelect'); for (c=0; c0) { dimensions = cartRes[0].replace(/tx_dddeliveryprogram_dimensionsInCart=/, '').replace(';','').split(','); for (c=0; c 1) { var dimensionSelectsRequest = new Request.HTML({ url:'/index.php', onSuccess: function(responseTree, responseElements, responseHTML, responseJavaScript) { dimensionTypes = responseHTML.split('~'); for (c=0; c1?'en':'')+' anzeigen'); if (this.count==1) { this.getDimensions(); } } }.bind(this) }).get({ 'id': 174, 'tx_dddeliveryprogram_pi1[profileId]': this.profileId, 'tx_dddeliveryprogram_pi1[alloys]': $('alloyIds').value, 'tx_dddeliveryprogram_pi1[searchMode]': 'default', 'tx_dddeliveryprogram_pi1[dimensions]': this.getDimensionsSelects() }); }, getAlternateDimensionsCount: function() { var dimensionsCountRequest = new Request.HTML({ url:'/index.php', onSuccess: function(responseTree, responseElements, responseHTML, responseJavaScript) { if (responseHTML=='0') { $('alternateSubmit').setStyle('display','none'); this.count = 0; } else { $('alternateSubmit').setStyle('display','inline'); $('alternateSubmit').set('html', responseHTML+' Alternativen anzeigen'); this.count = parseInt(responseHTML); } }.bind(this) }).get({ 'id': 174, 'tx_dddeliveryprogram_pi1[profileId]': this.profileId, 'tx_dddeliveryprogram_pi1[alloys]': $('alloyIds').value, 'tx_dddeliveryprogram_pi1[searchMode]': 'alternate', 'tx_dddeliveryprogram_pi1[dimensions]': this.getDimensionsSelects() }); }, getDimensions: function() { $('spinner').setStyle('display','inline'); that = this; var dimensionsRequest = new Request.HTML({ url:'/index.php', onSuccess: function(responseTree, responseElements, responseHTML, responseJavaScript) { $('spinner').setStyle('display','none'); $('dimensionsSearchResultTypes').setStyle('display','block'); $('dimensionsSearchResultdimensionType').addEvent('change', function() { this.currentDimensionType = $('dimensionsSearchResultdimensionType').value; $$('#searchResultTableAlloys tbody td').each(function(item, index) { item.set('html', this.dimensionTypes[index][this.currentDimensionType]); }.bind(this)); }.bind(that)); $('dimensionsSearchResult').empty(); var dimensionsResult = new Element('div', { 'id':'dimensionsSearchResultContent', 'html':responseHTML, 'styles': { } }); dimensionsResult.inject($('dimensionsSearchResult'), 'bottom'); this.loadedCount = 10; this.currentStart = 0; this.currentLeft = 0; if (this.count>this.loadedCount) { this.getMoreDimensions(); } if (this.count>10 || this.count==1) { $('dimensionsSearchResultScroller').setStyle('display','block'); $('scrollSlider').addEvent('mousedown', function(event) { this.scrollMove = true; scrollPos = $('scrollBg').getPosition(); mousePos = event.client.x - scrollPos.x; this.mouseScrollerOffset = mousePos - this.scrollLeft; }.bind(this)); $('main').addEvent('mouseup', function() { this.scrollMove = false; this.moveToScrollPosition(); }.bind(this)); $('main').addEvent('mousemove', function(event) { scrollPos = $('scrollBg').getPosition(); if (this.scrollMove) { mousePos = event.client.x - scrollPos.x; this.scrollLeft = mousePos - this.mouseScrollerOffset; if (this.scrollLeft < 0) { this.scrollLeft = 0; } if (this.scrollLeft > 420) { this.scrollLeft = 420; } $('scrollSlider').setStyle('margin-left',this.scrollLeft+'px'); } }.bind(this)); $('scrollBg').addEvent('click', function(event) { scrollPos = $('scrollBg').getPosition(); mousePos = event.client.x - scrollPos.x; if (mousePos < this.scrollLeft) { this.moveLeft(); } if (mousePos > this.scrollLeft+30) { this.moveRight(); } }.bind(this)); } else { $('dimensionsSearchResultScroller').setStyle('display','none'); } this.setScrollSlider(); cells = $$('#dimensionsSearchResult .dimensionCell'); for (c=0; c'+dimension.get('title') }); if (this.dimensionsInCart.length==0) { $('requestCartContent').empty(); } buttonDelete = new Element('a', { 'href': 'javascript:void(0)', 'html': '', 'styles': { 'float': 'right', 'margin': '0 0 0 5px' }, 'events': { 'click': function() { dimensionId = arguments[0].get('uid'); $('requestCartElement_'+dimensionId).dispose(); this.dimensionIdsInCart.erase(dimensionId); var copyArray = new Array(); for (c=0; c/) >= 0) { dimensionInfo.set('title', headCell[0].get('html').split('
').join(' x ')); } else { dimensionInfo.set('title', headCell[0].get('html').split('
').join(' x ')); } return dimensionInfo; }, getColCells: function(cell) { classes = cell.get('class').split(' '); cellId = ''; for (d=0; d(.*)<\/dimensionid>/gim); if (idsRes) { var dimensionIds = new Array(); for (c=0; c/, '').replace(/<\/dimensionid>/, ''); dimensionIds.push(content); } var headRes = responseText.match(/(.*)<\/dimensionhead>/gim); tableHead = $$('#searchResultTableDimensionsTable thead tr'); for (c=0; c/, '').replace(/<\/dimensionhead>/, ''); headCell = new Element('th', { 'class' : 'dimensionCell dimensionCell_'+dimensionIds[c], 'html' : content }); headCell.addEvent('mouseenter', function() { if (colCells = this.getColCells(arguments[0])) { for (d=0; d(.*)<\/alloys>/gi); var alloyRows = $$('#searchResultTableDimensionsTable tbody tr'); if (alloysRes) { alloysList = String(alloysRes[0]); var alloys = alloysList.split(";"); var resultCount = 0; if (alloys.length>0) { for (c=0; c<(alloys.length-1); c++) { if (alloys[c]!='') { var dimensions = alloys[c].split(","); if (dimensions.length>0) { var resultCount = 0; for (d=0; d<(dimensions.length-1); d++) { if (dimensions[d]!='') { resultCount += 1; dCell = new Element('td', { 'class': ('dimensionCell dimensionCell_'+dimensionIds[d]+' ') + (dimensions[d]=='1'?'alloyActive':'alloyInactive'), 'html': ' ' }); dCell.addEvent('mouseenter', function() { if (colCells = this.getColCells(arguments[0])) { for (d=0; d0) { this.currentLeft = 0; } this.currentStart -= 10; if (this.currentStart<0) { this.currentStart = 0; } $('searchResultTableDimensionsTable').setStyle('margin-left',String(this.currentLeft)+'px'); this.setScrollSlider(); this.setFader(); }, moveRight: function() { width = $('searchResultTableDimensionsTable').getSize(); width = width.x; containerWidth = $('searchResultTableDimensions').getSize(); containerWidth = containerWidth.x; this.currentLeft -= 400; if (((this.currentLeft*-1)+(containerWidth*2)) > width) { if (this.loadedCount < this.count) { this.getMoreDimensions(); } else { this.currentLeft = (width - containerWidth) * -1; } } this.currentStart += 10; if (this.currentStart>this.count) { this.currentStart = this.count; } if (this.loadedCount >= this.count && ((this.currentLeft*-1)+containerWidth > width)) { this.currentLeft = (-1) * (width-containerWidth); } $('searchResultTableDimensionsTable').setStyle('margin-left',String(this.currentLeft)+'px'); this.setScrollSlider(); this.setFader(); }, moveToScrollPosition: function() { width = $('searchResultTableDimensionsTable').getSize(); width = width.x; containerWidth = $('searchResultTableDimensions').getSize(); containerWidth = containerWidth.x; percent = (100/420)*this.scrollLeft; newStart = parseInt((percent/100) * this.count); if (this.loadedCount < (newStart+10)) { range = parseInt(newStart - this.loadedCount + 10); this.getMoreDimensions(range); } loadedPercent = (100/this.count) * this.loadedCount; fullWidth = (width/loadedPercent) * 100; this.currentStart = newStart; this.currentLeft = parseInt((percent/100) * fullWidth) * -1; if (this.loadedCount >= this.count && ((this.currentLeft*-1)+containerWidth > width)) { this.currentLeft = (-1) * (width-containerWidth); } $('searchResultTableDimensionsTable').setStyle('margin-left',String(this.currentLeft)+'px'); this.setFader(); }, setScrollSlider: function() { this.scrollLeft = String(parseInt(((100/this.count)*(this.currentStart)/100)*420)); $('scrollSlider').setStyle('margin-left',this.scrollLeft+'px'); }, initFader: function() { /* containerSize = $('searchResultTableDimensions').getSize(); containerPos = $('searchResultTableDimensions').getPosition(); for (c=0; c<10; c++) { $('dimensionsSearchResultFaderLeft'+String(c)).setStyles({ width: 1, height: String(containerSize.y)+'px', position: 'absolute', left: String(containerPos.x+c)+'px', top: String(containerPos.y+1)+'px', background: '#AA2222', opacity: 1 - (c/10) }); $('dimensionsSearchResultFaderRight'+String(c)).setStyles({ width: 1, height: String(containerSize.y)+'px', position: 'absolute', left: String(containerPos.x+containerSize.x-c)+'px', top: String(containerPos.y+1)+'px', background: '#e0e0e0', opacity: 1 - (c/10) }); } */ }, setFader: function() { /* if (this.scrollLeft>0) { // show left face out $('dimensionsSearchResultFaderLeft').setStyle('display','block'); } else { $('dimensionsSearchResultFaderLeft').setStyle('display','none'); } if (this.scrollLeft<420) { // show right face out $('dimensionsSearchResultFaderRight').setStyle('display','block'); } else { $('dimensionsSearchResultFaderRight').setStyle('display','none'); } */ } }); window.addEvent('domready', initDimensionsSearch); function initDimensionsSearch() { dimensionsSearch = new ddDimensionsSearch('dimensionsSearchForm','dimensionsSearchResult', 48); dimensionsSearch.dimensionTypes.push(new Array('Al 99,5', '3.0255', 'EN AW-1050A', 'AW-Al 99,5')); dimensionsSearch.dimensionTypes.push(new Array('Al Mg 1', '3.3315', 'EN AW-5005A', 'AW-Al Mg 1')); dimensionsSearch.dimensionTypes.push(new Array('Al Mg 3', '3.3535', 'EN AW-5754', 'AW-Al Mg 3')); dimensionsSearch.dimensionTypes.push(new Array('Al Mg 5', '3.3555', 'EN AW-5019', 'AW-Al Mg 5')); dimensionsSearch.dimensionTypes.push(new Array('Al Mg Mn', '', '', '')); dimensionsSearch.dimensionTypes.push(new Array('Al Mg 2 Mn 0,8', '', '', '')); dimensionsSearch.dimensionTypes.push(new Array('Al Mg 4,5 Mn', '3.3547', 'EN AW5083', 'AW-Al Mg 4,5 Mn 0,7')); dimensionsSearch.dimensionTypes.push(new Array('Al Mg Si 0,5', '3.3206', 'EN AW-6060', 'AW-Al Mg Si')); dimensionsSearch.dimensionTypes.push(new Array('Al-Gussplatten', '', '', '')); dimensionsSearch.dimensionTypes.push(new Array('Al Mg 4,5 Mn plangefräst', '3.3547', 'EN AW-5083', 'AW-Al MG 4,5 Mn 0,7')); dimensionsSearch.dimensionTypes.push(new Array('Al Mg Si 0,7', '3.3210', 'EN-AW6005A', 'AW-Al Si Mg (A)')); dimensionsSearch.dimensionTypes.push(new Array('Al Mg Si 1', '3.2315', 'EN AW-6082', 'AW-Al Si Mg Mn')); dimensionsSearch.dimensionTypes.push(new Array('Al Mg 1 Si Cu', '', 'EN AW-Al Mg 1 Si Cu', '')); dimensionsSearch.dimensionTypes.push(new Array('Al Mg Si Pb', '3.0615', 'EN AW-6012', 'AW-Al Mg Si Pb')); dimensionsSearch.dimensionTypes.push(new Array('Al Cu Bi Pb', '3.1655', 'EN AW-2011', 'AW-AlCu6 Bi Pb')); dimensionsSearch.dimensionTypes.push(new Array('Al Cu Mg Pb', '3.1645', 'EN AW-2007', 'AW-Al Cu4')); dimensionsSearch.dimensionTypes.push(new Array('Al Mn 1', '3.0515', 'EN AW-Al Mn 1', '')); dimensionsSearch.dimensionTypes.push(new Array('Al Cu Mg 1', '3.1325', 'EN AW-2017A', 'AW-Al Cu 4 Mg Si (A)')); dimensionsSearch.dimensionTypes.push(new Array('Al Cu Mg 2', '3.1355', 'EN AW-Al Cu 4 Mg 1', '')); dimensionsSearch.dimensionTypes.push(new Array('Al Cu 4 Si Mn Mg', '', '', '')); dimensionsSearch.dimensionTypes.push(new Array('Al Zn 4,5 Mg 1', '3.4335', 'EN AW-7020', '')); dimensionsSearch.dimensionTypes.push(new Array('Al Zn Mg Cu 0,5', '3.4345', 'EN AW-7022', 'AW-Al Zn 5 Mg 3 Cu')); dimensionsSearch.dimensionTypes.push(new Array('Al Zn Mg Cu 1,5', '3.4365', 'EN AW-7075', 'AW-Al Zn 5,5 Mg Cu')); dimensionsSearch.dimensionTypes.push(new Array('Ms 58 / CuZn39Pb2', '2.0380', 'EN CW612N', 'CuZn39Pb2')); dimensionsSearch.dimensionTypes.push(new Array('Ms 58 / CuZn39Pb3', '2.0401', 'EN CW614N', 'CuZn39Pb3')); dimensionsSearch.dimensionTypes.push(new Array('Ms 58 / CuZn40Pb2', '2.0402', 'EN CW617N', 'CuZn40Pb2')); dimensionsSearch.dimensionTypes.push(new Array('Ms 63 / CuZn37', '2.0321', 'CW 508L', 'CuZn37')); dimensionsSearch.dimensionTypes.push(new Array('Ms 63 / CuZn37', '2.0321', 'CW 508L', 'CuZn37')); dimensionsSearch.dimensionTypes.push(new Array('Ms 63 / CuZn37', '2.0321', 'CW 508L', 'CuZn37')); dimensionsSearch.dimensionTypes.push(new Array('Ms 63Pb / CuZn37', '2.0321', 'EN CW508L', 'CuZn37')); dimensionsSearch.dimensionTypes.push(new Array('Ms 60 / CuZn40', '2.0360', 'EN CW509L', 'CuZn40')); dimensionsSearch.dimensionTypes.push(new Array('Ms 60 Pb / CuZn40Pb2', '2.0402', 'EN CW617N', 'CuZn40Pb2')); dimensionsSearch.dimensionTypes.push(new Array('Ms 70 / CuZn30', '2.0265', 'EN CW 505L', 'CuZn30')); dimensionsSearch.dimensionTypes.push(new Array('Ms 72 / CuZn28', '2.0261', 'EN CW504L', 'CuZn28')); dimensionsSearch.dimensionTypes.push(new Array('Ms 85 / CuZn15', '2.0240', 'EN CW502L', 'CuZn15')); dimensionsSearch.dimensionTypes.push(new Array('Ms 95 / CuZn5', '2.0220', 'EN CW500L', 'CuZn5')); dimensionsSearch.dimensionTypes.push(new Array('So Ms 59', '', '', '')); dimensionsSearch.dimensionTypes.push(new Array('E-Cu', '', '', '')); dimensionsSearch.dimensionTypes.push(new Array('SF-Cu', '', '', '')); }