commit 7d5b007c2ec298d018752365ab0dc56d77838b6e
Author: Sjon Hortensius <sjon@hortensius.net>
Date:   Sun Jan 4 12:57:21 2015 +0100

    initial drag/drop WIP, working on backup/restore page

diff --git a/etc/inc/gmirror.inc b/etc/inc/gmirror.inc
index 88261c4fd8..2306771057 100644
--- a/etc/inc/gmirror.inc
+++ b/etc/inc/gmirror.inc
@@ -67,33 +67,39 @@ function gmirror_get_status_single($mirror) {
 function gmirror_html_status() {
 	$mirrors = gmirror_get_status();
 	$output = "";
-	if (count($mirrors) > 0) {
-		$output .= "<tr>\n";
-		$output .= "<th>Name</td>\n";
-		$output .= "<th>Status</td>\n";
-		$output .= "<th>Component</td>\n";
-		$output .= "</tr>\n";
-		foreach ($mirrors as $mirror => $name) {
-			$components = count($name["components"]);
-			$output .= "<tr>\n";
-			$output .= "<td rowspan=\"{$components}\">{$name['name']}</td>\n";
-			$output .= "<td rowspan=\"{$components}\" class=\"listr\">{$name['status']}</td>\n";
-			$output .= "<td>{$name['components'][0]}</td>\n";
-			$output .= "</tr>\n";
-			if (count($name["components"]) > 1) {
-				$morecomponents = array_slice($name["components"], 1);
-				foreach ($morecomponents as $component) {
-					$output .= "<tr>\n";
-					$output .= "<td>{$component}</td>\n";
-					$output .= "</tr>\n";
-				}
-			}
-		}
-	} else {
-		$output .= "<tr><td colspan=\"3\" class=\"listr\">No Mirrors Found</td></tr>\n";
+	if (count($mirrors) < 1) {
+?>
+<div class="alert">
+	<p>No Mirrors Found</p>
+</div>
+<?php
+		return;
 	}
-	// $output .= "<tr><td colspan=\"3\" class=\"listr\">Updated at " . date("F j, Y, g:i:s a") . "</td></tr>\n";
-	return $output;
+
+?>
+<table class="table table-striped">
+	<thead>
+		<tr>
+			<th>Name</td>
+			<th>Status</td>
+			<th>Component</td>
+		</tr>
+	</thead>
+	<tbody>
+<?php foreach ($mirrors as $mirror => $name): ?>
+		<tr>
+			<td rowspan="<?=count($name["components"])?>"><?=$name['name']?></td>
+			<td rowspan="<?=count($name["components"])?>"><?=$name['status']?></td>
+			<td><?=$name['components'][0]?></td>
+		</tr>
+<?php if (count($name["components"]) > 1): ?>
+		<?php foreach (array_slice($name["components"], 1) as $component): ?>
+			<tr>
+				<td><?=$component?></td>
+			</tr>
+		<?php endforeach; ?>
+	<?php endif; ?>
+<?php endforeach;
 }
 
 /* List all disks in the system (potential gmirror targets) */
diff --git a/usr/local/www/bandwidth_by_ip.php b/usr/local/www/bandwidth_by_ip.php
index 74697e6a39..2665315889 100755
--- a/usr/local/www/bandwidth_by_ip.php
+++ b/usr/local/www/bandwidth_by_ip.php
@@ -1,5 +1,5 @@
 <?php
-/* 
+/*
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  *
@@ -47,7 +47,7 @@ if ($filter == "local") {
 
 //get the sort method
 $sort = $_GET['sort'];
-if ($sort == "out") 
+if ($sort == "out")
 	{$sort_method = "-T";}
 else
 	{$sort_method = "-R";}
@@ -77,15 +77,15 @@ $_grb = exec("/usr/local/bin/rate -i {$real_interface} -nlq 1 -Aba 20 {$sort_met
 $someinfo = false;
 for ($x=2; $x<12; $x++){
 
-    $bandwidthinfo = $listedIPs[$x];
+	$bandwidthinfo = $listedIPs[$x];
 
-   // echo $bandwidthinfo;
-    $emptyinfocounter = 1;
-    if ($bandwidthinfo != "") {
-        $infoarray = explode (":",$bandwidthinfo);
+	// echo $bandwidthinfo;
+	$emptyinfocounter = 1;
+	if ($bandwidthinfo != "") {
+		$infoarray = explode (":",$bandwidthinfo);
 		if (($filter == "all") ||
-		    (($filter == "local") && (ip_in_subnet($infoarray[0], $intsubnet))) ||
-		    (($filter == "remote") && (!ip_in_subnet($infoarray[0], $intsubnet)))) {
+			(($filter == "local") && (ip_in_subnet($infoarray[0], $intsubnet))) ||
+			(($filter == "remote") && (!ip_in_subnet($infoarray[0], $intsubnet)))) {
 			if ($hostipformat == "") {
 				$addrdata = $infoarray[0];
 			} else {
@@ -116,6 +116,6 @@ unset($listedIPs);
 
 //no bandwidth usage found
 if ($someinfo == false)
-    echo gettext("no info");
+	echo gettext("no info");
 
-?>
+?>
\ No newline at end of file
diff --git a/usr/local/www/bootstrap/css/pfSense.css b/usr/local/www/bootstrap/css/pfSense.css
index f7c66fdc03..ada8941925 100644
--- a/usr/local/www/bootstrap/css/pfSense.css
+++ b/usr/local/www/bootstrap/css/pfSense.css
@@ -27,6 +27,13 @@ body.no-menu #jumbotron .container {
 	background: url("/logo.png") no-repeat;
 }
 
+body.index a[data-toggle][aria-expanded="false"] i {
+	background-position: 0 -96px;
+}
+body.index a[data-toggle][aria-expanded="true"] i {
+	background-position: -24px -96px;
+}
+
 tr.disabled {
 	opacity: .5;
 }
diff --git a/usr/local/www/carp_status.php b/usr/local/www/carp_status.php
index 83975b37c1..214c4a6271 100644
--- a/usr/local/www/carp_status.php
+++ b/usr/local/www/carp_status.php
@@ -1,30 +1,30 @@
 <?php
 /*
-    carp_status.php
-    Copyright (C) 2004 Scott Ullrich
-    Copyright (C) 2013-2014 Electric Sheep Fencing, LP
-    All rights reserved.
-
-    Redistribution and use in source and binary forms, with or without
-    modification, are permitted provided that the following conditions are met:
-
-    1. Redistributions of source code must retain the above copyright notice,
-       this list of conditions and the following disclaimer.
-
-    2. Redistributions in binary form must reproduce the above copyright
-       notice, this list of conditions and the following disclaimer in the
-       documentation and/or other materials provided with the distribution.
-
-    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
-    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-    POSSIBILITY OF SUCH DAMAGE.
+	carp_status.php
+	Copyright (C) 2004 Scott Ullrich
+	Copyright (C) 2013-2014 Electric Sheep Fencing, LP
+	All rights reserved.
+
+	Redistribution and use in source and binary forms, with or without
+	modification, are permitted provided that the following conditions are met:
+
+	1. Redistributions of source code must retain the above copyright notice,
+	   this list of conditions and the following disclaimer.
+
+	2. Redistributions in binary form must reproduce the above copyright
+	   notice, this list of conditions and the following disclaimer in the
+	   documentation and/or other materials provided with the distribution.
+
+	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+	POSSIBILITY OF SUCH DAMAGE.
 */
 
 ##|+PRIV
@@ -100,116 +100,85 @@ $carp_detected_problems = ((get_single_sysctl("net.inet.carp.demotion")) > 0);
 $pgtitle = array(gettext("Status"),gettext("CARP"));
 $shortcut_section = "carp";
 include("head.inc");
-
 ?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
+<body>
+<?php include("fbegin.inc")?>
 <form action="carp_status.php" method="post">
-<?php if ($savemsg) print_info_box($savemsg); ?>
-
-<?PHP	if ($carp_detected_problems) print_info_box(gettext("CARP has detected a problem and this unit has been demoted to BACKUP status.") . "<br />" . gettext("Check link status on all interfaces with configured CARP VIPs.")); ?>
-
-
-<div id="mainlevel">
-	<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="carp status">
-		<tr>
-			<td>
+<?php if ($savemsg) print_info_box($savemsg)?>
+<?php if ($carp_detected_problems) print_info_box(gettext("CARP has detected a problem and this unit has been demoted to BACKUP status.") . "<br />" . gettext("Check link status on all interfaces with configured CARP VIPs."))?>
 <?php
-			$carpcount = 0;
-			if(is_array($config['virtualip']['vip'])) {
-				foreach($config['virtualip']['vip'] as $carp) {
-					if ($carp['mode'] == "carp") {
-						$carpcount++;
-						break;
-					}
-				}
-			}
-			if($carpcount > 0) {
-				if($status > 0) {
-					$carp_enabled = true;
-					echo "<input type=\"submit\" name=\"disablecarp\" id=\"disablecarp\" value=\"" . gettext("Temporarily Disable CARP") . "\" />";
-				} else {
-					$carp_enabled = false;
-					echo "<input type=\"submit\" name=\"disablecarp\" id=\"disablecarp\" value=\"" . gettext("Enable CARP") . "\" />";
-				}
-				if(isset($config["virtualip_carp_maintenancemode"])) {
-					echo "<input type=\"submit\" name=\"carp_maintenancemode\" id=\"carp_maintenancemode\" value=\"" . gettext("Leave Persistent CARP Maintenance Mode") . "\" />";
-				} else {
-					echo "<input type=\"submit\" name=\"carp_maintenancemode\" id=\"carp_maintenancemode\" value=\"" . gettext("Enter Persistent CARP Maintenance Mode") . "\" />";
-				}
-			}
+$carpcount = 0;
+if(is_array($config['virtualip']['vip'])) {
+	foreach($config['virtualip']['vip'] as $carp) {
+		if ($carp['mode'] == "carp") {
+			$carpcount++;
+			break;
+		}
+	}
+}
+if ($carpcount > 0):
+	$carp_enabled = ($status > 0);
 ?>
-
-			<br/><br/>
-			<table class="tabcont sortable" width="100%" border="0" cellpadding="6" cellspacing="0" summary="results">
-				<tr>
-					<td class="listhdrr" align="center"><?=gettext("CARP Interface"); ?></td>
-					<td class="listhdrr" align="center"><?=gettext("Virtual IP"); ?></td>
-					<td class="listhdrr" align="center"><?=gettext("Status"); ?></td>
-				</tr>
+	<input type="submit" name="disablecarp" value="<?=($carp_enabled ? gettext("Temporarily Disable CARP") : gettext("Enable CARP"))?>" />
+	<input type="submit" name="carp_maintenancemode" value="<?=($config["virtualip_carp_maintenancemode"] ? gettext("Leave Persistent CARP Maintenance Mode") : gettext("Enter Persistent CARP Maintenance Mode"))?>" />
+<?php elseif ($carpcount == 0): ?>
+	<div class="alert alert-info" role="alert">
+		<p>
+			<?=gettext("Could not locate any defined CARP interfaces.")?><br/>
+			<a href="system_hasync.php" class="alert-link"><?=gettext("You can configure high availability sync settings here")?></a>.
+		</p>
+	</div>
+<?php else: ?>
+<table>
+	<tr>
+		<td><?=gettext("CARP Interface")?></td>
+		<td><?=gettext("Virtual IP")?></td>
+		<td><?=gettext("Status")?></td>
+	</tr>
 <?php
-				if ($carpcount == 0) {
-					echo "</table></td></tr></table></div></form><center><br />" . gettext("Could not locate any defined CARP interfaces.");
-					echo "</center>";
-
-					include("fend.inc");
-					echo "</body></html>";
-					return;
-				}
-				if(is_array($config['virtualip']['vip'])) {
-					foreach($config['virtualip']['vip'] as $carp) {
-						if ($carp['mode'] != "carp")
-							continue;
-						$ipaddress = $carp['subnet'];
-						$password = $carp['password'];
-						$netmask = $carp['subnet_bits'];
-						$vhid = $carp['vhid'];
-						$advskew = $carp['advskew'];
-						$advbase = $carp['advbase'];
-						$status = get_carp_interface_status("{$carp['interface']}_vip{$carp['vhid']}");
-						echo "<tr>";
-						$align = "style=\"vertical-align:middle\"";
-						if($carp_enabled == false) {
-							$icon = "<img {$align} src=\"/themes/".$g['theme']."/images/icons/icon_block.gif\" alt=\"disabled\" />";
-							$status = "DISABLED";
-						} else {
-							if($status == "MASTER") {
-								$icon = "<img {$align} src=\"/themes/".$g['theme']."/images/icons/icon_pass.gif\" alt=\"master\" />";
-							} else if($status == "BACKUP") {
-								$icon = "<img {$align} src=\"/themes/".$g['theme']."/images/icons/icon_pass_d.gif\" alt=\"backup\" />";
-							} else if($status == "INIT") {
-								$icon = "<img {$align} src=\"/themes/".$g['theme']."/images/icons/icon_log.gif\" alt=\"init\" />";
-							}
-						}
-						echo "<td class=\"listlr\" align=\"center\">" . convert_friendly_interface_to_friendly_descr($carp['interface']) . "@{$vhid} &nbsp;</td>";
-						echo "<td class=\"listlr\" align=\"center\">" . $ipaddress . "&nbsp;</td>";
-						echo "<td class=\"listlr\" align=\"center\">{$icon}&nbsp;&nbsp;" . $status . "&nbsp;</td>";
-						echo "</tr>";
-					}
-				}
+	foreach($config['virtualip']['vip'] as $carp) {
+		if ($carp['mode'] != "carp")
+			continue;
+		$ipaddress = $carp['subnet'];
+		$password = $carp['password'];
+		$netmask = $carp['subnet_bits'];
+		$vhid = $carp['vhid'];
+		$advskew = $carp['advskew'];
+		$advbase = $carp['advbase'];
+		$status = get_carp_interface_status("{$carp['interface']}_vip{$carp['vhid']}");
+		if($carp_enabled == false) {
+			$icon = 'remove-sign';
+			$status = "DISABLED";
+		} else {
+			if($status == "MASTER") {
+				$icon = 'ok-sign';
+			} else if($status == "BACKUP") {
+				$icon = 'ok-circle';
+			} else if($status == "INIT") {
+				$icon = 'question-sign';
+			}
+		}
 ?>
-			</table>
-			</td>
+	<tr>
+		<td>
+			<td><?=convert_friendly_interface_to_friendly_descr($carp['interface'])?>@<?=$vhid?></td>
+			<td><?=$ipaddress?></td>
+			<td><i class="icon icon-<?=$icon?>">$status</td>
 		</tr>
+<?php }?>
 	</table>
-</div>
 </form>
+<?php endif?>
 
-<p class="vexpl">
-<span class="red"><strong><?=gettext("Note"); ?>:</strong></span>
-<br />
-<?=gettext("You can configure high availability sync settings"); ?> <a href="system_hasync.php"><?=gettext("here"); ?></a>.
-</p>
-
+<h4><?=gettext("pfSync nodes")?></h4>
+<ul>
 <?php
-	echo "<br />" . gettext("pfSync nodes") . ":<br />";
-	echo "<pre>";
-	system("/sbin/pfctl -vvss | /usr/bin/grep creator | /usr/bin/cut -d\" \" -f7 | /usr/bin/sort -u");
-	echo "</pre>";
+	foreach (explode("\n", exec_command("/sbin/pfctl -vvss | /usr/bin/grep creator | /usr/bin/cut -d\" \" -f7 | /usr/bin/sort -u")) as $node)
+		echo '<li>'. $node .'</li>';
 ?>
+</ul>
 
-<?php include("fend.inc"); ?>
+<?php include("fend.inc")?>
 
 </body>
-</html>
+</html>
\ No newline at end of file
diff --git a/usr/local/www/crash_reporter.php b/usr/local/www/crash_reporter.php
index badf663c82..b55315469d 100644
--- a/usr/local/www/crash_reporter.php
+++ b/usr/local/www/crash_reporter.php
@@ -53,29 +53,18 @@ function upload_crash_report($files) {
 		$post["file{$counter}"] = "@{$file}";
 		$counter++;
 	}
-    $ch = curl_init();
-    curl_setopt($ch, CURLOPT_HEADER, 0);
-    curl_setopt($ch, CURLOPT_VERBOSE, 0);
-    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
-    curl_setopt($ch, CURLOPT_URL, $g['crashreporterurl']);
-    curl_setopt($ch, CURLOPT_POST, true);
-    curl_setopt($ch, CURLOPT_POSTFIELDS, $post); 
-    $response = curl_exec($ch);
+	$ch = curl_init();
+	curl_setopt($ch, CURLOPT_HEADER, 0);
+	curl_setopt($ch, CURLOPT_VERBOSE, 0);
+	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+	curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
+	curl_setopt($ch, CURLOPT_URL, $g['crashreporterurl']);
+	curl_setopt($ch, CURLOPT_POST, true);
+	curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
+	$response = curl_exec($ch);
 	return $response;
 }
 
-function output_crash_reporter_html($crash_reports) {
-	echo "<p><strong>" . gettext("Unfortunately we have detected a programming bug.") . "</strong></p>";
-	echo "<p>" . gettext("Would you like to submit the programming debug logs to the pfSense developers for inspection?") . "</p>";
-	echo "<p><i>" . gettext("Please double check the contents to ensure you are comfortable sending this information before clicking Yes.") . "</i></p>";
-	echo "<p>" . gettext("Contents of crash reports") . ":<br />";
-	echo "<textarea readonly=\"readonly\" rows=\"40\" cols=\"65\" name=\"crashreports\">{$crash_reports}</textarea></p>";
-	echo "<p><input name=\"Submit\" type=\"submit\" class=\"formbtn\" value=\"" . gettext("Yes") .  "\" />" . gettext(" - Submit this to the developers for inspection") . "</p>";
-	echo "<p><input name=\"Submit\" type=\"submit\" class=\"formbtn\" value=\"" . gettext("No") .  "\" />" . gettext(" - Just delete the crash report and take me back to the Dashboard") . "</p>";
-	echo "</form>";
-}
-
 $pgtitle = array(gettext("Diagnostics"),gettext("Crash reporter"));
 include('head.inc');
 
@@ -86,15 +75,9 @@ $crash_report_header .= php_uname("v") . "\n";
 $crash_report_header .= "\nCrash report details:\n";
 
 exec("/usr/bin/grep -vi warning /tmp/PHP_errors.log", $php_errors);
-
 ?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<?php include("fbegin.inc"); ?>
-
-	<form action="crash_reporter.php" method="post">
-
+<body class="crash_reporter">
+<?php include("fbegin.inc")?>
 <?php
 	if (gettext($_POST['Submit']) == "Yes") {
 		echo gettext("Processing...");
@@ -140,14 +123,32 @@ exec("/usr/bin/grep -vi warning /tmp/PHP_errors.log", $php_errors);
 					$crash_reports .= file_get_contents($cf);
 				}
 			}
