function gallery() {
	
	//slideshow settings
	var init = [1, "INITIAL", "CS"]
	var photos = [70, "PHOTOS", "PH"];
	var production = [17, "PRODUCTION_HOUSING", "SP"];
	var renderings = [6, "CUSTOM_HOMES_RENDERINGS", "RE"];
	var models = [12, "3D_MODELS", "3D"];
	var about = [1, "ABOUT", "TR"];
	var current_gallery = init;
	var current_image = 1;
	var buttonCurrent = '';

  initGallery();

  function initGallery() {
    $(document).ready(function() {
      loadGallery(init);
      getDateFormatted();
      setEventHandlers();
    });
  };

  function loadGallery(gallery) {
		current_image = 1;
		$("#top_frame").html("<img src=\'images/" + gallery[1] + "/" + current_image + ".jpg" +  "\'/>");
		$("#page_number").html(gallery[2] + " " + current_image);
  };
  function nextImage(gallery) {
		if(current_image == gallery[0]){
			current_image = 1;
		} else {
			current_image++;
		}
		$("#top_frame").html("<img src=\'images/" + gallery[1] + "/" + current_image + ".jpg" +  "\'/>");
		$("#page_number").html(gallery[2] + " " + current_image);
  };
  function prevImage(gallery) {
		if(current_image == 1){
			current_image = gallery[0];
		} else {
			current_image--;
		}
		$("#top_frame").html("<img src=\'images/" + gallery[1] + "/" + current_image + ".jpg" +  "\'/>");
		$("#page_number").html(gallery[2] + " " + current_image);					    
  };
  function comingSoonMessage() {
    $("#top_frame").html("<h2 id='coming_soon'>Coming Soon</h2>");
		$("#page_number").html("NA");    
  };
  function getDateFormatted() {
  	//set todays date on page
  	$("#date_time").html($.datepicker.formatDate('m-d-yy', new Date(Date())));    
  };
  function setButtonCurrent(button) {
    $(buttonCurrent).removeClass('current');
    $(button).addClass('current');
    buttonCurrent = button;
  };
  function setEventHandlers() {
		//next button gallery
		$("#next_button").click(function(){
			nextImage(current_gallery);
		});
		
		//previous button gallery
		$("#prev_button").click(function(){
			prevImage(current_gallery);
		});

		//buttons to gallery
		$("#box_2_inner_1").click(function(){
			loadGallery(renderings);
			current_gallery = renderings;
			setButtonCurrent(this);
		});
		$("#box_2_inner_2").click(function(){
			loadGallery(production);
			current_gallery = production;
			setButtonCurrent(this);			
		});
		$("#box_2_inner_3").click(function(){
      comingSoonMessage();
			setButtonCurrent(this);
		});
		$("#box_2_inner_4").click(function(){
			loadGallery(about);
			current_gallery = about;
			setButtonCurrent(this);			
		});		
		$("#box_4_inner_1").click(function(){
			loadGallery(renderings);
			current_gallery = renderings;
			setButtonCurrent(this);
		});
		$("#box_4_inner_2").click(function(){
			loadGallery(models);
			current_gallery = models;
			setButtonCurrent(this);			
		});
		$("#box_4_inner_3").click(function(){
      comingSoonMessage();
			setButtonCurrent(this);      	
		});
		$("#box_4_inner_4").click(function(){
			loadGallery(photos);
			current_gallery = photos;
			setButtonCurrent(this);			
		});		
  };
};