// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

//window.onerror = function(){return true}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

MM_preloadImages('/images/nav_difference_on.jpg','/images/nav_communities_on.jpg','/images/nav_gallery_on.jpg','/images/nav_accolades_on.jpg','/images/nav_design_on.jpg','/images/btn_retail_on.jpg','/images/btn_office_on.jpg','/images/btn_hot_topics_on.jpg','/images/concierge_over.gif','/images/btn_search_on.jpg','/images/btn_previous_on.jpg','/images/btn_next_on.jpg','/images/photogallery/nav_details_over.jpg','/images/photogallery/nav_details_on.jpg','/images/photogallery/nav_exteriors_over.jpg','/images/photogallery/nav_exteriors_on.jpg','/images/photogallery/nav_interiors_over.jpg','/images/photogallery/nav_interiors_on.jpg','/images/contactus_over.gif');

function change(that, fgcolor){
that.style.color = fgcolor;
}

document.observe("dom:loaded", function() {
	$$('a.new-window').each(function(tag){
		$(tag).observe('click',function(event){
			window.open(this.href,'pwin','toolbar=yes,location=yes,width=980,height=650,scrollbars=yes,resizable=yes');
			Event.stop(event);
			return false;
		});
	});
});


function showElevation(src){	
	$$('#floorplan-image img')[0].setStyle({width:'597px',height:'auto'}).writeAttribute('src',src);	
}

function validate(f){
	
	var errors = '';
	
	switch(f.id){
		
		case 'career-form':
			if(f['resume[first_name]'].value =='') errors += "\nFirst name is required";
			if(f['resume[last_name]'].value =='') errors += "\nLast name is required";
			if(f['resume[email]'].value =='') errors += "\nEmail is required";
			if(f['resume[phone]'].value =='') errors += "\nPhone is required";
			if(f['resume[content]'].value =='') errors += "\nContent is required";
		
		break;		
		
	}
	
	if(errors != ''){
		alert('There are errors with  your form.\n'+errors);
		return false;		
	}else{
		return true;
	}
	
	
	
}