var IosSplash = {};

IosSplash.menu = {};
IosSplash.slideshow = {};

IosSplash.init = function( urlPrefix ){

	urlPrefix += 'client/ios/';
	document.body.style.display = 'none';
	
	var required = [ 
	'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js',
	urlPrefix + 'js/splash/IosSplashSlideshow.js', 
	urlPrefix + 'js/splash/IosSplashMenu.js' 
	];

	LazyLoad.js( required, function () {
		$( 'head' ).find( 'link' ).remove();
		LazyLoad.css( urlPrefix + 'css/ios_splash.css' );
		IosSplash.build();
	});
	
	
}

IosSplash.build = function(){	
	
	this.menu = new IosSplashMenu();
	this.imgContainer = $( '<div id="splashImgContainer"></div>');
	$( 'body' ).append( this.imgContainer );

	this.slideshow = new IosSplashSlideshow( this.imgContainer );

	
	
	var linkHolder = $( '<div id="linkHolder"></div>' );
	var links = $('#image_meta a');
	linkHolder.append( links );
	links.attr('target','_blank');
	
	if( links.length != 0 ){
		$( 'body' ).append( linkHolder );
	}
	
//remove created with from ios version for now
//	$( 'body').append( $( '#createdWith' ));
	$( 'body' ).append( $( '#copyright'));
	$( '#layout' ).remove();
	
	console.log( 'trace = ' + this.imgContainer );
	$( 'body' ).show();
}


IosSplash.nextSlide = function(){
	IosSplash.slideshow.nextSlide();
	IosSplash.slideshow.alignInterval();
}

