// JavaScript Document

	community = ["images/easton01.jpg", "images/easton02.jpg", "images/easton03.jpg", "images/easton04.jpg", "images/easton05.jpg", "images/easton06.jpg"]
	amenities = ["images/amenities01.jpg", "images/amenities02.jpg", "images/amenities03.jpg"]
	contact = ["images/external01.jpg", "images/external02.jpg", "images/external03.jpg", "images/external04.jpg", "images/external05.jpg"]
	url = ["#", "#", "#", "#", "#", "#"]
	duration = 4;
	ads=[]; ct=0;
	skip = false
	pageID = 0

function switchAd(page) {
	pageID = page;
	if (skip = false){
		skip = true;
	}
	pickArray();
}

function pickArray(){
	if (pageID == 1){
		qwerty = community;
	}
	else if (pageID == 2){
		qwerty = amenities;
	}
	else if (pageID == 3){
		qwerty = contact
	}
	switchIt();
}

function switchIt(){
	var element = document.getElementById("Ad_Image");
	var n = (ct+1)%qwerty.length;
	if (ads[n] && (ads[n].complete || ads[n].complete==null))
	{
		element.src = ads[ct=n].src;
//		document["Ad_Image"].src = ads[ct=n].src;
	}
	ads[n=(ct+1)%qwerty.length] = new Image;
	ads[n].src = qwerty[n];
	setTimeout("switchAd()",duration*1000);
}


jQuery(document).ready(function() {
		
	if($(".lightbox").length >0){
		$(".lightbox").lightbox();
	}
/*	
	$('iframe').each(function(){
//		var fileStore = "http://www.chathamvillage.net/admin/protected/"
		var fileStore = "http://www.makfak.com/sites/chatham/"
		var currentURL = $(this).attr('src');
		currentURL = currentURL.substring(0, currentURL.length-4);
		getFile = currentURL.substring(46, currentURL.length);
		currentURL = fileStore + getFile + '.txt';
		if(getFile == "3months" || getFile == "6months"){
			$(this).before("<span class='months'></span>").prev().load(currentURL).next().remove();
		} else {
			$(this).before("<span class='" + getFile + "'></span>").prev().load(currentURL).next().remove();
		}
	});
*/
});// --- End $(document).ready ---






















