	/* Init Zoom */
	$(document).ready(function() {
	    	// Init Zoom
	    	zoomXinit();
	});
	/* Init Zoom End */
	
	/* Menu Actions */
    function setMenuActions(){
    	$('a.menuitem').each(function(i){
    		$(this).mouseover(function(){
    			$('#icon_'+$(this).attr('id')).attr('src', './images_design/icon_menu_active.jpg');
    		});
    		$(this).mouseout(function(){
    			$('#icon_'+$(this).attr('id')).attr('src', './images_design/icon_menu.jpg');
    		});
    	});
    	
    	$('a.year_trigger_menu').each(function(i){
    		$(this).click(function(event){
    			$('#'+$(this).attr('id')+'_content').slideToggle('slow');
    			event.preventDefault();
    		});
    	});
    }

	$(document).ready(function(){
		setMenuActions();
	});
	/* Menu Actions End */

	/* Carousel Logo */
    function carousel_logo_itemVisibleInCallback(carousel, item, i, state, evt){
      // The index() method calculates the index from a
      // given index who is out of the actual item range.
      var idx = carousel.index(i, carousel_logo_itemList.length);
      carousel.add(i, carousel_logo_getItemHTML(carousel_logo_itemList[idx - 1]));
    };

    function carousel_logo_itemVisibleOutCallback(carousel, item, i, state, evt){
      carousel.remove(i);
    };

    function carousel_logo_getItemHTML(item){
      return '<div class="container_info">'+
        '<div class="container_text">'+item.text+'</div></div>'+
	    '<img src="'+item.url+'" style="width: 96.8em; height: 11.3em;" />';
    };

    jQuery(document).ready(function() {
      jQuery('#carousel_logo').jcarousel({
	    wrap: 'circular',
	    auto: 20,
	    animation: 'slow',
	    itemVisibleInCallback: {onBeforeAnimation: carousel_logo_itemVisibleInCallback},
	    itemVisibleOutCallback: {onAfterAnimation: carousel_logo_itemVisibleOutCallback}
      });
    });
    /* Carousel Logo End */
    
    
    /* Carousel Channels */
    function carousel_channels_itemVisibleInCallback(carousel, item, i, state, evt){
        // The index() method calculates the index from a
        // given index who is out of the actual item range.
        var idx = carousel.index(i, carousel_channels_itemList.length);
        carousel.add(i, carousel_channels_getItemHTML(carousel_channels_itemList[idx - 1]));
      };

      function carousel_channels_itemVisibleOutCallback(carousel, item, i, state, evt){
        carousel.remove(i);
      };

      function carousel_channels_getItemHTML(item){
      	//if(item.id==carousel_channels_current_id)
    	//	return '<a class="active" href="'+item.url+'">'+item.title+'</a>';
      	if(item.activ==1)
    		return '<a href="'+item.url+'">'+item.title+'</a>';
    	else
    		return '<div class="ch-container">'+item.title+'</div>';
      };

      jQuery(document).ready(function() {
        jQuery('#carousel_channels').jcarousel({
	  	    wrap: 'circular',
	  	    scroll: 3,
	  	    visible: 4,
	  	    start: carousel_channels_current+1,
	  	    animation: 'slow',
	  	    itemVisibleInCallback: {onBeforeAnimation: carousel_channels_itemVisibleInCallback},
	  	    itemVisibleOutCallback: {onAfterAnimation: carousel_channels_itemVisibleOutCallback}
        });
      });
      /* Carousel Channels End */
      
      /* Carousel Channel Videos */
      var carousel_channels_current = 0;
      jQuery(document).ready(function() {
          jQuery('.jcarousel-skin-channels-videos, '+
              '.jcarousel-skin-channels-videos-top,  '+
              '.jcarousel-skin-channels-videos-bottom').each(function(){
        	  $(this).jcarousel({
	        	vertical: true,
	        	wrap: 'both',
	    	    scroll: 1,
	    	    visible: 3,
	    	    animation: 'slow'
	          });
          });
      });
      /* Carousel Channel Videos End */

      /* Carousel Channel Videos Recommended */
      function recommended_itemLoadCallback(carousel, state){
          if (carousel.has(carousel.first, carousel.last)) {
              return;
          }

          jQuery.get(
              './ajax_get_recommended.php',
              {
                  first: carousel.first,
                  last: carousel.last
              },
              function(xml){
            	  recommended_itemAddCallback(carousel, carousel.first, carousel.last, xml);
              },
              'xml'
          );
      };

      function recommended_itemAddCallback(carousel, first, last, xml){
          carousel.size(parseInt(jQuery('total', xml).text()));

          jQuery('image',xml).each(function(i) {
              carousel.add(first + i, recommended_getItemHTML(jQuery(this).text()));
          });
      };

      function recommended_getItemHTML(url){
          return url;
      };

      jQuery(document).ready(function(){
          jQuery('#carousel_channel_videos_recommended').jcarousel({
        	  vertical: true,
	          //wrap: 'both',
	      	  scroll: 1,
	      	  visible: 1,
	      	  animation: 'slow',
              itemLoadCallback: recommended_itemLoadCallback
          });
      });
      /* Carousel Channel Videos Popular End */

      
      /* Carousel Channel Videos Popular */
      function popular_itemLoadCallback(carousel, state){
          if (carousel.has(carousel.first, carousel.last)) {
              return;
          }

          jQuery.get(
              './ajax_get_popular.php',
              {
                  first: carousel.first,
                  last: carousel.last
              },
              function(xml){
                  popular_itemAddCallback(carousel, carousel.first, carousel.last, xml);
              },
              'xml'
          );
      };

      function popular_itemAddCallback(carousel, first, last, xml){
          carousel.size(parseInt(jQuery('total', xml).text()));

          jQuery('image',xml).each(function(i) {
              carousel.add(first + i, popular_getItemHTML(jQuery(this).text()));
          });
      };

      function popular_getItemHTML(url){
          return url;
      };

      jQuery(document).ready(function(){
          jQuery('#carousel_channel_videos_popular').jcarousel({
        	  vertical: true,
	          //wrap: 'both',
	      	  scroll: 1,
	      	  visible: 1,
	      	  animation: 'slow',
              itemLoadCallback: popular_itemLoadCallback
          });
      });
      /* Carousel Channel Videos Popular End */

	  /* Search box actions */
	  $(document).ready(function(){
		  $('#search_box').click(function(){
			  if($('#search_box').attr('value')=='Search'){
				  $('#search_box').attr('value','');
			  }
		  });
	  });
	  /* Search box actions End */

