function attachJQuery() {
    $(document).ready(function () {
    	Cufon.replace('h1, h2, .primary-button, #content legend, .offer h2, #ambassadors-vip h2, #more-channels-bar a');

    	$(".button").each(function () {
    	    if ($("span", $(this)).length == 0) {
    	        $(this).wrapInner("<span>");
    	    }
    	});
    });
}

attachJQuery();

function refreshCufon() {
	Cufon.refresh();
}

function showNextItem(direction, rotator) {
	if (rotator._animation && rotator._animation._isPaused) {
		resumeAnimation(rotator._animation);
	}
	rotator.showNext(direction);
}

function hoverScroller(sender, px) {
	sender.style.height = px;
	sender.style.width = px;
}

function resumeAnimation(animation) {
	animation._getAnimationQuery().filter("[paused='true']").removeAttr("paused");
	animation._isPaused = false;
}

function VideoDetailRedirect(intVIDO_ID, SearchCategoryID) {
	location.replace("/VideoDetail.aspx?VideoID=" + intVIDO_ID + (SearchCategoryID != '' ? "&SearchCategoryID=" + SearchCategoryID : ""));
}

function VideoDetailChannelRedirect(intVIDO_ID, intCHNL_ID, FullURL) {
    if (FullURL == '') {
        location.replace("/VideoDetail.aspx?VideoID=" + intVIDO_ID + "&ChannelID=" + intCHNL_ID);
    } else {
        //alert("http://www." + FullURL + "/VideoDetail.aspx?VideoID=" + intVIDO_ID + "&ChannelID=" + intCHNL_ID);
        location.replace("http://www." + FullURL  + "/VideoDetail.aspx?VideoID=" + intVIDO_ID + "&ChannelID=" + intCHNL_ID);
    }
}

$(document).ready(function () {
	hookUpVideos()
      });

      function hookUpVideos() {
      	$('.picture_scroll .pics').cycle({
      		timeout: 500,
      		speed: 'fast'
      	});

      	$('.picture_scroll .pics').show();

      	$('.picture_scroll .pics').cycle('pause');

      	$('.picture_scroll .controller').mouseover(function () {
      		$(this).parent().find('.pics').cycle('resume', true);
      		$(this).addClass('controller_over');
      	});

      	$('.picture_scroll .controller').mouseout(function () {
      		$(this).parent().find('.pics').cycle('pause');
      		$(this).removeClass('controller_over');
      	})
      }
