$(document).ready(function() {
		// This sets the opacity to 100% on hover/load
	if($('#div_home').css('opacity') == 1){
		$("#slideShowBtns").hover(function() {
			$("#slideShowBtns").fadeTo("fast", 1.0);
			
			// This sets the opacity to 100% on hover
		}, function() {
			$("#slideShowBtns").fadeTo("fast", 0.25);
		});
	}
});

$(document).ready(function() {

	var refreshIntervalId;
	var getDiaShow = location.search.substr(1, 7);
	var interval = 5000;
	var cnt = 0;

	// if (getDiaShow == 'diaShow') {
		// show play button
		$('#play').show();
	
		function fadeLoadFade() {
			$('#div_home, #slideShowBtns, .rightFrame .picCaption').fadeTo("slow", 0, function(){
				cnt++;
				// alert('cnt = ' + cnt);
				if(cnt==3){
					$('#div_home').load('randPic.php', function(){
						$('#div_home').ready(function(){
							$('#div_home, .rightFrame .picCaption').fadeTo("slow", 1);
							$('#slideShowBtns').fadeTo("slow", 0.25);
						});
				});
				}
			});
			cnt = 0;
		}

		function play(interval) {
			refreshIntervalId = setInterval(function() {
				fadeLoadFade();
			}, interval);
		}

		/**
		 * Play Button
		 */
		$('#play').click(function() {

			fadeLoadFade();

			if (refreshIntervalId) {
				clearInterval(refreshIntervalId);
				play(interval);
			} else {
				play(interval);
			}
			$('#play').hide();
			$('#pause').show();
		}); // END $('#play').click()

		/**
		 * Pause Button
		 */
		$('#pause').click(function() {
			// alert('refreshIntervalId = ' + refreshIntervalId);
				$('#pause').hide();
				$('#play').show();
				clearInterval(refreshIntervalId);
			}); // END $('#startStop').click()

//	} // END if(getDiaShow)
});