var slideTime;

var billStart;
var billEnd;

var hitTimer;

function stopSlide(){
$(".home_slide_timer").stop();
$(".home_slide_timer").height('1px');
$(".home_slide_timer").hide();	
};

function changeSlide(){
	var nextCount = Number($(lastBlock).attr('count'))+1;
	if(nextCount > 4){nextCount = 1};
	$(lastBlock).animate({width: minWidth+"px"}, { queue:false, duration:800 });
	$('#aa'+nextCount).animate({width: maxWidth+"px"}, { queue:false, duration:800});
	lastBlock = $('#aa'+nextCount);
	
	$(".home_slide_timer."+nextCount).animate({ height: '350px' }, 10000, function(){
		$(this).fadeOut('slow', function(){
		changeSlide();
		$(this).height('1px');
		});
	});		
	
}


$(document).ready(function(){
						   
	
	
	flashembed("home_countdown", { src: "/flash/countdown_home.swf", wmode: 'transparent' });

	$(".mag_glass img[rel]").overlay({effect: 'apple'});						   
						   
	$(".shirts_outer.scrollable").scrollable({ mousewheel: true, circular: true }).navigator(".shirtnav");
	
	$('.shirt_arrows_L').bind('click', function(){
			$(".shirts_outer.scrollable").data("scrollable").prev();									  
	});
	$('.shirt_arrows_R').bind('click', function(){
			$(".shirts_outer.scrollable").data("scrollable").next();									  
	});

						   
	$(".latest_bills.scrollable").scrollable({ vertical: true, mousewheel: true }).navigator(".billnavi");
	
	$(".video_scroll.scrollable").scrollable({ mousewheel: true }).navigator(".vidnavi");
	$(".top_vid_thumb").reflect({height: 0.3, opacity: 0.6});
	$(".vid_length").reflect({height: 0.3, opacity: 0.6});
	
	$(".video_scroll a.next_btn").bind('click', function(){
			$(".video_scroll.scrollable").data("scrollable").next();									  
	});
	
	$(".la_bills a.next_btn").bind('click', function(){
			$(".la_bills.scrollable").data("scrollable").next();									  
	});
	
	$(".video_scroll a.prev_btn").bind('click', function(){
			$(".video_scroll.scrollable").data("scrollable").prev();									  
	});
	
	$(".la_bills a.prev_btn").bind('click', function(){
			$(".la_bills.scrollable").data("scrollable").prev();									  
	});
	
	

    lastBlock = $("#aa1");
    maxWidth = 781;
    minWidth = 40;	
	
	$(".home_slide_timer.1").animate({ height: '350px' }, 10000, function(){
		$(this).fadeOut('slow', function(){
			changeSlide();
			$(this).height('1px');
		});																	  
	});
	
	$(".hitpad_a").hover(function(){
	$(".home_slide_timer").stop();
	$(".home_slide_timer").height('1px');
	$(".home_slide_timer").hide();
	var target = $(this).parent().attr('count');
	//showMessage('yellow', ".home_slide_timer."+target);
	$(".home_slide_timer."+target).show();
	$(".home_slide_timer."+target).animate({ height: '350px' }, 500, function(){
	$(".home_slide_timer."+target).hide();	
	$(lastBlock).removeClass('on');
	$(lastBlock).animate({width: minWidth+"px"}, { queue:false, duration:800 });
	$('#aa'+target).animate({width: maxWidth+"px"}, { queue:false, duration:800});
	$('#aa'+target).addClass('on');
	lastBlock = $('#aa'+target);	
	
	});
	},function(){
	
	$(".home_slide_timer").height('1px');
	$(".home_slide_timer."+target).hide();
	});
	
	
	
	
	$(".home_third").hover(
		function(){
			$(this).addClass('over');
		},
		function(){
			$(this).removeClass('over');
	});
	
	
});

function appendiframe(theIFRAME,theAPPEND){	
parent.frames[theIFRAME].document.body.innerHTML+=(theAPPEND);
}