-		} else { 
+		} else {
 			echo "Could not locate any crash data.";
 		}
-		output_crash_reporter_html($crash_reports);
+?>
+	<div class="jumbotron">
+	<div class="panel panel-default">
+		<div class="panel-heading"><h3><?=gettext("Unfortunately we have detected a programming bug.")?></h3></div>
+		<div class="panel-body">
+		<p>
+			<?=gettext("Would you like to submit the programming debug logs to the pfSense developers for inspection?")?>
+			<i><?=gettext("Please double check the contents to ensure you are comfortable sending this information before clicking Yes.")?></i>
+		</p>
+		<textarea readonly="readonly" style="width: 100%; height: 350px;">
+			<?=$crash_reports?>
+		</textarea>
+		<form action="crash_reporter.php" method="post">
+			<button class="btn btn-primary" name="Submit" type="submit" value="Yes"><?=gettext("Yes")?> - <?=gettext("Submit this to the developers for inspection")?></button>
+			<button class="btn btn-default" name="Submit" type="submit" value="No"><?=gettext("No")?> - <?=gettext("Just delete the crash report and take me back to the Dashboard")?></button>
+		</form>
+	</div>
+	</div>
+<?php
 	}
 ?>
 
-<?php include("fend.inc"); ?>
+<?php include("fend.inc")?>
 
 </body>
-</html>
+</html>
\ No newline at end of file
diff --git a/usr/local/www/diag_arp.php b/usr/local/www/diag_arp.php
index d99b09039e..64d58f2cf9 100644
--- a/usr/local/www/diag_arp.php
+++ b/usr/local/www/diag_arp.php
@@ -3,7 +3,7 @@
 	diag_arp.php
 	part of the pfSense project	(https://www.pfsense.org)
 	Copyright (C) 2004-2009 Scott Ullrich <sullrich@gmail.com>
-        Copyright (C) 2013-2014 Electric Sheep Fencing, LP
+	Copyright (C) 2013-2014 Electric Sheep Fencing, LP
 
 	originally part of m0n0wall (http://m0n0.ch/wall)
 	Copyright (C) 2005 Paul Taylor (paultaylor@winndixie.com) and Manuel Kasper <mk@neon1.net>.
@@ -253,7 +253,7 @@ function _getHostName($mac,$ip) {
 		exec("host -W 1 " . escapeshellarg($ip), $output);
 		if (preg_match('/.*pointer ([A-Za-z0-9.-]+)\..*/',$output[0],$matches)) {
 			if ($matches[1] <> $ip)
-				return $matches[1]; 
+				return $matches[1];
 		}
 	}
 	return "";
@@ -263,29 +263,17 @@ $pgtitle = array(gettext("Diagnostics"),gettext("ARP Table"));
 include("head.inc");
 
 ?>
-
-<body link="#000000" vlink="#000000" alink="#000000">
-
-<?php include("fbegin.inc"); ?>
-
-<div id="loading">
-	<img src="/themes/<?=$g['theme'];?>/images/misc/loader.gif" alt="loader" /><?= gettext("Loading, please wait..."); ?>
-	<p>&nbsp;</p>
-</div>
-
+<body>
+<?php include("fbegin.inc")?>
 <?php
 
-// Flush buffers out to client so that they see Loading, please wait....
-for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); }
-ob_implicit_flush(1);
-
 // Resolve hostnames and replace Z_ with "".  The intention
 // is to sort the list by hostnames, alpha and then the non
 // resolvable addresses will appear last in the list.
 $dnsavailable=1;
-$dns = trim(_getHostName("", "8.8.8.8")); 
+$dns = trim(_getHostName("", "8.8.8.8"));
 if ($dns == ""){
-	$dns = trim(_getHostName("", "8.8.4.4")); 
+	$dns = trim(_getHostName("", "8.8.4.4"));
 	if ($dns == "") $dnsavailable =0;
 }
 
