 
var fancybox_config={'overlayShow':true,'overlayColor':'#000','showNavArrows':false,'scrolling':'no','onComplete':function(){if($('#fancybox-content').find('.editor')){$('#fancybox-content').find('.editor').each(function(){$(this).ckeditor();});}},'onCleanup':function(){if($('#fancybox-content').find('.editor')){$('#fancybox-content').find('.editor').each(function(){CKEDITOR.instances[$(this).attr('id')].destroy(true);});}}};$(document).ready(function(){$('.top-bar').hover(function(){$(this).children('div').stop().animate({'opacity':1},200);},function(){if($(this).find('input:focus').length<1){$(this).children('div').stop().animate({'opacity':0.4},200);}});$('.top-bar input[type="text"],.top-bar input[type="password"]').focus(function(){$(this).parent().stop().animate({'opacity':1},200);}).blur(function(){$(this).parent().stop().animate({'opacity':0.4},200);});$('.logo-bar > a').hover(function(){$(this).stop().animate({'margin-top':'-3px'},200);},function(){$(this).stop().animate({'margin-top':'2px'},200);});$('.right-menu > ul > li').hover(function(){$(this).addClass('hover');var right_image='<span class="right-ribbon"></span>';var left_image='<span class="left-ribbon"></span>';$(this).append(right_image).append(left_image);var sub_menu_height=$(this).children('.menu-button-categories-full').outerHeight();if(($(this).offset().top+sub_menu_height)>($(window).scrollTop()+$(window).height())){var difference=($(window).scrollTop()+$(window).height())-($(this).offset().top+sub_menu_height);$(this).children('.menu-button-categories-full').css('top',difference+'px');}else{$(this).children('.menu-button-categories-full').css('top',0);}
$(this).children('.menu-button-categories-full').show();},function(){$(this).removeClass('hover');$(this).children('span.right-ribbon,span.left-ribbon').remove();$(this).children('.menu-button-categories-full').hide();});head.ready('fancybox',function(){$("a.floatify").livequery(function(){$(this).fancybox(fancybox_config);});});});$('.yalla-ui').livequery(function(){if(typeof($(this).data('yui'))!='undefined'){var $obj=$(this);switch($obj.data('yui').action){case'visible-menu':var $menu=$($obj.data('yui').menu);var $items=$($obj.data('yui').items);$items.children('div:gt(0)').hide();$menu.find('li > a').click(function(e){e.preventDefault();var index=$(this).parent().index();$(this).addClass('selected');$(this).parent().siblings().children('a').removeClass('selected');$items.children('div:eq('+index+')').show();$items.children('div:not(:eq('+index+'))').hide();});break;case'filter_by_price':$obj.click(function(e){e.preventDefault();location.href=location.href.replace(/\/price\/[0-9]+\-[0-9]+/gi,'')+'/price/'+$('input[name="price_filter_from"]').val()+'-'+$('input[name="price_filter_to"]').val();});break;case'site_search':$obj.submit(function(e){e.preventDefault();location.href=$obj.attr('action')+encodeURIComponent($obj.children('input[name="query"]').val());});break;}}});$('form.ajaxify').livequery(function(){var $form=$(this);$form.submit(function(e){e.preventDefault();if(!$form.valid()){return;}
$.ajax({type:(typeof($form.attr('method'))!='undefined')?$form.attr('method'):'get',url:$form.attr('action'),data:$form.serialize(),error:function(){$.errorbox.create($form,'error','אירעה שגיאה, אנא נסה שנית');},success:function(data){if(data&&typeof(data.success)&&data.success===true){$form.data('yui').success_function();}else if(data&&typeof(data.success)&&data.success!==true){$.errorbox.create($form,'warning',data.error);}else{$.errorbox.create($form,'error','אירעה שגיאה, אנא נסה שנית');}},dataType:'json'});});});(function($){var $warningBox=$('<div class="message-box warning-box"><span></span><p></p></div>').click(function(e){$(this).slideUp(300,function(){$(this).remove();});});var $errorBox=$('<div class="message-box error-box"><span></span><p></p></div>').click(function(e){$(this).slideUp(300,function(){$(this).remove();});});var $successBox=$('<div class="message-box success-box"><span></span><p></p></div>').click(function(e){$(this).slideUp(300,function(){$(this).remove();});});$.errorbox=function(){};$.errorbox.create=function(obj,type,content,position){$.errorbox.close();switch(type){case'error':var box=$errorBox;break;case'warning':var box=$warningBox;break;case'success':var box=$successBox;break;}
box=box.clone(true).hide();if(typeof(content)!='string'){var new_content='';$.each(content,function(k,v){new_content+=v+'<br/>';});content=new_content;}
box.children('p').html(content);if(typeof(position)!='undefined'){switch(position){case'after':obj.before(box);break;case'replace':obj.replaceWith(box);break;default:obj.before(box);break;}}else{obj.before(box);}
box.slideDown();return box;};$.errorbox.close=function(){$('.warning-box,.error-box,.success-box').remove();};})(jQuery);function uploadButton(){new AjaxUpload('upload-logo',{action:'openstore.ajax.php',name:'storeLogo',data:{action:$('#uploadAction').val()},autoSubmit:true,responseType:false,onChange:function(file,extension){if(extension!='jpg'&&extension!='jpeg'&&extension!='gif'&&extension!='png'){$('#white-box-error').text('מותר להעלות רק קבצי תמונה (jpg,jpeg,gif,png)');return false;}},onSubmit:function(file,extension){$('#upload-logo').hide();$('#upload-loader').show();},onComplete:function(file,response){switch(response){case'0':$("#white-box-error").text("מותר להעלות רק קבצי תמונה (jpg,jpeg,gif,png)");$('#upload-loader').hide();$('#upload-logo').show();break;case'1':$("#white-box-error").text("ההעלאה נכשלה, אנא נסה שנית");$('#upload-loader').hide();$('#upload-logo').show();break;case'2':$("#white-box-error").text("ההעלאה נכשלה, אנא נסה שנית");$('#upload-loader').hide();$('#upload-logo').show();break;default:$('#upload-loader').hide();$('#upload-logo-pic').show().append('<img src="'+response+'"/>');$('input[name=storeLogoFile]').val(response);break;}}});}
