/*******************************************************
 * Script Functions Used to Power the Edgemere Website *
 *******************************************************
 * All Functions and UI Handlers should be defined and *
 * documented as part of this file.                    *
 *******************************************************/

// hide popup windows like contact us and private registration by fading out and removing them from the body
function hidePopups() { $('.escapable').fadeOut('fast',function(){$('.escapable').remove();$('.staticWindow').fadeIn();}); }

// UI triggers for Removing the overlay on overlay click or close button click
$('.closeBtn a, .popupWindow .overlay').live('click', function(e) { e.preventDefault(); hidePopups(); });

// monitor for the escape key and hide popups when ever it's hit
$(document).keyup(function(e) {if (e.which == 27) {e.preventDefault(); hidePopups(); }});
$('#shareSubmit, #bookBtn, #shareBtn, #contactSubmit, #appointmentSubmit').live('hover', function (){$(this).toggleClass('hover');});

$(document).ready(function() {
  $("#availableTable tr.available").hover(function(event) {
   
      $(this).addClass('hover');
    }, function(event) {
      $(this).removeClass('hover');
  });
});
$('#availableTable .available').live('click',function(){location.href=$('a', this).attr('href'); });
$("#map a.unitblock span").live('hover', function() {$(this).toggleClass('hover');});
$("#map #units .available").live({
  mouseenter: function() { $(this).prepend("<span>More Information &gt;</span>").fadeIn('fast').show(); },
  mouseleave: function() {$(this).find('span').fadeOut('fast', function(){$(this).remove();}); }
});
$("#map #units p").live('hover',function(){$(this).toggleClass('hover'); });
  
  
$("#map #units .sold").live({
  mouseenter: function() {  $(this).prepend("<span>Sold</span>").fadeIn('fast').show(); },
  mouseleave: function() {$(this).find('span').fadeOut('fast'); }
});

$("#map #units .unreleased").live({
  mouseenter: function() {  $(this).prepend("<span>Coming Soon</span>").fadeIn('fast').show(); },
  mouseleave: function() {$(this).find('span').fadeOut('fast'); }
});

$("#map #units .construction").live({
  mouseenter: function() {  $(this).prepend("<span style='font-size: 9px;'>Under Construction</span>").fadeIn('fast').show(); },
  mouseleave: function() {$(this).find('span').fadeOut('fast'); }
});

$(document).ready(function(){
	$("#topnav .parent").hoverIntent({
		interval: 50, 
		over: drops_show, 
		timeout: 150, 
		out: drops_hide
	});
	$("#delayed-drops .nav-item").addClass('with-js');
});
function drops_show(){ $("ul", this).show('normal'); }
function drops_hide(){ $("ul", this).hide('normal'); }

//function drops_show(){ $("ul", this).show(); }
//function drops_hide(){ $("ul", this).hide(); }

 
// UI Trigger for Share Popup Window 
$('#shareBtn').live('click', function(e){ 
  e.preventDefault();
  $.get('./share.php?popup=true',      // call the popup version without any header/footer
  function(data) { 
    $('.staticWindow').fadeOut();
    $('body').append(data); $('#shareWindow').fadeIn(); // append data and fade in
  }); 
});

// UI Trigger for Contact Popup Window 
$('li.contact a').live('click', function(e){ 
  e.preventDefault();
  $.get('./contact.php?popup=true',      // call the popup version without any header/footer
  function(data) { 
    $('.staticWindow').fadeOut();
    $('body').append(data); $('#contactWindow').fadeIn(); // append data and fade in
  }); 
});

// UI Trigger for Renderings Popup Window 
$('li.renderings a').live('click', function(e){ 
  e.preventDefault();
  $.get('./renderings.php?popup=true',      // call the popup version without any header/footer
  function(data) { 
    $('.staticWindow').fadeOut();
    $('body').append(data); $('#renderingsWindow').fadeIn(); // append data and fade in
  }); 
});