@@ -306,50 +294,38 @@ $data = msort($data, "dnsresolve");
 // Load MAC-Manufacturer table
 $mac_man = load_mac_manufacturer_table();
 ?>
-<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="diag arp">
-	<tr>
-		<td>
-			<table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="tabcont">
-				<tr>
-					<td class="listhdrr"><?= gettext("IP address"); ?></td>
-					<td class="listhdrr"><?= gettext("MAC address"); ?></td>
-					<td class="listhdrr"><?= gettext("Hostname"); ?></td>
-					<td class="listhdr"><?= gettext("Interface"); ?></td>
-					<td class="list"></td>
-				</tr>
-				<?php foreach ($data as $entry): ?>
-					<tr>
-						<td class="listlr"><?=$entry['ip'];?></td>
-						<td class="listr">
-						<?php
-						$mac=trim($entry['mac']);
-						$mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]);
-						print $mac;
-						if(isset($mac_man[$mac_hi])){ print "<br /><font size=\"-2\"><i>{$mac_man[$mac_hi]}</i></font>"; }
-						?>
-						</td>
-						<td class="listr">
-							<?php
-							echo trim(str_replace("Z_ ", "", $entry['dnsresolve']));
-							?>
-						</td>
-						<td class="listr"><?=$hwif[$entry['interface']];?></td>
-					</tr>
-				<?php endforeach; ?>
-			</table>
-		</td>
-	</tr>
-	<tr>
-		<td><br /><?= gettext("NOTE: Local IPv6 peers use") ?> <a href="diag_ndp.php"><?= gettext("NDP") ?></a> <?= gettext("instead of ARP") ?>.</td>
-	</tr>
+<table class="table table-striped">
+	<thead>
+		<tr>
+			<td><?= gettext("Interface")?></td>
+			<td><?= gettext("IP address")?></td>
+			<td><?= gettext("MAC address")?></td>
+			<td><?= gettext("Hostname")?></td>
+			<td></td>
+		</tr>
+	</thead>
+	<tbody>
+	<?php foreach ($data as $entry): ?>
+		<tr>
+			<td><?=$hwif[$entry['interface']]?></td>
+			<td><?=$entry['ip']?></td>
+			<td>
+				<?=trim($entry['mac'])?>
+			<?php
+				$mac = trim($entry['mac']);
+				$mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]);
+
+				if (isset($mac_man[$mac_hi]))
+					print '('. $mac_man[$mac_hi] .'(';
+?>
+			</td>
+			<td><?=trim(str_replace("Z_ ", "", $entry['dnsresolve']))?></td>
+		</tr>
+	<?php endforeach?>
+	</tbody>
 </table>
+<p><?= gettext("NOTE: Local IPv6 peers use")?> <a href="diag_ndp.php"><?= gettext("NDP")?></a> <?= gettext("instead of ARP")?>.</p>
 
-<?php include("fend.inc"); ?>
-
-<script type="text/javascript">
-//<![CDATA[
-	jQuery('#loading').html('');
-//]]>
-</script>
+<?php include("fend.inc")?>
 </body>
