/**
 * All code protected by United States copyright law and may not be reproduced, distributed, transmitted, displayed, published or broadcast without the prior written permission of Christian.tv. 
 * All material contained are the copyrighted property of the company unless otherwise specified in association with a particular piece of material. No code owned, operated, licensed, or controlled by us may be copied, reproduced, republished, uploaded, posted, transmitted, or distributed in any way, without express permission. 
 * In the event you purchase software from Christian.tv, the software, including any files, images incorporated in or generated by the software, and data accompanying the software (collectively, the "Software") are licensed to you by us or third-party licensors for your use only. 
 * We do not transfer title to the Software to you. We (or our third-party licensors) retain full and complete title to the Software and all intellectual property rights therein. You may not redistribute, sell, auction, decompile, reverse engineer, disassemble, or otherwise reduce the Software to a human-readable form.
*/

var $j = jQuery.noConflict();
var currentShow = 0;
var currentPage = 0;
var currentChannel = 0;
$j(
	function () {
		$j("#featuredShows .gallary").css({width:(totalFeatured*205)});
		$j("#ShowsRightArrow, #ShowsLeftArrow").bind("click", function(e){
			id = $j(this).attr('id');
			var firstShow =0
			var lastShow = totalFeatured;
			
			switch(id){
				case 'ShowsRightArrow':
					nextShow = currentShow + 3
					if(nextShow >= lastShow){
						nextShow = firstShow;
						return false;
					}
					currentShow = nextShow;
				break;
				
				case 'ShowsLeftArrow':
					prevShow = currentShow - 3
					if(prevShow <= firstShow-3){
						prevShow = lastShow;
						return false;
					}
					currentShow = prevShow;
				break;
			}
			
			//alert(last);
			
			$j('#featuredShows .gallary').animate(
				{marginLeft:-1*(currentShow*205) + 'px'},
				1000
			)
			return false;
	    });
		
	    $j("#featuredPages .gallary").css({width:(totalPages*205)});
		$j("#PageRightArrow, #PageLeftArrow").bind("click", function(e){
			id = $j(this).attr('id');
			var firstPage =0
			var lastPage = totalPages;
			
			switch(id){
				case 'PageRightArrow':
					nextPage = currentPage + 3
					if(nextPage >= lastPage){
						nextPage = firstPage;
						return false;
					}
					currentPage = nextPage;
				break;
				
				case 'PageLeftArrow':
					prevPage = currentPage - 3
					if(prevPage <= firstPage-3){
						prevPage = lastPage;
						return false;
					}
					currentPage = prevPage;
				break;
			}
			
			//alert(last);
			
			$j('#featuredPages .gallary').animate(
				{marginLeft:-1*(currentPage*205) + 'px'},
				1000
			)
			return false;
	    });
		
	    $j("#featuredChannels .gallary").css({width:(totalChannels*205)});
		$j("#ChannelRightArrow, #ChannelLeftArrow").bind("click", function(e){
			id = $j(this).attr('id');
			var firstChannel =0
			var lastChannel = totalChannels;
			
			switch(id){
				case 'ChannelRightArrow':
					nextChannel = currentChannel + 3
					if(nextChannel >= lastChannel){
						nextChannel = firstChannel;
						return false;
					}
					currentChannel = nextChannel;
				break;
				
				case 'ChannelLeftArrow':
					prevChannel = currentChannel - 3
					if(prevChannel <= firstChannel-3){
						prevChannel = lastChannel;
						return false;
					}
					currentChannel = prevChannel;
				break;
			}
			
			//alert(last);
			
			$j('#featuredChannels .gallary').animate(
				{marginLeft:-1*(currentPage*205) + 'px'},
				1000
			)
			return false;
	    });

	}
)
