$(document).ready(function() { // ACT START var actClick = 0; var actCnt = 0; var actMax = 0; var actArr = new Array(); var actTexts = new Array(); $.each($('.banner4_text span'), function(index, value) { actTexts[index] = value; if (index == 0) $(value).show(); }); $.each($('.banner4_image img'), function(index, value) { actArr[index] = value; actCnt++; }); $.each($('.banner4_image img'), function(index, value) { if (index > 0) $(value).remove(); }); actMax = actCnt - 1; $('#left_act').click(function() { $(actTexts[actClick]).hide(); $(actArr[actClick]).fadeOut(800, function () { $(actArr[actClick]).remove(); actClick++; if (actClick > actMax) actClick = 0; $(actArr[actClick]).fadeIn().appendTo($('.banner4_image')); $(actTexts[actClick]).show(); }); }); $('#right_act').click(function() { $(actTexts[actClick]).hide(); $(actArr[actClick]).fadeOut(800, function () { $(actArr[actClick]).remove(); actClick++; if (actClick > actMax) actClick = 0; $(actArr[actClick]).fadeIn().appendTo($('.banner4_image')); $(actTexts[actClick]).show(); }); }); // ACT END // PROMO START var promoClick = 0; var promoCnt = 0; var promoMax = 0; var promoArr = new Array(); var promoTexts = new Array(); $.each($('.banner3_text span'), function(index, value) { promoTexts[index] = value; if (index == 0) $(value).show(); }); $.each($('.banner3_image img'), function(index, value) { promoArr[index] = value; promoCnt++; }); $.each($('.banner3_image img'), function(index, value) { if (index > 0) $(value).remove(); }); promoMax = promoCnt - 1; $('#left_promo').click(function() { $(promoTexts[promoClick]).hide(); $(promoArr[promoClick]).fadeOut(800, function () { $(promoArr[promoClick]).remove(); promoClick++; if (promoClick > promoMax) promoClick = 0; $(promoArr[promoClick]).fadeIn().appendTo($('.banner3_image')); $(promoTexts[promoClick]).show(); }); }); $('#right_promo').click(function() { $(promoTexts[promoClick]).hide(); $(promoArr[promoClick]).fadeOut(800, function () { $(promoArr[promoClick]).remove(); promoClick++; if (promoClick > promoMax) promoClick = 0; $(promoArr[promoClick]).fadeIn().appendTo($('.banner3_image')); $(promoTexts[promoClick]).show(); }); }); // PROMO END // NEWS START var newsClick = 0; var newsCnt = 0; var newsMax = 0; var newsArr = new Array(); var newsTexts = new Array(); $.each($('.banner1_text span'), function(index, value) { newsTexts[index] = value; if (index == 0) $(value).show(); }); $.each($('.banner1_image img'), function(index, value) { newsArr[index] = value; newsCnt++; }); $.each($('.banner1_image img'), function(index, value) { if (index > 0) $(value).remove(); }); newsMax = newsCnt - 1; $('#left_new').click(function() { $(newsTexts[newsClick]).hide(); $(newsArr[newsClick]).fadeOut(800, function () { $(newsArr[newsClick]).remove(); newsClick++; if (newsClick > newsMax) newsClick = 0; $(newsArr[newsClick]).fadeIn().appendTo($('.banner1_image')); $(newsTexts[newsClick]).show(); }); }); $('#right_new').click(function() { $(newsTexts[newsClick]).hide(); $(newsArr[newsClick]).fadeOut(800, function () { $(newsArr[newsClick]).remove(); newsClick++; if (newsClick > newsMax) newsClick = 0; $(newsArr[newsClick]).fadeIn().appendTo($('.banner1_image')); $(newsTexts[newsClick]).show(); }); }); // NEWS END // RECIPES START var recipesClick = 0; var recipesCnt = 0; var recipesMax = 0; var recipesArr = new Array(); var recipesTexts = new Array(); $.each($('.banner2_text span'), function(index, value) { recipesTexts[index] = value; if (index == 0) $(value).show(); }); $.each($('.banner2_image img'), function(index, value) { recipesArr[index] = value; recipesCnt++; }); $.each($('.banner2_image img'), function(index, value) { if (index > 0) $(value).remove(); }); recipesMax = recipesCnt - 1; $('#left_recipt').click(function() { $(recipesTexts[recipesClick]).hide(); $(recipesArr[recipesClick]).fadeOut(800, function () { $(recipesArr[recipesClick]).remove(); recipesClick++; if (recipesClick > recipesMax) recipesClick = 0; $(recipesArr[recipesClick]).fadeIn().appendTo($('.banner2_image')); $(recipesTexts[recipesClick]).show(); }); }); $('#right_recipt').click(function() { $(recipesTexts[recipesClick]).hide(); $(recipesArr[recipesClick]).fadeOut(800, function () { $(recipesArr[recipesClick]).remove(); recipesClick++; if (recipesClick > recipesMax) recipesClick = 0; $(recipesArr[recipesClick]).fadeIn().appendTo($('.banner2_image')); $(recipesTexts[recipesClick]).show(); }); }); // RECIPES END var click = 0; var min = 0; var max = 0; var iid = 0; var itemsAvail = new Array(); $.each($('.panel_image img'), function(index, value) { itemsAvail[index] = value; }); $.each('#all_images span', function(index, value) { max++; }); max = parseInt($('#images_cnt').val()) - 1; min = -1 * max; min = 0; $(itemsAvail[0]).css('position', 'absolute'); $(itemsAvail[1]).css('position', 'absolute'); $(itemsAvail[2]).css('position', 'absolute'); $(itemsAvail[0]).css('left', '-900px'); $(itemsAvail[2]).css('left', '900px'); $('.panel_right').click(function() { window.clearInterval(iid); $(itemsAvail[0]).animate({left: '-=900'}); $(itemsAvail[1]).animate({left: '-=900'}); $(itemsAvail[2]).animate({left: '-=900'}, function() { updateContent(click); }); click++; if (click > max) click = min; }); $('.panel_left').click(function() { window.clearInterval(iid) $(itemsAvail[0]).animate({left: '+=900'}); $(itemsAvail[1]).animate({left: '+=900'}); $(itemsAvail[2]).animate({left: '+=900'}, function() { updateContent(click); }); click--; if (click < min) click = max; }); function updateContent(cnt, type, lr) { var items = new Array(); $.each($('#all_images span'), function(index, value) { items[index] = value; }); for (i = 1; i < items.length; i++) { items[-1 * i] = items[i]; } idx0 = cnt - 1 < min ? max : cnt - 1; idx1 = cnt; idx2 = cnt + 1 > max ? min : cnt + 1; textIdx = 0; if (idx1 < 0) textIdx = -1 * idx1; else textIdx = idx1; $.each($('.panel_text span'), function(index, value) { if (index == textIdx) $(value).show(); else $(value).hide(); }); $('.panel_image').html($(items[idx0]).html() + $(items[idx1]).html() + $(items[idx2]).html()); $.each($('.panel_image img'), function(index, value) { itemsAvail[index] = value; }); $(itemsAvail[0]).css('position', 'absolute'); $(itemsAvail[1]).css('position', 'absolute'); $(itemsAvail[2]).css('position', 'absolute'); $(itemsAvail[0]).css('left', '-900px'); $(itemsAvail[1]).css('left', '0px'); $(itemsAvail[2]).css('left', '900px'); } iid = window.setInterval(function() { $(itemsAvail[0]).animate({left: '-=900'}); $(itemsAvail[1]).animate({left: '-=900'}); $(itemsAvail[2]).animate({left: '-=900'}, function() { updateContent(click); }); click++; if (click > max) click = min; }, 3000); $('#cow').mouseover(function() { $(this).css('margin-top', '8px'); }); $('#cow').mouseout(function() { $(this).css('margin-top', '40px'); }); $('#sheep').mouseover(function() { $(this).css('margin-top', '15px'); }); $('#sheep').mouseout(function() { $(this).css('margin-top', '40px'); }); $('#pig').mouseover(function() { $(this).css('margin-top', '30px'); }); $('#pig').mouseout(function() { $(this).css('margin-top', '40px'); }); $('#footer ul li').each(function() { $(this).mouseover(function() { if ($('#curr_mod').val() == $(this).attr('id')) $(this).css('text-decoration', 'underline'); else $(this).css('text-decoration', 'none'); }); $(this).mouseout(function() { $(this).css('text-decoration', 'none'); }); }); $('#footer_22').mouseover(function() { if ($('#curr_mod').val() == 'footer_22') $(this).css('text-decoration', 'underline'); else $(this).css('text-decoration', 'none'); }); $('#footer_22').mouseout(function() { $(this).css('text-decoration', 'none'); }); $('#' + $('#curr_mod').val()).css('text-decoration', 'underline'); });