
$(function(){bodyResizeInit();slideshowInit();homebtnsInit();$("#contactform").submit(function(){return formValidation();});});function formValidation(){var errors=0;$('#contactform .reqField').each(function(){if(!$(this).val()){errors++;$(this).addClass('reqFieldError');$(this).click(function(){$('#contactform #validationNotice').fadeOut(250,function(){$(this).remove()});$(this).removeClass('reqFieldError').unbind('click');});}});if(errors){$('#contactform #validationNotice').remove();$('#contactform #submit').after('<span id="validationNotice" class="req">Please fill out all the required fields before submitting.</span>');return false;}
return true;}
function slideshowInit(){var slideshowStartImg=Math.floor(Math.random()*$('#slideshow').children().size());$('#slideshow').children(':eq('+slideshowStartImg+')').addClass('active');setInterval('slideSwitch()',5000);}
function slideSwitch(){var $active=$('#slideshow IMG.active');if($active.length==0)$active=$('#slideshow IMG:last');var $next=$active.next().length?$active.next():$('#slideshow IMG:first');$active.addClass('last-active');$next.css({opacity:0.0}).addClass('active').animate({opacity:1},1000,function(){$active.removeClass('active last-active');});}
function bodyResizer(){var fullHeight=parseInt($('#container').attr('origHeight'))>$(window).height()?parseInt($('#container').attr('origHeight')):$(window).height();$('#containershell').height(fullHeight);$('#container').height(fullHeight);}
function bodyResizeInit(){$('#container').attr('origHeight',$('#container').height());$(window).bind('resize',function(){bodyResizer();});bodyResizer();}
function homebtnsInit(){$('.bigbtn').hover(function(){$(this).fadeTo(150,.5);},function(){$(this).fadeTo(150,1);});$('#bigbtn1').click(function(){window.location='/new-homes'});$('#bigbtn2').click(function(){window.location='/repairs-and-maintenance'});$('#bigbtn3').click(function(){window.location='/environmental-solutions'});$('#bigbtn4').click(function(){window.location='/contact-us'});}
