// JavaScript Document


$(document).ready( function() {
	check_browser();
	bg1 = $('#bg1'); 
	bg2 = $('#bg2');
	bg3 = $('#bg3');
	bg3.fadeIn(500);
	check_browser();
	bgControl1();
	
	//Open the content.
	//var props = {height:'100%', easing:'easeOutQuad', opacity:'toggle'};
	//$('#logoBar').delay(500).animate({height:300, easing:'easeOutQuad'},{duration:500});
	//$('#contentInsertionContainer').delay(1000).animate(props, 500);
	
	oldLogo = $('#oldLogo');
	oldText = $('#oldsitetext');
	
	oldLogo.hover(
		function() {
			oldText.fadeIn(250);
		},
		function() {
			oldText.fadeOut(250);
		}
	);
	
	$('#hours').hover(
		function() {
			$('#hoursPanel').fadeIn(250);
		},
		function() {
			$('#hoursPanel').fadeOut(250);
		}
	);
	
	$('#address').hover(
		function() {
			$('#addressPanel').fadeIn(250);
		},
		function() {
			$('#addressPanel').fadeOut(250);
		}
	);
	
	
});
//See if the user is using internet explorer.
function check_browser()
{
	var browser = navigator.appName;
	console.log("check_browser() executed; browser is: " + browser + "");
	if(browser=='Microsoft Internet Explorer')
	{
		window.alert("Heads up! Summit Pet Care's site has been tested and optimized with all web browsers EXCEPT Internet Explorer...which is what you're currently using. You may continue with browsing, but the site may look abnormal. If possible, we suggest you switch to a more advanced web browser.");
		console.log("Browser alert given to the internet explorer user.");
	}
}

function bgControl1() {
	bg3.delay(9000).fadeOut(1000);
	bg1.delay(9000).fadeIn(1000, function() {
			
			bgControl2();
		} 
	);	
}
function bgControl2() {
	bg1.delay(9000).fadeOut(1000);
	
	bg2.delay(9000).fadeIn(1000, function() {
			
			bgControl3();
		} 
	);	
}
function bgControl3() {
	bg2.delay(9000).fadeOut(1000);
	bg3.delay(9000).fadeIn(1000, function() {
			
			bgControl1();
		} 
	);	
}


