
// Ajax functions to call separate DIVs from 'videos.php'

$(document).ready(function() {
						   
	function hideForm () {
		$('#form-background').fadeOut(500);
	}
	function showForm () {
		$('#form-background').fadeIn(500);
		//var formID = this.id.replace('email-','');
		//document.getElementById('form-'+formID).selected = 'selected';
		//return false
	}
	
	$('#close').click(hideForm);
	
	$('.invoke-form').click(showForm);
	
	
	
	
	
	
	
	$('.grey, .grey-active').click(function () {
		$('.button-list li a, #floorplan-nav li a').removeClass('grey-active').addClass('grey');
		$(this).removeClass();
		$(this).addClass('grey-active');
	});
	$('.red').click(function () {
		$('.button-list li a, #floorplan-nav li a').removeClass('grey-active').addClass('grey');
	});
						   
	// $('#load-post').load('http://kainehomes.com/news/index.php #blog');
/*
	$('#playlist li a').click(function() {
		var curID = '#'+(this.id); 
		alert (curID);
		var toLoad = $(this).attr('href')+(curID);
		alert (toLoad);
		$('#video').hide('slow',loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show('slow');
		}
		return false;								
	});
	*/


	
	
	$('#video-home-1').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-1';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-2').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-2';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-3').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-3';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-4').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-4';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-5').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-5';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-6').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-6';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-7').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-7';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-8').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-8';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-9').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-9';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-10').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-10';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-11').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-11';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-12').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-12';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-13').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-13';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-14').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-14';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-15').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-15';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-16').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-16';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-17').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-17';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-18').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-18';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-19').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-19';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-20').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-20';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-21').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-21';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-22').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-22';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-23').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-23';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-24').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-24';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-25').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-25';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-26').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-26';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-27').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-27';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-28').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-28';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-29').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-29';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#video-home-30').click(function() {
		var toLoad = $(this).attr('href')+' #video-home-30';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#one').click(function() {
		var toLoad = $(this).attr('href')+' #kennedy-video';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#two').click(function() {
		var toLoad = $(this).attr('href')+' #jackson-video';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#three').click(function() {
		var toLoad = $(this).attr('href')+' #why-buy-now-video';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#four').click(function() {
		var toLoad = $(this).attr('href')+' #adams-video';
		$('#video').hide(0,loadContent);
		function loadContent() {
			$('#video').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#video').show(0);
		}
		return false;								
	});
	$('#kennedy').click(function() {
		var toLoad = $(this).attr('href')+' #kennedy-video-large';
		$('#media').fadeOut('0',loadContent);
		function loadContent() {
			$('#media').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#media').fadeIn('0');
		}
		return false;								
	});
	$('#jackson').click(function() {
		var toLoad = $(this).attr('href')+' #jackson-video-large';
		$('#media').fadeOut('0',loadContent);
		function loadContent() {
			$('#media').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#media').fadeIn('0');
		}
		return false;								
	});
	$('#why-buy-now').click(function() {
		var toLoad = $(this).attr('href')+' #why-buy-now-video-large';
		$('#media').fadeOut('0',loadContent);
		function loadContent() {
			$('#media').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#media').fadeIn('0');
		}
		return false;								
	});
	$('#adams').click(function() {
		var toLoad = $(this).attr('href')+' #adams-video-large';
		$('#media').fadeOut('0',loadContent);
		function loadContent() {
			$('#media').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#media').fadeIn('0');
		}
		return false;								
	});





	
	$('#rockwell-1').click(function() {
		var toLoad = $(this).attr('href')+' #rockwell-1';
		$('#media').fadeOut('0',loadContent);
		function loadContent() {
			$('#media').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#media').fadeIn('0');
		}
		return false;								
	});
	
	$('#rockwell-2').click(function() {
		var toLoad = $(this).attr('href')+' #rockwell-2';
		$('#media').fadeOut('0',loadContent);
		function loadContent() {
			$('#media').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#media').fadeIn('0');
		}
		return false;								
	});
	
	$('#rockwell-3').click(function() {
		var toLoad = $(this).attr('href')+' #rockwell-3';
		$('#media').fadeOut('0',loadContent);
		function loadContent() {
			$('#media').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#media').fadeIn('0');
		}
		return false;								
	});
	
	$('#rockwell-4').click(function() {
		var toLoad = $(this).attr('href')+' #rockwell-4';
		$('#media').fadeOut('0',loadContent);
		function loadContent() {
			$('#media').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#media').fadeIn('0');
		}
		return false;								
	});
	

});


// Playlist background slider