// UI Trigger for Appointment Popup Window
$('#eventsBar a.appointment, #bookBtn, li.appointment a').live('click', function(e){ 
  e.preventDefault();
  $.get('./private-appointment.php?popup=true',      // call the popup version without any header/footer
  function(data) { 
    $('.staticWindow').fadeOut();
    $('body').append(data); 
  	$( "#dateInput" ).datepicker({
	    showOn: "button",
	    minDate:1,
  		buttonImage: "./images/icon-calendar.png",
	    buttonImageOnly: true
    });
    $('#appointmentWindow').fadeIn('fast', function(){
      $("#timeInput").msDropDown();
    }); // append data and fade in
  }); 
});

// UI Triggers for Events Page
/*
$('#eventsBar .desc, li.event a').live('click', function (e){
  e.preventDefault();
  $.get('./event.php?popup=true',      // call the popup version without any header/footer
  function(data) { 
    $('.staticWindow').fadeOut();
    $('body').append(data); $('#eventWindow').fadeIn(); // append data and fade in
  }); 
});
*/
// UI Trigger for Map Popup Window 
$('#mapLink, li.map a').live('click', function(e){ 
  e.preventDefault();
  $.get('./interactive-map.php?popup=true',      // call the popup version without any header/footer
  function(data) { 
    $('.staticWindow').fadeOut();
    $('body').append(data); $('#mapWindow').fadeIn(); // append data and fade in
  }); 
});


var renderingsMoving = false;
  var sliderWidth = 880;
  var sliderLeft = 0;
  var sliderLength = 0;
  var sliderMaxLeft = 400;
  
function initRenderings() {

  $('#photoList a').live('click', function (e){
    e.preventDefault();
    $('#photoList li').removeClass('selected');$(this).parent().addClass('selected');
    if (!renderingsMoving) {
      renderingsMoving = true;
      targetID = $(this).attr('href');
      leftPos = ($(targetID).position().left)*-1;
      distance = (leftPos) - parseInt($('#renderSlider').css('left'), 10);
      if (distance < 0) {distance = distance*-1; }
      time = parseInt(distance/120, 10) * 30;
      fWidth = 880 + 90;
      slideCount = $('.frame').length;
      newFrameNumber = leftPos*-1 / fWidth;
      if (newFrameNumber == 0) { $('#prevBtn').fadeOut();} else {  $('#prevBtn').fadeIn();}
      if (newFrameNumber != slideCount-1) { $('#nextBtn').fadeIn();} else {$('#nextBtn').fadeOut();}
      $('#renderSlider').animate({ left: leftPos  }, time, 'linear', function(){ renderingsMoving = false; }); 
    }  
  });


  $('#nextThumb a').click(function(e){e.preventDefault;});
  $('#nextThumb a').hover(function() {toggleSlideRight();});
  
  $('#prevThumb a').click(function(e){e.preventDefault;});
  $('#prevThumb a').hover(function() {toggleSlideLeft();});
  
  
    
 
  
  
  
}
  var slideRight = false;
  function toggleSlideRight() { 
    if (slideRight == false) { slideRight = true;} else { slideRight = false; }
    slideThumbRight();
  }
  
  var slideLeft= false;
  function toggleSlideLeft() { 
    if (slideLeft == false) { slideLeft = true;} else { slideLeft = false; }
    slideThumbLeft();
  }
 function slideThumbRight() {
    if (slideRight == true) { 
      if (sliderLeft <= sliderMaxLeft) {
        sliderLeft = sliderLeft+6;  
        if (sliderLeft > sliderMaxLeft) {sliderLeft = sliderMaxLeft;}
        
        sliderLeftValue = "-"+sliderLeft+"px";
        
        $('#photoList').css('left',sliderLeftValue);
      }
      if (sliderLeft == sliderMaxLeft) {
        $('#nextThumb a').fadeOut();
      }
      if (sliderLeft > 0) {
        $('#prevThumb a').fadeIn();
      }

      var t=setTimeout("slideThumbRight();","30");
    }
  }
    
    
  
  function slideThumbLeft() {
    if (slideLeft == true) { 
      if (sliderLeft > 0) {
        sliderLeft = sliderLeft-6;  
        if (sliderLeft < 0) {sliderLeft = 0;}
        sliderLeftValue = "-"+sliderLeft+"px";
        
        $('#photoList').css('left',sliderLeftValue);
      }
      if (sliderLeft <= sliderMaxLeft) {
        $('#nextThumb a').fadeIn();
      }
      if (sliderLeft == 0) {
        $('#prevThumb a').fadeOut();
      }
      var t=setTimeout("slideThumbLeft();","30");
    }
  }

