var PopUpPlansX = (screen.width/2)-350;
var PopUpPlansY = (screen.height/2)-284;
var pos = "left="+PopUpPlansX+",top="+PopUpPlansY;

function PopUpPlans(Linkvar){
PopUpPlansWindow = window.open(Linkvar,"Floorplans","width=700,height=568,"+pos);
}

var PopUpPhotosX = (screen.width/2)-350;
var PopUpPhotosY = (screen.height/2)-284;
var pos = "left="+PopUpPhotosX+",top="+PopUpPhotosY;

function PopUpPhotos(Linkvar){
PopUpPhotosWindow = window.open(Linkvar,"Photos","width=660,height=500,"+pos);
}

/* Search Form Watermark */
$(function() {
    swapValues = [];
    $(".swap_value").each(function(i){
        swapValues[i] = $(this).val();
        $(this).focus(function(){
            if ($(this).val() == swapValues[i]) {
                $(this).val("");
            }
        }).blur(function(){
            if ($.trim($(this).val()) == "") {
                $(this).val(swapValues[i]);
            }
        });
    });
});


function isEmailAddr(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

function formValidate( form ) {
	if( form.firstname.value == "" ) {
		alert('Please enter your First Name.');
		form.firstname.focus();
		return false;
	}
	if( form.lastname.value == "" ) {
		alert('Please enter your Last Name.');
		form.lastname.focus();
		return false;
	}
	if( form.street.value == "" ) {
		alert('Please enter your Street Address.');
		form.street.focus();
		return false;
	}
	if( form.city.value == "" ) {
		alert('Please enter your City.');
		form.city.focus();
		return false;
	}
	if( form.state.value == "" ) {
		alert('Please choose a State.');
		form.state.focus();
		return false;
	}
	if( form.zip.value == "" ) {
		alert('Please enter your Zip Code.');
		form.zip.focus();
		return false;
	}
	if (!isEmailAddr(form.email.value)){
	    alert("Please enter a complete email address.");
	    form.email.focus();
	    return (false);
  	}
}