$(document).ready(function() {
						   
	/*					   
						   
	$('#playlist li a').click(function() {
		alert(this.id);
		var curID = $(this.id);
		var pos = curID.
		$('#marker').animate
	
	
	});

	*/						   					   
						   
	$("#rockwell-1").click(function(){
		$("#details-marker").animate({left: "0"}, "slow");
		return false;	
	});
	$("#rockwell-2").click(function(){
		$("#details-marker").animate({left: "160px"}, "slow");
		return false;
	});
	$("#rockwell-3").click(function(){
		$("#details-marker").animate({left: "320px"}, "slow");
		return false;
	});
	$("#rockwell-4").click(function(){
		$("#details-marker").animate({left: "480px"}, "slow");
		return false;
	});


	$(".video-1").click(function(){
		$("#marker, #marker2").animate({top: "0"}, "slow");
	});
	$(".video-2").click(function(){
		$("#marker, #marker2").animate({top: "72px"}, "slow");
	});
	$(".video-3").click(function(){
		$("#marker, #marker2").animate({top: "144px"}, "slow");
	});
	$(".video-4").click(function(){
		$("#marker, #marker2").animate({top: "216px"}, "slow");
	});
});
 
//ROCKWELL VIDEO PLAYLIST

function load_rw_video(id) {

	var dataString = 'vid=' + id;

	$.ajax
	({
	    type: "POST",
	    url: 'video/video-rockwell.php',
	    data: dataString,
		success: function(msg)
		{
			$('#media').html(msg);
			$('#media').fadeIn(200);
		},
		error: function(msg)
		{
			$('#media').html('Error: ' + msg.responseText);
		}
	});
	
	return false;

} 
 
// Homes.php page scripts

