// JavaScript Document

/* Sitewide controls, view manipulation
	Proprietary scripting by Rodger D. Kurth
	www.ChicagoWebDesignCo.com  */

Cufon.replace('h1');
Cufon.replace('#topper h2');

function flashShow(){
	swfobject.registerObject("FlashID");
}

var msgs = ["<img src=\"images/install_tub_liners2.png\" width=\"200\" height=\"245\" />","<img src=\"images/install_tub_liners1.png\" width=\"200\" height=\"245\" />"];
var i = 0; //counter of the items in the msgs array

function showMsgs(){
		
	/*  showMsgs()
		
	A simple jQuery animation coded by Rodger D. Kurth
	ChicagoWebDesignCo.com
	
	Dependencies:
	jQuery 1.3.2+ (not tested on earlier versions)
	
*/
$('.crossFade').fadeTo(2400, 0,function(){
		$('.crossFade').children().remove();
$(msgs[i]).prependTo('.crossFade');								   
						});	   

$('.crossFade').fadeTo(2400, 1.0);

i++;
	
	if (i>(msgs.length-1)){  /*this measures the number of text bits in the msgs array. Did it this way to allow user
	to enter as many messages as they want and not have to edit any other variables */
		i=0;
			}
		
	   }


/*DD_belatedPNG.fix('#theContent');
DD_belatedPNG.fix('#introBar');
DD_belatedPNG.fix('#topper');*/






$(document).ready(function(){
var $box = $('#theContent');
msgs_interval = setInterval(showMsgs,4800);
$(".photos a").colorbox({ transition:"elastic",speed:1200 });

$("div#scrollingText").hover(function(){ //pauses the scroll on mouseover, resumes on mouseout
									  
			$("div#scrollingText").smoothDivScroll("stopAutoScroll");
									  
									  },function(){
										  
				$("div#scrollingText").smoothDivScroll("startAutoScroll");						  
										  
									  });


		$('.nextLink').click(function(event){
				event.preventDefault();
				//alert('Click function works');
				var $pageContent = 0;
				var $newContent;
				 $newURI = $(this).attr("href");
				 $.get($newURI,function(data){
					$newContent = data;
					$newContent = $($newContent).find("#theContent").html();
					},'html');
				$box.slideUp(1800,function(){
					$box.children().remove();
					$box.html($newContent);
					Cufon.replace('#theContent h1');
					Cufon.replace('#topper h2');
					$(".photos a").colorbox({ transition:"elastic",speed:1200 });
					
					});
				
				$box.slideDown(1200);
				

		 }); //end ajax functions

						   
		});
