//www.RainbowFirm.com's Rainbow Software For Developing Variated Rainbow/Custom-Color Videos, Pictures, And Browsing
package rainbowPackage;

import java.awt.Dimension;

import javafx.application.Application;

//import android.graphics.Color;

import javafx.application.Platform;
import javafx.scene.*;
import javafx.scene.paint.Paint.*;
import javafx.scene.paint.Color.*;
import javafx.scene.Scene;
import javafx.stage.*;
import javafx.stage.Stage;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import javafx.scene.input.MouseEvent;

import javafx.event.EventHandler;
import javafx.scene.*;
import javafx.scene.image.*;
//import javafx.scene.input.KeyEvent;

import javafx.fxml.FXMLLoader;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.scene.SnapshotParameters;

import java.awt.*;
import java.awt.image.*;
//import java.awt.event.ActionEvent;
import java.awt.Dimension;
import java.lang.Object;
import java.io.InputStream;
import java.io.File;
import javax.imageio.ImageIO;//Keep For .png Image Creation
import java.io.IOException;
import java.nio.ByteBuffer;

import javafx.scene.paint.Color;
import javafx.geometry.Rectangle2D;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyCombination;
import javafx.scene.input.KeyCodeCombination;
//import javafx.scene.input.KeyEvent;
import javafx.scene.layout.StackPane;
import javafx.scene.image.*;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.image.PixelReader;
import javafx.scene.image.PixelWriter;
import javafx.scene.image.WritableImage;
import javafx.scene.image.WritableImage.*;
//import javafx.scene.input.KeyEvent;
//import javafx.scene.layout.VBox;
import javafx.scene.text.*;
import javafx.stage.Screen;
import javafx.stage.Stage;
import javafx.scene.layout.*;
//import javafx.scene.shape.*;

import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.concurrent.Worker;
import javafx.concurrent.Worker.State;

import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.concurrent.Worker;
import javafx.concurrent.Worker.State;
//import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.TextField;
import javafx.scene.layout.VBox;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;

//import java.util.Timer;
//import java.util.TimerTask;
import java.lang.Object.*;
import org.apache.commons.io.*;
import java.io.PrintWriter;
import java.io.PrintStream;
import javax.swing.JFileChooser;
//import javafx.stage.DirectoryChooser;
//import javafx.stage.FileChooser;
import javafx.embed.swing.SwingFXUtils;
import javafx.embed.swing.SwingFXUtils.*;
//import org.openqa.selenium.By;
//import org.openqa.selenium.WebDriver;
//import org.openqa.selenium.firefox.FirefoxDriver;

//import com.sun.tools.javac.api.JavacTaskPool.Worker;

//import org.apache.commons.io.FileUtils;

//import org.openqa.selenium.OutputType;

//import org.openqa.selenium.TakesScreenshot;

import java.io.*;

import org.jcodec.api.SequenceEncoder;
import org.jcodec.api.SequenceEncoder.*;
import org.jcodec.api.awt.AWTSequenceEncoder;
import org.jcodec.common.Codec;
import org.jcodec.common.Format;
import org.jcodec.common.io.NIOUtils;
import org.jcodec.common.io.SeekableByteChannel;
import org.jcodec.common.model.Rational;
import org.jcodec.scale.AWTUtil;
import org.jcodec.api.*;
import java.nio.channels.*;
//import java.nio.channels.SeekableByteChannel;
import org.jcodec.*;//Keep For .mp4 Video Creation

//www.allaviacad.com Owns
//www.freeworldalliance.org Which Operates
//www.rainbowfirm.com Which Provides
//RainbowSoft® For The Pixies To Use And Control In Their Local Area Under The Angels Of The
//www.orderofmagi.com Who Protect The
//rainbowPackage Where It All Is,
//main Starts Application
//RainbowMainBody Extends Application To Begin
//start Which Starts Threading
//Which Runs Setup
//Which Begins Engine To Deploy
//RainbodSoft2D Which Maintains Loop Of
//RainbowVideo.java Which Accesses
//RainbowColorCodeSchemes.java For Frames
//Which Uses RainbowSoftColorCodes.java Of
//RainbowSoftColorCode.java Codes Of
//VibrantColors.java Class To Configure Where Patterns Are Displayed Through Accessing
//RainbowPattern2D.java For Each Rainbow/Custom Pattern, Which Accesses
//RainbowSoftColor.java For Each Rainbow/Custom Color Determination, Which Uses
//ColorSlider.java For Variation Determination Between 2 Of Each Color Points And Can Use
//TranspaerencySlider.java As Well For Transparency Determination At The Same Time, And The
//ColorTooSimilar.java Class Is For Checking To See If 2 Colors Are To Similar For Another Color To Be Displayed Allowing Text To Be Seen Throughout
//RainbowFirm's®
//Rainbow Hardware® Developments That Make
//RainbowSoft's®
//Proprietary Rainbow Software Which With Proper Computational Support And Expertise Makes
//Ideal Variated Rainbow/Custom Videos

/*public class RainbowMainBody {

	public RainbowMainBody() {
		// TODO Auto-generated constructor stub
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}*/
public class RainbowMainBody extends Application 
{	
	/* RainbowMainBody.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>()
    {
        public void handle(MouseEvent event) 
        {
            System.exit(0);
        }
    });// */
	@Override
	public void start(Stage stage) throws IOException
	{
		Thread thread = new Thread();//(() -> {

		stage.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>()
		{
			public void handle(MouseEvent event) 
			{
				System.exit(0);
			}
		});

		try { Thread.sleep(400); }
		catch (InterruptedException exc) { throw new Error("Unexpected interruption", exc); }
		// Update text on FX Application Thread:
		/*stage.addEventHandler(KeyEvent.KEY_RELEASED, (KeyEvent event) -> {
	        if (KeyCode.ESCAPE == event.getCode()) {
	            stage.close();
	        }
	    });//*/
		/*stage.addEventFilter(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() {
			public void handle(KeyEvent event) {
				if (changeHotkey) {
					if (addHotkey(event, changeHotkeyFunction)) {
						changeHotkey = false;
					}
				}
			}
		});//*/

