Mission.tasks(1).extend ( {

	setup : function ( cb ) {
		Portal.loadPage ( this, 'profile_jo/', null, function(){
			$( '#incriminating-photo' ).click( function () {
				Portal.loadPage( null, '/skivingoff/single_photo/', null, function () {
					Portal.setHint( "Click the 'detag' link below the photo" );
					$( 'ul.user' )
						.html( '<li class="user">Jo Parsons</li><li class="settings">Settings<ul><li>Account Settings</li><li class="privacy-settings">Privacy Settings</li><li>Application Settings</li></ul></li><li class="logout">Log out</li>' );
					$( 'a:contains(Jo Parsons)' ).after( ' (<a class="detag">detag</a>)' );
					$( 'a.detag' )
						.click( function () {
							var li = $( this ).parent();
							if ( li.is( ':last-child' ) ) {
								if ( li.prev().length > 0 ) {
									li.prev().html( li.prev().html().replace( /,\s*$/, '' ) );
									li.remove();
								} else {
									$( '.photo-tags' ).remove();
								}
							} else {
								li.remove();
							}
							doAction( 'e98337' ); // Tag!
							window.audio.PRIVACY.resume( 'PHOTO DETAGGED' );
							Portal.setHint( "Click on the 'Settings' link at the top of the page, then select 'Privacy Settings'" );
							$( 'ul.user li.privacy-settings' ).click( function () {
								Portal.loadPage( null, '/skivingoff/privacy_overview/', null, function () {
									$( '#fakebook-privacy-overview li.profile h3' ).click( function () {
										Portal.loadPage( null, '/skivingoff/privacy_profile/', null, function() {
											Portal.setHint( "Change the line about 'Photos tagged of you' to 'Only Friends' and then click on the save button" );
										} );
									} );
								} );
							} );
						} );
				} );
			} );
			cb();
		} );
	},
	start : function ( cb ) {
		setStoppableTimeout ( this, function ( ) {
			loadConversation ( '/scripts/skivingoff/conversations/privacy.js', function ( s ) {
				if ( s ) {
					window.audio = window.audio || {};
					window.audio.PRIVACY = new Audio ( window.scripts.PRIVACY, true, function(){ cb(); } );
				}
			} );
		}, 500 );
	}

} );