$('#renderControls #nextBtn').live('click', function (e){
  e.preventDefault();
  if (!renderingsMoving) {
    renderingsMoving = true;
    // get current slider position
    curPos = parseInt($('#renderSlider').css('left'), 10);
    // get number of frames
    slideCount = $('.frame').length;
    // frame width + margin
    fWidth = 880 + 90;
    // new position
    newPos = curPos - fWidth;
    distance = newPos - curPos;
    if (distance < 0) {distance = distance*-1; }
    time = parseInt(distance/120, 10) * 30;
    newFrameNumber = newPos*-1 / fWidth;
    if (newFrameNumber == slideCount-1) { $('#nextBtn').fadeOut();}
    if (newFrameNumber != 0) { $('#prevBtn').fadeIn();} 
    if (newPos*-1 <= (fWidth * slideCount)) {
      $('#renderSlider').animate({
        left: newPos
      }, time, 'linear', function(){ renderingsMoving = false; });    
    }
  }
});

$('#renderControls #prevBtn').live('click', function (e){
   e.preventDefault();
  if (!renderingsMoving) {
    renderingsMoving = true;
    // get current slider position
    curPos = parseInt($('#renderSlider').css('left'), 10);
    // get number of frames
    slideCount = $('.frame').length;
    // frame width + margin
    fWidth = 880 + 90;
    // new position
    newPos = curPos + fWidth;
    distance = curPos - newPos;
    if (distance < 0) {distance = distance*-1; }
    time = parseInt(distance/120, 10) * 30;
    newFrameNumber = newPos*-1 / fWidth;
    if (newFrameNumber == 0) { $('#prevBtn').fadeOut();} 
    if (newFrameNumber != slideCount-1) { $('#nextBtn').fadeIn();}
    if (newPos <= 0) {
      $('#renderSlider').animate({
        left: newPos
      }, time, 'linear', function(){ renderingsMoving = false; });    
    }
  }  
});




var amenitiesMoving = false;
function initAmenities() {
$('#photoList a').live('click', function (e){
  e.preventDefault();
  $('#photoList li').removeClass('selected');$(this).parent().addClass('selected');
  if (!amenitiesMoving) {
    targetID = $(this).attr('href');
    leftPos = ($(targetID).position().left)*-1;
    distance = (leftPos) - parseInt($('#amenitiesSlider').css('left'), 10);
    if (distance < 0) {distance = distance*-1; }
    time = parseInt(distance/120, 10) * 30;
    fWidth = 880 + 90;
    slideCount = $('.frame').length;
    newFrameNumber = leftPos*-1 / fWidth;
    if (newFrameNumber == 0) { $('#prevBtn').fadeOut();} else {  $('#prevBtn').fadeIn();}
    if (newFrameNumber != slideCount-1) { $('#nextBtn').fadeIn();} else {$('#nextBtn').fadeOut();}
    $('#amenitiesSlider').animate({ left: leftPos  }, time, 'linear', function(){ amenitiesMoving = false; }); 
  }  
});
}

