/*
*       Site skripty
*
*/




$(document).ready(
  function adminDocumentLoad()
  {
    // corners
    /*DD_roundies.addRule('.rounded', '5px', true);
    DD_roundies.addRule('.rounded-top', '5px 5px 0 0', true);
    DD_roundies.addRule('.rounded-topleft', '5px 0 0 0', true);
    DD_roundies.addRule('.rounded-topright', '0 5px 0 0', true);
    DD_roundies.addRule('.rounded-bottomleft', '0 0 5px 0', true);
    DD_roundies.addRule('.rounded-bottomright', '0 0 0 5px', true);*/
    
    //$('.banner .slide-item:first').css('display','block');
    $(".banner").wtRotator({
					width:700,
					height:230,
					button_width:24,
					button_height:24,
					button_margin:5,
					auto_start:true,
					delay:15000,
					play_once:false,
					transition:"random",
					transition_speed:800,
					auto_center:true,
					easing:"",
					cpanel_position:"inside",
					cpanel_align:"BR",
					timer_align:"top",
					display_thumbs:true,
					display_dbuttons:true,
					display_playbutton:true,
					display_numbers:true,
					display_timer:true,
					mouseover_pause:false,
					cpanel_mouseover:false,
					text_mouseover:false,
					text_effect:"fade",
					text_sync:true,
					tooltip_type:"image",
					lock_tooltip:true,
					shuffle:false,
					block_size:75,
					vert_size:55,
					horz_size:50,
					block_delay:25,
					vstripe_delay:75,
					hstripe_delay:180			
				});
  });
  

  
function addToBasket (prefix, id) 
  {
    var toLeft = jQuery('div.basket a').attr('offsetLeft') + jQuery('div.basket a').attr('offsetWidth')/2;
    var toTop = jQuery('div.basket a').attr('offsetTop') + jQuery('div.basket a').attr('offsetHeight')/2;
    
    $('#'+prefix+id+' img')
    .clone()
    .css({'position' : 'absolute'})
    .prependTo("#"+prefix+id)
    .animate({opacity: 0.8}, 100 )
    .animate({opacity: 0.1, left: toLeft, top: toTop, width: 10, height: 10}, 1200, 
    function() 
      { 
        $(this).remove();
        var count = 1;
        if ($('#basketCount_'+id).length > 0)
          count = $('#basketCount_'+id).val();
          
        jQuery.getJSON("~/CMSSystem.aspx?cm_action=ajax_addToBasket&ModuleKey=catalog&Id="+id+"&Count="+count+"&Variant="+encodeURIComponent($('#variantInput').val()), 
            function(json, status) 
                  {
                    if (json.Count > -1)
                      jQuery('div.basket a').html('NÁKUPNÍ KOŠÍK: '+json.Count+' KS');
                      
                    jQuery('#basketCount_'+id).attr('value','1');
                 });

        
      });
  }
  