		Platform.runLater(new Runnable() {
			public void run()
			{
				//@Override
				stage.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>()
				{
					@Override
					public void handle(MouseEvent event) 
					{
						System.exit(0);
					}
				});// */

				//try { onKeyPressed (KeyEvent); }
				//catch(IOException ie) { ie.printStackTrace(); }
				try { Setup(stage, thread ); }
				catch(IOException ie) { ie.printStackTrace(); }
			}
		});

		thread.setDaemon(true);
		thread.start();
	}

	static void Setup( Stage primaryStage, Thread primaryThread ) throws IOException
	{
		primaryStage.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>()
		{
			@Override
			public void handle(MouseEvent event) 
			{
				System.exit(0);
			}
		});

		primaryStage.setTitle("Sonnet");

		boolean primaryIsFullScreened = true;

		// This is how you know how much screen you can write to.
		Screen primaryScreen = Screen.getPrimary();
		Rectangle2D primaryBounds = primaryScreen.getVisualBounds();
		System.out.println(primaryBounds);

		//primaryStage.setX(0);
		//primaryStage.setY(0);
		KeyCombination fullScreenedKeyCombination = new KeyCodeCombination(KeyCode.ENTER, KeyCombination.ALT_DOWN);
		primaryStage.setFullScreenExitHint("Alt-Enter To Toggle Full-Screened Mode");
		primaryStage.setFullScreenExitKeyCombination(fullScreenedKeyCombination);

		primaryStage.setX(-100);
		primaryStage.setY(100);
		primaryStage.setWidth( 1920 ); //666
		primaryStage.setHeight( 1080 ); //888

		primaryStage.setResizable(false);

		/*primaryStage.setMaximized(true);
		primaryStage.setFullScreen(primaryIsFullScreened);
		primaryStage.show();//*/
		//primaryStage.setMaximized(true);
		/*try { primaryThread.sleep(2400); } catch(InterruptedException e) {
		    System.out.println("got interrupted!");
		}//*/
		/*
		primaryStage.show();
		primaryStage.setFullScreen(primaryIsFullScreened);


		if ( primaryIsFullScreened == false )
		{

		primaryStage.setWidth( 666 ); //666
		primaryStage.setHeight( 888 ); //888

		}
		else
		{
			primaryStage.setWidth( primaryBounds.getWidth() );
			primaryStage.setHeight( primaryBounds.getHeight() );
		}

		primaryStage.setMaximized(true);
		primaryStage.setFullScreen(primaryIsFullScreened);
		primaryStage.show();

		primaryStage.fullScreenProperty().addListener((observable, oldValue, newValue) -> {
			if ( newValue != primaryStage.isFullScreen() )
			{  	primaryStage.setFullScreen(primaryIsFullScreened);
			primaryStage.setWidth( primaryBounds.getWidth() );
			primaryStage.setHeight( primaryBounds.getHeight() );	}
			else
				return;
		}); // */
		//primaryStage.show();

		/*Dimension dimension = new Dimension( (int)bounds.getWidth(), (int)bounds.getHeight() );
		dimension.width = (int)bounds.getWidth();
		dimension.height = (int)bounds.getHeight() + 40;
		Dimension Dim = dimension;//*/

		double fRateDivisor = 7;//24{With 24 Complete PrintScreen .png s //7//468 For Buddhism Testing: 4;//10;//48//192//69;//124;//2;//10;//22<- 444 468 888 HERE HERE HERE DETERMINES FRAME RATE AND RAINBOW MOVEMENT RATE For Rainbow Lights

		//FXMLLoader loader = new FXMLLoader(Sonnet.class.getResource("main.fxml"));

		StackPane stackPane[] = new StackPane[(int)(fRateDivisor + 1)];
		stackPane[0] = new StackPane();
		stackPane[0].setPrefSize( primaryBounds.getWidth(), primaryBounds.getHeight() ); //+ 40 );//stackPane.setPrefSize(1920, 1080);//stackPane.setPrefSize(960, 540);
		//Image image = new Image("http://www.nanofirm.org/scimagorder.com/Pictures/Pixies%20Text.png");

		Scene primaryScene[] = new Scene[(int)(fRateDivisor + 1)];
		ProgressBar progressBar = new ProgressBar();
		Button goButton = new Button("Go!");
		Label stateLabel = new Label();
		TextField addressBar = new TextField();
		//addressBar.setText("http://www.google.com");
		//addressBar.setText("http://www.pixies.zone/PixiesTest.html");
		WebView browser = new WebView();
		browser.resize(primaryBounds.getWidth(), primaryBounds.getHeight() );
		//browser.setMinSize(primaryBounds.getWidth(), primaryBounds.getHeight() );
		//browser.setPrefSize( primaryBounds.getWidth(), primaryBounds.getHeight() + 10 ); // Important For Full Screened
		WebEngine webEngine = browser.getEngine();
		//webEngine.load("https://news.google.com/news/?ned=us&hl=en&gl=US");
		webEngine.load( "http://www.pixies.zone/BlankWebPage.html" ); //http://www.pixies.zone/BlankWebPage.html "http://www.pixies.zone/PixiesTest%20-%20Copy%20(4).html" PixiesTest%20-%20Copy%20(2).html");// PixiesTest%20-%20Copy.html"); // ASDF For Rainbow Browser
		/*try { webEngine.wait(1000);
		} catch (InterruptedException e) {
			System.out.println("Interrupted.");
		}*/	

		//while ()
		/*try { primaryThread.sleep(10000);
		} catch (InterruptedException e) {
			System.out.println("Interrupted.");
		}// */
		//webEngine.load("http://www.pixies.zone/PixiesTest.html");
		//primaryStackPane[0].getChildren().add(origionalImageView);
		//stackPane[0].getChildren().add(browser);
		Image origionalBasisImage = new Image("http://www.pixies.zone/Pictures/BuddhismTemplateHD.png");//SciMagOrderMagiEliteFullHDGreenBacking.png//KnightsOfTheSciMagOrderNewPre1.png//BuddhismTemplateHD.png//SciMagOrderMagiEliteFullHD.png
		origionalBasisImage = new Image("http://www.pixies.zone/Pictures/BuddhismTemplateHD.png");
		Image firstBackupWorkAroundImage = new Image("http://www.pixies.zone/Pictures/PixieesText.png");//BuyHempStartImage.png, PixiesWillAlwaysGetReincarnatedText.png
		JFileChooser jFileChooser = new JFileChooser();
		String path = "C:\\TestVideo.mp4", text = "Sky.Netarianism";//"C:\\TestImage.png"//"C:\\TestVideo.mp4"//"C:\\TEMP_Sonnet.mp4";
		File selectedFile = new File (path);
		File javaScriptFile = new File ("C:/Users/AllAV/Desktop/FWA Website/pixies.zone/scrollContinuously444.js");
		File xSliderFile = new File ("C:/Users/AllAV/Desktop/FWA Website/pixies.zone/xSlider.dat");
		jFileChooser.setSelectedFile(selectedFile);
		int returnValue = jFileChooser.showSaveDialog(null);
		if (returnValue == JFileChooser.APPROVE_OPTION)
		{
			selectedFile = jFileChooser.getSelectedFile();
			System.out.println(selectedFile.getName());
			System.out.println(selectedFile.getPath());
		}
		//SequenceEncoder enc = new SequenceEncoder(selectedFile);
		//try { SequenceEncoder enc = new SequenceEncoder(secondFile); }
		//catch (IOException e) {	throw new RuntimeException(e); }//*/

		//Boolean primaryFullScreened = false; //OLD OLD OLD Important For Full Screened
		Dimension firstDim = new Dimension( (int)primaryBounds.getWidth(), (int)primaryBounds.getHeight() );
		WritableImage origionalTextPicture = new WritableImage( firstDim.width, firstDim.height );//666, 888
		BufferedImage bf = null;
		try {
			bf = ImageIO.read(new File("C:\\Dev\\RainbowSoftware\\Pictures\\SciMagOrderMagiEliteFullHDGreenBacking.png") );///RainbowSoftware/Pictures/SciMagOrderMagiEliteFullHDGreenBacking.png"));
		}
		catch (IOException e) {
		}
		System.out.println( "bf = " + (bf == null) );
		/*try {
			bf = ImageIO.read(new File("C:/Dev/SciMagOrderMagiEliteFullHDGreenBacking.png"));
        } catch (IOException ex) {
            System.out.println("Image failed to load.");
        }
		//ByteArrayOutputStream byteOutput = new ByteArrayOutputStream();
		//ImageIO.write( SwingFXUtils.fromFXImage( origionalTextPicture, null ), "png", byteOutput );
		//origionalTextPicture = ImageIO.byteOutput.toByteArray();
		/*BufferedImage bf = null;
        try {
            bf = ImageIO.read(new File("C:/Dev/SciMagOrderMagiEliteFullHDGreenBacking.png"));
        } catch (IOException ex) {
            System.out.println("Image failed to load.");
        }

        //WritableImage wr = null;
        if (bf != null) {
        	origionalTextPicture = new WritableImage(bf.getWidth(), bf.getHeight());
            PixelWriter pw = origionalTextPicture.getPixelWriter();
            for (int x = 0; x < bf.getWidth(); x++) {
                for (int y = 0; y < bf.getHeight(); y++) {
                    pw.setArgb(x, y, bf.getRGB(x, y));
                }
            }
        }//*/
		//ImageView imView = new ImageView(origionalBasisImage);
		//origionalTextPicture = SwingFXUtils.toFXImage(bf, origionalTextPicture);
		//System.out.println( "origionalTextPicture = " + (origionalTextPicture == null) );
		//primaryScene[0].snapshot(SwingFXUtils.toFXImage(bf, null));//origionalTextPicture);
		//WritableImage origionalTextPicture = new WritableImage( (int)primaryBounds.getWidth(), (int)primaryBounds.getHeight() );
		/*
		//try { synchronized (webEngine) {
		//	webEngine.wait(2000);
		//} } catch (InterruptedException e) { e.printStackTrace(); }
		if ( primaryStage.isFullScreen() == false )
		{
			if ( primaryIsFullScreened != primaryStage.isFullScreen() )
			{
				primaryStage.setFullScreen(true);
				firstDim.width = 600;
				firstDim.height = 400;
			}
			else 
			{
				firstDim.width = (int)primaryStage.getWidth();
				firstDim.height = (int)primaryStage.getHeight();// + 40;
			}
			//primaryScene[0].snapshot(origionalTextPicture);
			//sP.setViewport( new Rectangle2D( (double)Dim.width, (double)Dim.height, 0, 0 ) );
			primaryStage.setScene(primaryScene[0]);
			primaryStage.setFullScreen(primaryIsFullScreened);
			primaryStage.show();// *_/

		}
		else if ( primaryIsFullScreened != primaryStage.isFullScreen() )
		{
			primaryScene[0].snapshot(origionalTextPicture);
			primaryStage.setFullScreen(primaryIsFullScreened);
			primaryStage.setWidth(primaryScreen.getBounds().getWidth());
			primaryStage.setHeight(primaryScreen.getBounds().getHeight());
			firstDim.width = (int)primaryStage.getWidth();
			firstDim.height = (int)primaryStage.getHeight();// + 40;

			//sP.setViewport( new Rectangle2D( (double)Dim.width, (double)Dim.height, 0, 0 ) );
			primaryStage.setScene(primaryScene[0]);
			primaryStage.setFullScreen(true);
			primaryStage.show();// *_/
		}// Important For Full Screened */
		System.out.println("Got To Worker");
		//Worker<Void> worker = webEngine.getLoadWorker();
		//ASDF PROBLEM PROBLEM PROBLEM BEFORE System.out.println("Not At Problem");
		//worker.stateProperty().addListener(new ChangeListener<State>() {
		//	@Override
		//	public void changed(ObservableValue<? extends State> observable, State oldValue, State newValue) {//System.out.println("Got To Worker Test");
		//		stateLabel.setText("Loading state: " + newValue.toString());
		//		if (newValue == Worker.State.SUCCEEDED) {System.out.println("Not At Problem");
		try { RainbowSystem(primaryStage, origionalBasisImage, /*firstBackupWorkAroundImage,*/ webEngine, browser, stackPane, primaryScene, primaryScreen, fRateDivisor, stateLabel, jFileChooser.getSelectedFile(), javaScriptFile, xSliderFile, primaryThread, primaryIsFullScreened, firstBackupWorkAroundImage ); }//, enc
		catch (IndexOutOfBoundsException e) { System.err.println("IndexOutOfBoundsException: " + e.getMessage()); }
		//}
		//}
		/*scene[(int)fRateDivisor].setOnKeyReleased(new EventHandler<KeyEvent>()
				{
					@Override
					public void handle(KeyEvent event)
					{
						if ( event.isAltDown() == true)
						{
							switch (event.getCode())
							{
							case ENTER: primaryStage.setFullScreen(!primaryStage.isFullScreen()); break;
							}
						}
					}
				});//*/
		/*try { RainbowSystem(primaryStage, browser, stackPane, scene, screen, fRateDivisor, stateLabel, selectedFile); }//enc,
				catch (IOException e) {	throw new RuntimeException(e); }//*/
		//}
		//});



		primaryStage.setScene(primaryScene[0]);// ???
		primaryStage.setFullScreen(primaryIsFullScreened);
		primaryStage.show();

		//progressBar.progressProperty().bind(worker.progressProperty());



		/*goButton.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent event) {
				String url = addressBar.getText();
				// Load the page.
				webEngine.load(url);
			}
		});//*/
	}





	public static void RainbowSystem (Stage secondaryStage, Image basisImage, WebEngine secondBrowserEngine, WebView secondBrowser, StackPane secondStackPane[], Scene secondScene[], Screen secondScreen,
			double secondFRateDivisor, Label SecondStateLabel, File secondFile, File secondJavaScriptFile, File secondXSliderFile, Thread secondaryThread, boolean secondaryIsFullScreened,
			Image secondaryBackupWorkAroundImage)//SequenceEncoder secondEnc, Image secondBackupWorkAroundImage, 
	{
		System.out.println("Got To The Top Of Worker");
		secondaryStage.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>()
		{
			@Override
			public void handle(MouseEvent event) 
			{
				System.exit(0);
			}
		});
		secondaryStage.setFullScreen(secondaryIsFullScreened);
		/*try ( PrintWriter out = new PrintWriter(secondJavaScriptFile.getPath() ) )
		{

			out.println("function scrollContinuously( timeInterval )\r\n" + 
					"{\r\n" + 
					"	timeInterval = 444;\r\n" + 
					"	window.setInterval( scrollWin, timeInterval );\r\n" + 
					"}\r\n" + 
					"function scrollWin()\r\n" + 
					"{\r\n" + 
					"    window.scrollBy( 0, 0 );\r\n" + 
					"}");
			out.close();
		}
		catch(IOException ie) { ie.printStackTrace(); }// Important For Browser AutoScrolling */


		secondaryStage.fullScreenProperty().addListener((observable, oldValue, newValue) -> {
			if ( newValue != secondaryStage.isFullScreen() )
			{
				secondaryStage.setFullScreen(secondaryIsFullScreened);
				//secondaryStage.setWidth( primaryBounds.getWidth() );
				// secondaryStage.setHeight( secondaryBounds.getHeight() );
			}
			else
				return;
		});// Important For Full Screened */

		secondaryStage.fullScreenProperty().addListener((observable, oldValue, newValue) -> {
			if ( newValue == secondaryStage.isFullScreen() )
			{
				secondaryStage.setFullScreen(secondaryIsFullScreened);
				secondaryStage.setWidth( secondScreen.getBounds().getWidth() );
				secondaryStage.setHeight( secondScreen.getBounds().getHeight() );
			}
			else
				return;
		});// Important For Not Full Screened */

		System.out.println("Got In Worker Past Full Screening");
		// This is how you know how much screen you can write to.
		Screen screen = Screen.getPrimary();
		Rectangle2D bounds = screen.getVisualBounds();
		System.out.println(bounds);

		//secondaryStage.setMaximized(true);
		//secondaryStage.setFullScreen(true); Improtant For Full Screened
		secondaryStage.setFullScreen(secondaryIsFullScreened);
		Dimension dimension = new Dimension( (int)bounds.getWidth(), (int)bounds.getHeight() );
		//Dimension dimension = new Dimension( 666, 888 );// 666, 888
		//dimension.width = (int)bounds.getWidth();// All Around Here Important For Full Screened
		//dimension.height = (int)bounds.getHeight();// + 40;
		Dimension Dim = dimension;// */

		//Dimension Dim = new Dimension();
		//Dim.width = (int)secondaryStage.getWidth(); // Important For Full Screened
		//Dim.height = (int)secondaryStage.getHeight();// + 40; // Important For Full Screened Without + 40
		secondaryStage.setFullScreen(secondaryIsFullScreened);
		secondaryStage.setTitle(secondBrowser.getEngine().getLocation());
		SecondStateLabel.setText("Finish!");
		secondaryStage.setFullScreen(secondaryIsFullScreened);
		//SequenceEncoder enc = new SequenceEncoder(secondFile);
		//try { SequenceEncoder enc = new SequenceEncoder(secondFile); }
		//catch (IOException e) {	throw new RuntimeException(e); }//*/


		if ( secondaryIsFullScreened == false )
		{
			secondBrowser.autosize();
			secondBrowser.resize( 666, 888 );
		}
		SnapshotParameters sP = new SnapshotParameters();
		//sP.setViewport( new Rectangle2D(-8, -19, 666, 888 ) );
		//secondBrowser.resizeRelocate( -8, -19, 666, 888 );

		//WritableImage origionalTextPicture = new WritableImage( Dim.width, Dim.height );
		WritableImage bufferPicture = new WritableImage( Dim.width, Dim.height );
		//origionalTextPicture = secondBrowser.snapshot(null, bufferPicture);
		//secondBrowser.snapshot(sP, bufferPicture);
		secondaryStage.show();
		WritableImage nextTextPicture = new WritableImage( Dim.width, Dim.height ), bufferPicure = new WritableImage( Dim.width, Dim.height );
		//secondBrowser.snapshot(sP, nextTextPicture);
		/*//Image origionalBrowserImage = new Image("http://www.nanofirm.org/scimagorder.com/Pictures/Pixies%20Text.png");//browser.snapshot(sP, nextTextPicture);//new Image("http://www.nanofirm.org/scimagorder.com/Pictures/Pixies%20Text.png");//
			//Image origionalBrowserImage = new Image("http://www.nanofirm.org/scimagorder.com/Pictures/Test.png");//browser.snapshot(sP, nextTextPicture);//new Image("http://www.nanofirm.org/scimagorder.com/Pictures/Pixies%20Text.png");//
			stackPane[0].getChildren().add(browser);

			scene[0] = new Scene(stackPane[0]);
			secondaryStage.setScene(scene[0]);

			secondaryStage.setFullScreen(true);
			secondaryStage.show();

			//boolean encFinished = false;
			//while (encFinished =  false)
				//if ( stateLabel.getText() == "Finish!")//secondaryStage.isShowing() && secondaryStage.isFullScreen() )
				//{*/
		//secondStackPane[0].getChildren().add(secondBrowser);
		Image origionalBrowserImage = secondaryBackupWorkAroundImage;
		//Image origionalBrowserImage = secondBrowser.snapshot(sP, nextTextPicture);		/*sP.setViewport(secondScreen.getBounds());
		secondStackPane[0] = new StackPane();
		//while ( secondBrowser.isVisible() == false )//fdsa
		//try { secondaryThread.wait();
		//} catch (InterruptedException e) {
		//	System.out.println("Interrupted.");
		//}
		secondStackPane[0].getChildren().add(secondBrowser);
		secondScene[0] = secondStackPane[0].getScene();
		secondScene[0] = new Scene(secondStackPane[0]);
		secondaryStage.setFullScreen(secondaryIsFullScreened);
		//while ( secondBrowser.isVisible() && secondaryStage.isShowing() )//fdsa
		//	try {

		//double xSlider = 0; //MUST START OUT AS 0 Or Else Video Won't Produce Or Potentially Scroll At All!
		secondBrowser.autosize();

		//secondBrowser.resize(1080, 1930 );
		System.out.println("Got To Main Listener");
		secondBrowserEngine.getLoadWorker().stateProperty().addListener(
				new ChangeListener() {
					public void changed(ObservableValue observable, Object oldValue, Object newValue) {
						secondaryStage.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>()
						{
							@Override
							public void handle(MouseEvent event) 
							{
								System.exit(0);
							}
						});
						System.out.println("oldValue: " + oldValue);
						System.out.println("newValue: " + newValue);
						secondaryStage.setFullScreen(secondaryIsFullScreened);
						if (newValue == Worker.State.SUCCEEDED) {
							//document finished loading
							System.out.println("Worker State:" + Worker.State.values());
							secondaryStage.setFullScreen(secondaryIsFullScreened);
							System.out.println("Worked Till After Here");
							//sP.setViewport(secondScreen.getBounds());
							//sP.setViewport( new Rectangle2D(-8, -19, 666, 888 ) );
							secondStackPane[0] = new StackPane();
							//while ( secondBrowser.isVisible() == false )//fdsa
							//try { secondaryThread.wait();
							//} catch (InterruptedException e) {
							//	System.out.println("Interrupted.");
							//}
							secondStackPane[0].getChildren().add(secondBrowser);
							secondScene[0] = secondStackPane[0].getScene();
							secondScene[0] = new Scene(secondStackPane[0]);
							secondaryStage.setFullScreen(secondaryIsFullScreened);
							secondaryStage.show();
							System.out.println("Worked Till After 1.5");
							//origionalBrowserImage = secondBrowser.snapshot(sP, nextTextPicture);
							Image currentBrowserImage = origionalBrowserImage;// !!!!! Uncomment To Show Video !!!!!
							System.out.println("Worked Till After 1.6");
							//origionalBrowserImage = secondScene[0].snapshot(nextTextPicture);
							//origionalBrowserImage = secondStackPane[0].getScene().snapshot(bufferPicure);
							secondaryStage.setScene(secondScene[0]);
							System.out.println("Worked Till After 1.7");
							//secondaryStage.setFullScreen(secondaryIsFullScreened);
							System.out.println("Worked Till After 1.8");
							/*try { secondaryThread.sleep(4000);
							} catch (InterruptedException e) {
								System.out.println("Interrupted.");
							}// */
							secondaryStage.show();// !!!!! Uncomment To Show Video !!!!!
							//origionalBrowserImage = secondBrowser.snapshot(sP, bufferPicure);
							System.out.println("Got Stopped Up Show Command In");
							//origionalBrowserImage = secondBrowser.snapshot(sP, bufferPicture);//new Image("http://www.nanofirm.org/scimagorder.com/Pictures/Pixies%20Text.png");
							currentBrowserImage = origionalBrowserImage;// !!!!! Uncomment To Show Video !!!!!
							///TEST
							//secondStackPane[0].getChildren().add(secondBrowser);

							PixelReader origionalpr = origionalBrowserImage.getPixelReader();
							origionalpr = origionalBrowserImage.getPixelReader();//ASDF HERE HERE For Rainbow Browser
							//PixelReader origionalpr = secondBackupWorkAroundImage.getPixelReader();
							//origionalpr = secondScene[0].snapshot(bufferPicure).getPixelReader();//ASDF HERE HERE For Rainbow Browser
							//bufferPicure = new WritableImage( Dim.width, Dim.height );
							//origionalpr = secondStackPane[0].getScene().snapshot(bufferPicure).getPixelReader();
							PixelWriter origionalpw = bufferPicture.getPixelWriter();
							ImageView origionalImageView = new ImageView();
							origionalImageView.setImage(basisImage);//origionalBrowserImage
							//origionalImageView.setImage(origionalBrowserImage); //ASDF FOR RAINBOW BROWSER
							//origionalImageView.setImage(secondBackupWorkAroundImage);



							//secondScene[0].setRoot(secondBrowser);

							//secondStackPane[0].getChildren().add(origionalImageView);
							//secondStackPane[0].getChildren().add(secondBrowser);


							/*File tempFile;
					//WebDriver driver=new FirefoxDriver();

					// Maximize the window
					driver.manage().window().maximize();

					// Pass the url
					driver.get("http://www.pixies.zone/PixiesTest.html");

					// Take screenshot and store as a file format
					File src= ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
					try {// now copy the  screenshot to desired location using copyFile //method
						FileUtils.copyFile(src, new File("C:/TempImage.png"));
					}

					catch (IOException e)
					{
						System.out.println(e.getMessage());

					}// */
							System.out.println("Worked Till After Here 2");
							PixelReader basispr = basisImage.getPixelReader();
							basispr = basisImage.getPixelReader();
							WritableImage writableImage = nextTextPicture; //USE FOR ???
							PixelReader pr = writableImage.getPixelReader();
							PixelWriter pw = writableImage.getPixelWriter();
							ImageView imageView = new ImageView();
							imageView.setImage(writableImage);

							double numberOfScrollFrames = 9999;//Testing 2; Normally 11;

							ColorSlider black = new ColorSlider( new double[]{0,0,0} );

							//ColorSlider color = black;
							Diagnostics diagnostics = new Diagnostics( secondScreen.getBounds() );
							RainbowSoftColor color = new RainbowSoftColor( new double[]{0,0,0,1} );//????????????????????????????
							RainbowPattern2D pattern2D = new RainbowPattern2D( new double[]{0,0,0,1} );
							RainbowSoft2D rainbowSoft2D = new RainbowSoft2D( new double[]{0,0,0,1} );
							TransparencySlider transparencySlider = new TransparencySlider( new double[]{0,0,0,1} );
							RainbowSoftColor rainbowSoftColor = new RainbowSoftColor( new double[]{0,0,0,1} );
							Color tempFXColor = Color.BLACK;

							TransparencySlider redTransparencySlider = new TransparencySlider( new double[]{193,0,0,1} );
							TransparencySlider blueTransparencySlider = new TransparencySlider( new double[]{0,0,192,1} );

							String typeOfDisplay = "FullDisplay";
							Color colorTooSimilarReplacementColor = Color.color( 0., 1., 0., 1. );
							double colorDifference = 164.;
							
							ColorSlider white = new ColorSlider( new double[]{255,255,255} );
							ColorSlider skyblue = new ColorSlider( new double[]{134,206,249} );
							ColorSlider oxylblue = new ColorSlider( new double[]{0,255,255} );
							ColorSlider pink = new ColorSlider( new double[]{255,64,143} );
							ColorSlider blue = new ColorSlider( new double[]{0,0,192} );
							ColorSlider red = new ColorSlider( new double[]{193,0,0} );
							ColorSlider purple = new ColorSlider( new double[]{122,0,178} );
							ColorSlider orange = new ColorSlider( new double[]{255,134,0} );
							ColorSlider green = new ColorSlider( new double[]{0,133,50} );
							ColorSlider yellow = new ColorSlider( new double[]{246,252,15} );
							ColorSlider teal = new ColorSlider( new double[]{3,224,149} );
							ColorSlider bronze = new ColorSlider( new double[]{152,123,46} );
							ColorSlider silver = new ColorSlider( new double[]{193,192,192} );
							ColorSlider gold = new ColorSlider( new double[]{205,191,44} );
							ColorSlider lime = new ColorSlider( new double[]{126,193,33} );
							ColorSlider brown = new ColorSlider( new double[]{131,103,71} );
							ColorSlider neongreen = new ColorSlider( new double[]{0,255,0} );
							ColorSlider oxylblue0FF = new ColorSlider( new double[]{0,255,255} );

							ColorTooSimilar neonGreenCheck = new ColorTooSimilar();

							int transparentNum = (int)(0 * 16777216) + (int)(0 * 65536) + (int)(0 * 256) + 0;
							int oxylBlueNum = (int)(255 * 16777216) + (int)(0 * 65536) + (int)(246 * 256) + 255;
							int oxylBlue0FFNum = (int)(255 * 16777216) + (int)(0 * 65536) + (int)(255 * 256) + 255;
							int skyBlueNum = (int)(255 * 16777216) + (int)(135 * 65536) + (int)(206 * 256) + 250;
							int magentaNum = (int)(255 * 16777216) + (int)(255 * 65536) + (int)(0 * 256) + 255;
							int halfGreyNum = (int)(255 * 16777216) + (int)(127 * 65536) + (int)(127 * 256) + 127;
							int pinkNum = (int)(255 * 16777216) + (int)(255 * 65536) + (int)(64 * 256) + 143;
							int maroonNum = (int)(255 * 16777216) + (int)(167 * 65536) + (int)(0 * 256) + 118;
							int shitBrownNum = (int)(255 * 16777216) + (int)(110 * 65536) + (int)(82 * 256) + 48;
							int simpleBlueNum = (int)(255 * 16777216) + (int)(0 * 65536) + (int)(0 * 256) + 255;
							int neonGreenNum = (int)(255 * 16777216) + (int)(0 * 65536) + (int)(255 * 256) + 0;
							int webBlackNum = (int)(255 * 16777216) + (int)(0 * 65536) + (int)(0 * 256) + 0;
							int whiteNum = (int)(255 * 16777216) + (int)(255 * 65536) + (int)(255 * 256) + 255;

							int redNum = (int)(255 * 16777216) + (int)(193 * 65536) + (int)(0 * 256) + 0;
							int orangeNum = (int)(255 * 16777216) + (int)(255 * 65536) + (int)(134 * 256) + 0;
							int yellowNum = (int)(255 * 16777216) + (int)(246 * 65536) + (int)(252 * 256) + 15;
							int tealNum = (int)(255 * 16777216) + (int)(3 * 65536) + (int)(224 * 256) + 149;
							int greenNum = (int)(255 * 16777216) + (int)(0 * 65536) + (int)(133 * 256) + 50;
							int blueNum = (int)(255 * 16777216) + (int)(0 * 65536) + (int)(0 * 256) + 192;
							int purpleNum = (int)(255 * 16777216) + (int)(122 * 65536) + (int)(0 * 256) + 178;

							int white1Num = (int)(255 * 16777216) + (int)(254 * 65536) + (int)(254 * 256) + 254;
							int white2Num = (int)(255 * 16777216) + (int)(253 * 65536) + (int)(253 * 256) + 253;
							int white3Num = (int)(255 * 16777216) + (int)(252 * 65536) + (int)(252 * 256) + 252;
							int white4Num = (int)(255 * 16777216) + (int)(251 * 65536) + (int)(251 * 256) + 251;
							int blackRedNumArray[] = new int[18];
							for (int blackRedNum = 1; blackRedNum <= 18; blackRedNum++)
								blackRedNumArray[blackRedNum - 1] = (int)(255 * 16777216) + (int)(blackRedNum * 65536) + (int)(0 * 256) + 0;
							int blackBlueNumArray[] = new int[18];
							for (int blackBlueNum = 1; blackBlueNum <= 18; blackBlueNum++)
								blackBlueNumArray[blackBlueNum - 1] = (int)(255 * 16777216) + (int)(0 * 65536) + (int)(0 * 256) + blackBlueNum;
							int blackGreenNumArray[] = new int[4];
							for (int blackGreenNum = 1; blackGreenNum <= 4; blackGreenNum++)
								blackGreenNumArray[blackGreenNum - 1] = (int)(255 * 16777216) + (int)(0 * 65536) + (int)(blackGreenNum * 256) + 0;
							int blackPurpleNumArray[] = new int[4];
							for (int blackPurpleNum = 1; blackPurpleNum <= 4; blackPurpleNum++)
								blackPurpleNumArray[blackPurpleNum - 1] = (int)(255 * 16777216) + (int)(blackPurpleNum * 65536) + (int)(0 * 256) + blackPurpleNum;
							int black6Num = (int)(255 * 16777216) + (int)(6 * 65536) + (int)(6 * 256) + 6;
							int wheelOuterRingNum = (int)(255 * 16777216) + (int)(255 * 65536) + (int)(204 * 256) + 3;
							int wheelMiddleRingNum = (int)(255 * 16777216) + (int)(255 * 65536) + (int)(204 * 256) + 1;
							int wheelInnerRingNum = (int)(255 * 16777216) + (int)(212 * 65536) + (int)(170 * 256) + 1;
							int wheelRodsNum = (int)(255 * 16777216) + (int)(255 * 65536) + (int)(204 * 256) + 2;
							int wheelEndsNum = (int)(255 * 16777216) + (int)(255 * 65536) + (int)(204 * 256) + 4;
							int wheelTipsNum = (int)(255 * 16777216) + (int)(255 * 65536) + (int)(204 * 256) + 5;
							int wheelDiamondsNum = (int)(255 * 16777216) + (int)(255 * 65536) + (int)(204 * 256) + 6;
							int wheelDiamondsArrayNum[] = { whiteNum, redNum, orangeNum, yellowNum, tealNum, greenNum, blueNum, purpleNum };

							int numberOfColorsInTheRainbow = 7;//asdf Always Worry About This!

							Color[] imperialFXcolors = new Color[] {green.ToFXColor(), blue.ToFXColor(), purple.ToFXColor(), blue.ToFXColor(), red.ToFXColor()};
							double[][] imperialColorsNum = {green.rgb, blue.rgb, purple.rgb, purple.rgb, blue.rgb, green.rgb};
							Color[] imperialFXcolorsReverse = new Color[] {red.ToFXColor(), orange.ToFXColor(), gold.ToFXColor(), orange.ToFXColor(), green.ToFXColor()};
							double[][] imperialColorsReverseNum = {red.rgb, orange.rgb, gold.rgb, gold.rgb, orange.rgb, red.rgb};
							Color[] doubleBlack = new Color[] { black.ToFXColor(), black.ToFXColor() };

							//VibrantColors vibrantColors;//DO NOT USE AS UPPER CASE FIRST LETTER CLASS IS THE WAY TO ACCESS THESE STUCTS
							//VibrantColorCombos vibrantColorCombos;//DO NOT USE AS UPPER CASE FIRST LETTER CLASS IS THE WAY TO ACCESS THESE STUCTS
							
							//System.out.println( "imperialFXcolors Brightnesses" + imperialFXcolors[0].getBrightness() + imperialFXcolors[1].getBrightness() + imperialFXcolors[2].getBrightness() + imperialFXcolors[3].getBrightness() + imperialFXcolors[4].getBrightness() + imperialFXcolors[5].getBrightness() );

							//Dimension HalfedDim = new Dimension();
							//HalfedDim.width = Math.round( ( Dim.width + 1 ) / 2 - 1 );
							//HalfedDim.height = Math.round( ( Dim.height + 1 ) / 2 - 1 );
							int x = 0, y = 0, xMinusxSlider = 0, yMinusxSlider = 0, ySlider = 0, yMinusySlider = 0, cyMy = 0,  b = 0, xSliderFactor = 1, fixedOfabcd = 4, numOfabcd = 4, colorIntervalDivisor = 1, aCounter = 0, bCounter = 0, cCounter = 0;//cxMx Corrected xMinusSlider for determining color
							double a = 0, colorIntervalForWholeScreen = Dim.width / ( numberOfColorsInTheRainbow - 1 ), numberOfClockHandsForRainbow = 7, numberOfColorsForOrderOfMagi = 3, numberOfClockHandsForOrderOfMagi = 16, abcd = 0, abc = 0, rCheck = 0, aAngle = 0, bAngle = 0, newx = 0, newy = 0, abc2 = 0, aIncrementAngle = 0, bIncrementAngle = 0, aTan = 0, cxMx = 0, cheapFractalAdjustedxSlider = 0, xSliderBackAndFourth = 0;
							boolean TrispectralRainbow = false, someTargetColorHit = false, greenBlueGreenUsed = false, someTargetColorInTheCenterHit = false, otherBrowserColorHit = false, makePixelTransparent = false, scrollHappened = false;
							if (TrispectralRainbow == true)
								colorIntervalForWholeScreen = colorIntervalForWholeScreen / 3;//For Trispectral Rainbow.
							double colorDisplacement = 0;//For Rainbow Disk And 0 Rainbow Cloc
							double angle1 = 0, angle2 = 0, angle3 = 0, angle4 = 0, aAngleCheck = 0;
							double radius = 0;
							double angle = 0;

							/*int xprDisplacement = -8;
							int yprDisplacement = -19;
							int xpwDisplacement = -7;
							int ypwDisplacement = -18;// */

							double xSlider = 0; //MUST START OUT AS 0 Or Else Video Won't Produce Or Potentially Scroll At All!
							Dimension HalfedDim = new Dimension();
							//HalfedDim.width = Math.round( ( Dim.width + 1 ) / 2 - 1 );
							//HalfedDim.height = Math.round( ( Dim.height + 1 ) / 2 - 1 );
							HalfedDim.width = Math.round( Dim.width / 2 );
							HalfedDim.height = Math.round( Dim.height / 2 );
							//double radialDistance = Math.pow(Math.pow(HalfedDim.width + 1, 2) + Math.pow(HalfedDim.height + 1, 2), 0.5);
							double halfSreenDiagionalLength = Math.pow(Math.pow( HalfedDim.getWidth(), 2) + Math.pow( HalfedDim.getHeight(), 2), 0.5);
							//double radialDistance = Math.pow(Math.pow(HalfedDim.width, 2) + Math.pow(HalfedDim.height, 2), 0.5);//HalfedDim.width + 1 HalfedDim.height + 1
							double fullAngle = Math.PI * halfSreenDiagionalLength;
							//double archimedesZoomFactor = 1;
							//int varGradAdjGradChoiceNum = 0;//Variated = 0, Graduated = 1, Adjusted-Graduated = 2
							
							//double fullAngle = Math.PI * radialDistance;
							double sliderInterval = fullAngle / secondFRateDivisor;// / 10 For Rainbow Spotlight Last Division Determines The Frame Rate
							colorIntervalForWholeScreen = fullAngle / ( numberOfColorsInTheRainbow - 1 );//For Rainbow Clock And Spiral
							///double interval = radialDistance * 2 * Math.PI / 1444;//1444 Instead Of 14 Gets The Frame Rate To Have Contiguous Motion For Rainbow Clock
							//double fullAngle = 2 * Math.PI * radialDistance;//For Rainbow Clock
							//colorIntervalForWholeScreen = fullAngle / ( numberOfColorsInTheRainbow - 1 ) / numberOfClockHands;//For Rainbow Clock
							//for (xSlider = (int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHands / 2; xSlider < 1.5 * ( radialDistance * 2 * Math.PI / numberOfClockHands ); xSlider++)// < For Rainbow Clock, xSlider = (int)Math.round(colorDisplacement); For Rings -144 Use cy And < HalfedDim.height Instead of Dim.height For Circular Rainbow Use Dim.width < For Rainbow Slider And Fractal //Start At -144 For Videos And Pictures
							System.out.println("Got To Main Program Loop. Dim = " + Dim);
							final double chrysanthemumRadius = 60;
							final double chrysanthemumInnerRadius = 9;
							final double chrysanthemumYDisplacement = 25;
							final double chrysanthemumNumberOfPedals = 16;
							double coreVariable = 0, angleVariable = 0, aVariable = 0, radiusVariable = 0, fullCycleVariable = 0, colorDisplacementVariable = 0, colorIntervalVariable = 0, speedIncreaseFactor = numberOfColorsInTheRainbow, speedDecreaseFactor = 1 / numberOfColorsInTheRainbow;
							double radialVariableDistance = 0;//Hypnosis Spiral
							double diskColorInterval = Dim.width / ( numberOfColorsInTheRainbow - 1 );//Rainbow Disk
							double ringColorInterval = diskColorInterval * 0.175979734764;//Rainbow Ring
							double ringcolorDisplacement = HalfedDim.height * (1 - 0.175979734764);
							double fullScrollCycle =  sliderInterval * 11 * 1904;//1904 Scroll Height In Pixels
							/*try ( PrintWriter in = new PrintWriter(secondXSliderFile.getPath() ) )
							{
								try{
									xSlider = Double.parseDouble( in.toString() );
								}catch(NumberFormatException ex){ // handle your exception
									ex.printStackTrace();
								}
								//xSlider = Double.parseDouble( in.toString() );
								in.close();
							}
							catch(IOException ie) { ie.printStackTrace(); }// Important For Browser AutoScroll*/

							SeekableByteChannel videoOut = null;
							try
							{
								videoOut = NIOUtils.writableFileChannel( secondFile.getPath() );
								// for Android use: AndroidSequenceEncoder
								//try {
								BufferedImage bImage = null;
								AWTSequenceEncoder encoder = new AWTSequenceEncoder(videoOut, Rational.R(25, 1));
								//} catch(IOException ie) { ie.printStackTrace(); }
								System.out.println("xSlider: " + xSlider);
								//xSlider = 3301.2077096635903;//FOR TESTING END ANOMOLYS ONLY
								while ( xSlider < fullAngle)//fullScrollCycle / 4000 )// For Scrolling; xSlider < fullScrollCycle / 4000 . For MagiElite: fullAngle / 10)//for (xSlider = 0; xSlider <= 0.175979734764 * cy; xSlider++)
								{//0.175979734764 *
									secondaryStage.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>()
									{
										@Override
										public void handle(MouseEvent event) 
										{
											System.exit(0);
										}
									});
									try { secondaryThread.sleep(4000);
									} catch (InterruptedException e) {
										System.out.println("Interrupted.");
									}


									System.out.println("Worked Till After 4 Second Wait");
									//secondaryStage.setFullScreen(secondaryIsFullScreened); //Important For Full Screening
									//dimension = new Dimension( (int)bounds.getWidth(), (int)bounds.getHeight() );
									//dimension.width = 666;// Important For Full Screened
									//dimension.height = 888;// + 40; // Important For Full Screened Not + 40 Too
									//dimension.width = (int)bounds.getWidth();// Important For Full Screened
									//dimension.height = (int)bounds.getHeight();// + 40;// Important For Full Screened
									//Dim = dimension;// */
									/*if ( secondaryStage.isFullScreen() == false )
									{
										if ( secondaryIsFullScreened != secondaryStage.isFullScreen() )
										{
											secondaryStage.setFullScreen(secondaryIsFullScreened);
											Dim.width = 600;
											Dim.height = 400;
										}
										else 
										{
											Dim.width = (int)secondaryStage.getWidth();
											Dim.height = (int)secondaryStage.getHeight();// + 40;
										}
										sP.setViewport( new Rectangle2D( (double)Dim.width, (double)Dim.height, 0, 0 ) );
										////sP.setViewport( new Rectangle2D(-8, -19, 666, 888 ) );
										//origionalBrowserImage = secondBrowser.snapshot(sP, nextTextPicture);
										//Image origionalBrowserImage = secondScene[(int)(secondFRateDivisor * xSlider/fullAngle)].snapshot(nextTextPicture);
										//origionalBrowserImage = secondScene[(int)(secondFRateDivisor * xSlider/fullAngle)].snapshot(nextTextPicture);
										//origionalBrowserImage = secondStackPane[(int)(secondFRateDivisor * xSlider/fullAngle)].getScene().snapshot(bufferPicture);
										secondaryStage.setScene(secondScene[(int)(secondFRateDivisor * xSlider/fullAngle)]);
										secondaryStage.setFullScreen(secondaryIsFullScreened);
										secondaryStage.show();// *_/

										basispr = basisImage.getPixelReader();

										origionalpr = origionalBrowserImage.getPixelReader();//ASDF HERE HERE For Rainbow Browser
										//origionalpr = secondBackupWorkAroundImage.getPixelReader();
										origionalpr = secondStackPane[(int)(secondFRateDivisor * xSlider/fullAngle)].getScene().snapshot(bufferPicture).getPixelReader();//ASDF HERE HERE For Rainbow Browser
										origionalpw = bufferPicture.getPixelWriter();
										origionalImageView = new ImageView();
										origionalImageView.setImage(origionalBrowserImage);//ASDF HERE HERE For Rainbow Browser
										//origionalImageView.setImage(secondBackupWorkAroundImage);

									}
									else if ( secondaryIsFullScreened != secondaryStage.isFullScreen() )
									{
										secondaryStage.setFullScreen(secondaryIsFullScreened);
										secondaryStage.setWidth(secondScreen.getBounds().getWidth());
										secondaryStage.setHeight(secondScreen.getBounds().getHeight());
										Dim.width = (int)secondaryStage.getWidth();
										Dim.height = (int)secondaryStage.getHeight();// + 40;

										sP.setViewport( new Rectangle2D( (double)Dim.width, (double)Dim.height, 0, 0 ) );
										////sP.setViewport( new Rectangle2D(-8, -19, 666, 888 ) );
										//origionalBrowserImage = secondBrowser.snapshot(sP, nextTextPicture);
										//Image origionalBrowserImage = secondScene[(int)(secondFRateDivisor * xSlider/fullAngle)].snapshot(nextTextPicture);
										//origionalBrowserImage = secondScene[(int)(secondFRateDivisor * xSlider/fullAngle)].snapshot(nextTextPicture);
										//origionalBrowserImage = secondStackPane[(int)(secondFRateDivisor * xSlider/fullAngle)].getScene().snapshot(bufferPicture);
										secondaryStage.setScene(secondScene[(int)(secondFRateDivisor * xSlider/fullAngle)]);
										secondaryStage.setFullScreen(secondaryIsFullScreened);
										secondaryStage.show();// *_/

										basispr = basisImage.getPixelReader();

										origionalpr = origionalBrowserImage.getPixelReader();//ASDF HERE HERE For Rainbow Browser
										//origionalpr = secondBackupWorkAroundImage.getPixelReader();
										origionalpr = secondStackPane[(int)(secondFRateDivisor * xSlider/fullAngle)].getScene().snapshot(bufferPicture).getPixelReader();//ASDF HERE HERE For Rainbow Browser
										origionalpw = bufferPicture.getPixelWriter();
										origionalImageView = new ImageView();
										origionalImageView.setImage(origionalBrowserImage);//ASDF HERE HERE For Rainbow Browser
										//origionalImageView.setImage(secondBackupWorkAroundImage);
									}// */
									secondaryStage.setScene(secondScene[(int)(secondFRateDivisor * xSlider/fullAngle)]);
									//secondaryStage.setFullScreen(secondaryIsFullScreened);
									if ( secondaryIsFullScreened == false )
									{
										secondaryStage.setWidth(666);
										secondaryStage.setHeight(888);
										secondaryStage.setFullScreen(false);
										secondaryStage.show();
									}
									System.out.println("Worked Till After Full Screen Enforcement");

									int lengthOfColorBar = 0;
									y = HalfedDim.height;
									for (x = 0; x < Dim.width; x++)
										if ( basispr.getArgb( x, y ) == blackBlueNumArray[16] )
											lengthOfColorBar++;
									int outerRingRadius = 293, outerRingThickness = 72;//outerRingThickness = 65;
									int middleRingRadius = 88, middleRingThickness = 20;
									int innerRingRadius = 66, innerRingThickness = 18;
									/*boolean ringRadiusFound = false;
									y = HalfedDim.height;
									for (x = 0; x < Dim.width; x++)
										if ( basispr.getArgb( x, y ) == wheelMiddleRingNum )
										{
											if ( ringRadiusFound == false )
											{
												middleRingRadius = HalfedDim.width - x + 1;
												ringRadiusFound = true;
											}
											middleRingThickness++;
										}
									middleRingThickness = middleRingThickness / 2;
									y = HalfedDim.height;
									ringRadiusFound = false;
									for (x = 0; x < Dim.width; x++)
										if ( basispr.getArgb( x, y ) == wheelInnerRingNum )
										{
											if ( ringRadiusFound == false )
											{
												innerRingRadius = HalfedDim.width - x + 1;
												ringRadiusFound = true;
											}
											innerRingThickness++;
										}
									innerRingThickness = innerRingThickness / 2;// */
									//System.out.println("lengthOfColorBar = " + lengthOfColorBar); 
									boolean aColorBarHit = false;
									int maxIndexOfHorizontalColorBars = 17, maxIndexOfVerticalColorBars = 3, colorBarIndex = 0, colorBarCheck = 0, colorBarDistance = 0;									
									boolean aWheelDiamondHit = false;
									int eightColorDiamondsIndex = 0;
									boolean wheelTipsHit = false;
									/*Dim.width = (int)secondaryStage.getWidth();
									Dim.height = (int)secondaryStage.getHeight() + 40;
									Dim = Dim;//*/
									//secondStackPane[(int)(secondFRateDivisor * (xSlider - interval)/fullAngle) + 1].getChildren().add(browser);
									//origionalpr = secondStackPane[(int)(secondFRateDivisor * (xSlider - interval)/fullAngle) + 1].getScene().snapshot(bufferPicure).getPixelReader();
									//Dim = f.getSize();//Dim = f.getContentPane().getSize();
									//HalfedDim.width = Math.round( ( Dim.width + 1 ) / 2 - 1 );
									//HalfedDim.height = Math.round( ( Dim.height + 1 ) / 2 - 1 );
									HalfedDim.width = Math.round( Dim.width / 2 );
									HalfedDim.height = Math.round( Dim.height / 2 );
									halfSreenDiagionalLength = Math.pow(Math.pow( HalfedDim.getWidth(), 2) + Math.pow( HalfedDim.getHeight(), 2), 0.5);
									//radialDistance = Math.pow(Math.pow(HalfedDim.width + 1, 2) + Math.pow(HalfedDim.height + 1, 2), 0.5);//??? + 1
									//archimedesZoomFactor = 1.04 * ( xSlider + 1 );
									rCheck = HalfedDim.height / fixedOfabcd;
									//numOfabcd = (int)Math.ceil(radialDistance / HalfedDim.height);
									//double[] angle = new double[numOfabcd], abcdefg = new double[numOfabcd];
									colorDisplacement = 0;//For Rainbow Disk
									System.out.println("Got To Primary for Statement");
									for (x = 0; x < Dim.width; x++) //Dim.width; x++)//Comment Out Here For Circular Rainbow
									{//Comment Out Here For Circular Rainbow
										for (y = 0; y < Dim.height; y++)
										{// coreVariable // angleVariable // aVariable // radiusVariable // fullCycleVariable // colorDisplacementVariable // colorIntervalVariable XXXXXX // speedIncreaseFactor // speedDecreaseFactor
											someTargetColorHit = true;
											someTargetColorInTheCenterHit = false;
											greenBlueGreenUsed = false;
											otherBrowserColorHit = false;
											makePixelTransparent = false;
											aColorBarHit = false;
											aWheelDiamondHit = false;
											wheelTipsHit = false;
											
											//diagnostics.ColorTooSimilar( x, y, xSlider * secondScreen.getBounds().getWidth() / fullAngle );
											//diagnostics.ColorSlider( x, y, xSlider * secondScreen.getBounds().getWidth() / fullAngle, xSlider / fullAngle, (int)( xSlider / sliderInterval ) );
											//diagnostics.TransparencySlider( x, y, xSlider * secondScreen.getBounds().getWidth() / fullAngle, xSlider / fullAngle, (int)( xSlider / sliderInterval ), 0, 1 );
											diagnostics.RainbowSoftColor( x, y, xSlider, xSlider * secondScreen.getBounds().getWidth() / fullAngle, (int)( xSlider / sliderInterval ), VibrantColorCombos.ImperialFXcolors, VibrantColorCombos.ImperialColorsNum, 0, 1 );
											//4444
											//LocationOfStillMovement & LocationOfColorMovement MUST BE SYNCED!!!!!!!!
											//pattern2D.SimpleCustomColor( secondScreen.getBounds().getWidth() / imperialFXcolors.length, 0., xSlider * secondScreen.getBounds().getWidth() / fullAngle,  x - HalfedDim.width, secondScreen.getBounds().getWidth() / 2., imperialFXcolors );
											
											//pattern2D.SimpleRainbow( secondScreen.getBounds().getWidth(), 0., xSlider * secondScreen.getBounds().getWidth() / fullAngle,  x, secondScreen.getBounds().getWidth() );
											//pattern2D.SimpleRainbow( secondScreen.getBounds().getWidth(), 0., 12. * xSlider * secondScreen.getBounds().getWidth() / fullAngle,  x, secondScreen.getBounds().getWidth() / 6. );
											//pattern2D.SimpleRainbow( secondScreen.getBounds().getWidth() / 3., 0., xSlider * secondScreen.getBounds().getWidth() / fullAngle,  x, secondScreen.getBounds().getWidth() );
											//pattern2D.SimpleRainbow( - secondScreen.getBounds().getWidth(), 0., xSlider * secondScreen.getBounds().getWidth() / fullAngle,  x, - secondScreen.getBounds().getWidth() );
											//pattern2D.SimpleRainbow( - secondScreen.getBounds().getWidth(), 0., xSlider * secondScreen.getBounds().getWidth() / fullAngle,  x, secondScreen.getBounds().getWidth() );
											//pattern2D.SimpleRainbow( secondScreen.getBounds().getWidth(), 0., xSlider * secondScreen.getBounds().getWidth() / fullAngle,  x, - secondScreen.getBounds().getWidth() );
											
											//pattern2D.SimpleRainbow( - secondScreen.getBounds().getWidth(), 0, 12 * xSlider * secondScreen.getBounds().getWidth() / fullAngle, x, secondScreen.getBounds().getWidth() / 6. );
											//pattern2D.SimpleRainbow( - secondScreen.getBounds().getWidth(), 0, 12. * xSlider * secondScreen.getBounds().getWidth() / fullAngle, x, - secondScreen.getBounds().getWidth() / 6. );
											
											//Screen Bounds Not In Alignment Yet Because Not Full Screened
											//pattern2D.RainbowDiskVaryated( secondScreen.getBounds().getHeight() / 4., 0, xSlider * secondScreen.getBounds().getHeight() / fullAngle / 4.,  x - HalfedDim.width, y - HalfedDim.height, secondScreen.getBounds().getHeight() / 4., false );
											//pattern2D.RainbowDiskVaryated( secondScreen.getBounds().getHeight() / 4., 0, xSlider * secondScreen.getBounds().getHeight() / fullAngle / 4.,  x - HalfedDim.width, y - HalfedDim.height, secondScreen.getBounds().getHeight() / 24., false );
											//pattern2D.RainbowDiskVaryated( secondScreen.getBounds().getHeight() / 12., 0, xSlider * secondScreen.getBounds().getHeight() / fullAngle / 4.,  x - HalfedDim.width, y - HalfedDim.height, secondScreen.getBounds().getHeight() / 4., false );
											
											//pattern2D.SimpleRainbow( secondScreen.getBounds().getWidth() / 7, 0, xSlider * secondScreen.getBounds().getHeight() / fullAngle,  x - HalfedDim.width, secondScreen.getBounds().getWidth() / 2 );// - Locaition Flips Rainbow Like Reverse Without Green Being Replaced By Pink
											//BuildMepattern2D.RainbowDiskVaryated( secondScreen.getBounds().getHeight() / 7, 0, xSlider * secondScreen.getBounds().getHeight() / fullAngle / 2,  x - HalfedDim.width, y - HalfedDim.height, secondScreen.getBounds().getHeight() / 2, false );//May Not Be Synced Properly To Show 1 Clock Rotation Must Be Properly Relative Factoring
											//pattern2D.RainbowDiskVaryated( secondScreen.getBounds().getHeight() / 7, 0, xSlider * secondScreen.getBounds().getHeight() / fullAngle / 2,  x - HalfedDim.width, y - HalfedDim.height, secondScreen.getBounds().getHeight() / 2, false );//May Not Be Synced Properly To Show 1 Clock Rotation Must Be Properly Relative Factoring
											//pattern2D.RainbowDiskVaryated( secondScreen.getBounds().getHeight() / 14, 0, xSlider * secondScreen.getBounds().getHeight() / fullAngle / 2 ,  x - HalfedDim.width, y - HalfedDim.height, secondScreen.getBounds().getHeight() / 14, false );//May Not Be Synced Properly To Show 1 Clock Rotation Must Be Properly Relative Factoring
											
											//pattern2D.RainbowDiskVaryated( secondScreen.getBounds().getHeight() / 4., 0, xSlider * secondScreen.getBounds().getHeight() / fullAngle / 4.,  x - HalfedDim.width, y - HalfedDim.height, secondScreen.getBounds().getHeight() / 4., VibrantColorCombos.ImperialFXcolors, false );
											//pattern2D.RainbowDiskVaryated( secondScreen.getBounds().getHeight() / 4., 0, xSlider * secondScreen.getBounds().getHeight() / fullAngle / 4.,  x - HalfedDim.width, y - HalfedDim.height, secondScreen.getBounds().getHeight() / 4., VibrantColorCombos.HalloweenFXcolors, false );
											
											//pattern2D.RainbowClockVaryated( fullAngle / 2., 0, xSlider * fullAngle * 4,  x - HalfedDim.width, y - HalfedDim.height, fullAngle / 2., halfSreenDiagionalLength, false );
											//pattern2D.RainbowClockVaryated( fullAngle / 2., 0, xSlider * fullAngle * 4,  x - HalfedDim.width, y - HalfedDim.height, fullAngle / 2., halfSreenDiagionalLength, false );
											//pattern2D.RainbowClockVaryated( Math.PI / 2., Math.PI * - xSlider / fullAngle + Math.PI, 0, x - HalfedDim.width, y - HalfedDim.height, Math.PI / 2., false );
											//pattern2D.RainbowClockVaryated( Math.PI / 2., Math.PI * - xSlider / fullAngle + Math.PI, - 2. * xSlider / fullAngle, x - HalfedDim.width, y - HalfedDim.height, Math.PI / 2., false );
											
											//pattern2D.RainbowClockVaryated( Math.PI / 2.5, 0, - ( 12. * Math.PI * xSlider / fullAngle ) / 5. + 3 * Math.PI / 15, x - HalfedDim.width, y - HalfedDim.height, Math.PI / 15., false );//MUST BE RADIALLY SYNCED
											//pattern2D.RainbowClockVaryated( Math.PI / 7.5, 0, - ( 4. * Math.PI * xSlider / fullAngle ) / 5. + 7.5 * Math.PI / 7.5, x - HalfedDim.width, y - HalfedDim.height, Math.PI / 2.5, false );
											//pattern2D.RainbowClockVaryated( Math.PI / 2.5, - ( 12. * Math.PI * xSlider / fullAngle ) / 5. + 3 * Math.PI / 15, 0, x - HalfedDim.width, y - HalfedDim.height, Math.PI / 15., false );//MUST BE RADIALLY SYNCED
											//pattern2D.RainbowClockVaryated( Math.PI / 7.5, - ( 4. * Math.PI * xSlider / fullAngle ) / 5. + 7.5 * Math.PI / 7.5, 0, x - HalfedDim.width, y - HalfedDim.height, Math.PI / 2.5, false );
//SYNC Loc RADIALLY LIKEABOVE With LocOColMv//pattern2D.RainbowClockVaryated( Math.PI / 2.5, ( 12. * Math.PI * xSlider / fullAngle ) / 5. + Math.PI, ( 6. * Math.PI * xSlider / fullAngle ) / 5., x - HalfedDim.width, y - HalfedDim.height, Math.PI / 15., false );
											//pattern2D.RainbowClockVaryated( Math.PI / 7.5, ( 4. * Math.PI * xSlider / fullAngle ) / 5. + Math.PI, - ( 3.5 * Math.PI * xSlider / fullAngle ) / 5., x - HalfedDim.width, y - HalfedDim.height, Math.PI / 2.5, false );
											
											//1st Check Over All 36 Functions To Check To Make Sure They Will Acesess The Right Function In The End
											
											//Tests For All SliderFormulates In RainbowPattern2D
											//MovingColors
											//pattern2D.RainbowClockVaryated( Math.PI / 2., 0, Math.PI * ( xSlider / fullAngle ) / 2., x - HalfedDim.width, y - HalfedDim.height, Math.PI / 2., false );//1
											//pattern2D.RainbowClockVaryated( Math.PI / 2.5, 0, 12. * Math.PI * xSlider / fullAngle / 2.5, x - HalfedDim.width, y - HalfedDim.height, Math.PI / 15., false );//2//!!!!!{Potential BUG Caused By Patent Terrorists Here}?LocationOfColorMovement Must Be - For Rainbow Clock To Work Properly As A Natural Consequence Of Things
											//pattern2D.RainbowClockVaryated( Math.PI / 7.5, 0, Math.PI * xSlider / fullAngle / 2.5, x - HalfedDim.width, y - HalfedDim.height, Math.PI / 2.5, false );//3
											//MovingColors Negatives
											//pattern2D.RainbowClockVaryated( - Math.PI / 2., 0, Math.PI * ( xSlider / fullAngle ) / 2., x - HalfedDim.width, y - HalfedDim.height, - Math.PI / 2., false );//4//Remember 2 * 180 degrees, 2 * Math.PI So Half The Divisor And Add Math.PI To Location To Make Into Clock Make xSlider -xSlider To Reverse Spinning Direction
											//pattern2D.RainbowClockVaryated( - Math.PI / 2., 0, Math.PI * ( xSlider / fullAngle ) / 2., x - HalfedDim.width, y - HalfedDim.height, Math.PI / 2., false );//5
											//pattern2D.RainbowClockVaryated( Math.PI / 2., 0, Math.PI * ( xSlider / fullAngle ) / 2., x - HalfedDim.width, y - HalfedDim.height, - Math.PI / 2., false );//6
											//pattern2D.RainbowClockVaryated( - Math.PI / 2.5, 0, 12. * Math.PI * ( xSlider / fullAngle ) / 2.5, x - HalfedDim.width, y - HalfedDim.height, - Math.PI / 15., false );//7
											//pattern2D.RainbowClockVaryated( - Math.PI / 2.5, 0, 12. * Math.PI * ( xSlider / fullAngle ) / 2.5, x - HalfedDim.width, y - HalfedDim.height, Math.PI / 15., false );//8
											//pattern2D.RainbowClockVaryated( Math.PI / 2.5, 0, 12. * Math.PI * ( xSlider / fullAngle ) / 2.5, x - HalfedDim.width, y - HalfedDim.height, - Math.PI / 15., false );//9
											//pattern2D.RainbowClockVaryated( - Math.PI / 7.5, 0, Math.PI * ( xSlider / fullAngle ) / 2.5,  x - HalfedDim.width, y - HalfedDim.height, - Math.PI / 2.5, false );//10
											//pattern2D.RainbowClockVaryated( - Math.PI / 7.5, 0, Math.PI * ( xSlider / fullAngle ) / 2.5,  x - HalfedDim.width, y - HalfedDim.height, Math.PI / 2.5, false );//11
											//pattern2D.RainbowClockVaryated( Math.PI / 7.5, 0, Math.PI * ( xSlider / fullAngle ) / 2.5, x - HalfedDim.width, y - HalfedDim.height, - Math.PI / 2.5, false );//12
											//TransitionSlider
											//pattern2D.RainbowClockVaryated( Math.PI / 2., Math.PI * ( xSlider / fullAngle ) / 2., 0, x - HalfedDim.width, y - HalfedDim.height, Math.PI / 2., false );//13 //Does Something Slightly Different Than Expected That May Become Something New But NM I Think It Is Doing What Is Supposed To Do But Save Things When You Get It Back To This Or This When You Get This To That.
											//pattern2D.RainbowClockVaryated( Math.PI / 2.5, 12. * Math.PI * xSlider / fullAngle / 2.5, 0, x - HalfedDim.width, y - HalfedDim.height, Math.PI / 15., false );//14
											//pattern2D.RainbowClockVaryated( Math.PI / 7.5, Math.PI * xSlider / fullAngle / 2.5 + 7.5 * Math.PI / 7.5, 0, x - HalfedDim.width, y - HalfedDim.height, Math.PI / 2.5, false );//15
											
											//After Doing 3 Main DoubleSliders Stop Here And Wait For Diagnostics [9 ++] 3X[-~-] To Test!!
											
											//TransitionSlider Negatives
											//pattern2D.RainbowClockVaryated( - Math.PI / 2., Math.PI * ( xSlider / fullAngle ) / 2, 0, x - HalfedDim.width, y - HalfedDim.height, - Math.PI / 2., false );//16
											//pattern2D.RainbowClockVaryated( - Math.PI / 2., Math.PI * ( xSlider / fullAngle ) / 2, 0, x - HalfedDim.width, y - HalfedDim.height, Math.PI / 2., false );//17
											//pattern2D.RainbowClockVaryated( Math.PI / 2., Math.PI * ( xSlider / fullAngle ) / 2, 0, x - HalfedDim.width, y - HalfedDim.height, - Math.PI / 2., false );//18
											//pattern2D.RainbowClockVaryated( - Math.PI / 2.5, 12. * Math.PI * ( xSlider / fullAngle ) / 2.5, 0, x - HalfedDim.width, y - HalfedDim.height, - Math.PI / 15., false );//19
											//pattern2D.RainbowClockVaryated( - Math.PI / 2.5, 12. * Math.PI * ( xSlider / fullAngle ) / 2.5, 0, x - HalfedDim.width, y - HalfedDim.height, Math.PI / 15., false );//20
											//pattern2D.RainbowClockVaryated( Math.PI / 2.5, 12. * Math.PI * ( xSlider / fullAngle ) / 2.5, 0, x - HalfedDim.width, y - HalfedDim.height, - Math.PI / 15., false );//21
											//pattern2D.RainbowClockVaryated( - Math.PI / 7.5, Math.PI * ( xSlider / fullAngle ) / 2.5, 0,  x - HalfedDim.width, y - HalfedDim.height, - Math.PI / 2.5, false );//22
											//pattern2D.RainbowClockVaryated( - Math.PI / 7.5, Math.PI * ( xSlider / fullAngle ) / 2.5, 0,  x - HalfedDim.width, y - HalfedDim.height, Math.PI / 2.5., false );//23
											//pattern2D.RainbowClockVaryated( Math.PI / 7.5, Math.PI * ( xSlider / fullAngle ) / 2.5, 0, x - HalfedDim.width, y - HalfedDim.height, - Math.PI / 2.5, false );//24
											//DoubleSlider
											//pattern2D.RainbowClockVaryated( Math.PI / 2., Math.PI * ( xSlider / fullAngle ) / 2., - Math.PI * ( - xSlider / fullAngle ) / 2., x - HalfedDim.width, y - HalfedDim.height, Math.PI / 2., false );//25 //Save Any Changes To Under Functions To Preserve These Beauties
											//pattern2D.RainbowClockVaryated( Math.PI / 2.5, - 6. * Math.PI * xSlider / fullAngle / 5., ( 12. * Math.PI * xSlider / fullAngle ) / 5., x - HalfedDim.width, y - HalfedDim.height, Math.PI / 15., false );//26
											//pattern2D.RainbowClockVaryated( Math.PI / 7.5, 3. * Math.PI * xSlider / fullAngle / 5., ( 4. * Math.PI * xSlider / fullAngle ) / 5., x - HalfedDim.width, y - HalfedDim.height, Math.PI / 2.5, false );//27
											//DoubleSlider Negatives
											//pattern2D.RainbowClockVaryated( - Math.PI / 2., Math.PI * ( xSlider / fullAngle ) / 2., - Math.PI * ( - xSlider / fullAngle ) / 2., x - HalfedDim.width, y - HalfedDim.height, - Math.PI / 2., false );//28
											//pattern2D.RainbowClockVaryated( - Math.PI / 2., Math.PI * ( xSlider / fullAngle ) / 2., - Math.PI * ( - xSlider / fullAngle ) / 2., x - HalfedDim.width, y - HalfedDim.height, Math.PI / 2., false );//29
											//pattern2D.RainbowClockVaryated( Math.PI / 2., Math.PI * ( xSlider / fullAngle ) / 2., - Math.PI * ( - xSlider / fullAngle ) / 2., x - HalfedDim.width, y - HalfedDim.height, - Math.PI / 2., false );//30
											//pattern2D.RainbowClockVaryated( - Math.PI / 2.5, - 6. * Math.PI * xSlider / fullAngle / 5., ( 12. * Math.PI * xSlider / fullAngle ) / 5., x - HalfedDim.width, y - HalfedDim.height, - Math.PI / 15., false );//31
											//pattern2D.RainbowClockVaryated( - Math.PI / 2.5, - 6. * Math.PI * xSlider / fullAngle / 5., ( 12. * Math.PI * xSlider / fullAngle ) / 5., x - HalfedDim.width, y - HalfedDim.height, Math.PI / 15., false );//32
											//pattern2D.RainbowClockVaryated( Math.PI / 2.5, - 6. * Math.PI * xSlider / fullAngle / 5., ( 12. * Math.PI * xSlider / fullAngle ) / 5., x - HalfedDim.width, y - HalfedDim.height, - Math.PI / 15., false );//33
											//pattern2D.RainbowClockVaryated( - Math.PI / 7.5, 3. * Math.PI * xSlider / fullAngle / 5., ( 4. * Math.PI * xSlider / fullAngle ) / 5., x - HalfedDim.width, y - HalfedDim.height, - Math.PI / 2.5, false );//34
											//pattern2D.RainbowClockVaryated( - Math.PI / 7.5, 3. * Math.PI * xSlider / fullAngle / 5., ( 4. * Math.PI * xSlider / fullAngle ) / 5., x - HalfedDim.width, y - HalfedDim.height, Math.PI / 2.5., false );//35
											//pattern2D.RainbowClockVaryated( Math.PI / 7.5, 3. * Math.PI * xSlider / fullAngle / 5., ( 4. * Math.PI * xSlider / fullAngle ) / 5., x - HalfedDim.width, y - HalfedDim.height, - Math.PI / 2.5, false );//36
											
											//pattern2D.RainbowSpiralVaryated( fullAngle, 0, xSlider, ( x - HalfedDim.width ) / 3., ( y - HalfedDim.height ) / 3., fullAngle, 24.6, 1., halfSreenDiagionalLength, false );
											//pattern2D.RainbowSpiralVaryated( fullAngle, 0, xSlider, ( x - HalfedDim.width ) / 3., ( y - HalfedDim.height ) / 3., fullAngle, 24.6, 1., halfSreenDiagionalLength, false );
											//pattern2D.RainbowSpiralVaryated( fullAngle, 0, xSlider, ( x - HalfedDim.width ) / 3., ( y - HalfedDim.height ) / 3., fullAngle, 24.6, 1., halfSreenDiagionalLength, false )
											
											//BAD pattern2D.RainbowClockVaryated( 90, 0, - xSlider * 360 / fullAngle,  x - HalfedDim.width, y - HalfedDim.height, 90, 3, 180, false );//BAD
											//pattern2D.RainbowSpiralVaryated( fullAngle, 0, xSlider, ( x - HalfedDim.width ) / 3., ( y - HalfedDim.height ) / 3., fullAngle, 24.6, 1, halfSreenDiagionalLength, false );//For Proper Rainbow Hypnosis Spiral
											//pattern2D.RainbowSpiralVaryated( fullAngle, 0, xSlider, ( x - HalfedDim.width ) / 10., ( y - HalfedDim.height ) / 10., fullAngle, 144, 10, halfSreenDiagionalLength, false );//For Proper Rainbow Rainbow Shrunken
											//pattern2D.RainbowSpiralVaryated( fullAngle * 6, 0, xSlider * 6, ( x - HalfedDim.width ) / 6., ( y - HalfedDim.height ) / 6., fullAngle, 88.8, 4, halfSreenDiagionalLength, false );//For Segment View
											//pattern2D.RainbowSpiralVaryated( fullAngle, 0, xSlider * 3, ( x - HalfedDim.width ) / 6., ( y - HalfedDim.height ) / 6., fullAngle * 3, 66.6, 3, halfSreenDiagionalLength, false );//For View Of More Length Than 1 Segment, Values Must Be Mulitples Of Eachother Somehow 3 In This Instance
											//pattern2D.RainbowSpiralVaryated( fullAngle, 0, xSlider, ( x - HalfedDim.width ) / 1., ( y - HalfedDim.height ) / 1., fullAngle, 999, 1680, halfSreenDiagionalLength, false );//For Proper Rainbow PsychaHypnotic
											//pattern2D.RainbowSpiralVaryated( fullAngle, 0, xSlider, ( x - HalfedDim.width ) / 10., ( y - HalfedDim.height ) / 10., fullAngle, 999, 1680, halfSreenDiagionalLength, false );//For Strange Rainbow PsychaHypnotic
											//System.out.println("x: " + x +" y: " + y + " xSlider: " + xSlider);
											//pattern2D.RainbowSpiralVaryated( fullAngle, 0, xSlider / Math.pow ( 1.003, xSlider ), ( x - HalfedDim.width ) / Math.pow( 1.004, xSlider ), ( y - HalfedDim.height ) / Math.pow( 1.004, xSlider ), fullAngle, 999, 1680, halfSreenDiagionalLength, false );//For Proper Rainbow PsychaHypnotic //Unknown Anomaly Like Shrunken Tangent Determining Disk Being Scanned By My Cybertron Steel 9600 Computer And Shows Atoms That Cannot Become More Resolute At The Present Time Or Ever!?
											/*cheapFractalAdjustedxSlider = xSlider * 480 / fullAngle;
											if ( cheapFractalAdjustedxSlider < 240 )//For Fractal
												xSliderBackAndFourth = cheapFractalAdjustedxSlider;//For Fractal
											else//For Fractal
												xSliderBackAndFourth = 480 - cheapFractalAdjustedxSlider;// */
											//System.out.println("x: " + x +" y: " + y + " cheapFractalAdjustedxSlider: " + cheapFractalAdjustedxSlider);
											//pattern2D.RainbowCheapFractalVaryated( secondScreen.getBounds().getWidth(), 0, xSliderBackAndFourth,  x, y - HalfedDim.height, secondScreen.getBounds().getWidth(), secondScreen.getBounds().getWidth(), false );//Good Vibrant Version
											//pattern2D.RainbowCheapFractalVaryated( secondScreen.getBounds().getWidth(), 0, xSliderBackAndFourth,  x, y - HalfedDim.height, secondScreen.getBounds().getWidth() / 6, secondScreen.getBounds().getWidth(), false );//Rainbow Segment Version
											//pattern2D.RainbowCheapFractalVaryated( secondScreen.getBounds().getWidth() / 3, 0, xSliderBackAndFourth,  x, y - HalfedDim.height, secondScreen.getBounds().getWidth(), secondScreen.getBounds().getWidth(), false );//Rainbow With Even Ends Of 1 Color
											//pw.setColor( x, y, diagnostics.ToFXColor() );
											//System.out.println("x: " + x +" y: " + y);
											//rainbowSoft2D.Buddhism( fullAngle, 0., xSlider, sliderInterval, (int)x, (int)y, fullAngle, lengthOfColorBar, 24.6, 1., 1.14, halfSreenDiagionalLength, false, 1., 2147483647, 1., 1., false, basispr, origionalpr, Dim, typeOfDisplay, colorTooSimilarReplacementColor, colorDifference );
											pw.setColor( x, y, diagnostics.ToFXColor() );
											//pw.setColor( x, y, basispr.getColor( x, y ) );
											//pw.setColor( x, y, pattern2D.ToFXColor() );
											//pw.setColor( x, y, rainbowSoft2D.ToFXColor() );
										}
									}
									imageView.setImage(writableImage);
									
									secondStackPane[(int)(secondFRateDivisor * xSlider/fullAngle) + 1] = new StackPane();
									System.out.println("(int)(secondFRateDivisor * xSlider/fullAngle) + 1 = " + (int)(secondFRateDivisor * xSlider/fullAngle) + 1);
									//secondStackPane[(int)(secondFRateDivisor * xSlider/fullAngle) + 1].getChildren().add(browser);
									//secondStackPane[(int)(secondFRateDivisor * xSlider/fullAngle) + 1].getChildren().remove(0);
									secondStackPane[(int)(secondFRateDivisor * xSlider/fullAngle) + 1].getChildren().add(imageView);
									//End Of xSlider Loop For .3db Video Production .3da Should Be For Abstract 3-D Video Compression .3dc Should For Degraded 3-D Video Compression .3dm Should Be For Standard 3D Videos
									//.3dv Should Be For 3-D Virtual Environment Integration And Interoperability With 2-D Pictures And Video And Interactive Audio Management.
									secondScene[(int)(secondFRateDivisor * xSlider/fullAngle) + 1] = new Scene(secondStackPane[(int)(secondFRateDivisor * xSlider/fullAngle) + 1]);//Each A 3D Image
									secondStackPane[(int)(secondFRateDivisor * xSlider/fullAngle) + 1].getScene().snapshot(bufferPicture);
									currentBrowserImage = secondStackPane[(int)(secondFRateDivisor * xSlider/fullAngle) + 1].getScene().snapshot(bufferPicture);// !!!!! Uncomment To Show Video !!!!!
									//secondaryStage.setFullScreen(secondaryIsFullScreened);
									//secondaryStage.show();// !!!!! Uncomment To Show Video !!!!!

									secondaryStage.setScene(secondScene[(int)(secondFRateDivisor * xSlider/fullAngle) + 1]);

									System.out.println(Dim);

									//secondaryStage.setFullScreen(secondaryIsFullScreened);// ASDF !!!! HERE ! Important For Full Screened
									secondaryStage.show(); // !!!!! Uncomment To Show Video !!!!!
									//secondaryStage.setFullScreen(secondaryIsFullScreened);// Important For Full Screened
									bImage = SwingFXUtils.fromFXImage(secondScene[(int)(secondFRateDivisor * xSlider/fullAngle) + 1].snapshot( writableImage ), bImage );

									if ( xSlider < 1 && xSlider > -1 )//(int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHandsForRainbow / 2)
									{
										try {
											File outputFile = new File("C:/TestImage00.png");
											ImageIO.write(bImage, "png", outputFile);
										} catch (IOException e) {
											throw new RuntimeException(e);
										}
									}
									else
										if ( xSlider > 142 && xSlider <= 143 )//(int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHandsForRainbow / 2)
										{
											try {
												File outputFile = new File("C:/TestImage01.png");
												ImageIO.write(bImage, "png", outputFile);
											} catch (IOException e) {
												throw new RuntimeException(e);
											}
										}
										else
											if ( xSlider > 285 && xSlider <= 286 )//(int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHandsForRainbow / 2)
											{
												try {
													File outputFile = new File("C:/TestImage02.png");
													ImageIO.write(bImage, "png", outputFile);
												} catch (IOException e) {
													throw new RuntimeException(e);
												}
											}
											else
												if ( xSlider > 489 && xSlider <= 490 )//(int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHandsForRainbow / 2)
												{//428 && xSlider <= 429
													try {
														File outputFile = new File("C:/TestImage03.png");
														ImageIO.write(bImage, "png", outputFile);
													} catch (IOException e) {
														throw new RuntimeException(e);
													}
												}
												else
													if ( xSlider > 571 && xSlider <= 572 )//(int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHandsForRainbow / 2)
													{
														try {
															File outputFile = new File("C:/TestImage04.png");
															ImageIO.write(bImage, "png", outputFile);
														} catch (IOException e) {
															throw new RuntimeException(e);
														}
													}
													else
														if ( xSlider > 714 && xSlider <= 715 )//(int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHandsForRainbow / 2)
														{
															try {
																File outputFile = new File("C:/TestImage05.png");
																ImageIO.write(bImage, "png", outputFile);
															} catch (IOException e) {
																throw new RuntimeException(e);
															}
														}
														else
															if ( xSlider > 857 && xSlider <= 858 )//(int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHandsForRainbow / 2)
															{
																try {
																	File outputFile = new File("C:/TestImage06.png");
																	ImageIO.write(bImage, "png", outputFile);
																} catch (IOException e) {
																	throw new RuntimeException(e);
																}
															}
															else
																if ( xSlider > 1000 && xSlider <= 1001 )//(int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHandsForRainbow / 2)
																{
																	try {
																		File outputFile = new File("C:/TestImage07.png");
																		ImageIO.write(bImage, "png", outputFile);
																	} catch (IOException e) {
																		throw new RuntimeException(e);
																	}
																}
																else
																	if ( xSlider > 1143 && xSlider <= 1144 )//(int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHandsForRainbow / 2)
																	{
																		try {
																			File outputFile = new File("C:/TestImage08.png");
																			ImageIO.write(bImage, "png", outputFile);
																		} catch (IOException e) {
																			throw new RuntimeException(e);
																		}
																	}
																	else
																		if ( xSlider > 1286 && xSlider <= 1287 )//(int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHandsForRainbow / 2)
																		{
																			try {
																				File outputFile = new File("C:/TestImage09.png");
																				ImageIO.write(bImage, "png", outputFile);
																			} catch (IOException e) {
																				throw new RuntimeException(e);
																			}
																		}
																		else
																			if ( xSlider > 1429 && xSlider <= 1430 )//(int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHandsForRainbow / 2)
																			{
																				try {
																					File outputFile = new File("C:/TestImage10.png");
																					ImageIO.write(bImage, "png", outputFile);
																				} catch (IOException e) {
																					throw new RuntimeException(e);
																				}
																			}
																			else
																				if ( xSlider > 1572 && xSlider <= 1573 )//(int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHandsForRainbow / 2)
																				{
																					try {
																						File outputFile = new File("C:/TestImage11.png");
																						ImageIO.write(bImage, "png", outputFile);
																					} catch (IOException e) {
																						throw new RuntimeException(e);
																					}
																				}
																				else
																					if ( xSlider > 1714 && xSlider <= 1715 )//(int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHandsForRainbow / 2)
																					{
																						try {
																							File outputFile = new File("C:/TestImage12.png");
																							ImageIO.write(bImage, "png", outputFile);
																						} catch (IOException e) {
																							throw new RuntimeException(e);
																						}
																					}
																					else
																						if ( xSlider > 1857 && xSlider <= 1858 )//(int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHandsForRainbow / 2)
																						{
																							try {
																								File outputFile = new File("C:/TestImage13.png");
																								ImageIO.write(bImage, "png", outputFile);
																							} catch (IOException e) {
																								throw new RuntimeException(e);
																							}
																						}
																						else
																							if ( xSlider > 2000 && xSlider <= 2001 )//(int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHandsForRainbow / 2)
																							{
																								try {
																									File outputFile = new File("C:/TestImage14.png");
																									ImageIO.write(bImage, "png", outputFile);
																								} catch (IOException e) {
																									throw new RuntimeException(e);
																								}
																							}
																							else
																								if ( xSlider > 2143 && xSlider <= 2144 )//(int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHandsForRainbow / 2)
																								{
																									try {
																										File outputFile = new File("C:/TestImage15.png");
																										ImageIO.write(bImage, "png", outputFile);
																									} catch (IOException e) {
																										throw new RuntimeException(e);
																									}
																								}
																								else
																									if ( xSlider > 2286 && xSlider <= 2287 )//(int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHandsForRainbow / 2)
																									{
																										try {
																											File outputFile = new File("C:/TestImage16.png");
																											ImageIO.write(bImage, "png", outputFile);
																										} catch (IOException e) {
																											throw new RuntimeException(e);
																										}
																									}
																									else
																										if ( xSlider > 2429 && xSlider <= 2430 )//(int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHandsForRainbow / 2)
																										{
																											try {
																												File outputFile = new File("C:/TestImage17.png");
																												ImageIO.write(bImage, "png", outputFile);
																											} catch (IOException e) {
																												throw new RuntimeException(e);
																											}
																										}
																										else
																											if ( xSlider > 2572 && xSlider <= 2573 )//(int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHandsForRainbow / 2)
																											{
																												try {
																													File outputFile = new File("C:/TestImage18.png");
																													ImageIO.write(bImage, "png", outputFile);
																												} catch (IOException e) {
																													throw new RuntimeException(e);
																												}
																											}
																											else
																												if ( xSlider > 2715 && xSlider <= 2716 )//(int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHandsForRainbow / 2)
																												{
																													try {
																														File outputFile = new File("C:/TestImage19.png");
																														ImageIO.write(bImage, "png", outputFile);
																													} catch (IOException e) {
																														throw new RuntimeException(e);
																													}
																												}
																												else
																													if ( xSlider > 2858 && xSlider <= 2859 )//(int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHandsForRainbow / 2)
																													{
																														try {
																															File outputFile = new File("C:/TestImage20.png");
																															ImageIO.write(bImage, "png", outputFile);
																														} catch (IOException e) {
																															throw new RuntimeException(e);
																														}
																													}
																													else
																														if ( xSlider > 3001 && xSlider <= 3002 )//(int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHandsForRainbow / 2)
																														{
																															try {
																																File outputFile = new File("C:/TestImage21.png");
																																ImageIO.write(bImage, "png", outputFile);
																															} catch (IOException e) {
																																throw new RuntimeException(e);
																															}
																														}
																														else
																															if ( xSlider > 3144 && xSlider <= 3145 )//(int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHandsForRainbow / 2)
																															{
																																try {
																																	File outputFile = new File("C:/TestImage22.png");
																																	ImageIO.write(bImage, "png", outputFile);
																																} catch (IOException e) {
																																	throw new RuntimeException(e);
																																}
																															}
																															else
																																if ( xSlider > 3287 && xSlider <= 3288 )//(int)Math.round(colorDisplacement) + radialDistance * 2 * Math.PI / numberOfClockHandsForRainbow / 2)
																																{
																																	try {
																																		File outputFile = new File("C:/TestImage23.png");
																																		ImageIO.write(bImage, "png", outputFile);
																																	} catch (IOException e) {
																																		throw new RuntimeException(e);
																																	}
																																}// */

									// Generate the image, for Android use Bitmap
									//BufferedImage bImage = SwingFXUtils.fromFXImage(secondScene[(int)(secondFRateDivisor * xSlider/fullAngle) + 1].snapshot(null), null);
									// Encode the image OLD: try {
									try {
										System.out.println( "bImage Height: " + bImage.getHeight() );
										encoder.encodeImage( bImage );
										//encoder.encodeImage( bImage.getSubimage( 0, 0, 666, 888 ) );
									}
									catch(IOException ie) { ie.printStackTrace(); }
									System.out.println("Finished Encoding Frame: " + (int)Math.round( (secondFRateDivisor * xSlider/fullAngle) + 1 ) );

									/*try {
									secondEnc.encodeImage( SwingFXUtils.fromFXImage(secondScene[(int)(secondFRateDivisor * xSlider/fullAngle) + 1].snapshot(null), null ) ); }
								catch(IOException ie) { ie.printStackTrace(); }//*/

									//enc.encodeImage( SwingFXUtils.fromFXImage( imageView.getImage(), null ) );

									//Save JavaScript With JavaScript Scroll Changes
									/*try ( PrintWriter out = new PrintWriter(secondJavaScriptFile.getPath() ) )
								{
									out.println("Is Writing");
									out.close();
								}
								catch(IOException ie) { ie.printStackTrace(); }// */

									if ( xSlider != 0 && xSlider / ( sliderInterval * numberOfScrollFrames ) - Math.floor( xSlider / ( sliderInterval * numberOfScrollFrames ) ) < .0001)//interval * 11->Twice + (int)(xSlider / ( interval * 11 )) + " );\r\n" + 
									{
										try ( PrintWriter printWriterOut = new PrintWriter(secondXSliderFile.getPath() ) )
										{
											printWriterOut.println("+" + xSlider + "d");
											printWriterOut.close();
										}
										catch(IOException ie) { ie.printStackTrace(); }// */
										try ( PrintWriter printWriterOut = new PrintWriter(secondJavaScriptFile.getPath() ) )
										{
											printWriterOut.println("function scrollContinuously( timeInterval )\r\n" + 
													"{\r\n" + 
													"	timeInterval = 444;\r\n" + 
													"	window.setInterval( scrollWin, timeInterval );\r\n" + 
													"}\r\n" + 
													"function scrollWin()\r\n" + 
													"{\r\n" + 
													"    window.scrollBy( 0, 100 )\\r\\n" +
													"}");
											printWriterOut.close();
										}
										catch(IOException ie) { ie.printStackTrace(); }// */
										scrollHappened = true;
									}
									if (scrollHappened)
									{
										scrollHappened = false;
										//secondBrowserEngine.executeScript(script);
										secondBrowserEngine.load( "http://www.pixies.zone/PixiesTest%20-%20Copy%20(3).html" );
										secondBrowserEngine.reload();
										return;
									}//System.out.println(secondJavaScriptFile.toString());
									//secondBrowser.getEngine().load("file:///C:/Users/AllAV/Desktop/FWA%20Website/pixies.zone/PixiesTest%20-%20Copy%20(2).html");

									//fullScreened = secondaryStage.isFullScreen();

									/*secondScene[(int)(secondFRateDivisor * xSlider/fullAngle) + 1].setOnKeyReleased(new EventHandler<KeyEvent>()
								{
									@Override
									public void handle(KeyEvent event)
									{
										if ( event.isAltDown() == true)
										{
											switch (event.getCode())
											{
											case ENTER: secondaryStage.setFullScreen(!secondaryStage.isFullScreen()); break;
											}
										}
									}
								});// */
									System.out.println("xSlider: " + xSlider);
									xSlider = xSlider + sliderInterval;
									//System.out.println(Dim);

									//}
									//Thread.sleep(2000);}
									//catch (Exception ex) {ex.printStackTrace();}
								}
								System.out.println("Main Program Loop Over");
								// Finalize the encoding, i.e. clear the buffers, write the header, etc.
								try {
									encoder.finish();
								}
								catch(IOException ie) { ie.printStackTrace(); }
							}
							catch(IOException ie) { ie.printStackTrace(); }
							finally {
								NIOUtils.closeQuietly(videoOut);
							}
							System.exit(0);
							//return;
						}
						//return;
					}
				}
				);

		/*synchronized ( secondaryThread )
						{

							System.out.println("Before Wait");
							secondaryThread.wait(10000);
							System.out.println("Past Wait");
						}//secondaryThread.wait(1000);
			} catch (InterruptedException ex) {
				System.err.println("An InterruptedException was caught: " + ex.getMessage());
				ex.printStackTrace();
			}*/
		//secondaryStage.show();
		//origionalBrowserImage = secondBrowser.snapshot(sP, nextTextPicture);
		//Image origionalBrowserImage = secondBrowser.snapshot(sP, nextTextPicture);
		//nextTextPicture = secondBrowser.snapshot(sP, nextTextPicture);
		//Image origionalBrowserImage = secondScene[0].snapshot(nextTextPicture);
		/*origionalBrowserImage = secondScene[0].snapshot(nextTextPicture);
		origionalBrowserImage = secondStackPane[0].getScene().snapshot(bufferPicure);
		secondaryStage.setScene(secondScene[0]);
		secondaryStage.setFullScreen(true);
		try { secondaryThread.sleep(4000);
		} catch (InterruptedException e) {
			System.out.println("Interrupted.");
		}
		secondaryStage.show();// */
		/*secondScene[(int)(secondFRateDivisor * xSlider/fullAngle)].setOnKeyReleased(new EventHandler<KeyEvent>()
		{
			@Override
			public void handle(KeyEvent event)
			{
				if ( event.isAltDown() == true)
				{
					switch (event.getCode())
					{
					case ENTER: secondaryStage.setFullScreen(!secondaryStage.isFullScreen()); break;
					}
				}
			}
		});//*/

		//VBox root = new VBox();
		//root.getChildren().addAll(addressBar, goButton, stateLabel, progressBar, browser);
		//secondScene[0] = new Scene(secondStackPane[0]);
		//secondaryStage.setScene(secondScene[0]);



		//secondaryStage.setFullScreen(true);
		//secondaryStage.show();

		//WritableImage nextTextPicture = new WritableImage( Dim.width, Dim.height );
		//Image origionalBrowserImage = new Image("http://www.nanofirm.org/scimagorder.com/Pictures/Pixies%20Text.png");//browser.snapshot(sP, nextTextPicture);//new Image("http://www.nanofirm.org/scimagorder.com/Pictures/Pixies%20Text.png");//
		//Image origionalBrowserImage = new Image("http://www.nanofirm.org/scimagorder.com/Pictures/Test.png");//browser.snapshot(sP, nextTextPicture);//new Image("http://www.nanofirm.org/scimagorder.com/Pictures/Pixies%20Text.png");//
		//secondStackPane[0].getChildren().add(browser);

		//secondScene[0] = new Scene(secondStackPane[0]);
		//secondaryStage.setScene(secondScene[0]);

		//secondaryStage.setFullScreen(true);
		//secondaryStage.show();
		//JUST THIS DISPLAYS BROWSER!!!!!






		//nextTextPicture = secondScene[0].snapshot(null);

		//Image origionalBrowserImage = secondScene[0].snapshot(null);//browser.snapshot(sP, nextTextPicture);
		//Image origionalBrowserImage = new Image("http://www.nanofirm.org/scimagorder.com/Pictures/FatLevels.png");

		///TEST


		/*try { secondEnc.finish(); }
		catch(IOException ie) { ie.printStackTrace(); }//*/

		//encFinished = true;
		//}
		/*webEngine.getLoadWorker().stateProperty().addListener(
	        new ChangeListener<State>() {
	            public void changed(ObservableValue ov, State oldState, State newState) {
	                if (newState == State.SUCCEEDED) {
	                    secondaryStage.setTitle(webEngine.getLocation());
	                }
	            }
	        });*/
		/*browser.getEngine().getLoadWorker().stateProperty().addListener(
			  (ObservableValue<? extends worker.State> observable,
			    worker.State oldValue,
			    worker.State newValue) -> {
			    if( newValue != worker.State.SUCCEEDED ) {
			      return;
			    }

			    // Your logic here
			  } );*/

		//if (worker.State.SUCCEEDED == true)
		//{


		//}
		/*secondScene.setOnKeyReleased(new EventHandler<KeyEvent>()
	{
		@Override
		public void handle(KeyEvent event)
		{
			if ( event.isAltDown() == true)
			{
				switch (event.getCode())
				{
					case ENTER: secondaryStage.setFullScreen(!secondaryStage.isFullScreen()); break;
				}
			}
		}
	});//*
		secondScene[(int)secondFRateDivisor].setOnKeyReleased(new EventHandler<KeyEvent>()
		{
			@Override
			public void handle(KeyEvent event)
			{
				if ( event.isAltDown() == true)
				{
					switch (event.getCode())
					{
					case ENTER: secondaryStage.setFullScreen(!secondaryStage.isFullScreen()); break;
					}
				}
			}
		});
	//*/
		//browser.snapshot(sP, nextTextPicture);
	}
	//@Override
	public void onKeyPressed(KeyEvent secondEvent) {
		if (secondEvent.getKeyCode() == KeyCode.ESCAPE.hashCode()) {
			System.exit(0);
		}
	}// */
	
	public static void main(String[] args) throws IOException
	{
		/*args.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>()
        {
            public void handle(MouseEvent event) 
            {
                System.exit(0);
            }
        });// */
		launch(args);

	}

}