// Path: app/setups/AppConfig.java
// public class AppConfig {
// 
// 	public static String uploadDirectory;
// 	public static String uploadDirectoryCache;
// 	public static String temporaryFilesDirectory;
// 	public static String appRootDirectory;
// 	public static String domain;
// 	
// 	
// 	public static String mail_smtpPassword; 
// 	public static String mail_smtpUsername; 
// 	public static String mail_smtpHost; 
// 	public static String mail_smtpPort; 
// 	
// 	public static String mail_fromEmail = "stan@wethreecreatives.com";
// 	public static String developerEmail = "stan@wethreecreatives.com";
// 	public static String supportEmail = "stan@wethreecreatives.com";
// 	
// 	public static String pathToHtmlToImageGenerator;
// 
// 	public static String googleAnalyticsCode;
// 	
// 	public static boolean isProd() {
// 		return Play.application().configuration().getString("app.envirement").equals("prod");
// 	}
// 	public static boolean isTest() {
// 		return Play.application().configuration().getString("app.envirement").equals("test");
// 	}
// 	public static boolean isDev() {
// 		return Play.application().configuration().getString("app.envirement").equals("dev");
// 	}
// 	
// 	public static void setupDevEnv() {
// 		appRootDirectory = Play.application().path().getAbsolutePath()+"/";
// 		uploadDirectory = "/media/ext3/www/htdocs/work/we3c/uploads/";
// 		uploadDirectoryCache = "/media/ext3/www/htdocs/work/we3c/uploads/cache/";
// 		temporaryFilesDirectory = "/media/ext3/www/htdocs/work/we3c/tracker_tmp/";
// 		pathToHtmlToImageGenerator = "/media/ext3/www/htdocs/work/we3c/wkhtmltoimage-i386";
// 		domain = "localhost:9001";
// 		
// 	
// 		
// 		googleAnalyticsCode = "";
// 		
// 	}
// 	public static void setupTestEnv() {
// 		appRootDirectory = Play.application().path().getAbsolutePath()+"/";
// 		uploadDirectory = "";
// 		uploadDirectoryCache = "";
// 		temporaryFilesDirectory = "/www/sites/we3c/tracker_files/";
// 		
// 		pathToHtmlToImageGenerator = "/www/sites/we3c/wkhtmltoimage-i386";
// 		domain = "clickheat.wethreecreatives.com";
// 		
// 		
// 		
// 		googleAnalyticsCode = "";
// 		
// 	}
// 	public static void setupProdEnv() {
// 		appRootDirectory = Play.application().path().getAbsolutePath()+"/";
// 		uploadDirectory = "";
// 		uploadDirectoryCache = "";
// 		temporaryFilesDirectory = "/www/sites/we3c/tracker_files/";
// 		pathToHtmlToImageGenerator = "/www/sites/we3c/wkhtmltoimage-i386";
// 		domain = "clickheat.wethreecreatives.com";
// 		
// 		
// 		
// 		googleAnalyticsCode = "";
// 	}
// 	
// }


