	//global variables
	var currentgallery = "lakebridge";
	var currentpic = "images/gallery/lakebridge_1.jpg";
	var counter,x,i = 0;
	var place = 0;
	var arrlength = 0;
	var range = 0;
	var hold_over = "";
	var show_toggle = 0;
		
	// set the arrays 
	// home page images
	var gallery_array=[["images/gallery/lake_center_3.jpg", "Lakebridge Apartments"],["images/gallery/lakebridge_1.jpg", "Lakebridge Apartments"],["images/gallery/lakebridge_6.jpg", "Lakebridge Apartments"],["images/gallery/lakebridge_ducks_1.jpg", "Lakebridge Apartments"],["images/gallery/lakebridge_4.jpg", "Lakebridge Apartments"],["images/gallery/lakebridge_ducks_2.jpg", "Lakebridge Apartments"],["images/gallery/gallery_4.jpg", "Lakebridge Apartments"],["images/gallery/lakebridge_2.jpg", "Lakebridge Apartments"],["images/gallery/lakebridge_artpark_1.jpg", "Lakebridge Apartments"],["images/gallery/bridge_1.jpg", "Lakebridge Apartments"],["images/gallery/lakebridge_office_2.jpg", "Lakebridge Apartments"],["images/gallery/lakebridge_3.jpg", "Lakebridge Apartments"],["images/gallery/lakebridge_7.jpg", "Lakebridge Apartments"],["images/gallery/lakebridge_5.jpg", "Lakebridge Apartments"],["images/gallery/lakebridge_fitness_center.jpg", "Lakebridge Apartments"],["images/gallery/lakebridge_8.jpg", "Lakebridge Apartments"],["images/gallery/lakebridge_ducks_4.jpg", "Lakebridge Apartments"],["images/gallery/gallery_5.jpg", "Lakebridge Apartments"],["images/gallery/fountain_sculpture_2.jpg", "Lakebridge Apartments"],["images/gallery/lake_center_1.jpg", "Lakebridge Apartments"],["images/gallery/gallery_2.jpg", "Lakebridge Apartments"],["images/gallery/lake_center_2.jpg", "Lakebridge Apartments"],["images/gallery/flower_arch_3.jpg", "Lakebridge Apartments"],["images/gallery/clubroom_2.jpg", "Lakebridge Apartments"],["images/gallery/lakebridge_office_1.jpg", "Lakebridge Apartments"],["images/gallery/rock_fountain.jpg", "Lakebridge Apartments"],["images/gallery/art_park_1.jpg", "Lakebridge Apartments"],["images/gallery/art_park_3.jpg", "Lakebridge Apartments"],["images/gallery/art_park_4.jpg", "Lakebridge Apartments"],["images/gallery/interior_kitchen.jpg", "Lakebridge Apartments"],["images/gallery/interior_kitchen_2.jpg", "Lakebridge Apartments"],["images/gallery/gallery_1.jpg", "Lakebridge Apartments"],["images/gallery/lakebridge_ducks_3.jpg", "Lakebridge Apartments"],["images/gallery/lake_rushes_2.jpg", "Lakebridge Apartments"],["images/gallery/bridge_2.jpg", "Lakebridge Apartments"],["images/gallery/pool_1.jpg", "Lakebridge Apartments"],["images/gallery/corner_2.jpg", "Lakebridge Apartments"],["images/gallery/corner_3.jpg", "Lakebridge Apartments"],["images/gallery/pool_2.jpg", "Lakebridge Apartments"],["images/gallery/bridge_3.jpg", "Lakebridge Apartments"],["images/gallery/pool_3.jpg", "Lakebridge Apartments"],["images/gallery/lake_center_4.jpg", "Lakebridge Apartments"],["images/gallery/lake_center_5.jpg", "Lakebridge Apartments"],["images/gallery/fireplace_2.jpg", "Lakebridge Apartments"],["images/gallery/interior_livingroom.jpg", "Lakebridge Apartments"],["images/gallery/interior_livingroom_2.jpg", "Lakebridge Apartments"],["images/gallery/interior_livingroom_3.jpg", "Lakebridge Apartments"]];

	// floor plan images
	var plan_array=[["images/gallery/floorplan_a_sm.jpg", "Floor Plan A - Lakebridge", "images/gallery/floorplan_a_lg.jpg"],["images/gallery/floorplan_a2_sm.jpg", "Floor Plan AII - Lakebridge", "images/gallery/floorplan_a2_lg.jpg"],["images/gallery/floorplan_b_sm.jpg", "Floor Plan B - Lakebridge", "images/gallery/floorplan_b_lg.jpg"],["images/gallery/floorplan_b2_sm.jpg", "Floor Plan BII - Lakebridge", "images/gallery/floorplan_b2_lg.jpg"],["images/gallery/floorplan_c_sm.jpg", "Floor Plan C - Lakebridge", "images/gallery/floorplan_c_lg.jpg"],["images/gallery/floorplan_c2_sm.jpg", "Floor Plan CII - Lakebridge", "images/gallery/floorplan_c2_lg.jpg"],["images/gallery/floorplan_d_sm.jpg", "Floor Plan D - Lakebridge", "images/gallery/floorplan_d_lg.jpg"],["images/gallery/floorplan_e_sm.jpg", "Floor Plan E - Lakebridge", "images/gallery/floorplan_e_lg.jpg"],["images/gallery/floorplan_f_sm.jpg", "Floor Plan F - Lakebridge", "images/gallery/floorplan_f_lg.jpg"]];
	
	function get_gallery(galname,state){
		switch (galname) { 
			case "lakebridge" :
				if (state==0) {
					place = 0;
					currentgallery = "lakebridge";
					arrlength = gallery_array.length - 1;	
				}				
				document.gallerypic.src = gallery_array[place][0];
				document.gallerypic.alt = gallery_array[place][1];
				break;
			case "floorplan" :
				if (state==0) {
					place = 0;
					currentgallery = "floorplan";
					arrlength = plan_array.length - 1;
				}				
				document.plangallery.src = plan_array[place][0];
				document.plangallery.alt = plan_array[place][1];
				break;

		   default:  alert("Unexpected value encountered.");
		}		
	}

	function get_next_pic() {				
		place = place + 1;		
		if (place <= arrlength) {
			get_gallery(currentgallery,1);
			
		} else {
			place=0;
			get_gallery(currentgallery,1);
		}
	}
	
	function get_pic(planno) {
		place = planno;
		if (planno<=arrlength && planno>=0) {
			get_gallery(currentgallery,1);
		}
	}

	function put_pic(what,who) {
		document.gallerypic.src = what;
		document.gallerypic.alt = who;
	}

	function openFixedWindow(where,big) {
		var theUrl;
		var theSize;
		if (where=="" || where==null) {
			theUrl = plan_array[place][2];
			theSize = 'width=625,height=740'
		} else {
			theUrl = where;
			theSize = big;
		}		
		window.open(theUrl,'floorplan',theSize);
	}
	function get_prev_pic() {
		place = place - 1;		
		if (place >= 0) {
			get_gallery(currentgallery,1);
		} else {
			place=arrlength;
			get_gallery(currentgallery,1);
		}		
	}

	function 	toggle_show() {
		if (show_toggle==0) {
			show_toggle=1;
		} else {
			show_toggle=0;
		}
		run_show();
	}

	function run_show() {
				
		if (show_toggle==1) {
			place = place + 1;		
			if (place <= arrlength) {
				get_gallery(currentgallery,1);				
			} else {
				place=0;
				get_gallery(currentgallery,1);
			}
			setTimeout("run_show()",4000);
		}
	}
				
	function nav_swap_over(navname,imgroot,imgswap) {
		hold_over=imgroot;
		document.images[navname].src=imgswap;
				
	}
	function nav_swap_out(navname) {
		document.images[navname].src=hold_over;
	}
