// JavaScript Document

	var photoIndex=1;
	window.addEvent('domready', function(){	
		
		//* center content on browser resize *//
		window.addEvent('resize', function(){
			reSize();
		});
		
		//* center content on onload/dom ready *//
		reSize(); 
			
		//* setup slider and mouse wheel if height of inner content is more than 312px *//
		if($('contentInner').getSize().size.y > 312){
			$('scroller').setStyle('visibility', 'visible');
			var sliderSteps = $('contentInner').getSize().size.y - 312; //312 visible height of the innerContent to be scrolled
			var slider = new Slider($('scrollBar'), $('scroller'), {
			steps: sliderSteps,
			mode: 'vertical',
			//wheel: true,
			onChange: function(pos){$('contentInner').setStyle('top', 1 - pos);}
			}).set(0);
		
			document.addEvent('mousewheel', function(event) {
				event = new Event(event);
	 
				//* Mousewheel up *//
				if (event.wheel > 0) {
				slider.set(slider.step - 10);
				} 
				//* Mousewheel down *//
				else if (event.wheel < 0) {
				slider.set(slider.step + 10);
				}
			});
		}	
		

	});
	
	//* Resize Function *//
	function reSize(){
		var win = window.getSize();
		var winHeight = win.size.y;
			
		if (winHeight > 584) {
		var pad = (winHeight - 584) / 2;
		$('container').setStyle('padding-top', pad);
		}
		else {
		$('container').setStyle('padding-top', 0);
		}
	}
	
 	function initializeMap(strlat, strLong) 
	{
	 
    if (GBrowserIsCompatible()) 
		{
      		var map = new GMap2(document.getElementById('map'));
      	    map.addControl(new GSmallMapControl());
			//map.addControl(new GMapTypeControl());
      	    map.setCenter(new GLatLng(strlat, strLong), 14); 
			map.setMapType(G_NORMAL_MAP);
      		var marker = new GMarker(new GLatLng(strlat, strLong));
      	    map.addOverlay(marker);
            GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(WINDOW_HTML);});
    	}
	}
	
	function showNextPhoto()
	{
		photoIndex++;
		if(photoIndex==8) photoIndex=1;
		new Asset.image('images/homepagePhoto'+photoIndex+'.jpg', {onload:function(){
			var container = $('photoContainer');
			if(!window.ie) container.getChildren()[1].setStyle('top',-290);
			container.getChildren()[1].setOpacity(0);
			container.getChildren()[1].src=this.src;
			new Fx.Styles(container.getChildren()[1],{duration:2000, onComplete:function(){
				container.getChildren()[0].src=container.getChildren()[1].src;
			}}).start({'opacity':1});
		}});
	}
	
	
	function showPhoto(index)
	{
	
		/*new Asset.image('images/homepagePhoto'+index+'.jpg', {onload:function(){
			var container = $('photoContainer');
			this.replace(container.getChildren[1]);
			new Fx.Styles(container.getChildren()[1],{duration:500, onComplete:function(){
					container.getChildren()[1].src = this.src;
					container.getChildren()[1].setOpacity(0);
					container.getChildren()[1].setStyle('display','inline');
					if(window.ie) container.getChildren()[1].setStyle('top',-211);
					new Fx.Styles(container.getChildren()[1],{duration:500, onComplete:function(){
						container.getChildren()[0].src = container.getChildren()[1].src;
						container.getChildren()[0].setOpacity(1);
						container.getChildren()[1].setOpacity(0);
					}}).start({'opacity':1});
			}}).start({'opacity':1});
		}});*/
	}
	
