




//$(window).load(function() {
$(document).ready(function() {
	
	var $pages = $('div[data-role="page"]');
	var numPages = $pages.length;
	var $wrapper = $(".wrapper");
	
	$wrapper.css("height",$(window).height() );

	$(window).resize(function(){
		$wrapper.css("height",$(window).height() );
	});

	$pages.each(function(i) {
		$(this).find(".prev").live('tap', {index:i + 1},function(e) {
			var num = e.data.index <= 2 ? numPages : e.data.index - 1 ;
			$.mobile.changePage( "#page" + (num), {
				 transition: "slide",
				 reverse: true
			});
		});
		$(this).find(".next").live('tap', {index:i + 1}, function(e) {
			var num = e.data.index >= numPages ? 2 : e.data.index + 1 ;
			$.mobile.changePage( "#page" + (num), { transition: "slide"} );
		});
	  $(this).find('div.img').live( 'swiperight', {index:i + 1}, function( e ) {
			var num = e.data.index <= 2 ? numPages : e.data.index - 1 ;
 			$.mobile.changePage( "#page" + (num), {
				 transition: "slide",
				 reverse: true
			});
		} );  
	  $(this).find('div.img').live( 'swipeleft', {index:i + 1}, function( e ) {
			var num = e.data.index >= numPages ? 2 : e.data.index + 1 ;
 			$.mobile.changePage( "#page" + (num), { transition: "slide"} );
		} );  
	
	});


/*

	resizeElement();



	$(window).resize(function(){
		resizeElement();
	});


	$('#page2').live('pagebeforecreate',function(event){

//		$(this).show();
		resizeElement();


	});
	$('#page2').live('pageshow',function(event){

//	$(this).show();
	resizeElement();

	
	});

	$('#page2').live('orientationchange',function(event){

//	$(this).show();
	resizeElement();
//	$(this).show();

	
	});



//	$('#page2').live('animationComplete',function(event){
	$('#page2').live('pagehide',function(event){

//		$(this).hide();


	});



	$('#page2').live('pageshow',function(event){

	$(this).show();
	resizeElement();

	
	});

	$('#img1').live('click',function(event){

	$("#page2").show();
//	resizeElement();

	
	});

*/


/*
	$('#page2').live('orientationchange',function(event){

	$(this).show();
	resizeElement();
//	$(this).show();

	
	});
*/

});




$(document).ready(function() {
	



/*
$.fn.animationComplete = function( callback ) {

$("#background").fullBg();


};



$('div').live('pageshow',function(event, ui){
	
	$(".ui-header").css({
	
			position:"absolute",
			opacity:0.2
	});
	$(".ui-footer").css({
	
			position:"absolute",
			opacity:0.2,
			bottom:0
	
	});
});
*/


	


});

