
if(!sevt){var sevt={}};sl.require('sl.event.js');sl.require('sl.image.js');sl.require('sl.cms.js');sevt.image={setThumbSize:function(_image,_thumb_max_width,_thumb_max_height){if(_image.width&&_image.height){var old_width=_image.width;var old_height=_image.height;var new_width=_image.width;var new_height=_image.height;var aspect_ratio=_image.width/_image.height;if((aspect_ratio>=1)&&old_width>=_thumb_max_width){new_width=_thumb_max_width;new_height=_thumb_max_width/aspect_ratio;}else if((aspect_ratio<1)&&(old_height>_thumb_max_height)){new_height=_thumb_max_height;new_width=_thumb_max_height*aspect_ratio;}
if(new_height>_thumb_max_height){new_height=_thumb_max_height;new_width=_thumb_max_height*aspect_ratio;}
_image.style.width=new_width+'px';_image.style.height=new_height+'px';}},createDropShadow:function(_object,_class){var drop_shadow_div=document.createElement('div');sl.dom.addClass(drop_shadow_div,_class);_object.appendChild(drop_shadow_div);},updateImages:function(_document,_class_image_name,_class_div_name,_thumb_max_width,_thumb_max_height){var _images=sl.dom.getElementsByClass(_class_image_name,'img',_document);for(var i=0;i<_images.length;i++){sevt.image.setThumbSize(_images[i],_thumb_max_width,_thumb_max_height);}}}
sl.event.addHandler(window,'load',function(){sl.image.initSlideshow()});sl.cms.images_container_class='content';function showInfoLayer(){sevt.infolayer.show();}
function initCartForms(){var _forms=sl.dom.getElementsByClass('to_cart_form','form');for(var i=0;i<_forms.length;i++){_forms[i].target='info_frame';_forms[i].action+='ajax/';sl.event.addHandler(_forms[i],'submit',function(e){var event=sl.event.getEvent(e);var _submited_form=sl.event.getTarget(event);sl.event.preventDefault(event);sl.event.stopPropagation(event);if(!sl.validator.validIntegerOrEmpty(_submited_form.elements['amount'].value)){alert('Nesprávný počet produktů: '+_submited_form.elements['amount'].value);}else{_submited_form.submit();sevt.infolayer.show();}});}}
sl.event.addHandler(window,'load',initCartForms);if(sl.isIE6()){sl.event.addHandler(window,'load',function(){var pngFix=new sl.image.PNGFix();pngFix.addElementsByClass('alpha-image-loader');var crossroad_on_homepage=sl.dom.getElementsByClass('cms-widget-crossroad-categories','div',document);for(var i=0;i<crossroad_on_homepage.length;i++){pngFix.addElementChildNodes(crossroad_on_homepage[i]);}
var step_order=sl.dom.getElementsByClass('content-order-step','div',document);for(var i=0;i<step_order.length;i++){pngFix.addElementChildNodes(step_order[i]);}
pngFix.process();})}
