window.addEvent("domready",function() {
	
//add touchstart event to the body
//document.body.addEvent('touchstart',function(e) {
//  //react to the touchstart however you'd like!
//  $$("#menu").fade('hide');
//});
//add touchmove event to the body
document.body.addEvent('touchmove',function(e) {
  //react to the touchmove however you'd like!
  $$("#menu").fade('hide');
});
//add touchend event to the body
document.body.addEvent('touchend',function(e) {
  //react to the touchend however you'd like!
  $$("#menu").fade('in');
});
	
// If this is an iOS mobile platform...	
if(Browser.Platform.ios || Browser.Platform.android) {
  // Create the "top" link
  var menu = $$("#menu");
  
  // Create a ScrollSpy instance
  var spy = new ScrollSpy({
    min: 300,
    //duration: '300',
	//touchmove: function(pos) {
      //menu.fade(0);
    //},
    //touchend: function(pos) {
      //menu.fade(1);
    //}
  })  

  // Change styling of the TOP element's position
  menu.setStyles({ 
    position: "absolute", 
    bottom: "0", 
	//opacity: "0" 
  });
  
  $$("#models-01, #models-11, #models-12, #models-21, #models-22, #models-31, #models-32").setStyles({ 
    display: "none", 
  });
  
  // Add a scroll event to...
  spy.addEvent("scroll",function(position) {
    // ...position the element
     // 20px offset from bottom
    menu.setStyle("top",(position.y + window.getSize().y - 55) + "px");
  });

}

});
