$(document).ready(function(){
	
	 	$(".synotes_ipad_iphone_dot").mousedown(function(){
	 	 swap_screenshot_ipad( $(this).attr("id").replace("synotes_ipad_iphone_dot_", ""));   
	 	 });
	 	 
	 	 $(".synotes_ipad_iphone_next").mousedown(function(){
	
	 		 if(total_screenshots_ipad != current_screenshot_ipad)
	 		 {
	 		  swap_screenshot_ipad(current_screenshot_ipad*1+1);  
	 		 } 
	 	  });
	 	  
	 	  $(".synotes_ipad_iphone_prev").mousedown(function(){
	 	  
	 	 if(1 != current_screenshot_ipad)
	 	 {
	 	  swap_screenshot_ipad(current_screenshot_ipad*1-1);
	 	 }
	   
	 });
	 
	 


});

var current_screenshot_ipad = 1;
var total_screenshots_ipad = 7;
function swap_screenshot_ipad(image)
{
		if(ninety == null)
		{
			margin = 79;
		}
		else
		{
			margin = 79;
		}
		
		margin = 79;
		size = 577;
		if(image != current_screenshot_ipad)
		{
		
		$("#synotes_ipad_iphone_dot_"+current_screenshot_ipad).attr('class', 'synotes_iphone_dot');
	
		if(current_screenshot_ipad > image)
		{
 			$("#ipad_screenshot").animate({ opacity: 0, marginLeft: (margin+30)+"px", }, 300 )
 			.animate({ marginLeft: (margin*1-30)+"px", }, 1 )
 			.animate({ backgroundPosition: "-"+(image*577-577)+"px 0px", }, 1 )
 			.animate({ opacity: 1, marginLeft: margin+"px", }, 300 );
		} else
		{
		
		$("#ipad_screenshot").animate({ opacity: 0, marginLeft: (margin*1-30)+"px", }, 300 )
		.animate({ marginLeft: (margin+30)+"px", }, 1 )
		.animate({ backgroundPosition: "-"+(image*577-577) + "px 0px", }, 1 )
		.animate({ opacity: 1, marginLeft: margin+"px", }, 300 );
		
		}
		current_screenshot_ipad = image;
		$("#synotes_ipad_iphone_dot_"+image).attr('class', 'synotes_ipad_iphone_dot synotes_ipad_iphone_dot_active');
		//syncopy_iphone_dot_active
		}	
		
		//alert(3);
}

var ninety;
function rotateThis()
{
	if(ninety == null)
	{
	ninety = true;

	$('#ipad_outter_wrapper').stop().animate({rotate: '90deg'}, 1000);
	$('#roate_spacing_top').stop().animate({height: '90px'}, 1000);
	$('#roate_spacing_bottom').stop().animate({height: '100px'}, 1000);
	
	
	$('.synotes_ipad_toogle').css('background-position','0 0');
	
	setTimeout('flipImage("/images/synotes_ipad_screenshots_p.png");',500);
	setTimeout('flipImageIMG("/images/ipad_device_p.png");',500);
	}
	else
	{
	ninety = null;
	
	$('#ipad_outter_wrapper').stop().animate({rotate: '0deg'}, 1000);
	$('#roate_spacing_top').stop().animate({height: '0px'}, 1000);
	$('#roate_spacing_bottom').stop().animate({height: '0px'}, 1000);
	
	$('.synotes_ipad_toogle').css('background-position','0 -48px');
	
	setTimeout('flipImage("/images/synotes_ipad_screenshots_l.png");',500);
	setTimeout('flipImageIMG("/images/ipad_device.png");',500);
	}

}
function flipImage(img)
{
	$('#ipad_screenshot').css('background-image',"url("+img+")");
}
function flipImageIMG(img)
{
	$('#ipad_main').attr('src', img);
}

