function iphoneNav()
{	
	this.scaleIpod = 0;
	//--------------------------------------
	// INIT
	//--------------------------------------
	
	this.init = function()
	{
		this.IphoneEvent(); 
	}

	//--------------------------------------
	// EVENT IPHONE
	//--------------------------------------
	
	this.IphoneEvent = function()
	{
		///// ESCONDE O CÓDIGO DO IE
		/*@cc_on
	   /*@if ( @_jscript_version >= 5 )
		//alert('IE');
	   @else @*/
			
		
  		if( _iphone ) 
		{	
			this.cssIphone();
			this.IphoneTouch();
		}
		
		if( _ipad ) 
		{
			this.cssIpad();
			this.IphoneTouch();
		}
		
	   /*@end
		@*/
	}
	
	
	//--------------------------------------
	// EVENT TOUCH
	//--------------------------------------
	
	this.IphoneTouch = function ()
	{		
			window.onscroll = function() 
			{
			  	controlPos();
			};
			
			var	originalCoord = { x: 0, y: 0 };
			var	finalCoord = { x: 0, y: 0 };
			var	movTouch = { x: 30, y: 50 };
			
			setTimeout( scrollTo,0,0,1 );
			document.addEventListener("touchstart", touch_start, false);
			document.addEventListener("touchmove", touch_move, false);
			document.addEventListener("touchend", touch_end, false);
			document.addEventListener("touchcancel", touch_cancel, false);
			document.addEventListener("gesturechange", touch_change, false);

			function touch_start(event) 
			{
				originalCoord.x = event.targetTouches[0].pageX;
				originalCoord.y = event.targetTouches[0].pageY;
			}
			
			function touch_move(event) 
			{	
				finalCoord.x = event.targetTouches[0].pageX // Updated X,Y coordinates
				finalCoord.y = event.targetTouches[0].pageY
			}

			function touch_end(event) 
			{
				changeY = originalCoord.y - finalCoord.y
				changeX = originalCoord.x - finalCoord.x
							 
				if(changeY < movTouch.y && changeY > ( movTouch.y * (-1) )) {
					
					changeX = originalCoord.x - finalCoord.x
				
					if( changeX > movTouch.x ) 
					navRight();
					
					if( changeX < ( movTouch.x * (-1) ) ) 
					navLeft();
				}
				
				//
			}
			
			function touch_cancel(event) 
			{ 


			}
			
			function touch_change(event) 
			{ 
				//$( '#clip_controllers' ).css('top', document.documentElement.clientHeight/2 );
				//this.scaleIpod = event.scale;
				//event.preventDefault();
			}
	}
	
	//--------------------------------------
	// CSS IPHONE/IPAD
	//--------------------------------------
	
	this.cssIphone = function ()
	{	
		// CSS IPOD
		$( '#nav_controllers_divisor_img' ).css( "height", 195 );
		
		$( '#nav_controllers' ).css( "marginLeft", -129 );
		$( '#nav_controllers' ).stop().animate
		(
			{
				marginLeft: -129
			},
			50, 'easeOutCubic'
		);
		
		//
		$( '#left_arrow' ).stop().animate
		(
			{
				marginLeft: 0
			},
			100, 'easeOutCubic'
		);
		
		$( '#right_arrow' ).stop().animate
		(
			{
				marginLeft: 0
			},
			150, 'easeOutCubic'
		);
		
	}
	
	this.cssIpad = function ()
	{	
		$( '#nav_controllers' ).css( "marginLeft", -129 );
		$( '#nav_controllers' ).stop().animate
		(
			{
				marginLeft: -129
			},
			50, 'easeOutCubic'
		);
		
		//
		$( '#left_arrow' ).stop().animate
		(
			{
				marginLeft: 0
			},
			100, 'easeOutCubic'
		);
		
		$( '#right_arrow' ).stop().animate
		(
			{
				marginLeft: 0
			},
			150, 'easeOutCubic'
		);
		
	}
	
	//--------------------------------------
	// CONTROL POS
	//--------------------------------------
	
	function controlPos()
	{
		//var pageY = ($(window).scrollTop() - 64 ) + "px";
		var pageY = ( $(window).scrollTop() - 64 ) + "px";
		
		$( '#clip_controllers' ).stop().animate
		(
			{
				"marginTop": pageY
			},
			250, 'easeInOutQuint'
		);
	}
}