import java.io.File;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import akka.util.Duration;
import play.Application;
import play.GlobalSettings;
import play.Play;
import play.mvc.Http.RequestHeader;
import play.mvc.Result;
import setups.AppConfig;
				String text = "mode: " + Play.application().configuration().getString("app.envirement") + "id: " + ((play.api.PlayException.UsefulException)arg0).id() + "\n title: " + ((play.api.PlayException.UsefulException)arg0).title() + "\n" + "descr: " + ((play.api.PlayException.UsefulException)arg0).description() + "\n " + "msg: " + arg0.getMessage() + "\nstack: " + errors;

				message.setText( text );
				Transport.send( message );

			} catch (MessagingException e) {
			}
			return super.onError(arg1, arg0);
			//			return Results.internalServerError( views.html.custom_500.render( ((play.api.PlayException.UsefulException)arg0).id() ) );
		} else {
			return super.onError(arg1, arg0);
		}
	}

	@Override
	public Result onHandlerNotFound(play.mvc.Http.RequestHeader arg0) {
		if( AppConfig.isProd() ) {
			return super.onHandlerNotFound(arg0);
		} else {
			return super.onHandlerNotFound(arg0);
		}
	}

	@Override
	public void onStart(Application app) {
		if( Play.application().configuration().getString("app.envirement").equals("dev") ) {
			AppConfig.setupDevEnv();
		} else if( Play.application().configuration().getString("app.envirement").equals("test") ) {
			AppConfig.setupTestEnv();
		} else if( Play.application().configuration().getString("app.envirement").equals("prod") ) {
// Path: app/setups/AppConfig.java
// public class AppConfig {
// 
// 	public static String uploadDirectory;
// 	public static String uploadDirectoryCache;
// 	public static String temporaryFilesDirectory;
// 	public static String appRootDirectory;
// 	public static String domain;
// 	
// 	
// 	public static String mail_smtpPassword; 
// 	public static String mail_smtpUsername; 
// 	public static String mail_smtpHost; 
// 	public static String mail_smtpPort; 
// 	
// 	public static String mail_fromEmail = "stan@wethreecreatives.com";
// 	public static String developerEmail = "stan@wethreecreatives.com";
// 	public static String supportEmail = "stan@wethreecreatives.com";
// 	
// 	public static String pathToHtmlToImageGenerator;
// 
// 	public static String googleAnalyticsCode;
// 	
// 	public static boolean isProd() {
// 		return Play.application().configuration().getString("app.envirement").equals("prod");
// 	}
// 	public static boolean isTest() {
// 		return Play.application().configuration().getString("app.envirement").equals("test");
// 	}
// 	public static boolean isDev() {
// 		return Play.application().configuration().getString("app.envirement").equals("dev");
// 	}
// 	
// 	public static void setupDevEnv() {
// 		appRootDirectory = Play.application().path().getAbsolutePath()+"/";
// 		uploadDirectory = "/media/ext3/www/htdocs/work/we3c/uploads/";
// 		uploadDirectoryCache = "/media/ext3/www/htdocs/work/we3c/uploads/cache/";
// 		temporaryFilesDirectory = "/media/ext3/www/htdocs/work/we3c/tracker_tmp/";
// 		pathToHtmlToImageGenerator = "/media/ext3/www/htdocs/work/we3c/wkhtmltoimage-i386";
// 		domain = "localhost:9001";
// 		
// 	
// 		
// 		googleAnalyticsCode = "";
// 		
// 	}
// 	public static void setupTestEnv() {
// 		appRootDirectory = Play.application().path().getAbsolutePath()+"/";
// 		uploadDirectory = "";
// 		uploadDirectoryCache = "";
// 		temporaryFilesDirectory = "/www/sites/we3c/tracker_files/";
// 		
// 		pathToHtmlToImageGenerator = "/www/sites/we3c/wkhtmltoimage-i386";
// 		domain = "clickheat.wethreecreatives.com";
// 		
// 		
// 		
// 		googleAnalyticsCode = "";
// 		
// 	}
// 	public static void setupProdEnv() {
// 		appRootDirectory = Play.application().path().getAbsolutePath()+"/";
// 		uploadDirectory = "";
// 		uploadDirectoryCache = "";
// 		temporaryFilesDirectory = "/www/sites/we3c/tracker_files/";
// 		pathToHtmlToImageGenerator = "/www/sites/we3c/wkhtmltoimage-i386";
// 		domain = "clickheat.wethreecreatives.com";
// 		
// 		
// 		
// 		googleAnalyticsCode = "";
// 	}
// 	
// }


// Path: app/Global.java
import java.io.File;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import akka.util.Duration;
import play.Application;
import play.GlobalSettings;
import play.Play;
import play.mvc.Http.RequestHeader;
import play.mvc.Result;
import setups.AppConfig;

				String text = "mode: " + Play.application().configuration().getString("app.envirement") + "id: " + ((play.api.PlayException.UsefulException)arg0).id() + "\n title: " + ((play.api.PlayException.UsefulException)arg0).title() + "\n" + "descr: " + ((play.api.PlayException.UsefulException)arg0).description() + "\n " + "msg: " + arg0.getMessage() + "\nstack: " + errors;

				message.setText( text );
				Transport.send( message );

			} catch (MessagingException e) {
			}
			return super.onError(arg1, arg0);
			//			return Results.internalServerError( views.html.custom_500.render( ((play.api.PlayException.UsefulException)arg0).id() ) );
		} else {
			return super.onError(arg1, arg0);
		}
	}

	@Override
	public Result onHandlerNotFound(play.mvc.Http.RequestHeader arg0) {
		if( AppConfig.isProd() ) {
			return super.onHandlerNotFound(arg0);
		} else {
			return super.onHandlerNotFound(arg0);
		}
	}

	@Override
	public void onStart(Application app) {
		if( Play.application().configuration().getString("app.envirement").equals("dev") ) {
			AppConfig.setupDevEnv();
		} else if( Play.application().configuration().getString("app.envirement").equals("test") ) {
			AppConfig.setupTestEnv();
		} else if( Play.application().configuration().getString("app.envirement").equals("prod") ) {
			AppConfig.setupProdEnv();