/*
*       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-bottom', '0 0 5px 5px', 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);
    
    
    $('.produkt-foto a[rel^=lightbox],.produkt-nextfoto a[rel^=lightbox]').lightBox();
    $('.cmsGalleryItem a[rel^=lightbox]').lightBox();
    
      $(".slideshow").wtRotator({
					width:457,
					height:135,
					button_width:5,
					button_height:5,
					button_margin:5,
					auto_start:true,
					delay:6000,
					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:false,
					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 showLista()
{
    $('div.lista-close .pruh-cont').animate( { height: '74px' } ,500);
    $('div.lista-close .pruh-cont a').animate( { opacity: '1' } ,500);
    $('div.lista-close .pruh-obsah').animate( { marginTop: '-70px' } ,500);
}

function hideLista()
{
    $('div.lista-close .pruh-cont').animate( { height: '2px' } ,500);
    $('div.lista-close .pruh-cont a').animate( { opacity: '0' } ,500);
    $('div.lista-close .pruh-obsah').animate( { marginTop: '2px' } ,500);
}

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();
        jQuery.getJSON("~/CMSSystem.aspx?cm_action=ajax_addToBasket&ModuleKey=catalog&Id="+id+"&Count=1", 
            function(json, status) 
                  {
                    if (json.Count > -1)
                      jQuery('div.basket a').html('V košíku máte <strong>'+json.Count+'</strong> položek');
                      
                    jQuery('#basketCount_'+id).attr('value','1');
                 });

        
      });
  }


