/////////////////////////////////////////////
// Edit File Select /////
////////////////////////////////////////////////////////////////////////
// Breeze Website Builder
// Copyright Silver Dolphin Solutions, LLC, Edward Lemmers, P.E.
// For licensing, see license.txt.
// Created: 4/18/2018	ELL

var browser = BrowserDetect.browser;
var browser_version = BrowserDetect.version;

var param_array = {'popup_msg_type' : 1, 'status_msg' : '', 'popup_timeout' : -1};
var popup_msg = new PopupMsg(param_array);

window.parent.document.title = document.title;

function OpenHelpWindow()
{
	window.open(http + "breezewebsitebuilder.com/docs/cms/help.html#minify_file", "Help", "scrollbars=1,resizable=1,status=0,toolbar=0,menubar=0,location=0,height=700,width=800");
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////
function ShowFiles()
{
	var show_hidden = 0;

	$.post( "get_js_files.php" ).done(CompleteShowFiles) ;

	document.getElementById("btn_scripts").className = "button_sub_level_1";

	var btn = "btn_scripts";

	document.getElementById(btn).className = "button_sub_level_1 down_sub";
}
function CompleteShowFiles(data)
{
	document.getElementById("file_list_div").innerHTML = data;
}

function MinifyJS(file_name)
{
	$.post( "minify_js.php", { file_name: file_name } ).done(CompleteMinifyJS) ;
}
function CompleteMinifyJS(data)
{
	popup_msg.top_offset = 100;
	popup_msg.left_offset = 320;
	popup_msg.popup_msg_type = 2;
	popup_msg.popup_timeout = 2000;
	if (data == 1)
		popup_msg.status_msg = MINIFY_FILE_MINIFY_JS_COMPLETE_MSG;
	else
		popup_msg.status_msg = MINIFY_FILE_MINIFY_JS_COMPLETE_ERR;
	popup_msg.ShowPopupMsg();
	
	ShowFiles();
}

function MinifyCSS()
{
	$.post( "minify_css.php", { file_name: "*" } ).done(CompleteMinifyCSS) ;
}
function CompleteMinifyCSS(data)
{
	popup_msg.top_offset = 100;
	popup_msg.left_offset = 320;
	popup_msg.popup_msg_type = 2;
	popup_msg.popup_timeout = 2000;
	if (data == 1)
		popup_msg.status_msg = MINIFY_FILE_MINIFY_CSS_COMPLETE_MSG;
	else
		popup_msg.status_msg = MINIFY_FILE_MINIFY_CSS_COMPLETE_ERR;
	popup_msg.ShowPopupMsg();
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////
function ResizeWorkspace(mainWidth, mainHeight, menuWidth, headerHeight) {

}

function DisplayNotSavedMessage(btn)	{
	// Needed to complete call when deleting unsaved file.
	window.parent.SetWorkSavedNotSaved(true);
	window.parent.next_btn = btn;
	window.parent.DoNextClick();
}