// JavaScript Document
function playCaregiver(inDiv){
		var urlPre = 'http://catfish.prolitical.com/sites/default/files/catfishfiles/';
		var so = new SWFObject(urlPre + inDiv + '.swf', 'xspf_player', '300px', '70px', '8', '#fffff');
		so.addParam('quality', 'high');
		so.addVariable('autoplay', 'true');
		so.write(inDiv);
}

$(document).ready(function(){
//	$('#search-theme-form .form-submit').attr('type', 'button');
	
	if($('#catfishcountdown')){
		var yr = 2009;
		var m = 10;
		var d = 19;
		var before=" the Classic on"
		var current="Catfish Classic Day!"
		var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
		var today = new Date();
		var todayy = today.getYear();
		
		if (todayy < 1000){
		     todayy+=1900;
		}
			
		var todaym = today.getMonth();
		var todayd = today.getDate();
		var todayh = today.getHours();
		var todaymin = today.getMinutes();
		var todaysec = today.getSeconds();
		
		var todaystring = montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec;
		var futurestring = montharray[m-1]+" "+d+", "+yr;
		
		var dd = Date.parse(futurestring) - Date.parse(todaystring);
		var dday = Math.floor(dd/(60*60*1000*24)*1);
		var dhour = Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1);
		var dmin = Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1);
		var dsec = Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1);
			
		
		$('#catfishcountdown').html(dday+ " days<br />"+dhour+" hours<br />"+dmin+" minutes<br />till "+before);
		
		function slideShow(containerId, slideInc, effect, 
						   effectSpeed, transitionSpeed, debugId){
			var slideTo = 0;
			var containerId = '#' + containerId;
			var reps = $(containerId).children().length;
			var randomnumber=Math.floor(Math.random() * (reps + 1))
			var repCount = 1;
			
			window.setInterval(function(){
				var debugText = 'RepCount: ' + repCount + ' | Reps: ' + reps;
				debugText += '<br />Going to: ' + slideTo + ' Incrementing by: ' + slideInc;
				
				if($('#' + debugId)){
					$('#' + debugId).html(debugText);
				}
				
				if(repCount == reps){
					$(containerId).css({
						'top' : slideInc + 'px'
					});
					repCount = 0;
					slideInc = slideInc;
					slideTo = 0;
				}
				else{
					slideTo = slideTo - slideInc;
				}
				
				if(effect == 'slide'){
					$(containerId).animate({
						top: slideTo + 'px'					   
					}, effectSpeed);
				}
				if(effect == 'fade'){
					$(containerId).fadeOut((effectSpeed / 2), function(){
						//Move Up
						$(containerId).css({
							'top' : slideTo + 'px'
						});
					});
					$(containerId).fadeIn((effectSpeed / 2));
				}
				repCount++;
				
			}, transitionSpeed);
		}
		
		slideShow('promoslider', 250, 'slide', 1000, 8000, 'promoinfo');
		slideShow('hometableslider', 280, 'fade', 1000, 10000, null);

	}

});