window.addEvent('domready', function() { if ($('promo_flash')) { var so = new SWFObject("/images/visual3.swf", "flash_movie", "612", "381", "8", "#ffffff"); so.addParam("wmode", "transparent"); so.write("promo_flash"); } var last_tab = ""; function mySwitch(el, wi) { var myEffect = new Fx.Morph(el, {duration: '500'}) myEffect.start({ 'width': ['0px', wi+'px'] }); } function toggle_new(cur_tab) { if (last_tab != cur_tab) { content_tab = cur_tab.getParent().getFirst(); cur_tab_w = content_tab.getWidth(); mySwitch(content_tab, 577); } } function s_toggle(cur_tab) { content_tab = last_tab.getParent().getFirst(); var myEffect = new Fx.Morph(content_tab,{ duration: '500' }); myEffect.start({'width': ['0px', '577px']}); } function f_toggle(cur_tab) { if (last_tab != "") { if (cur_tab == last_tab) { var myEffect2 = new Fx.Morph(content_tab,{ duration: '500' }); myEffect2.start({'width': ['577px', '0px']}); last_tab = ""; } else { content_tab = last_tab.getParent().getFirst(); var myEffect = new Fx.Morph(content_tab,{ duration: '500', onComplete: function() { s_toggle(cur_tab); } }); myEffect.start({'width': ['577px', '0px']}); last_tab = cur_tab; } } else { toggle_new(cur_tab); last_tab = cur_tab; } } $$('#promo_links .link_tab').each(function(el) { el.addEvent('click', function() { f_toggle(el); return false; }); }); //all_main_items if ($('all_main_items_con')) { var cur_all_sales_items = 1; var count_all_sales_items = 0; $$('#all_main_items #all_main_items_con .one_item').each(function(el) { count_all_sales_items++; }); $$('#all_main_items #all_main_items_con').getFirst().set('opacity','1'); function flip_sales_items(next_el) { $('sales_item_' + cur_all_sales_items).setStyle('z-index', '1'); $('sales_item_' + cur_all_sales_items).setStyle("opacity" , 0) $('sales_item_' + next_el).setStyle("opacity" , 1); $('sales_item_' + next_el).setStyle('z-index', '2'); cur_all_sales_items = next_el; } function show_sales_items(act) { var next_init; if (act == "next") { if (cur_all_sales_items == count_all_sales_items) { next_init = 1; } else { next_init = cur_all_sales_items+1; } flip_sales_items(next_init); } else { if (cur_all_sales_items == 1) { next_init = count_all_sales_items; } else { next_init = cur_all_sales_items-1; } flip_sales_items(next_init); } } $('sale_controls_up').addEvent('click', function() { show_sales_items("prev"); return false; }); $('sale_controls_down').addEvent('click', function() { show_sales_items("next"); return false; }); setInterval("$('sale_controls_down').fireEvent('click')", 5000); } //product if ($('pick_color')) { new Asset.images(['/images/inner/show_left_products2.jpg','/images/inner/show_left_products.jpg','/images/inner/show_right_products2.jpg','/images/inner/show_right_products.jpg']); var cur_product_image = 0; $$('#pick_color a').each(function(el) { el.addEvent('click', function() { var el_num = el.get('rel').toInt(); if (cur_product_image != el_num) { /*var myEffect = new Fx.Morph('pro_img_' + cur_product_image, {duration: '800'}); myEffect.start({ 'opacity': [1, 0] }); $('pro_img_' + cur_product_image).setStyle('z-index', '1'); var myEffect2 = new Fx.Morph('pro_img_' + el_num, {duration: '800'}); myEffect2.start({ 'opacity': [0, 1] }); $('pro_img_' + el_num).setStyle('z-index', '2');*/ var item_sel = $('pro_img_' + (el_num + 1)); $('pro_img_src').src = item_sel.value; cur_product_image = el_num; } return false; }); }); var count_more_items = 0; var cur_more_item = 0; $$('#show_products_cont .more_product').each(function(el) { count_more_items++; }); function show_more_products(act) { var set_margin_right; var step2 = false; if (act == "left") { if (cur_more_item != count_more_items-3) { cur_more_item++; set_margin_right = cur_more_item*200*-1; step2 = true; } } else { if (cur_more_item != 0) { cur_more_item--; set_margin_right = cur_more_item*200*-1; step2 = true; } } if (step2) { curr_ml = $('show_products_cont').getStyle('margin-right'); var myEffect = new Fx.Morph('show_products_cont', {duration: '700'}); myEffect.start({ 'margin-right': [curr_ml, set_margin_right+"px"] }); if (cur_more_item == count_more_items-3) { $$('#show_left_products img').set('src', '/images/inner/show_left_products.jpg'); } if (cur_more_item == count_more_items-4) { $$('#show_left_products img').set('src', '/images/inner/show_left_products2.jpg'); } if (cur_more_item == 0) { $$('#show_right_products img').set('src', '/images/inner/show_right_products2.jpg'); } if (cur_more_item == 1) { $$('#show_right_products img').set('src', '/images/inner/show_right_products.jpg'); } } } if($('show_left_products')) { $('show_left_products').addEvent('click', function() { show_more_products("left"); return false; }); $('show_right_products').addEvent('click', function() { show_more_products("right"); return false; }); } } //inner_items if ($('all_inner_items')) { var cur_all_inner_items = 1; var count_all_inner_items = 0 $$('#all_inner_items .inner_slider').each(function(el) { count_all_inner_items++; }); $('all_inner_items').getFirst().set('opacity','1'); function flip_inner_items(next_el) { /*var myEffect = new Fx.Morph('inner_item_' + cur_all_inner_items, {duration: '800'}); myEffect.start({ 'opacity': [1, 0] });*/ //$('inner_item_' + cur_all_inner_items).setStyle('z-index', '1'); /*var myEffect2 = new Fx.Morph('inner_item_' + next_el, {duration: '800'}); myEffect2.start({ 'opacity': [0, 1] });*/ //$('inner_item_' + cur_all_inner_items).setStyle("opacity" , 0) //$('inner_item_' + next_el).setStyle("opacity" , 1); //$('inner_item_' + next_el).setStyle('z-index', '2'); var item_sel = $('inner_slider_' + next_el); var items = item_sel.value.split(';'); $('inner_slider_link').href = items[0]; $$('#inner_slider_link img').set('src', items[1]); $$('#inner_slider_link img').set('alt', items[2]); if(items[3]) $$('.inner_item_info').set('html', items[3]); else { $$('.inner_item_info').set('html', "" + '
' + items[2] + '
' + '
מחיר:  ' + items[4] + 'ש"ח
' + '
מחיר מבצע: 
' + items[5] + 'ש"ח
' ); } //$('pro_img_src').src = item_sel.value; cur_all_inner_items = next_el; } function show_inner_items(act) { var next_init; if (act == "next") { if (cur_all_inner_items == count_all_inner_items) { next_init = 1; } else { next_init = cur_all_inner_items+1; } flip_inner_items(next_init); } else { if (cur_all_inner_items == 1) { next_init = count_all_inner_items; } else { next_init = cur_all_inner_items-1; } flip_inner_items(next_init); } } $('to_items_right').addEvent('click', function() { show_inner_items("prev"); return false; }); $('to_items_left').addEvent('click', function() { show_inner_items("next"); return false; }); } //all_catalog_hir if ($('all_catalog_hir')) { $$('#all_catalog_hir .not_active_sub_catalog').each(function(el) { el.setStyle('display', 'none'); }); } if($('accordion')){ $$("#accordion .title a").addEvent('click' , $lambda(false)); var accordion = new Accordion( $$("#accordion .title a") , $$("#accordion .box-content"), { display: -1, onActive:function(tglr , elm){ $$("#accordion .title").removeClass("active"); tglr.addClass("active"); } } ); } /* if ($('all_news')) { function replace_news(new1, new2) { $('home_news_div_'+new1).setStyle('z-index', '1'); var myEffect = new Fx.Morph('home_news_div_'+new1, {duration: '500'}); myEffect.start({ 'opacity': [1, 0] }); $('home_news_div_'+new2).setStyle('z-index', '5'); var myEffect2 = new Fx.Morph('home_news_div_'+new2, {duration: '500'}); myEffect2.start({ 'opacity': [0, 1] }); if (cur_hnd == home_news_div_count) { cur_hnd = 1; last_hnd = home_news_div_count; } else { last_hnd = cur_hnd; cur_hnd++; } } var home_news_div_count = $$('#all_news .home_news_div').length; var cur_hnd = 1; var last_hnd = home_news_div_count; $$('#all_news .home_news_div').setStyle('opacity', '0'); $$('#all_news .home_news_div').setStyle('z-index', '1'); function mySwitch2() { replace_news(last_hnd, cur_hnd); } var timer = mySwitch2.periodical(4000); mySwitch2(); } */ }); function contact_validate() { if (document.getElementById("contact_name").value=='') { alert('שדה "שם מלא" הינו חובה'); return false; } if (document.getElementById("contact_email").value=='') { alert('שדה "מייל" הינו חובה'); return false; } var objRegExp =/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i if (objRegExp.test(document.getElementById("contact_email").value)==false) { alert('"מייל" נא להכניס כתובת אי-מייל תקינה עבור'); return false; } if (document.getElementById("contact_phone").value=='') { alert('שדה "טלפון" הינו חובה'); return false; } }