<?php
////////////////////////////////////////////////////////////////////////
// Breeze Website Builder
// Copyright Silver Dolphin Solutions, LLC, Edward Lemmers, P.E.
// For licensing, see license.txt.
// Created: 8/18/09	ELL
// Revised: 2/8/2012	ELL
// Added table prefix handling.
// 
//
	include ("check_session.php");
		
	
	$query = "SELECT * FROM `" . BWB_TABLE_PREFIX . "custom_site_css`";
	$result = $bwb_dbh->query($query);
	$row = $result->fetch(PDO::FETCH_ASSOC);
	if ($row["custom_css"])
		$custom_css = $row["custom_css"];
	else
		$custom_css = "";
		
	$custom_css_saved = $_REQUEST['custom_css_saved'];
?>
<html>
<head>
<title>Breeze Website Builder</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="manager.css" type="text/css">
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">

<style type="text/css">
#custom_styles_editor_heading	{	width:280px;	}
#help_button	{	
	position:relative;
	display:block;
	top:-15px;
	left:230px;
	height:31px;
	width:31px;
	z-index:100;
}
</style>

<script type="text/javascript" src="js/mouse_position.js"></script>
<script type="text/javascript" src="js/popup_msg.js"></script>
<script type="text/javascript" src="js/edit_custom_css.js"></script>

</head>

<body>
<div align="center">
<table border="0" width="90%">
 <tr>
  <td width="80%">
    <div class="button_heading_sub_level_1" id="custom_styles_editor_heading"><div class="button_heading_text_sub_level_1">Custom Site Styles Editor</div><div class="help_button" id="help_button" onClick="OpenHelpWindow();">&nbsp;</div></div>
  </td>
 </tr>
</table>

<table width="90%" border="1" cellspacing="0" cellpadding="0">
  <tr>
    <td>
 
   <form action="save_custom_css.php" method="post" enctype="multipart/form-data" name="frm_site_styles" id="frm_site_styles">
	   <table width="100%" border="0" cellspacing="1" cellpadding="1"> 
	     <tr>
 
	       <td><span class="sub_title">Custom Styles not included above:</span> (This section requires programming
	           knowledge of CSS.)</td>
	     </tr>
	     <tr>
	       <td><textarea name="textarea_custom_css" id="textarea_custom_css" cols="115" rows="20"><?php echo $custom_css; ?></textarea></td>
	     </tr>
		 <tr><td><hr size="3" noshade /></td></tr>
       </table>
	 
       <table width="100%" border="0" cellspacing="0" cellpadding="0">
         <tr>
	       <td colspan="2">
           <input type="hidden" name="style_sheet" value="custom" />
           <input type="hidden" name="submit_action" id="submit_action" value="custom" />
           </td>
	     </tr>
         <tr>
         <td align="left">
            <div class='button_console_preview' style="width:110px;" onClick="document.getElementById('submit_action').value='Preview'; document.getElementById('frm_site_styles').submit();"><span class='button_console_text_w_icon'>Preview</span></div>
          </td>
		   <td align="right">
            <div class='button_console_save' style="width:110px;" onClick="document.getElementById('submit_action').value='Update'; document.getElementById('frm_site_styles').submit();"><span class='button_console_text_w_icon'>Update</span></div>
		   </td>
	     </tr>
       </table>
       </form>
	 </td>
   </tr>
</table>
</div>

<?php include("lib/popup_msg.html"); ?>

<script language="javascript" type="text/javascript">
	HidePopupMsg();

<?php	if ($custom_css_saved == 1)	{	?>
	popup_msg.top_offset = 100;
	popup_msg.left_offset = 320;
	popup_msg.popup_msg_type = 1;
	popup_msg.popup_timeout = 2000;
	popup_msg.status_msg = "Custom CSS has been saved.";
	popup_msg.ShowPopupMsg();
<?php	}	?>
</script>

</body>
</html>