-</html>
+</html>
\ No newline at end of file
diff --git a/usr/local/www/diag_authentication.php b/usr/local/www/diag_authentication.php
index e7b26dcd29..f03ab98a26 100644
--- a/usr/local/www/diag_authentication.php
+++ b/usr/local/www/diag_authentication.php
@@ -3,7 +3,7 @@
 	diag_authentication.php
 	part of the pfSense project	(https://www.pfsense.org)
 	Copyright (C) 2010 Ermal Luçi
-        Copyright (C) 2013-2014 Electric Sheep Fencing, LP
+	Copyright (C) 2013-2014 Electric Sheep Fencing, LP
 	All rights reserved.
 
 	Redistribution and use in source and binary forms, with or without
@@ -72,61 +72,46 @@ include("head.inc");
 
 ?>
 
-<body link="#000000" vlink="#000000" alink="#000000">
-
-<?php include("fbegin.inc"); ?>
-<?php if ($input_errors) print_input_errors($input_errors);?>
-<?php if ($savemsg) print_info_box($savemsg);?>
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="diag authentication">
-	<tr>
-		<td class="tabnavtbl"></td>
-	</tr>
-	<tr>
-	<td>
-	<div id="mainarea">
-	<form id="iform" name="iform" action="diag_authentication.php" method="post">
-	<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6" summary="test">
-	<tr>
-		<td width="22%" valign="top" class="vncell"><?=gettext("Authentication Server"); ?></td>
-		<td width="78%" class="vtable">
-			<select name="authmode" id="authmode" class="formselect" >
-			<?php
-				$auth_servers = auth_get_authserver_list();
-				foreach ($auth_servers as $auth_server):
-					$selected = "";
-					if ($auth_server['name'] == $pconfig['authmode'])
-						$selected = "selected=\"selected\"";
-			?>
-			<option value="<?=$auth_server['name'];?>" <?=$selected;?>><?=$auth_server['name'];?></option>
-			<?php   endforeach; ?>
-			</select>
-		</td>
-	</tr>
-	<tr>
-		<td width="22%" valign="top" class="vncell"><?=gettext("Username"); ?></td>
-		<td width="78%" class="vtable">
-			<input class="formfld unknown" size="20" id="username" name="username" value="<?=htmlspecialchars($pconfig['username']);?>" />
-		</td>
-	</tr>
-	<tr>
-		<td width="22%" valign="top" class="vncell"><?=gettext("Password"); ?></td>
-		<td width="78%" class="vtable">
-			<input class="formfld pwd" type="password" size="20" id="password" name="password" value="<?=htmlspecialchars($pconfig['password']);?>" />
-		</td>
-	</tr>
-	<tr>
-		<td width="22%" valign="top">&nbsp;</td>
-		<td width="78%">
-			<input id="save" name="save" type="submit" class="formbtn" value="<?=gettext("Test");?>" />
-		</td>
-	</tr>
-	</table>
-	</form>
+<body>
+<?php include("fbegin.inc")?>
+<?php if ($input_errors) print_input_errors($input_errors)?>
+<?php if ($savemsg) print_info_box($savemsg)?>
+	<div id="container">
+		<form class="form-horizontal" action="diag_authentication.php" method="post">
+			<div class="form-group">
+				<label for="authmode" class="col-sm-2 control-label"><?=gettext("Authentication Server")?></label>
+				<div class="col-sm-10">
+					<select name="authmode" id="authmode" class="formselect" >
+					<?php
+							foreach (auth_get_authserver_list() as $auth_server):
+								$selected = ($auth_server['name'] == $pconfig['authmode'])
+					?>
+						<option value="<?=$auth_server['name']?>" <?=($selected?'selected="selected"':'')?>>
+							<?=$auth_server['name']?>
+						</option>
+					<?php   endforeach?>
+					</select>
+				</div>
+			</div>
+
+			<div class="form-group">
+				<label for="authmode" class="col-sm-2 control-label"><?=gettext("Username")?></label>
+				<div class="col-sm-10">
+					<input name="username" value="<?=htmlspecialchars($pconfig['username'])?>" />
+				</div>
+			</div>
+
+			<div class="form-group">
+				<label for="authmode" class="col-sm-2 control-label"><?=gettext("Password")?></label>
+				<div class="col-sm-10">
+					<input name="password" type="password" value="<?=htmlspecialchars($pconfig['password'])?>" />
+				</div>
+			</div>
+
+			<button type="submit" class="btn btn-primary"><?=gettext("Test");?></button>
+		</form>
 	</div>
-	</td></tr>
-</table>
-
-<?php include("fend.inc"); ?>
+</div>
+<?php include("fend.inc")?>
 </body>
-</html>
+</html>
\ No newline at end of file
diff --git a/usr/local/www/diag_backup.php b/usr/local/www/diag_backup.php
index 741dd666c1..da9ee6ab30 100644
--- a/usr/local/www/diag_backup.php
+++ b/usr/local/www/diag_backup.php
@@ -3,7 +3,7 @@
 /*
 	diag_backup.php
 	Copyright (C) 2004-2009 Scott Ullrich
-        Copyright (C) 2013-2014 Electric Sheep Fencing, LP
+	Copyright (C) 2013-2014 Electric Sheep Fencing, LP
 	All rights reserved.
 
 	originally part of m0n0wall (http://m0n0.ch/wall)
@@ -178,32 +178,33 @@ function check_and_returnif_section_exists($section) {
 function spit_out_select_items($name, $showall) {
 	global $config;
 
-	$areas = array("aliases" => gettext("Aliases"),
-		       "captiveportal" => gettext("Captive Portal"),
-		       "voucher" => gettext("Captive Portal Vouchers"),
-		       "dnsmasq" => gettext("DNS Forwarder"),
-		       "dhcpd" => gettext("DHCP Server"),
-		       "dhcpdv6" => gettext("DHCPv6 Server"),
-		       "filter" => gettext("Firewall Rules"),
-		       "interfaces" => gettext("Interfaces"),
-		       "ipsec" => gettext("IPSEC"),
-		       "nat" => gettext("NAT"),
-		       "openvpn" => gettext("OpenVPN"),
-		       "installedpackages" => gettext("Package Manager"),
-		       "pptpd" => gettext("PPTP Server"),
-		       "rrddata" => gettext("RRD Data"),
-		       "cron" => gettext("Scheduled Tasks"),
-		       "syslog" => gettext("Syslog"),
-		       "system" => gettext("System"),
-		       "staticroutes" => gettext("Static routes"),
-		       "sysctl" => gettext("System tunables"),
-		       "snmpd" => gettext("SNMP Server"),
-		       "shaper" => gettext("Traffic Shaper"),
-		       "vlans" => gettext("VLANS"),
-		       "wol" => gettext("Wake on LAN")
-		);
-
-	$select  = "<select name=\"{$name}\" id=\"{$name}\">";
+	$areas = array(
+		"aliases" => gettext("Aliases"),
+		"captiveportal" => gettext("Captive Portal"),
+		"voucher" => gettext("Captive Portal Vouchers"),
+		"dnsmasq" => gettext("DNS Forwarder"),
+		"dhcpd" => gettext("DHCP Server"),
+		"dhcpdv6" => gettext("DHCPv6 Server"),
+		"filter" => gettext("Firewall Rules"),
+		"interfaces" => gettext("Interfaces"),
+		"ipsec" => gettext("IPSEC"),
+		"nat" => gettext("NAT"),
+		"openvpn" => gettext("OpenVPN"),
+		"installedpackages" => gettext("Package Manager"),
+		"pptpd" => gettext("PPTP Server"),
+		"rrddata" => gettext("RRD Data"),
+		"cron" => gettext("Scheduled Tasks"),
+		"syslog" => gettext("Syslog"),
+		"system" => gettext("System"),
+		"staticroutes" => gettext("Static routes"),
+		"sysctl" => gettext("System tunables"),
+		"snmpd" => gettext("SNMP Server"),
+		"shaper" => gettext("Traffic Shaper"),
+		"vlans" => gettext("VLANS"),
+		"wol" => gettext("Wake on LAN")
+	);
+
+	$select  = "<select name=\"{$name}\" id=\"{$name}\" multiple=\"multiple\">";
 	$select .= "<option value=\"\">" . gettext("ALL") . "</option>";
 
 	if($showall == true)
@@ -216,22 +217,7 @@ function spit_out_select_items($name, $showall) {
 
 	$select .= "</select>\n";
 
-	if ($name === "backuparea") {
-		$select .= <<<END_SCRIPT_BLOCK
-			<script type="text/javascript">
-			//<![CDATA[
-				jQuery(function (\$) {
-					$("#{$name}").change(function () {
-						backuparea_change(this);
-					}).trigger("change");
-				});
-			//]]>
-			</script>
-END_SCRIPT_BLOCK;
-	}
-
 	echo $select;
-
 }
 
 if ($_POST['apply']) {
@@ -594,132 +580,71 @@ $pgtitle = array(gettext("Diagnostics"),gettext("Backup/restore"));
 include("head.inc");
 
 ?>
+<body>
+<?php include("fbegin.inc")?>
+<?php if ($input_errors) print_input_errors($input_errors)?>
+<?php if ($savemsg) print_info_box($savemsg)?>
+<?php if (is_subsystem_dirty('restore')):?><br/>
+	<form action="reboot.php" method="post">
+		<input name="Submit" type="hidden" value="Yes" />
+		<?php print_info_box(gettext("The firewall configuration has been changed.") . "<br />" . gettext("The firewall is now rebooting."))?><br />
+	</form>
+<?php endif?>
+<?php
+	$tab_array = array();
+	$tab_array[0] = array(gettext("Config History"), false, "diag_confbak.php");
+	$tab_array[1] = array(gettext("Backup/Restore"), true, "diag_backup.php");
+	display_top_tabs($tab_array);
+?>
+	<div id="container">
+		<form class="form-horizontal" action="diag_backup.php" method="post" name="iform" enctype="multipart/form-data">
+			<h2><?=gettext("Backup configuration"); ?></h2>
+			<div class="form-group">
+				<label for="backuparea" class="col-sm-2 control-label"><?=gettext("Backup area"); ?></label>
+				<div class="col-sm-10">
+					<?php spit_out_select_items("backuparea", false)?>
+				</div>
+			</div>
 
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<script type="text/javascript">
-//<![CDATA[
-
-function encrypt_change() {
+			<div class="form-group">
+				<label for="nopackages" class="col-sm-2 control-label"><?=gettext("Do not backup package information.")?></label>
+				<div class="col-sm-10">
+					<input name="nopackages" type="checkbox" />
+				</div>
+			</div>
 
-	if (!document.iform.encrypt.checked)
-		document.getElementById("encrypt_opts").style.display="none";
-	else
-		document.getElementById("encrypt_opts").style.display="";
-}
+			<div class="form-group">
+				<label for="donotbackuprrd" class="col-sm-2 control-label"><?=gettext("Do not backup RRD data (NOTE: RRD Data can consume 4+ megabytes of config.xml space!)")?></label>
+				<div class="col-sm-10">
+					<input name="donotbackuprrd" type="checkbox" checked="checked" />
+				</div>
+			</div>
 
-function decrypt_change() {
+			<div class="form-group">
+				<label for="encrypt" class="col-sm-2 control-label"><?=gettext("Encrypt this configuration file.")?></label>
+				<div class="col-sm-10">
+					<input name="encrypt" type="checkbox" data-toggle="collapse" href="#encryptOptions" aria-expanded="false" aria-controls="encryptOptions" />
 
-	if (!document.iform.decrypt.checked)
-		document.getElementById("decrypt_opts").style.display="none";
-	else
-		document.getElementById("decrypt_opts").style.display="";
-}
+					<div class="collapse"id="encryptOptions">
+						<input name="encrypt_password" type="password" placeholder="Password" /><br/>
+						<input name="encrypt_passconf" type="password" placeholder="Confirm password" />
+					</div>
+				</div>
+			</div>
 
-function backuparea_change(obj) {
-	if (obj.value == "rrddata") {
-		document.getElementById("nopackages").disabled      = true;
-		document.getElementById("dotnotbackuprrd").disabled = true;
-	} else {
-		document.getElementById("nopackages").disabled      = false;
-		document.getElementById("dotnotbackuprrd").disabled = false;
-	}
-}
-//]]>
-</script>
-
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-<?php if ($savemsg) print_info_box($savemsg); ?>
-<?php if (is_subsystem_dirty('restore')): ?><br/>
-<form action="reboot.php" method="post">
-<input name="Submit" type="hidden" value="Yes" />
-<?php print_info_box(gettext("The firewall configuration has been changed.") . "<br />" . gettext("The firewall is now rebooting."));?><br />
+			<input name="Submit" type="submit" class="btn btn-default" value="<?=gettext("Download configuration as XML")?>" />
 </form>
-<?php endif; ?>
+
 <form action="diag_backup.php" method="post" name="iform" enctype="multipart/form-data">
-<table width="100%" border="0" cellspacing="0" cellpadding="0" summary="diag backup">
-	<tr>
-		<td>
-<?php
-		$tab_array = array();
-		$tab_array[0] = array(gettext("Config History"), false, "diag_confbak.php");
-		$tab_array[1] = array(gettext("Backup/Restore"), true, "diag_backup.php");
-		display_top_tabs($tab_array);
-?>
-		</td>
-	</tr>
-	<tr>
-		<td>
-			<div id="mainarea">
-			<table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
 				<tr>
-					<td colspan="2" class="listtopic"><?=gettext("Backup configuration"); ?></td>
+					<td><?=gettext("Restore configuration")?></td>
 				</tr>
 				<tr>
-					<td width="22%" valign="baseline" class="vncell">&nbsp;</td>
-					<td width="78%" class="vtable">
-						<p><?=gettext("Click this button to download the system configuration in XML format."); ?><br /><br /> <?=gettext("Backup area:"); ?> <?php spit_out_select_items("backuparea", false); ?></p>
-						<table>
-							<tr>
-								<td>
-									<input name="nopackages" type="checkbox" class="formcheckbox" id="nopackages" />
-								</td>
-								<td>
-									<span class="vexpl"><?=gettext("Do not backup package information."); ?></span>
-								</td>
-							</tr>
-						</table>
-						<table>
-							<tr>
-								<td>
-									<input name="encrypt" type="checkbox" class="formcheckbox" id="nopackages" onclick="encrypt_change()" />
-								</td>
-								<td>
-									<span class="vexpl"><?=gettext("Encrypt this configuration file."); ?></span>
-								</td>
-							</tr>
-							<tr>
-								<td>
-									<input name="donotbackuprrd" type="checkbox" class="formcheckbox" id="dotnotbackuprrd" checked="checked" />
-								</td>
-								<td>
-									<span class="vexpl"><?=gettext("Do not backup RRD data (NOTE: RRD Data can consume 4+ megabytes of config.xml space!)"); ?></span>
-								</td>
-							</tr>
-						</table>
-						<table id="encrypt_opts">
-							<tr>
-								<td>
-									<span class="vexpl"><?=gettext("Password:"); ?> </span>
-								</td>
-								<td>
-									<input name="encrypt_password" type="password" class="formfld pwd" size="20" value="" />
-								</td>
-							</tr>
-							<tr>
-								<td>
-									<span class="vexpl"><?=gettext("confirm:"); ?> </span>
-								</td>
-								<td>
-									<input name="encrypt_passconf" type="password" class="formfld pwd" size="20" value="" />
-								</td>
-							</tr>
-						</table>
-						<p><input name="Submit" type="submit" class="formbtn" id="download" value="<?=gettext("Download configuration"); ?>" /></p>
-					</td>
-				</tr>
-				<tr>
-					<td colspan="2" class="list" height="12">&nbsp;</td>
-				</tr>
-				<tr>
-					<td colspan="2" class="listtopic"><?=gettext("Restore configuration"); ?></td>
-				</tr>
-				<tr>
-					<td width="22%" valign="baseline" class="vncell">&nbsp;</td>
-					<td width="78%" class="vtable">
-						<?=gettext("Open a"); ?> <?=$g['[product_name']?> <?=gettext("configuration XML file and click the button below to restore the configuration."); ?>
+					<td>&nbsp;</td>
+					<td>
+						<?=gettext("Open a")?><?=$g['[product_name']?><?=gettext("configuration XML file and click the button below to restore the configuration.")?>
 						<br /><br />
-						<?=gettext("Restore area:"); ?> <?php spit_out_select_items("restorearea", true); ?>
+						<?=gettext("Restore area:")?><?php spit_out_select_items("restorearea", true)?>
 						<p><input name="conffile" type="file" class="formbtn" id="conffile" size="40" /></p>
 						<table>
 							<tr>
@@ -727,14 +652,14 @@ function backuparea_change(obj) {
 									<input name="decrypt" type="checkbox" class="formcheckbox" id="nopackages" onclick="decrypt_change()" />
 								</td>
 								<td>
-									<span class="vexpl"><?=gettext("Configuration file is encrypted."); ?></span>
+									<span><?=gettext("Configuration file is encrypted.")?></span>
 								</td>
 							</tr>
 						</table>
-						<table id="decrypt_opts">
+						<table>
 							<tr>
 								<td>
-									<span class="vexpl"><?=gettext("Password :"); ?></span>
+									<span><?=gettext("Password :")?></span>
 								</td>
 								<td>
 									<input name="decrypt_password" type="password" class="formfld pwd" size="20" value="" />
@@ -742,41 +667,41 @@ function backuparea_change(obj) {
 							</tr>
 							<tr>
 								<td>
-									<span class="vexpl"><?=gettext("confirm :"); ?></span>
+									<span><?=gettext("confirm :")?></span>
 								</td>
 								<td>
 									<input name="decrypt_passconf" type="password" class="formfld pwd" size="20" value="" />
 								</td>
 							</tr>
 						</table>
-						<p><input name="Submit" type="submit" class="formbtn" id="restore" value="<?=gettext("Restore configuration"); ?>" /></p>
-						<p><strong><span class="red"><?=gettext("Note:"); ?></span></strong><br /><?=gettext("The firewall will reboot after restoring the configuration."); ?><br /></p>
+						<p><input name="Submit" type="submit" class="formbtn" id="restore" value="<?=gettext("Restore configuration")?>" /></p>
+						<p><strong><span><?=gettext("Note:")?></span></strong><br /><?=gettext("The firewall will reboot after restoring the configuration.")?><br /></p>
 					</td>
 				</tr>
-				<?php if (($config['installedpackages']['package'] != "") || (is_subsystem_dirty("packagelock"))) { ?>
+				<?php if (($config['installedpackages']['package'] != "") || (is_subsystem_dirty("packagelock"))) {?>
 				<tr>
-					<td colspan="2" class="list" height="12">&nbsp;</td>
+					<td>&nbsp;</td>
 				</tr>
 				<tr>
-					<td colspan="2" class="listtopic"><?=gettext("Package Functions"); ?></td>
+					<td><?=gettext("Package Functions")?></td>
 				</tr>
 				<tr>
-					<td width="22%" valign="baseline" class="vncell">&nbsp;</td>
-					<td width="78%" class="vtable">
-						<?php if ($config['installedpackages']['package'] != "") { ?>
-							<p><?=gettext("Click this button to reinstall all system packages.  This may take a while."); ?> <br /><br />
-							<input name="Submit" type="submit" class="formbtn" id="reinstallpackages" value="<?=gettext("Reinstall packages"); ?>" />
+					<td>&nbsp;</td>
+					<td>
+						<?php if ($config['installedpackages']['package'] != "") {?>
+							<p><?=gettext("Click this button to reinstall all system packages.  This may take a while.")?><br /><br />
+							<input name="Submit" type="submit" class="formbtn" id="reinstallpackages" value="<?=gettext("Reinstall packages")?>" />
 							<br />
 							<br />
-						<?php } ?>
-						<?php if (is_subsystem_dirty("packagelock")) { ?>
-							<p><?=gettext("Click this button to clear the package lock if a package fails to reinstall properly after an upgrade."); ?> <br /><br />
-							<input name="Submit" type="submit" class="formbtn" id="clearpackagelock" value="<?=gettext("Clear Package Lock"); ?>" />
-						<?php } ?>
+						<?php }?>
+						<?php if (is_subsystem_dirty("packagelock")) {?>
+							<p><?=gettext("Click this button to clear the package lock if a package fails to reinstall properly after an upgrade.")?><br /><br />
+							<input name="Submit" type="submit" class="formbtn" id="clearpackagelock" value="<?=gettext("Clear Package Lock")?>" />
+						<?php }?>
 							</p>
 					</td>
 				</tr>
-				<?php } ?>
+				<?php }?>
 			</table>
 			</div>
 		</td>
@@ -784,19 +709,11 @@ function backuparea_change(obj) {
 </table>
 </form>
 
-<script type="text/javascript">
-//<![CDATA[
-encrypt_change();
-decrypt_change();
-//]]>
-</script>
-
-<?php include("fend.inc"); ?>
+<?php include("fend.inc")?>
 </body>
 </html>
 <?php
 
 if (is_subsystem_dirty('restore'))
 	system_reboot();
-
-?>
+?>
\ No newline at end of file
diff --git a/usr/local/www/fend.inc b/usr/local/www/fend.inc
index 9982130813..10544fdbf0 100755
--- a/usr/local/www/fend.inc
+++ b/usr/local/www/fend.inc
@@ -15,4 +15,5 @@
 </footer>
 
 <script src="/jquery/jquery-1.11.1.min.js"></script>
+<script src="/jquery/jquery-ui-1.11.2.min.js"></script>
 <script src="/bootstrap/js/bootstrap.min.js"></script>
\ No newline at end of file
diff --git a/usr/local/www/firewall_nat.php b/usr/local/www/firewall_nat.php
index 0a373ba1a7..56451f9383 100644
--- a/usr/local/www/firewall_nat.php
+++ b/usr/local/www/firewall_nat.php
@@ -108,7 +108,7 @@ if (isset($_POST['del_x'])) {
 			// Check for filter rule associations
 			if (isset($a_nat[$rulei]['associated-rule-id'])){
 				delete_id($a_nat[$rulei]['associated-rule-id'], $config['filter']['rule']);
-				
+
 				mark_subsystem_dirty('filter');
 			}
 	        unset($a_nat[$rulei]);
@@ -172,6 +172,7 @@ echo "<script type=\"text/javascript\" src=\"/javascript/domTT/domTT.js\"></scri
 echo "<script type=\"text/javascript\" src=\"/javascript/domTT/behaviour.js\"></script>";
 echo "<script type=\"text/javascript\" src=\"/javascript/domTT/fadomatic.js\"></script>";
 
+//FIXME This largely matches firewall_rules.php
 ?>
 </head>
 
@@ -226,8 +227,8 @@ echo "<script type=\"text/javascript\" src=\"/javascript/domTT/fadomatic.js\"></
 		  </td>
 		</tr>
 	<?php $nnats = $i = 0; foreach ($a_nat as $natent): ?>
-	<?php 
-	
+	<?php
+
 		//build Alias popup box
 		$span_end = "</U></span>";
 
@@ -257,9 +258,9 @@ echo "<script type=\"text/javascript\" src=\"/javascript/domTT/fadomatic.js\"></
 			$textss = "<span>";
 
 		$textse = "</span>";
-	
+
 		/* if user does not have access to edit an interface skip on to the next record */
-		if(!have_natpfruleint_access($natent['interface'])) 
+		if(!have_natpfruleint_access($natent['interface']))
 			continue;
 	?>
                 <tr valign="top" id="fr<?=$nnats;?>">
diff --git a/usr/local/www/firewall_nat_out.php b/usr/local/www/firewall_nat_out.php
index 23bf8fe7c1..077db6736c 100644
--- a/usr/local/www/firewall_nat_out.php
+++ b/usr/local/www/firewall_nat_out.php
@@ -214,6 +214,8 @@ if (isset($_POST['del_x'])) {
 $pgtitle = array(gettext("Firewall"),gettext("NAT"),gettext("Outbound"));
 include("head.inc");
 
+//FIXME This largely matches firewall_rules.php
+
 ?>
 <body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc
index ed2934b432..76e236ba80 100644
--- a/usr/local/www/guiconfig.inc
+++ b/usr/local/www/guiconfig.inc
@@ -1064,6 +1064,18 @@ function rule_columns_with_alias($src, $srcport, $dst, $dstport){
 	}
 }
 
+function form_output_row($name, $label, $content){
+var_dump($content);die;
+?>
+<div class="form-group">
+	<label for="<?=$name?>" class="col-sm-2 control-label"><?=gettext($label); ?></label>
+	<div class="col-sm-10">
+		<?=$content?>
+	</div>
+</div>
+<?php
+}
+
 $timezone = $config['system']['timezone'];
 if (!$timezone)
 	$timezone = "Etc/UTC";
diff --git a/usr/local/www/index.php b/usr/local/www/index.php
index b56046d1b6..2c36efd68a 100644
--- a/usr/local/www/index.php
+++ b/usr/local/www/index.php
@@ -258,17 +258,20 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard");
 <div class="panel panel-default">
 	<div class="panel-heading"><h3><?=gettext("Available Widgets"); ?></h3></div>
 	<div class="panel-body">
-<?php
-	foreach($widgets as $widgetname => $widgetconfig):
-?>
+<?php foreach($widgets as $widgetname => $widgetconfig): ?>
 		<div class="col-sm-3"><a href="#"><i class="icon icon-plus"></i> <?=$widgetconfig['name']?></a></div>
 <?php endforeach; ?>
 	</div>
 </div>
 
-<div class="panel panel-default">
-	<div class="panel-heading"><h3><?=gettext("Welcome to the Dashboard page"); ?>!</h3></div>
-	<div class="panel-body">
+<div class="modal fade">
+<div class="modal-dialog">
+<div class="modal-content">
+	<div class="modal-header">
+		<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
+		<h4 class="modal-title"><?=gettext("Welcome to the Dashboard page"); ?>!</h4>
+	</div>
+	<div class="modal-body">
 		<p>
 			<?=gettext("This page allows you to customize the information you want to be displayed!");?>
 			<?=gettext("To get started click the");?> FIXME <?=gettext("icon to add widgets.");?><br />
@@ -276,6 +279,11 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard");
 			<?=gettext("You can move any widget around by clicking and dragging the title.");?>
 		</p>
 	</div>
+	<div class="modal-footer">
+		<button type="button" class="btn btn-default btn-primary" data-dismiss="modal">Close</button>
+	</div>
+</div>
+</div>
 </div>
 
 <?php
@@ -288,12 +296,17 @@ foreach ($widgets as $widgetname => $widgetconfig){
 				<?=$widgetconfig['name']?>
 				<span style="float: right">
 					<a href="#"><i class="icon icon-wrench"></i></a>
-					<a href="#"><i class="icon icon-plus-sign"></i></a>
-					<a href="#"><i class="icon icon-minus-sign"></i></a>
+					<a data-toggle="collapse" href="#widget-<?=$widgetname?>">
+						<?php if ($widgetconfig['display'] == 'close'): ?>
+							<i class="icon icon-plus-sign"></i>
+						<?php else: ?>
+							<i class="icon icon-minus-sign"></i>
+						<?php endif; ?>
+					</a>
 					<a href="#"><i class="icon icon-remove-sign"></i></a>
 				</span>
 			</div>
-			<div class="panel-body">
+			<div class="panel-body collapse<?=($widgetconfig['display']=='close' ? '' : ' in')?>" id="widget-<?=$widgetname?>">
 				<?php include('/usr/local/www/widgets/widgets/'. $widgetname.'.widget.php'); ?>
 			</div>
 		</div>
diff --git a/usr/local/www/jquery/jquery-ui-1.11.2.min.js b/usr/local/www/jquery/jquery-ui-1.11.2.min.js
new file mode 100644
index 0000000000..737b4c4e21
--- /dev/null
+++ b/usr/local/www/jquery/jquery-ui-1.11.2.min.js
@@ -0,0 +1,7 @@
+/*! jQuery UI - v1.11.2 - 2015-01-03
+* http://jqueryui.com
+* Includes: core.js, widget.js, mouse.js, draggable.js, droppable.js, selectable.js
+* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
+
+(function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){function t(t,s){var n,a,o,r=t.nodeName.toLowerCase();return"area"===r?(n=t.parentNode,a=n.name,t.href&&a&&"map"===n.nodeName.toLowerCase()?(o=e("img[usemap='#"+a+"']")[0],!!o&&i(o)):!1):(/input|select|textarea|button|object/.test(r)?!t.disabled:"a"===r?t.href||s:s)&&i(t)}function i(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}e.ui=e.ui||{},e.extend(e.ui,{version:"1.11.2",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({scrollParent:function(t){var i=this.css("position"),s="absolute"===i,n=t?/(auto|scroll|hidden)/:/(auto|scroll)/,a=this.parents().filter(function(){var t=e(this);return s&&"static"===t.css("position")?!1:n.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==i&&a.length?a:e(this[0].ownerDocument||document)},uniqueId:function(){var e=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,s){return!!e.data(t,s[3])},focusable:function(i){return t(i,!isNaN(e.attr(i,"tabindex")))},tabbable:function(i){var s=e.attr(i,"tabindex"),n=isNaN(s);return(n||s>=0)&&t(i,!n)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(t,i){function s(t,i,s,a){return e.each(n,function(){i-=parseFloat(e.css(t,"padding"+this))||0,s&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),a&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],a=i.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+i]=function(t){return void 0===t?o["inner"+i].call(this):this.each(function(){e(this).css(a,s(this,t)+"px")})},e.fn["outer"+i]=function(t,n){return"number"!=typeof t?o["outer"+i].call(this,t):this.each(function(){e(this).css(a,s(this,t,!0,n)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(i,s){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),s&&s.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function(){var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(e+".ui-disableSelection",function(e){e.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(void 0!==t)return this.css("zIndex",t);if(this.length)for(var i,s,n=e(this[0]);n.length&&n[0]!==document;){if(i=n.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(s=parseInt(n.css("zIndex"),10),!isNaN(s)&&0!==s))return s;n=n.parent()}return 0}}),e.ui.plugin={add:function(t,i,s){var n,a=e.ui[t].prototype;for(n in s)a.plugins[n]=a.plugins[n]||[],a.plugins[n].push([i,s[n]])},call:function(e,t,i,s){var n,a=e.plugins[t];if(a&&(s||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(n=0;a.length>n;n++)e.options[a[n][0]]&&a[n][1].apply(e.element,i)}};var s=0,n=Array.prototype.slice;e.cleanData=function(t){return function(i){var s,n,a;for(a=0;null!=(n=i[a]);a++)try{s=e._data(n,"events"),s&&s.remove&&e(n).triggerHandler("remove")}catch(o){}t(i)}}(e.cleanData),e.widget=function(t,i,s){var n,a,o,r,h={},l=t.split(".")[0];return t=t.split(".")[1],n=l+"-"+t,s||(s=i,i=e.Widget),e.expr[":"][n.toLowerCase()]=function(t){return!!e.data(t,n)},e[l]=e[l]||{},a=e[l][t],o=e[l][t]=function(e,t){return this._createWidget?(arguments.length&&this._createWidget(e,t),void 0):new o(e,t)},e.extend(o,a,{version:s.version,_proto:e.extend({},s),_childConstructors:[]}),r=new i,r.options=e.widget.extend({},r.options),e.each(s,function(t,s){return e.isFunction(s)?(h[t]=function(){var e=function(){return i.prototype[t].apply(this,arguments)},n=function(e){return i.prototype[t].apply(this,e)};return function(){var t,i=this._super,a=this._superApply;return this._super=e,this._superApply=n,t=s.apply(this,arguments),this._super=i,this._superApply=a,t}}(),void 0):(h[t]=s,void 0)}),o.prototype=e.widget.extend(r,{widgetEventPrefix:a?r.widgetEventPrefix||t:t},h,{constructor:o,namespace:l,widgetName:t,widgetFullName:n}),a?(e.each(a._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete a._childConstructors):i._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){for(var i,s,a=n.call(arguments,1),o=0,r=a.length;r>o;o++)for(i in a[o])s=a[o][i],a[o].hasOwnProperty(i)&&void 0!==s&&(t[i]=e.isPlainObject(s)?e.isPlainObject(t[i])?e.widget.extend({},t[i],s):e.widget.extend({},s):s);return t},e.widget.bridge=function(t,i){var s=i.prototype.widgetFullName||t;e.fn[t]=function(a){var o="string"==typeof a,r=n.call(arguments,1),h=this;return a=!o&&r.length?e.widget.extend.apply(null,[a].concat(r)):a,o?this.each(function(){var i,n=e.data(this,s);return"instance"===a?(h=n,!1):n?e.isFunction(n[a])&&"_"!==a.charAt(0)?(i=n[a].apply(n,r),i!==n&&void 0!==i?(h=i&&i.jquery?h.pushStack(i.get()):i,!1):void 0):e.error("no such method '"+a+"' for "+t+" widget instance"):e.error("cannot call methods on "+t+" prior to initialization; "+"attempted to call method '"+a+"'")}):this.each(function(){var t=e.data(this,s);t?(t.option(a||{}),t._init&&t._init()):e.data(this,s,new i(a,this))}),h}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=s++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=e(),this.hoverable=e(),this.focusable=e(),i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy()}}),this.document=e(i.style?i.ownerDocument:i.document||i),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(t,i){var s,n,a,o=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(o={},s=t.split("."),t=s.shift(),s.length){for(n=o[t]=e.widget.extend({},this.options[t]),a=0;s.length-1>a;a++)n[s[a]]=n[s[a]]||{},n=n[s[a]];if(t=s.pop(),1===arguments.length)return void 0===n[t]?null:n[t];n[t]=i}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=i}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!t),t&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(t,i,s){var n,a=this;"boolean"!=typeof t&&(s=i,i=t,t=!1),s?(i=n=e(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),e.each(s,function(s,o){function r(){return t||a.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?a[o]:o).apply(a,arguments):void 0}"string"!=typeof o&&(r.guid=o.guid=o.guid||r.guid||e.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+a.eventNamespace,u=h[2];u?n.delegate(u,l,r):i.bind(l,r)})},_off:function(t,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(i).undelegate(i),this.bindings=e(this.bindings.not(t).get()),this.focusable=e(this.focusable.not(t).get()),this.hoverable=e(this.hoverable.not(t).get())},_delay:function(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var n,a,o=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],a=i.originalEvent)for(n in a)n in i||(i[n]=a[n]);return this.element.trigger(i,s),!(e.isFunction(o)&&o.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,n,a){"string"==typeof n&&(n={effect:n});var o,r=n?n===!0||"number"==typeof n?i:n.effect||i:t;n=n||{},"number"==typeof n&&(n={duration:n}),o=!e.isEmptyObject(n),n.complete=a,n.delay&&s.delay(n.delay),o&&e.effects&&e.effects.effect[r]?s[t](n):r!==t&&s[r]?s[r](n.duration,n.easing,a):s.queue(function(i){e(this)[t](),a&&a.call(s[0]),i()})}}),e.widget;var a=!1;e(document).mouseup(function(){a=!1}),e.widget("ui.mouse",{version:"1.11.2",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!a){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var i=this,s=1===t.which,n="string"==typeof this.options.cancel&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(t)!==!1,!this._mouseStarted)?(t.preventDefault(),!0):(!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return i._mouseMove(e)},this._mouseUpDelegate=function(e){return i._mouseUp(e)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),a=!0,!0)):!0}},_mouseMove:function(t){if(this._mouseMoved){if(e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button)return this._mouseUp(t);if(!t.which)return this._mouseUp(t)}return(t.which||t.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),a=!1,!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),e.widget("ui.draggable",e.ui.mouse,{version:"1.11.2",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._setHandleClassName(),this._mouseInit()},_setOption:function(e,t){this._super(e,t),"handle"===e&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(t){var i=this.options;return this._blurActiveElement(t),this.helper||i.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(t){this.iframeBlocks=this.document.find(t).map(function(){var t=e(this);return e("<div>").css("position","absolute").appendTo(t.parent()).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(t){var i=this.document[0];if(this.handleElement.is(t.target))try{i.activeElement&&"body"!==i.activeElement.nodeName.toLowerCase()&&e(i.activeElement).blur()}catch(s){}},_mouseStart:function(t){var i=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===e(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(t),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._normalizeRightBottom(),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_refreshOffsets:function(e){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:e.pageX-this.offset.left,top:e.pageY-this.offset.top}},_mouseDrag:function(t,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",t,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var i=this,s=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(s=e.ui.ddmanager.drop(this,t)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",t)!==!1&&i._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1},_mouseUp:function(t){return this._unblockFrames(),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),this.handleElement.is(t.target)&&this.element.focus(),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this.handleElement.addClass("ui-draggable-handle")},_removeHandleClassName:function(){this.handleElement.removeClass("ui-draggable-handle")},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper),n=s?e(i.helper.apply(this.element[0],[t])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(e){return/(html|body)/i.test(e.tagName)||e===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var e=this.element.position(),t=this._isRootNode(this.scrollParent[0]);return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+(t?0:this.scrollParent.scrollTop()),left:e.left-(parseInt(this.helper.css("left"),10)||0)+(t?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,n=this.options,a=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||a.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,e(a).width()-this.helperProportions.width-this.margins.left,(e(a).height()||a.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=e(n.containment),s=i[0],s&&(t=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(t?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0)},_convertPositionTo:function(e,t){t||(t=this.position);var i="absolute"===e?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:t.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:t.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(e,t){var i,s,n,a,o=this.options,r=this._isRootNode(this.scrollParent[0]),h=e.pageX,l=e.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),t&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,e.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),e.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),e.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),e.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),o.grid&&(n=o.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-o.grid[1]:n+o.grid[1]:n,a=o.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,h=i?a-this.offset.click.left>=i[0]||a-this.offset.click.left>i[2]?a:a-this.offset.click.left>=i[0]?a-o.grid[0]:a+o.grid[0]:a),"y"===o.axis&&(h=this.originalPageX),"x"===o.axis&&(l=this.originalPageY)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_normalizeRightBottom:function(){"y"!==this.options.axis&&"auto"!==this.helper.css("right")&&(this.helper.width(this.helper.width()),this.helper.css("right","auto")),"x"!==this.options.axis&&"auto"!==this.helper.css("bottom")&&(this.helper.height(this.helper.height()),this.helper.css("bottom","auto"))},_trigger:function(t,i,s){return s=s||this._uiHash(),e.ui.plugin.call(this,t,[i,s,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),e.Widget.prototype._trigger.call(this,t,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,i,s){var n=e.extend({},i,{item:s.element});s.sortables=[],e(s.options.connectToSortable).each(function(){var i=e(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",t,n))})},stop:function(t,i,s){var n=e.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,e.each(s.sortables,function(){var e=this;e.isOver?(e.isOver=0,s.cancelHelperRemoval=!0,e.cancelHelperRemoval=!1,e._storedCSS={position:e.placeholder.css("position"),top:e.placeholder.css("top"),left:e.placeholder.css("left")},e._mouseStop(t),e.options.helper=e.options._helper):(e.cancelHelperRemoval=!0,e._trigger("deactivate",t,n))})},drag:function(t,i,s){e.each(s.sortables,function(){var n=!1,a=this;a.positionAbs=s.positionAbs,a.helperProportions=s.helperProportions,a.offset.click=s.offset.click,a._intersectsWith(a.containerCache)&&(n=!0,e.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==a&&this._intersectsWith(this.containerCache)&&e.contains(a.element[0],this.element[0])&&(n=!1),n})),n?(a.isOver||(a.isOver=1,a.currentItem=i.helper.appendTo(a.element).data("ui-sortable-item",!0),a.options._helper=a.options.helper,a.options.helper=function(){return i.helper[0]},t.target=a.currentItem[0],a._mouseCapture(t,!0),a._mouseStart(t,!0,!0),a.offset.click.top=s.offset.click.top,a.offset.click.left=s.offset.click.left,a.offset.parent.left-=s.offset.parent.left-a.offset.parent.left,a.offset.parent.top-=s.offset.parent.top-a.offset.parent.top,s._trigger("toSortable",t),s.dropped=a.element,e.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,a.fromOutside=s),a.currentItem&&(a._mouseDrag(t),i.position=a.position)):a.isOver&&(a.isOver=0,a.cancelHelperRemoval=!0,a.options._revert=a.options.revert,a.options.revert=!1,a._trigger("out",t,a._uiHash(a)),a._mouseStop(t,!0),a.options.revert=a.options._revert,a.options.helper=a.options._helper,a.placeholder&&a.placeholder.remove(),s._refreshOffsets(t),i.position=s._generatePosition(t,!0),s._trigger("fromSortable",t),s.dropped=!1,e.each(s.sortables,function(){this.refreshPositions()}))})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,i,s){var n=e("body"),a=s.options;n.css("cursor")&&(a._cursor=n.css("cursor")),n.css("cursor",a.cursor)},stop:function(t,i,s){var n=s.options;n._cursor&&e("body").css("cursor",n._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,i,s){var n=e(i.helper),a=s.options;n.css("opacity")&&(a._opacity=n.css("opacity")),n.css("opacity",a.opacity)},stop:function(t,i,s){var n=s.options;n._opacity&&e(i.helper).css("opacity",n._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(e,t,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(t,i,s){var n=s.options,a=!1,o=s.scrollParentNotHidden[0],r=s.document[0];o!==r&&"HTML"!==o.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+o.offsetHeight-t.pageY<n.scrollSensitivity?o.scrollTop=a=o.scrollTop+n.scrollSpeed:t.pageY-s.overflowOffset.top<n.scrollSensitivity&&(o.scrollTop=a=o.scrollTop-n.scrollSpeed)),n.axis&&"y"===n.axis||(s.overflowOffset.left+o.offsetWidth-t.pageX<n.scrollSensitivity?o.scrollLeft=a=o.scrollLeft+n.scrollSpeed:t.pageX-s.overflowOffset.left<n.scrollSensitivity&&(o.scrollLeft=a=o.scrollLeft-n.scrollSpeed))):(n.axis&&"x"===n.axis||(t.pageY-e(r).scrollTop()<n.scrollSensitivity?a=e(r).scrollTop(e(r).scrollTop()-n.scrollSpeed):e(window).height()-(t.pageY-e(r).scrollTop())<n.scrollSensitivity&&(a=e(r).scrollTop(e(r).scrollTop()+n.scrollSpeed))),n.axis&&"y"===n.axis||(t.pageX-e(r).scrollLeft()<n.scrollSensitivity?a=e(r).scrollLeft(e(r).scrollLeft()-n.scrollSpeed):e(window).width()-(t.pageX-e(r).scrollLeft())<n.scrollSensitivity&&(a=e(r).scrollLeft(e(r).scrollLeft()+n.scrollSpeed)))),a!==!1&&e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(s,t)}}),e.ui.plugin.add("draggable","snap",{start:function(t,i,s){var n=s.options;s.snapElements=[],e(n.snap.constructor!==String?n.snap.items||":data(ui-draggable)":n.snap).each(function(){var t=e(this),i=t.offset();this!==s.element[0]&&s.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:i.top,left:i.left})})},drag:function(t,i,s){var n,a,o,r,h,l,u,d,c,p,f=s.options,m=f.snapTolerance,g=i.offset.left,v=g+s.helperProportions.width,y=i.offset.top,b=y+s.helperProportions.height;for(c=s.snapElements.length-1;c>=0;c--)h=s.snapElements[c].left-s.margins.left,l=h+s.snapElements[c].width,u=s.snapElements[c].top-s.margins.top,d=u+s.snapElements[c].height,h-m>v||g>l+m||u-m>b||y>d+m||!e.contains(s.snapElements[c].item.ownerDocument,s.snapElements[c].item)?(s.snapElements[c].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=!1):("inner"!==f.snapMode&&(n=m>=Math.abs(u-b),a=m>=Math.abs(d-y),o=m>=Math.abs(h-v),r=m>=Math.abs(l-g),n&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.top=s._convertPositionTo("relative",{top:d,left:0}).top),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left)),p=n||a||o||r,"outer"!==f.snapMode&&(n=m>=Math.abs(u-y),a=m>=Math.abs(d-b),o=m>=Math.abs(h-g),r=m>=Math.abs(l-v),n&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.top=s._convertPositionTo("relative",{top:d-s.helperProportions.height,left:0}).top),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left)),!s.snapElements[c].snapping&&(n||a||o||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=n||a||o||r||p)}}),e.ui.plugin.add("draggable","stack",{start:function(t,i,s){var n,a=s.options,o=e.makeArray(e(a.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0)});o.length&&(n=parseInt(e(o[0]).css("zIndex"),10)||0,e(o).each(function(t){e(this).css("zIndex",n+t)}),this.css("zIndex",n+o.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,i,s){var n=e(i.helper),a=s.options;n.css("zIndex")&&(a._zIndex=n.css("zIndex")),n.css("zIndex",a.zIndex)},stop:function(t,i,s){var n=s.options;n._zIndex&&e(i.helper).css("zIndex",n._zIndex)}}),e.ui.draggable,e.widget("ui.droppable",{version:"1.11.2",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,i=this.options,s=i.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(s)?s:function(e){return e.is(s)
+},this.proportions=function(){return arguments.length?(t=arguments[0],void 0):t?t:t={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(i.scope),i.addClasses&&this.element.addClass("ui-droppable")},_addToManager:function(t){e.ui.ddmanager.droppables[t]=e.ui.ddmanager.droppables[t]||[],e.ui.ddmanager.droppables[t].push(this)},_splice:function(e){for(var t=0;e.length>t;t++)e[t]===this&&e.splice(t,1)},_destroy:function(){var t=e.ui.ddmanager.droppables[this.options.scope];this._splice(t),this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,i){if("accept"===t)this.accept=e.isFunction(i)?i:function(e){return e.is(i)};else if("scope"===t){var s=e.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(i)}this._super(t,i)},_activate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",t,this.ui(i))},_deactivate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",t,this.ui(i))},_over:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(i)))},_out:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(i)))},_drop:function(t,i){var s=i||e.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var i=e(this).droppable("instance");return i.options.greedy&&!i.options.disabled&&i.options.scope===s.options.scope&&i.accept.call(i.element[0],s.currentItem||s.element)&&e.ui.intersect(s,e.extend(i,{offset:i.element.offset()}),i.options.tolerance,t)?(n=!0,!1):void 0}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(s)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(){function e(e,t,i){return e>=t&&t+i>e}return function(t,i,s,n){if(!i.offset)return!1;var a=(t.positionAbs||t.position.absolute).left+t.margins.left,o=(t.positionAbs||t.position.absolute).top+t.margins.top,r=a+t.helperProportions.width,h=o+t.helperProportions.height,l=i.offset.left,u=i.offset.top,d=l+i.proportions().width,c=u+i.proportions().height;switch(s){case"fit":return a>=l&&d>=r&&o>=u&&c>=h;case"intersect":return a+t.helperProportions.width/2>l&&d>r-t.helperProportions.width/2&&o+t.helperProportions.height/2>u&&c>h-t.helperProportions.height/2;case"pointer":return e(n.pageY,u,i.proportions().height)&&e(n.pageX,l,i.proportions().width);case"touch":return(o>=u&&c>=o||h>=u&&c>=h||u>o&&h>c)&&(a>=l&&d>=a||r>=l&&d>=r||l>a&&r>d);default:return!1}}}(),e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,i){var s,n,a=e.ui.ddmanager.droppables[t.options.scope]||[],o=i?i.type:null,r=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(s=0;a.length>s;s++)if(!(a[s].options.disabled||t&&!a[s].accept.call(a[s].element[0],t.currentItem||t.element))){for(n=0;r.length>n;n++)if(r[n]===a[s].element[0]){a[s].proportions().height=0;continue e}a[s].visible="none"!==a[s].element.css("display"),a[s].visible&&("mousedown"===o&&a[s]._activate.call(a[s],i),a[s].offset=a[s].element.offset(),a[s].proportions({width:a[s].element[0].offsetWidth,height:a[s].element[0].offsetHeight}))}},drop:function(t,i){var s=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance,i)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(t,i){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)})},drag:function(t,i){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,i),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,a,o=e.ui.intersect(t,this,this.options.tolerance,i),r=!o&&this.isover?"isout":o&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,a=this.element.parents(":data(ui-droppable)").filter(function(){return e(this).droppable("instance").options.scope===n}),a.length&&(s=e(a[0]).droppable("instance"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(t,i){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)}},e.ui.droppable,e.widget("ui.selectable",e.ui.mouse,{version:"1.11.2",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var t,i=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(i.options.filter,i.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),i=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:i.left,top:i.top,right:i.left+t.outerWidth(),bottom:i.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var i=this,s=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(s.filter,this.element[0]),this._trigger("start",t),e(s.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=e.data(this,"selectable-item");s.startselected=!0,t.metaKey||t.ctrlKey||(s.$element.removeClass("ui-selected"),s.selected=!1,s.$element.addClass("ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",t,{unselecting:s.element}))}),e(t.target).parents().addBack().each(function(){var s,n=e.data(this,"selectable-item");return n?(s=!t.metaKey&&!t.ctrlKey||!n.$element.hasClass("ui-selected"),n.$element.removeClass(s?"ui-unselecting":"ui-selected").addClass(s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",t,{selecting:n.element}):i._trigger("unselecting",t,{unselecting:n.element}),!1):void 0}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,a=this.opos[0],o=this.opos[1],r=t.pageX,h=t.pageY;return a>r&&(i=r,r=a,a=i),o>h&&(i=h,h=o,o=i),this.helper.css({left:a,top:o,width:r-a,height:h-o}),this.selectees.each(function(){var i=e.data(this,"selectable-item"),l=!1;i&&i.element!==s.element[0]&&("touch"===n.tolerance?l=!(i.left>r||a>i.right||i.top>h||o>i.bottom):"fit"===n.tolerance&&(l=i.left>a&&r>i.right&&i.top>o&&h>i.bottom),l?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,s._trigger("selecting",t,{selecting:i.element}))):(i.selecting&&((t.metaKey||t.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",t,{unselecting:i.element}))),i.selected&&(t.metaKey||t.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",t,{unselecting:i.element})))))}),!1}},_mouseStop:function(t){var i=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",t,{unselected:s.element})}),e(".ui-selecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-selecting").addClass("ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",t,{selected:s.element})}),this._trigger("stop",t),this.helper.remove(),!1}})});
\ No newline at end of file
diff --git a/usr/local/www/widgets/javascript/gmirror_status.js b/usr/local/www/widgets/javascript/gmirror_status.js
new file mode 100644
index 0000000000..ae3c5da7fe
--- /dev/null
+++ b/usr/local/www/widgets/javascript/gmirror_status.js
@@ -0,0 +1,14 @@
+function gmirrorStatusUpdateFromServer(){
+	$.ajax({
+		type: 'GET',
+		url: '/widgets/widgets/gmirror_status.widget.php',
+		dataType: 'html',
+		success: function(data){
+			$('#gmirror_status').html(data);
+		}
+	});
+}
+
+$(document).ready(function(){
+	setInterval('gmirrorStatusUpdateFromServer()', 60*1000);
+});
\ No newline at end of file
diff --git a/usr/local/www/widgets/javascript/ntp_status.js b/usr/local/www/widgets/javascript/ntp_status.js
index a837bdff57..bca6ea99ca 100644
--- a/usr/local/www/widgets/javascript/ntp_status.js
+++ b/usr/local/www/widgets/javascript/ntp_status.js
@@ -5,7 +5,6 @@ function ntpWidgetUpdateFromServer(){
 		data: 'updateme=yes',
 		dataType: 'html',
 		success: function(data){
-			console.log(data);
 			$('#ntp_status_widget').html(data);
 		}
 	});
@@ -15,7 +14,7 @@ function ntpWidgetUpdateDisplay(){
 	// Javascript handles overflowing
 	ntpServerTime.setSeconds(ntpServerTime.getSeconds()+1);
 
-	$('#ntpStatusClock').html(ntpServerTime);
+	$('#ntpStatusClock').html(ntpServerTime.toString());
 }
 
 $(document).ready(function(){
diff --git a/usr/local/www/widgets/widgets/gmirror_status.widget.php b/usr/local/www/widgets/widgets/gmirror_status.widget.php
index f9711eb0dd..c692ad7156 100644
--- a/usr/local/www/widgets/widgets/gmirror_status.widget.php
+++ b/usr/local/www/widgets/widgets/gmirror_status.widget.php
@@ -32,21 +32,7 @@ $nocsrf = true;
 require_once("guiconfig.inc");
 require_once("gmirror.inc");
 
-if ($_GET['textonly'] == "true") {
-	header("Cache-Control: no-cache");
-	echo gmirror_html_status();
-	exit;
-}
 ?>
-<table>
-	<tbody id="gmirror_status_table">
-		<?php echo gmirror_html_status(); ?>
-	</tbody>
-</table>
-
-<script type="text/javascript">
-//<![CDATA[
-	var gmirrorupdater = new Ajax.PeriodicalUpdater('gmirror_status_table', '/widgets/widgets/gmirror_status.widget.php?textonly=true',
-	{ method: 'get', frequency: 5 } );
-//]]>
-</script>
+<div id="gmirror_status">
+	<?=gmirror_html_status()?>
+</div>
\ No newline at end of file
diff --git a/usr/local/www/widgets/widgets/ntp_status.widget.php b/usr/local/www/widgets/widgets/ntp_status.widget.php
index fb608d5c1d..adaea63df8 100644
--- a/usr/local/www/widgets/widgets/ntp_status.widget.php
+++ b/usr/local/www/widgets/widgets/ntp_status.widget.php
@@ -140,7 +140,7 @@ if (isset($config['ntpd']['gps']['type']) && ($config['ntpd']['gps']['type'] ==
 		<td id="ntpStatusClock">
 			<script>var ntpServerTime = new Date('<?=date_format(date_create(), 'c')?>');</script>
 			<!-- display initial value before javascript takes over -->
-			<?=date_format(date_create(), 'D j Y H:i:s \G\M\T O (T)');?>
+			<?=gmdate('D j Y H:i:s \G\M\T O (T)');?>
 		</td>
 	</tr>
 	<tr>
diff --git a/usr/local/www/widgets/widgets/services_status.widget.php b/usr/local/www/widgets/widgets/services_status.widget.php
index 823c0256e0..7ece14e9ad 100644
--- a/usr/local/www/widgets/widgets/services_status.widget.php
+++ b/usr/local/www/widgets/widgets/services_status.widget.php
@@ -60,6 +60,7 @@ if(isset($_POST['servicestatusfilter'])) {
 <table class="table table-striped">
 <thead>
 	<tr>
+		<th></th>
 		<th>Service</td>
 		<th>Description</td>
 		<th>Action</td>
@@ -81,7 +82,8 @@ if (count($services) > 0) {
 		$service_desc = explode(".",$service['description']);
 ?>
 		<tr>
-			<th><i class="icon icon-<?=get_service_status($service)? 'ok' : 'remove'?>"></i> <?=$service['name']?></th>
+			<td><i class="icon icon-<?=get_service_status($service)? 'ok' : 'remove'?>-sign"></i></td>
+			<td><?=$service['name']?></td>
 			<td><?=$service_desc[0]?></td>
 			<td><?=get_service_control_links($service)?></td>
 		</tr>
diff --git a/usr/local/www/widgets/widgets/smart_status.widget.php b/usr/local/www/widgets/widgets/smart_status.widget.php
index 1a18a46807..f350308edb 100644
--- a/usr/local/www/widgets/widgets/smart_status.widget.php
+++ b/usr/local/www/widgets/widgets/smart_status.widget.php
@@ -33,43 +33,45 @@ require_once("functions.inc");
 require_once("/usr/local/www/widgets/include/smart_status.inc");
 ?>
 
-<table>
-	<tr>
-		<td class="widgetsubheader" align="center"><b><?php echo gettext("Drive") ?></b></td>
-		<td class="widgetsubheader" align="center"><b><?php echo gettext("Ident") ?></b></td>
-		<td class="widgetsubheader" align="center"><b><?php echo gettext("SMART Status") ?></b></td>
-	</tr>
-
+<table class="table table-striped">
+	<thead>
+		<tr>
+			<th></th>
+			<th><?=gettext("Drive")?></th>
+			<th><?=gettext("Ident")?></th>
+			<th><?=gettext("SMART Status")?></th>
+		</tr>
+	</thead>
+	<tbody>
 <?php
 $devs = array();
 ## Get all adX, daX, and adaX (IDE, SCSI, and AHCI) devices currently installed
 $devs = get_smart_drive_list();
 
-if(count($devs) > 0)  {
-	foreach($devs as $dev)  {	## for each found drive do
-		$dev_ident = exec("diskinfo -v /dev/$dev | grep ident	| awk '{print $1}'"); ## get identifier from drive
-		$dev_state = trim(exec("smartctl -H /dev/$dev | awk -F: '/^SMART overall-health self-assessment test result/ {print $2;exit}
+foreach($devs as $dev):
+	$dev_ident = exec("diskinfo -v /dev/$dev | grep ident	| awk '{print $1}'"); ## get identifier from drive
+	$dev_state = trim(exec("smartctl -H /dev/$dev | awk -F: '/^SMART overall-health self-assessment test result/ {print $2;exit}
 /^SMART Health Status/ {print $2;exit}'")); ## get SMART state from drive
-		switch ($dev_state) {
+	switch ($dev_state) {
 		case "PASSED":
 		case "OK":
-			$color = "#90EE90";
+			$icon = 'ok';
 			break;
 		case "":
 			$dev_state = "Unknown";
-			$color = "#C0B788";
+			$icon = 'question';
 			break;
 		default:
-			$color = "#F08080";
+			$icon = 'remove';
 			break;
-		}
+	}
 ?>
 		<tr>
-			<td class="listlr"><?php echo $dev; ?></td>
-			<td class="listr" align="center"><?php echo $dev_ident; ?></td>
-			<td class="listr" align="center"><span style="background-color:<?php echo $color; ?>">&nbsp;<?php echo $dev_state; ?>&nbsp;</span></td>
+			<td><i class="icon icon-<?=$icon?>-sign"></i></td>
+			<td><?=$dev?></td>
+			<td><?=$dev_ident?></td>
+			<td><?=ucfirst($dev_state)?></td>
 		</tr>
-<?php	}
-}
-?>
+<?php endforeach; ?>
+	</tbody>
 </table>
diff --git a/usr/local/www/widgets/widgets/traffic_graphs.widget.php b/usr/local/www/widgets/widgets/traffic_graphs.widget.php
index a5747ba058..f6745b53af 100644
--- a/usr/local/www/widgets/widgets/traffic_graphs.widget.php
+++ b/usr/local/www/widgets/widgets/traffic_graphs.widget.php
@@ -100,11 +100,11 @@ if (isset($a_config["scale_type"])) {
 ?>
 <input type="hidden" id="traffic_graphs-config" name="traffic_graphs-config" value="" />
 
-<div id="traffic_graphs-settings" class="widgetconfigdiv" style="display:none;">
+<div>
 <form action="/widgets/widgets/traffic_graphs.widget.php" method="post" name="iform" id="iform">
-	<?php foreach ($ifdescrs as $ifname => $ifdescr) { ?>
-		<input type="hidden" name="shown[<?= $ifname ?>]" value="<?= $shown[$ifname] ? "show" : "hide" ?>" />
-	<?php } ?>
+	<?php foreach ($ifdescrs as $ifname => $ifdescr) {?>
+		<input type="hidden" name="shown[<?= $ifname?>]" value="<?= $shown[$ifname] ? "show" : "hide"?>" />
+	<?php }?>
 	Default AutoScale:
 		<?php
 			$scale_type_up="checked=\"checked\"";
@@ -120,14 +120,14 @@ if (isset($a_config["scale_type"])) {
 					$scale_type_follow = "checked=\"checked\"";
 				}
 			}
-		?>
-	<input name="scale_type" class="radio" type="radio" id="scale_type_up" value="up" <?php echo $scale_type_up; ?> onchange="updateGraphDisplays();" /><span>up</span>
-	<input name="scale_type" class="radio" type="radio" id="scale_type_follow" value="follow" <?php echo $scale_type_follow; ?> onchange="updateGraphDisplays();" /><span>follow</span><br /><br />
+?>
+	<input name="scale_type" class="radio" type="radio" id="scale_type_up" value="up" <?=$scale_type_up?> onchange="updateGraphDisplays();" /><span>up</span>
+	<input name="scale_type" class="radio" type="radio" id="scale_type_follow" value="follow" <?=$scale_type_follow?> onchange="updateGraphDisplays();" /><span>follow</span><br /><br />
 	Refresh Interval:
 	<select name="refreshinterval" class="formfld" id="refreshinterval" onchange="updateGraphDisplays();">
-		<?php for ($i = 1; $i <= 10; $i += 1) { ?>
-			<option value="<?= $i ?>" <?php if ($refreshinterval == $i) echo "selected=\"selected\"";?>><?= $i ?></option>
-		<?php } ?>
+		<?php for ($i = 1; $i <= 10; $i += 1) {?>
+			<option value="<?= $i?>" <?php if ($refreshinterval == $i) echo "selected=\"selected\""?>><?= $i?></option>
+		<?php }?>
 	</select>&nbsp; Seconds<br />&nbsp; &nbsp; &nbsp; <b>Note:</b> changing this setting will increase CPU utilization<br /><br />
 	<input id="submit_settings" name="submit_settings" type="submit" onclick="return updatePref();" class="formbtn" value="Save Settings" />
 </form>
@@ -158,22 +158,22 @@ foreach ($ifdescrs as $ifname => $ifdescr) {
 		$graphdisplay = "none";
 		$interfacevalue = "hide";
 	}
-	if ($ifinfo['status'] != "down") { ?>
-		<div id="<?=$ifname;?>trafficdiv" style="padding: 5px">
-			<div id="<?=$ifname;?>topic" class="widgetsubheader">
-				<div style="float:left;width:49%">
-					<span onclick="location.href='/status_graph.php?if=<?=$ifname;?>'" style="cursor:pointer">Current <?=$ifdescr;?> Traffic</span>
+	if ($ifinfo['status'] != "down") {?>
+		<div>trafficdiv" style="padding: 5px">
+			<div>topic" class="widgetsubheader">
+				<div>
+					<span>'" style="cursor:pointer">Current <?=$ifdescr?> Traffic</span>
 				</div>
-				<div align="right" style="float:right;width:49%">
-					<div id="<?=$ifname;?>graphdiv-min" onclick='return trafficminimizeDiv("<?= $ifname ?>", true);'
-						style="display:<?php echo $mingraphbutton;?>; cursor:pointer" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_minus.gif" alt="Minimize <?=$ifname;?> traffic graph" /></div>
-					<div id="<?=$ifname;?>graphdiv-open" onclick='return trafficshowDiv("<?= $ifname ?>", true);'
-						style="display:<?php echo $showgraphbutton;?>; cursor:pointer" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_open.gif" alt="Show <?=$ifname;?> traffic graph" /></div>
+				<div>
+					<div>graphdiv-min" onclick='return trafficminimizeDiv("<?= $ifname?>", true);'
+						style="display:<?=$mingraphbutton?>; cursor:pointer" ><img src="./themes/<?= $g['theme']?>/images/icons/icon_minus.gif" alt="Minimize <?=$ifname?> traffic graph" /></div>
+					<div>graphdiv-open" onclick='return trafficshowDiv("<?= $ifname?>", true);'
+						style="display:<?=$showgraphbutton?>; cursor:pointer" ><img src="./themes/<?= $g['theme']?>/images/icons/icon_open.gif" alt="Show <?=$ifname?> traffic graph" /></div>
 				</div>
-				<div style="clear:both;"></div>
+				<div></div>
 			</div>
-			<div id="<?=$ifname;?>graphdiv" style="display:<?php echo $graphdisplay;?>">
-				<object data="graph.php?ifnum=<?=$ifname;?>&amp;ifname=<?=rawurlencode($ifdescr);?>&amp;timeint=<?=$refreshinterval;?>&amp;initdelay=<?=$graphcounter * 2;?>" height="100%" width="100%">
+			<div>graphdiv" style="display:<?=$graphdisplay?>">
+				<object data="graph.php?ifnum=<?=$ifname?>&amp;ifname=<?=rawurlencode($ifdescr)?>&amp;timeint=<?=$refreshinterval?>&amp;initdelay=<?=$graphcounter * 2?>" height="100%" width="100%">
 					<param name="id" value="graph" />
 					<param name="type" value="image/svg+xml" />
 					<param name="pluginspage" value="http://www.adobe.com/svg/viewer/install/auto" />
@@ -182,4 +182,4 @@ foreach ($ifdescrs as $ifname => $ifdescr) {
 		</div>
 	<?php }
 }
-?>
+?>
\ No newline at end of file