$(document).ready(function() {		   
						  
	$('#large-homes, #larger-homes, #immediate-homes, #site-plan, #area-map, #first-floor, #second-floor, #third-floor, #lower-level, #home-photos,#community-photos,#custom-photos,#site-plan-1,#site-plan-2,#site-plan-3').hide(0);
	$('.community-floorplans-list, .home-floorplans-list, .blueprints-list, .site-plan-list').slideUp(0);
	
	$('#small-homes-button').click(function() {
		$('#large-homes, #larger-homes, #immediate-homes, #home-details, #first-floor, #second-floor, #third-floor, #lower-level, #home-photos, #community-details, #site-plan, #area-map,#community-photos,#site-plan-1,#site-plan-2,#site-plan-3').hide(0);
		$('#small-homes').fadeIn(1100);
		return false;
	});
	
	$('#large-homes-button').click(function() {
		$('#small-homes, #larger-homes, #immediate-homes, #home-details, #first-floor, #second-floor, #third-floor, #lower-level, #home-photos, #community-details, #site-plan, #area-map,#community-photos,#site-plan-1,#site-plan-2,#site-plan-3').hide(0);
		$('#large-homes').fadeIn(1100);
		return false;
	});
	
	$('#larger-homes-button').click(function() {
		$('#small-homes, #large-homes, #immediate-homes, #home-details, #first-floor, #second-floor, #third-floor, #lower-level, #home-photos, #community-details, #site-plan, #area-map,#community-photos,#site-plan-1,#site-plan-2,#site-plan-3').hide(0);
		$('#larger-homes').fadeIn(1100);
		return false;
	});
	
	$('#home-details-button, #community-details-button').click(function() {
		$('#small-homes, #large-homes, #larger-homes, #immediate-homes, #first-floor, #second-floor, #third-floor, #lower-level, #home-photos, #area-map, #site-plan, #community-photos, #community-floorplans').hide(0);
		$('#home-details, #community-details').fadeIn(1100);
		$('.community-floorplans-list, .home-floorplans-list, .site-plan-list').slideUp(1100);
		return false;
	});
	
	
	$('#community-photos-button').click(function() {
		$('#small-homes, #large-homes, #larger-homes, #area-map, #community-details, #site-plan, #first-floor, #third-floor, #second-floor, #lower-level, #immediate-homes,#site-plan-1,#site-plan-2,#site-plan-3').hide(0);
		$('#community-photos').fadeIn(1100);
		$('.community-floorplans-list, .home-floorplans-list, .site-plan-list').slideUp(1100);
		return false;
	});
	
	$('#home-photos-button').click(function() {
		$('#small-homes, #large-homes, #larger-homes, #immediate-homes, #home-details, #first-floor, #third-floor, #second-floor, #lower-level').hide(0);
		$('#home-photos').fadeIn(1100);
		$('.community-floorplans-list, .home-floorplans-list').slideUp(1100);
		return false;
	});
	
	$('#first-floor-button').click(function() {
		$('#small-homes, #large-homes, #larger-homes, #immediate-homes, #home-details, #home-photos, #third-floor, #second-floor, #lower-level, #area-map, #community-details, #site-plan').hide(0);
		$('#first-floor').fadeIn(1100);
		return false;
	});
	
	$('#second-floor-button').click(function() {
		$('#small-homes, #large-homes, #larger-homes, #immediate-homes, #home-details, #home-photos, #third-floor, #first-floor, #lower-level, #area-map, #community-details, #site-plan').hide(0);
		$('#second-floor').fadeIn(1100);
		return false;
	});
	
	$('#lower-level-button').click(function() {
		$('#small-homes, #large-homes, #larger-homes, #immediate-homes, #home-details, #home-photos, #third-floor, #first-floor, #second-floor, #area-map, #community-details, #site-plan').hide(0);
		$('#lower-level').fadeIn(1100);
		return false;
	});
	
	$('#third-floor-button').click(function() {
		$('#small-homes, #large-homes, #larger-homes, #immediate-homes, #home-details, #home-photos, #lower-level, #first-floor, #second-floor, #area-map, #community-details, #site-plan').hide(0);
		$('#third-floor').fadeIn(1100);
		return false;
	});
	
	$('#community-floorplans-button, #home-floorplans-button').click(function() {
		$('.community-floorplans-list, .home-floorplans-list').slideToggle(500);
		$('#small-homes, #large-homes, #larger-homes, #immediate-homes, #home-details, #home-photos, #lower-level, #second-floor, #third-floor, #area-map, #community-details, #community-photos, #site-plan,#site-plan-1,#site-plan-2,#site-plan-3').hide(0);
		$('#community-floorplans, #community-floorplans > div:first').fadeIn(1100);
		$('.site-plan-list').slideUp(1100);
		return false;
	});
	
	$('#immediate-homes-button').click(function() {
		$('#small-homes, #large-homes, #larger-homes, #area-map, #community-details, #site-plan, #first-floor, #third-floor, #second-floor, #lower-level, #community-photos,#site-plan-1,#site-plan-2,#site-plan-3').hide(0);
		$('#immediate-homes').fadeIn(1100);
		$('.community-floorplans-list, .home-floorplans-list, .site-plan-list').slideUp(1100);
		return false;
	});
	
	$('#site-plan-button').click(function() {
		$('#small-homes, #large-homes, #larger-homes, #area-map, #community-details, #community-photos, #first-floor, #third-floor, #second-floor, #lower-level, #immediate-homes').hide(0);
		$('#site-plan').fadeIn(1100);
		$('.community-floorplans-list, .home-floorplans-list').slideUp(1100);
		return false;
	});




	$('#site-plan-button-multi').click(function() {
		$('.site-plan-list').slideToggle(500);
		$('#small-homes, #large-homes, #larger-homes, #immediate-homes, #home-details, #home-photos, #lower-level, #second-floor, #third-floor, #area-map, #community-details, #community-photos, #site-plan-2,#site-plan-3').hide(0);
		$('#site-plan-1').fadeIn(1100);
		$('.community-floorplans-list, .home-floorplans-list').slideUp(1100);		
		return false;
	});

		$('#site-plan-button-multi-1').click(function() {
			$('#small-homes, #large-homes, #larger-homes, #area-map, #community-details, #community-photos, #first-floor, #third-floor, #second-floor, #lower-level, #immediate-homes,#site-plan-2,#site-plan-3').hide(0);
			$('#site-plan-1').fadeIn(1100);
			return false;
		});
		
		$('#site-plan-button-multi-2').click(function() {
			$('#small-homes, #large-homes, #larger-homes, #area-map, #community-details, #community-photos, #first-floor, #third-floor, #second-floor, #lower-level, #immediate-homes,#site-plan-1,#site-plan-3').hide(0);
			$('#site-plan-2').fadeIn(1100);
			return false;
		});	

		$('#site-plan-button-multi-3').click(function() {
			$('#small-homes, #large-homes, #larger-homes, #area-map, #community-details, #community-photos, #first-floor, #third-floor, #second-floor, #lower-level, #immediate-homes,#site-plan-1,#site-plan-2').hide(0);
			$('#site-plan-3').fadeIn(1100);
			return false;
		});	


	
	$('#custom-photos-btn').click(function() {
		$('#blueprints').hide(0);
		$('#custom-photos').show(0);
		$('.blueprints-list').slideUp(1100);
		return false;
	});
	$('#blueprints-btn').click(function() {
		$('.blueprints-list').slideToggle(200);
		return false;
	});
	$('.blueprints-list li a').click(function() {
		$('.blueprints-list').slideUp(200);
		$('#custom-photos').hide(0);
		$('#blueprints').show(0);
		return false;
	});
	
	
	
	$('.video-category').click(function () {
		$('#video-menu li a').removeClass('video-category-active').addClass('video-category');
		$(this).removeClass();
		$(this).addClass('video-category-active');
	});
	
	$('.video-list li a').mouseenter(function() {
		$(this).next('.tooltip').delay(400).fadeIn(200);
	});
	
	$('.video-list li a').mouseleave(function() {
		$(this).next('.tooltip').clearQueue().fadeOut(200);
	});
	
});

function initMenu() {
$('#video-menu ul').hide();
//$('#video-menu ul:first').show();
$('#video-menu li a').click(
function() {
var checkElement = $(this).next();
if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
return false;
}
if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
$('#video-menu ul:visible').slideUp('normal');
checkElement.slideDown('normal');
return false;
}
}
);
}
$(document).ready(function() {initMenu();});
