Index: designs/default_design.des.tpl =================================================================== --- designs/default_design.des.tpl (revision 14592) +++ designs/default_design.des.tpl (working copy) @@ -71,6 +71,57 @@
+ +
+ + +
" style="display:none;">
+
" style="display:none;"> + + + +
+
display:none;"> +
+
+
+
+
+
+ +
" class="promo-item">
+
+ +
+
+
+
+
+ + + +
Index: inc/content.css =================================================================== --- inc/content.css (revision 14592) +++ inc/content.css (working copy) @@ -213,3 +213,93 @@ float: left; width: 245px; } + +/** ======= START Promo block =============== **/ +.promo-choice { + float: right; + height: 218px; + width: 329px; + position: relative; +} + +.promo-back-container { + height: 218px; + width: 329px; + position: absolute; + display: none; +} + +.promo-orange { + background: #f49d13 url(../img/homepromo_orange_grad.gif) repeat-x; +} + +.promo-green { + background: #75af02 url(../img/homepromo_green_grad.gif) repeat-x; +} + +.promo-blue { + background: #05b3d3 url(../img/homepromo_blue_grad.gif) repeat-x; +} + +.promo-shadow-right { + background-color: #878787; + float: left; + margin-top: 1px; + height: 217px; + width: 1px; +} + +.promo-shadow-bottom { + clear: left; + background-color: #878787; + margin-left: 4px; + height: 1px; + width: 647px; +} + +.promo-item { + color: #fff; + font-size: 1.25em; + font-weight: bold; + height: 28px; + z-index: 10; + position: relative; + cursor: pointer; +} + +.promo-item.active { + color: #1b91b1; + height: 28px; +} + +.promo-selector { + position: absolute; + overflow: hidden; + float: left; + left: 30px; + top: 0px; + display: none; +} + +.promo-left-ear { + background: transparent url(../img/promo_ears.png) top left no-repeat; + width: 14px; + height: 28px; + position: relative; + float: left; +} + +.promo-middle { + height: 28px; + background: #fff; + float: left; +} + +.promo-right-ear { + background: transparent url(../img/promo_ear_r.png) top right no-repeat; + width: 14px; + height: 28px; + position: relative; + float: left; +} +/** ======= END Promo block =============== **/ Index: inc/general.js =================================================================== --- inc/general.js (revision 14592) +++ inc/general.js (working copy) @@ -76,4 +76,166 @@ return false; }); -}); \ No newline at end of file + if ($('#promo').length) { + initPromo(); + } + +}); + +function register_promo_view (target_num) { + var $block_id = promo_blocks[target_num].id; + + if ( !promo_blocks[target_num].viewed ) { + promo_blocks[target_num].viewed = true; + + $.get( $promo_stats_url.replace('#ID#', $block_id).replace('#EVENT#', 'OnRegisterView') ); + } +} + +function switchPromo(target_num, quick) { + + register_promo_view(target_num); + + var target = $('#promo_title' + target_num); + var current = $('#promo_title' + current_promo); + + /*if (target_num == 1 && current_promo == 4) { + quick = 1; + }*/ + + var duration = promo_transition_effect; + if ($('#promo_selector').css('display') == 'none') { + duration = 1; + } + + var target_top = target.position().top - 6; + + $('#promo_selector:hidden').css('top', target_top); + + if (quick) { + $('#promo_selector').stop().show(); + fadeImg($('#promo_link img:visible'), promo_blocks[target_num].image, duration, null, target_num); + if (promo_transition_controls == '1') { + fadeBackground('.promo-back-container:visible', promo_blocks[target_num].rightClass, duration); + } + $('#promo_selector').css('top', target_top).show(); + target.animate({color: '#1b91b1'}, duration/2); + +// $('#promo_selector').stop().show().fadeOut(duration/2, function() { +// fadeImg($('#promo_link img:visible'), promo_blocks[target_num].image, duration, null, target_num); +// fadeBackground('.promo-back-container:visible', promo_blocks[target_num].rightClass, duration); +// $(this).css('top', target_top).show(); //fadeIn(duration) +// target.animate({color: '#1b91b1'}, duration/2); +// } ); + + current.animate({color: '#fff'}, duration/2); + } + else { + current.animate({color: '#fff'}, duration/2); + $('#promo_selector').stop().show().animate( { top: target_top }, duration, '', function() { + + } ); + target.animate({color: '#1b91b1'}, duration); + fadeImg($('#promo_link img:visible'), promo_blocks[target_num].image, duration, null, target_num) + if (promo_transition_controls == '1') { + fadeBackground('.promo-back-container:visible', promo_blocks[target_num].rightClass, duration); + } + } + $('.corner-wrap .transp-corner').css('display', 'block').css('z-index', 10); // this is for IE6 to re-render the corners, otherwise they are left on old position + $('#promo_link').attr('href', promo_blocks[target_num].promoLink); + $('#promo_link').attr('target', promo_blocks[target_num].openInNewWindow ? '_blank' : '_self'); + $('#promo_link').attr('promo_id', promo_blocks[target_num].id); + current_promo = parseInt(target_num); +} + +function fadeImg(img, target_src, duration, callback, target_num) +{ + if ($(img).attr('src') == target_src) return; + + var the_img = $(img); + + tmp = $('[src='+target_src+']', img.parentNode); + if (!tmp.length) { + var tmp = the_img.clone().css({position: 'absolute', display: 'none'}).attr('src', target_src); + the_img.before(tmp); + } + tmp.fadeIn(duration, 'linear', callback).attr('alt', promo_blocks[target_num].name); + the_img.fadeOut(duration, 'linear'); +} + +function fadeBackground(elem, targetClass, duration) +{ + if ($(elem+':visible').hasClass(targetClass)) { + $('.corner-wrap .transp-corner').css('display', 'none').css('display', 'block'); // this is for IE6 to re-render the corners, otherwise they are left on old position + return; + } + + var the_elem = $(elem); + + tmp = $('.'+targetClass, the_elem[0].parentNode); + if (!tmp.length) { + if (promo_transition_controls == '1') { + var tmp = the_elem.clone().empty().css({display: 'none'}).removeClass().addClass('promo-back-container '+targetClass); + the_elem.after(tmp); + } + } + tmp.fadeIn(duration, function() { + $('.corner-wrap').css('display', 'none').css('display', 'block'); // this is for IE6 to re-render the corners, otherwise they are left on old position + }); + the_elem.fadeOut(duration, function() { + $('.corner-wrap').css('display', 'none').css('display', 'block'); // this is for IE6 to re-render the corners, otherwise they are left on old position + }); +} + +var promo_interval = null; +var promo_count = 0; + +function startPromo() +{ + promo_interval = window.setInterval( + function() { + var next_num = current_promo+1; + if (next_num > promo_count) { + next_num = 1; + switchPromo(next_num, 1); + } + else { + switchPromo(next_num); + } + }, + promo_speed) +} + +function initPromo() +{ + pos = $('#promo_right_box').position(); + w = $('#promo_right_box').width(); + h = $('#promo_right_box').height(); + if (promo_transition_controls == '1') { + $('.promo-back-container').css({left: pos.left, top: pos.top, width: w, height: h}).show(); + $('#promo_right_box').removeClass().addClass('promo-choice'); + } + // preload images and count promo_block + for (var i in promo_blocks) { + $("").attr("src", promo_blocks[i].image); + promo_count++; + } + switchPromo(1); + + $('.promo-item').click(function() { + switchPromo(this.id.replace(/^promo_title/, '')); + }); + + startPromo(); + + $(window).resize(function() { + $('.promo-back-container').css('left', $('#promo_right_box').position().left) + }) + + $('#promo') + .mouseover(function() { + clearInterval(promo_interval); + }) + .mouseout(startPromo); +} +