$('#photoControls #nextBtn').live('click', function (e){
  e.preventDefault();
  if (!amenitiesMoving) {
    amenitiesMoving = true;
    // get current slider position
    curPos = parseInt($('#amenitiesSlider').css('left'), 10);
    // get number of frames
    slideCount = $('.frame').length;
    // frame width + margin
    fWidth = 880 + 90;
    // new position
    newPos = curPos - fWidth;
    distance = newPos - curPos;
    if (distance < 0) {distance = distance*-1; }
    time = parseInt(distance/120, 10) * 30;
    newFrameNumber = newPos*-1 / fWidth;
    if (newFrameNumber == slideCount-1) { $('#nextBtn').fadeOut();}
    if (newFrameNumber != 0) { $('#prevBtn').fadeIn();} 
    if (newPos*-1 <= (fWidth * slideCount)) {
      $('#amenitiesSlider').animate({
        left: newPos
      }, time, 'linear', function(){ amenitiesMoving = false; });    
    }
  }
});

$('#photoControls #prevBtn').live('click', function (e){
   e.preventDefault();
  if (!amenitiesMoving) {
    amenitiesMoving = true;
    // get current slider position
    curPos = parseInt($('#amenitiesSlider').css('left'), 10);
    // get number of frames
    slideCount = $('.frame').length;
    // frame width + margin
    fWidth = 880 + 90;
    // new position
    newPos = curPos + fWidth;
    distance = curPos - newPos;
    if (distance < 0) {distance = distance*-1; }
    time = parseInt(distance/120, 10) * 30;
    newFrameNumber = newPos*-1 / fWidth;
    if (newFrameNumber == 0) { $('#prevBtn').fadeOut();} 
    if (newFrameNumber != slideCount-1) { $('#nextBtn').fadeIn();}
    if (newPos <= 0) {
      $('#amenitiesSlider').animate({
        left: newPos
      }, time, 'linear', function(){ amenitiesMoving = false; });    
    }
  }  
});


$('#showAvailableOnly').live('change', function(){
  if ($('#showAvailableOnly').attr('checked')) {
    $('.unavailable').hide();
  } else {
    $('.unavailable').show(); 
  }
});


$('a.floorplanlink, #residenceDetails .photos a').colorbox({photo: true});
$('.colorbox').colorbox();
$('#eventPhotoFrame a, #eventPhotoContainer a').live('click', function(e){
  e.preventDefault();
  $.colorbox({href: 'flythrough.php', width: "775px", height: "480px"});
  
});
$(document).bind('cbox_complete', function(){
   VideoJS.setupAllWhenReady();
});


var resphotos=new Array(); 
  resphotos[0]="./images/photos/residences/residences-photo-1-large.jpg";
  resphotos[1]="./images/photos/residences/_A_B_South_FLAT_Brochure-SMF.jpg";
  resphotos[2]="./images/photos/residences/Project_Rendering.jpg";
  resphotos[3]="./images/photos/residences/Edgemere_Dining_room_Final.jpg";  
  resphotos[4]="./images/photos/residences/Edgemere_Kitchen_Final.jpg";
  resphotos[5]="./images/photos/residences/Edgemere_Master_Bed_Final.jpg";
  resphotos[6]="./images/photos/residences/Edgemere_Greatroom_Final.jpg";
  
function initResidenceSlider() {
  // start preloading
  imageObj = new Image();
  for(i=0; i<=6; i++) { imageObj.src=resphotos[i]; }
  $('#photoList .photo0').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#residencesPhotoContainer img').fadeOut('fast', function(){$(this).attr('src', resphotos[0]).fadeIn();});});
  $('#photoList .photo1').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#residencesPhotoContainer img').fadeOut('fast', function(){$(this).attr('src', resphotos[1]).fadeIn();});});
  $('#photoList .photo2').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#residencesPhotoContainer img').fadeOut('fast', function(){$(this).attr('src', resphotos[2]).fadeIn();});});
  $('#photoList .photo3').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#residencesPhotoContainer img').fadeOut('fast', function(){$(this).attr('src', resphotos[3]).fadeIn();});});          
  $('#photoList .photo4').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#residencesPhotoContainer img').fadeOut('fast', function(){$(this).attr('src', resphotos[4]).fadeIn();});});          
  $('#photoList .photo5').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#residencesPhotoContainer img').fadeOut('fast', function(){$(this).attr('src', resphotos[5]).fadeIn();});});          
  $('#photoList .photo6').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#residencesPhotoContainer img').fadeOut('fast', function(){$(this).attr('src', resphotos[6]).fadeIn();});});          
}


