
function currentdate() {
	var d=new Date()
	var year=d.getFullYear()
	document.write(year)
}
function setbg(id, color) {
	document.getElementById(id).style.background=color;
}
function validate_required(field,alerttxt) {
	with (field) {
		if (value==null||value=="") {
			alert(alerttxt);
			return false;
		} else {
			return true;
		}
	}
}
function validate_form(thisform){


	with (thisform) {
		if (validate_required(first,"First Name must be filled out!")==false) {
			first.focus();
		} else if (validate_required(last,"Last Name must be filled out!")==false) {
			last.focus();
		} else if (validate_required(phone,"Phone must be filled out!")==false) {
			phone.focus();
		} else if (validate_required(email,"Email Address must be filled out!")==false) {
			email.focus();
		} else {
			thisform.submit();
		}
	}

}
function onprodClear() {
	if (document.getElementById("saddr").value == "Enter Starting Address") {
		document.getElementById("saddr").value = "";
	} else if (document.getElementById("saddr").value == "") {
		document.getElementById("saddr").value = "Enter Starting Address";
	}
};
function disclaimer () {
	alert("LEGAL DISCLAIMER\n\nThe builder reserves the right at their discretion to make changes or modifications to maps, plan specifications, materials, features, colors or floor plans without notice. Prices are subject to change and availability. Optional features may be included at additional cost and are subject to construction cut-off dates. All maps, floor plans, landscaping, elevations, and renderings are artist's representations and are not to scale.\n\nNo Federal Agency has judged the merits or value, if any, of this Property. Equal Housing Opportunity. This product is only available in California and is subject to prior sale.");
}


/* load news */

String.prototype.truncate = function(){
    var re = this.match(/^.{0,75}[\S]*/);
    var l = re[0].length;
    var re = re[0].replace(/\s$/,'');
    if(l < this.length)
        re = re + "...";
    return re;
}

$(document).ready(function(){
						   
						   
	var date = new Date();
	$.getJSON("http://s125585.gridserver.com/find-a-community/belmont-court/news/feed/?feed=json&jsonp=?",
		 function(data){
				entry = data[0];

				var monthNames = [ "January", "February", "March", "April", "May", "June",
													 "July", "August", "September", "October", "November", "December" ];
				var d = new Date(entry.date);
				var date = monthNames[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear();
				$("#newsContainerDate").html(date);                
				var title = entry.title;
				$("#newsContainerTitle").html(title);

				var content = entry.excerpt;
				
				content = content.truncate();
				
				content = content + " <a href=\"http://s125585.gridserver.com/find-a-community/belmont-court/news/\">More &gt;</a>";
				
				$("#newsContainerContent").html(content);

	 });
});


/* cycles */

$('#homeHeader').cycle({ 
    fx:     'fade', 
    speed:  1000, 
    timeout: 5000
});

$('#headerStart1').cycle({ 
    fx:     'fade', 
    speed:  1000, 
    timeout: 5000,
	startingSlide: 0
});

$('#headerStart2').cycle({ 
    fx:     'fade', 
    speed:  1000, 
    timeout: 5000,
	startingSlide: 1
});

$('#headerStart3').cycle({ 
    fx:     'fade', 
    speed:  1000, 
    timeout: 5000,
	startingSlide: 2
});

$('#headerStart4').cycle({ 
    fx:     'fade', 
    speed:  1000, 
    timeout: 5000,
	startingSlide: 3
});

$('#headerStart5').cycle({ 
    fx:     'fade', 
    speed:  1000, 
    timeout: 5000,
	startingSlide: 4
});

$('#headerStart6').cycle({ 
    fx:     'fade', 
    speed:  1000, 
    timeout: 5000,
	startingSlide: 5
});

$('#headerStart7').cycle({ 
    fx:     'fade', 
    speed:  1000, 
    timeout: 5000,
	startingSlide: 6
});

$('#headerStart8').cycle({ 
    fx:     'fade', 
    speed:  1000, 
    timeout: 5000,
	startingSlide: 7
});



