function animateNews() { var objectInfo = { w: $('.newsContainer div:eq(0)').width(), h: $('.newsContainer div:eq(0)').height(), pL: parseInt($('.newsContainer div:eq(0)').css('paddingLeft')), pR: parseInt($('.newsContainer div:eq(0)').css('paddingRight')), cnt: $('.newsContainer div').length }; $('.newsContainer').width((objectInfo.w + objectInfo.pL + objectInfo.pR) * objectInfo.cnt); $('.newsNavRight').bind('click', function() { if (this.running || $('.newsNavLeft').get(0).running) return false; var containerLeft = parseInt($('.newsContainer').css('left')); if ((((-1) *containerLeft) + (objectInfo.w + objectInfo.pL + objectInfo.pR)) == $('.newsContainer').width()) return false; this.running = true; $('.newsContainer').animate({ left: containerLeft - (objectInfo.w + objectInfo.pL + objectInfo.pR) + 'px' }, 500, function() { $('.newsNavRight').get(0).running = false; }); return false; }); $('.newsNavLeft').bind('click', function() { if (this.running || $('.newsNavRight').get(0).running) return false; var containerLeft = parseInt($('.newsContainer').css('left')); if (containerLeft == 0) return false; this.running = true; $('.newsContainer').animate({ left: containerLeft + (objectInfo.w + objectInfo.pL + objectInfo.pR) + 'px' }, 500, function() { $('.newsNavLeft').get(0).running = false; }); return false; }); } function animatePhotos(i) { var objectInfo = { w: $('.photos').width(), h: $('.photos').height() }; if ($('.photoContainer').css('top') == (-1) * objectInfo.h * (i-1) + 'px') return false; $('.photoContainer').fadeOut('normal', function() { $('.photoContainer').css('top', (-1)*objectInfo.h * (i-1) + 'px'); $('.photoContainer').fadeIn(); }); /* var actualPage = Math.abs(parseInt($('.photoContainer').css('top'))) / objectInfo.h +1; $('.photoContainer').animate({ top: (-1)*objectInfo.h * (i-1) + 'px' }, 500* Math.abs(i-actualPage)); */ return false; } function displayBigPhoto(id, clickObj) { if ($('img[id*=bigphoto]').length == 0 || id == $('img[id*=bigphoto]').attr('id').replace(/^bigphoto_(\d+)$/, '$1')) return false; $('img[id*=bigphoto]').fadeOut('normal', function() { $('img[id*=bigphoto]').remove(); /** * Ha a következő lapozott kép már egy új oldalon van, akkor a kis képeket is lapozzuk */ if (($(clickObj).attr('id') == 'nextButton' || $(clickObj).attr('id') == '') && uploadedPhotos[id]['number'] % 12 == 1 && uploadedPhotos[id]['number'] != 1) animatePhotos(Math.ceil(uploadedPhotos[id]['number'] / 12)); /** * Ha az előző lapozott kép már egy új oldalon van, akkor a kis képeket is lapozzuk */ if ($(clickObj).attr('id') == 'previousButton' && uploadedPhotos[id]['number'] % 12 == 0) animatePhotos(Math.floor(uploadedPhotos[id]['number'] / 12)); /** * Ha van következő kép, akkor a nagyképnek is beállítjuk, hogy kattintásra a következőt nyissa meg */ if (typeof uploadedPhotos[id]['next'] != 'undefined') { if ($('.bigImage a').length == 0) $('.bigImage').append(''); $('.bigImage a').attr('onclick', '').unbind('click').click(function() { return displayBigPhoto(uploadedPhotos[id]['next'], this); }); } else $('.bigImage a').remove(); /** * Nagy kép készítése */ var image = new Image(); image.src = 'upload/photos/big/' + uploadedPhotos[id]['src']; image.style.display = 'none'; image.id = 'bigphoto_' + id; /** * Preloader indiítása */ $('.bigImage img').show(); /** * Amikor a nagykép betöltődik */ image.onload = function() { var o = this; setTimeout(function() { $('.bigImage img').hide(); /** * Adatbázis adatok beállítása a JSON tömbből */ $('#photoTitle').html(uploadedPhotos[id]['title_' + lang]); if (uploadedPhotos[id]['description_' + lang] != null) { $('#description').html(uploadedPhotos[id]['description_' + lang].replace('\n', '
')); $('#description').show(); } else $('#description').hide(); if (typeof uploadedPhotos[id]['details'] == 'undefined') $('.imgInfo').hide(); else { $('.imgInfo').show(); for (var i in uploadedPhotos[id]['details']) { $('.imgInfo b:eq(' + i + ')').html(uploadedPhotos[id]['details'][i]['key_' + lang] + ':'); $('.imgInfo span:eq(' + i + ')').html(uploadedPhotos[id]['details'][i]['value_' + lang]); } } if (typeof uploadedPhotos[id]['next'] != 'undefined') $('.bigImage a').html(image); else $('.bigImage').append(image); if (typeof uploadedPhotos[id]['next'] != 'undefined') { $('#nextButton').show(); $('#nextButton').attr('onclick', '').unbind('click').click(function() { return displayBigPhoto(uploadedPhotos[id]['next'], this); }); } else $('#nextButton').hide(); if (typeof uploadedPhotos[id]['previous'] != 'undefined') { $('#previousButton').show(); $('#previousButton').attr('onclick', '').unbind('click').click(function() { return displayBigPhoto(uploadedPhotos[id]['previous'], this); }); } else $('#previousButton').hide(); $(o).fadeIn(); }, 500); } }); return false; } function noHoverTopMenu() { $('.navcontainer').css('borderBottom', '6px solid white'); } /** * Felső menü hoverezése */ function hoverTopMenu(num, sel) { /** * Flash hoverezi */ if (typeof num == 'number') { $('.navcontainer').css('borderBottom', '6px solid white'); $('#navigation .navcontainer:eq(' + num + ')').css( { borderBottom : (sel == 1 ? '6px solid #737171' : '6px solid #ffffff') }); } /** * Javascript hoverezi */ else { $(num).css({ borderBottom : (sel == 1 ? '6px solid #737171' : '6px solid #ffffff') }); } } /** * Submenuk kinyitása becsukása */ function animateTopMenu(e) { topMenuAnimateRun = true; var $obj = $(".subcontainer", e); if (!$obj.is(':visible')) { $(".subcontainer:visible").fadeOut(); $obj.show(); sIFR.replace(arial, { selector: '#navigation div.navcontainer div.subcontainer' ,css: [ '.sIFR-root { color: #aaaaaa; font-size: 11px; }', 'a { color: #aaaaaa; font-size: 11px; text-transform: uppercase; text-decoration: none;}', 'a:hover { color: #676664; }', ] ,wmode: 'transparent' ,selectable: true }); $obj.hide(); $obj.fadeIn(); } else $obj.fadeOut(); } function setScrollbar() { if ($('#scroller-bar-drag').length > 0) { $('#scroller-content').disableTextSelect(); var sizes = { scrollerHeight: $('#scroller-bar-drag').height(), scrollBarHeight: $('#scroller-bar-bg').height(), contentHeight: $('#scroller-content').height() } if (sizes.contentHeight < sizes.scrollBarHeight) { $("#scroller-bar").hide(); return; } var scale = (sizes.contentHeight - sizes.scrollBarHeight) / (sizes.scrollBarHeight - sizes.scrollerHeight); var scrollerscale = (sizes.scrollBarHeight - sizes.scrollerHeight) / (sizes.contentHeight - sizes.scrollBarHeight); $('#scroller-bar-drag').draggable({ containment: 'parent' }); $('#scroller-bar-drag').bind('drag', function(event, ui) { var scrollbarTop = parseInt($('#scroller-bar-drag').css('top').replace(/^(\d+)px$/, '$1')); if (isNaN(scrollbarTop)) scrollbarTop = 0; $('#scroller-content').css('top', -(scrollbarTop * scale) + 'px'); }); $('#scroller-content-container').mousewheel(function(event, delta) { var contentTop = parseInt($('#scroller-content').css('top').replace(/^(\d+)px$/, '$1')); if (isNaN(contentTop)) contentTop = 0; var sctop = contentTop + delta * 5; sctop = Math.min(0, sctop); sctop = Math.max(sizes.scrollBarHeight - sizes.contentHeight, sctop); $('#scroller-content').css('top', sctop + 'px'); var scrollerTop = -(sctop * scrollerscale); scrollerTop = Math.max(0, scrollerTop); scrollerTop = Math.min(sizes.scrollBarHeight-sizes.scrollerHeight, scrollerTop); $('#scroller-bar-drag').css('top', -(sctop * scrollerscale) + 'px'); return false; }, null, true); } } function setScrollBar2() { if ($('#scroller-bar-drag-leftmenu').length > 0) { $('#scroller-content-leftmenu').disableTextSelect(); var sizes = { scrollerHeight: $('#scroller-bar-drag-leftmenu').height(), scrollBarHeight: $('#scroller-bar-bg-leftmenu').height(), contentHeight: $('#scroller-content-leftmenu').height() } if (sizes.contentHeight <= sizes.scrollBarHeight+6) { $("#scroller-bar-leftmenu").hide(); return; } var scale = (sizes.contentHeight - sizes.scrollBarHeight) / (sizes.scrollBarHeight - sizes.scrollerHeight); var scrollerscale = (sizes.scrollBarHeight - sizes.scrollerHeight) / (sizes.contentHeight - sizes.scrollBarHeight); $('#scroller-bar-drag-leftmenu').draggable({ containment: 'parent' }); $('#scroller-bar-drag-leftmenu').bind('drag', function(event, ui) { var scrollbarTop = parseInt($('#scroller-bar-drag-leftmenu').css('top').replace(/^(\d+)px$/, '$1')); if (isNaN(scrollbarTop)) scrollbarTop = 0; $('#scroller-content-leftmenu').css('top', -(scrollbarTop * scale) + 'px'); }); $('#scroller-content-container-leftmenu').mousewheel(function(event, delta) { var contentTop = parseInt($('#scroller-content-leftmenu').css('top').replace(/^(\d+)px$/, '$1')); if (isNaN(contentTop)) contentTop = 0; var sctop = contentTop + delta * 5; sctop = Math.min(0, sctop); sctop = Math.max(sizes.scrollBarHeight - sizes.contentHeight, sctop); $('#scroller-content-leftmenu').css('top', sctop + 'px'); var scrollerTop = -(sctop * scrollerscale); scrollerTop = Math.max(0, scrollerTop); scrollerTop = Math.min(sizes.scrollBarHeight-sizes.scrollerHeight, scrollerTop); $('#scroller-bar-drag-leftmenu').css('top', -(sctop * scrollerscale) + 'px'); return false; }, null, true); } } function scrollProductThumbs() { var objectInfo = { w: $('.pager .productPictures a:eq(1)').width(), cW: $('.pager .productPicturesContainer').width(), mL: parseInt($('.pager .productPictures a:eq(1)').css('marginLeft')), mR: parseInt($('.pager .productPictures a:eq(1)').css('marginRight')), bL: parseInt($('.pager .productPictures a:eq(1)').css('borderLeftWidth')), bR: parseInt($('.pager .productPictures a:eq(1)').css('borderRightWidth')), cnt: $('.pager .productPictures a').length }; if (isNaN(objectInfo.w)) objectInfo.w = 0; if (isNaN(objectInfo.cW)) objectInfo.cW = 0; if (isNaN(objectInfo.mL)) objectInfo.mL = 0; if (isNaN(objectInfo.mR)) objectInfo.mR = 0; if (isNaN(objectInfo.bL)) objectInfo.bL = 0; if (isNaN(objectInfo.bR)) objectInfo.bR = 0; if (typeof objectInfo.w == 'undefined') return false; var containerWidth = (objectInfo.w + objectInfo.mL + objectInfo.mR + objectInfo.bR + objectInfo.bL) * objectInfo.cnt; $('.productPictures').width(containerWidth); $('.rightPagerBtn').bind('click', function() { if (this.running || $('.leftPagerBtn').get(0).running) return false; var containerLeft = parseInt($('.productPictures').css('left')); if ((((-1) *containerLeft) + (objectInfo.w + objectInfo.mL + objectInfo.mR + objectInfo.bL + objectInfo.bR)) == $('.productPictures').width()) return false; this.running = true; $('.productPictures').animate({ left: Math.max(-(containerWidth - objectInfo.cW), containerLeft - objectInfo.cW) + 'px' }, 500, function() { $('.rightPagerBtn').get(0).running = false; }); return false; }); $('.leftPagerBtn').bind('click', function() { if (this.running || $('.rightPagerBtn').get(0).running) return false; var containerLeft = parseInt($('.productPictures').css('left')); if (containerLeft == 0) return false; this.running = true; $('.productPictures').animate({ left: Math.min(0, containerLeft + objectInfo.cW) + 'px' }, 500, function() { $('.leftPagerBtn').get(0).running = false; }); return false; }); } function displayProductPhoto(o) { var src = $("img", o).attr("src").replace(/.*[\/](.*)/, '$1'); $('.productImage img.bigPhoto').fadeOut("normal", function() { $('.productImage img.bigPhoto').remove(); $('.productImage img.preloader').show(); }); var image = new Image(); image.src = 'upload/products/big/' + src; image.className = 'bigPhoto'; image.onload = function() { setTimeout(function() { $('.productImage').append(image); $('.productImage img.bigPhoto').hide(); $('.productImage img.preloader').hide(); $('.productImage img.bigPhoto').fadeIn(); }, 1000); } return false; } $(function() { $("#navigation .navcontainer").each(function() { $(this).click(function() { animateTopMenu(this) }); var o = this; $(this).hover(function() { $.browser.msie && $.browser.version == 6 hoverTopMenu(o, 1); }, function() { $.browser.msie && $.browser.version == 6 hoverTopMenu(o, 0); }); }); animateNews(); scrollProductThumbs(); setScrollbar(); setScrollBar2(); });