var estatephotos = new Array(); 
  estatephotos[0]="./images/photos/estate/estate-photo-2.jpg";         
  estatephotos[1]="./images/photos/estate/estate-photo-1.jpg";       
  estatephotos[2]="./images/photos/estate/Edgemere-Disc-1-347.jpg";    
  estatephotos[3]="./images/photos/estate/Edgemere-Disc-2-344.jpg";    
  estatephotos[4]="./images/photos/estate/Edgemere-Disc-6-099.jpg";    
  estatephotos[5]="./images/photos/estate/IMGP1044.jpg";
  estatephotos[6]="./images/photos/estate/IMGP1046_2.jpg";
function initEstateSlider() {var i = 0;
  // start preloading
  imageObj = new Image();
  for(i=0; i<=6; i++) { imageObj.src=estatephotos[i]; }
  $('#photoList .photo0').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#estatePhotos img').fadeOut('fast', function(){$(this).attr('src', estatephotos[0]).fadeIn();});});
  $('#photoList .photo1').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#estatePhotos img').fadeOut('fast', function(){$(this).attr('src', estatephotos[1]).fadeIn();});});
  $('#photoList .photo2').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#estatePhotos img').fadeOut('fast', function(){$(this).attr('src', estatephotos[2]).fadeIn();});});
  $('#photoList .photo3').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#estatePhotos img').fadeOut('fast', function(){$(this).attr('src', estatephotos[3]).fadeIn();});});
  $('#photoList .photo4').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#estatePhotos img').fadeOut('fast', function(){$(this).attr('src', estatephotos[4]).fadeIn();});});  
  $('#photoList .photo5').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#estatePhotos img').fadeOut('fast', function(){$(this).attr('src', estatephotos[5]).fadeIn();});});          
  $('#photoList .photo6').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#estatePhotos img').fadeOut('fast', function(){$(this).attr('src', estatephotos[6]).fadeIn();});});          
}







var servicephotos = new Array(); 
  servicephotos[0]="./images/services.jpg";       
  servicephotos[1]="./images/temp/filler-image-1b.jpg";       
  servicephotos[2]="./images/temp/filler-image-2b.jpg";    
  servicephotos[3]="./images/temp/filler-image-3b.jpg";    
  servicephotos[4]="./images/temp/filler-image-4b.jpg";    
  servicephotos[5]="./images/temp/filler-image-5b.jpg";
function initServicesSlider() {var i = 0;
  // start preloading
  imageObj = new Image();
  for(i=0; i<=5; i++) { imageObj.src=servicephotos[i]; }
  $('#photoList .photo0').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#servicesPhotos img').fadeOut('fast', function(){$(this).attr('src', servicephotos[0]).fadeIn();});});
  $('#photoList .photo1').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#servicesPhotos img').fadeOut('fast', function(){$(this).attr('src', servicephotos[1]).fadeIn();});});
  $('#photoList .photo2').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#servicesPhotos img').fadeOut('fast', function(){$(this).attr('src', servicephotos[2]).fadeIn();});});
  $('#photoList .photo3').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#servicesPhotos img').fadeOut('fast', function(){$(this).attr('src', servicephotos[3]).fadeIn();});});
  $('#photoList .photo4').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#servicesPhotos img').fadeOut('fast', function(){$(this).attr('src', servicephotos[4]).fadeIn();});});  
  $('#photoList .photo5').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#servicesPhotos img').fadeOut('fast', function(){$(this).attr('src', servicephotos[5]).fadeIn();});});          
}





