/////////////////////////////////////////////
// Main Menu Management /////
////////////////////////////////////////////////////////////////////////
// Breeze Website Builder
// Copyright Silver Dolphin Solutions, LLC, Edward Lemmers, P.E.
// For licensing, see license.txt.
// Created: 11/29/2013	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);

function DeleteConfirm(delete_mode)
{
	popup_msg.top_offset = 0;
	popup_msg.left_offset = 300;
	popup_msg.popup_msg_type = 3;
	popup_msg.popup_btn_cnt = 2;
	popup_msg.popup_button_2_span = "Yes";
	popup_msg.popup_button_1_span = "No";
	popup_msg.popup_timeout = -1;
	
	if (delete_mode == "blog")
	{
		var list = document.getElementById('selectBlogToDelete');
		var blog = list.options[list.selectedIndex].innerHTML;
		popup_msg.popup_msg_cell = "Are your sure you want to delete <b>" + blog + "</b>?";
		document.getElementById("popup_button_2_span").onclick = function() { DeleteBlog(); };
	}
	else if (delete_mode == "recall_plugin")
	{
		var list = document.getElementById('recall_plugin');
		var plugin_name = list.options[list.selectedIndex].innerHTML;
		var plugin_name_arr = plugin_name.split("-");
		plugin_name = plugin_name_arr[0];
		popup_msg.popup_msg_cell = "Are your sure you want to recall the <b>" + plugin_name + "</b> plugin?";
		document.getElementById("popup_button_2_span").onclick = function() { RecallPlugin(); };
	}
	else	// page
	{
		popup_msg.popup_msg_cell = "Are your sure you want to delete the <b>" + document.getElementById("selectPageToDelete").value + "</b> page?";
		document.getElementById("popup_button_2_span").onclick = function() { DeletePage(); };
	}
	document.getElementById("popup_button_1_span").onclick = function () { HidePopupMsg(); };
	popup_msg.ShowPopupMsg();
}

function DeletePage()
{
	var page_name = document.getElementById("selectPageToDelete").value;
	HidePopupMsg();
	var url = "delete_page.php?page_name=" + page_name;
	window.location = url;
}

function DeleteBlog()
{
	var blog_id = document.getElementById("selectBlogToDelete").value;
	HidePopupMsg();
	var url = "delete_blog.php?blog_id=" + blog_id;
	window.location = url;
}

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