var lifephotos=new Array(); 
  
  lifephotos[0]="./images/photos/lifestyle/Lifestyle-Overview.jpg";       
  lifephotos[1]="./images/photos/lifestyle/LifestyleOverview2.jpg";    
  lifephotos[2]="./images/photos/lifestyle/LifestyleOverview3.jpg"; 
  lifephotos[3]="./images/photos/lifestyle/LifestyleOverview4.jpg"; 
  lifephotos[4]="./images/photos/lifestyle/LifestyleOverview5.jpg"; 
  lifephotos[5]="./images/photos/lifestyle/LifestyleOverview6.jpg"; 
  lifephotos[6]="./images/photos/lifestyle/LifestyleOverview7.jpg"; 

function initLifestyleSlider() {var i = 0;
  // start preloading
  imageObj = new Image();
  for(i=0; i<=6; i++) { imageObj.src=lifephotos[i]; }
  $('#photoList .photo0').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#lifestylePhotos img').fadeOut('fast', function(){$(this).attr('src', lifephotos[0]).fadeIn();});});
  $('#photoList .photo1').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#lifestylePhotos img').fadeOut('fast', function(){$(this).attr('src', lifephotos[1]).fadeIn();});});  
  $('#photoList .photo2').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#lifestylePhotos img').fadeOut('fast', function(){$(this).attr('src', lifephotos[2]).fadeIn();});});  
  $('#photoList .photo3').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#lifestylePhotos img').fadeOut('fast', function(){$(this).attr('src', lifephotos[3]).fadeIn();});});  
  $('#photoList .photo4').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#lifestylePhotos img').fadeOut('fast', function(){$(this).attr('src', lifephotos[4]).fadeIn();});});  
  $('#photoList .photo5').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#lifestylePhotos img').fadeOut('fast', function(){$(this).attr('src', lifephotos[5]).fadeIn();});});  
  $('#photoList .photo6').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#lifestylePhotos img').fadeOut('fast', function(){$(this).attr('src', lifephotos[6]).fadeIn();});});  
}


var oakvillephotos=new Array(); 
  oakvillephotos[0]="./images/photos/oakville/photo-oakville.jpg";       
  oakvillephotos[1]="./images/photos/oakville/Oakville1.jpg";       
  oakvillephotos[2]="./images/photos/oakville/Oakville2.jpg";    
  oakvillephotos[3]="./images/photos/oakville/Oakville3.jpg";    
  oakvillephotos[4]="./images/photos/oakville/marina.jpg";    

function initOakvilleSlider() {var i = 0;
  // start preloading
  imageObj = new Image();
  for(i=0; i<=4; i++) { imageObj.src=lifephotos[i]; }
  $('#photoList .photo0').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#oakvillePhotos img').fadeOut('fast', function(){$(this).attr('src', oakvillephotos[0]).fadeIn();});});
  $('#photoList .photo1').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#oakvillePhotos img').fadeOut('fast', function(){$(this).attr('src', oakvillephotos[1]).fadeIn();});});
  $('#photoList .photo2').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#oakvillePhotos img').fadeOut('fast', function(){$(this).attr('src', oakvillephotos[2]).fadeIn();});});          
  $('#photoList .photo3').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#oakvillePhotos img').fadeOut('fast', function(){$(this).attr('src', oakvillephotos[3]).fadeIn();});});          
  $('#photoList .photo4').click(function(e){e.preventDefault();$('#photoList li').removeClass('selected');$(this).addClass('selected');$('#oakvillePhotos img').fadeOut('fast', function(){$(this).attr('src', oakvillephotos[4]).fadeIn();});});          
}



