<?php
if ($_SESSION['FirstName'] == "") {
	echo 'You are not authorized to view this page. <br><br>You may <a href="index.php"><font color="blue">log in here.</font></a>';
	exit;
	}
 if($_SESSION['roladmin'] ==1){$roladmin=1;}
//require_once ('mysql_connect.php');
$action          = $_GET["a"];
include ('includes/admin-config.php');

//echo 'Action = ' . $action; (for testing)
//require_once ('config.inc');
include_once 'ckeditor/ckeditor.php' ;
//require_once 'ckfinder/ckfinder.php' ;

?>

<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<?php
if ($action == "update") {

		$query = "UPDATE storePrefs SET ";

		
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", hours1='" . $_POST['hours1'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " hours1='" . $_POST['hours1'] . "'";
			}
		
		
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", hours2='" . $_POST['hours2'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " hours2='" . $_POST['hours2'] . "'";
			}
		
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", hours3='" . $_POST['hours3'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " hours3='" . $_POST['hours3'] . "'";
			}

			if(!empty($_POST['timezone'])) { //only save timezone if it is selected
				if(!empty($sv)) {  //sw clause exists, add to it
					$sv .= ", timeZone='" . $_POST['timezone'] . "'";
				} else { //sw clause does not exist, create it now
					$sv .= " timeZone='" . $_POST['timezone'] . "'";
				}
			}

			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", title='" . $_POST['title'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " title='" . $_POST['title'] . "'";
			}

			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", address1='" . $_POST['address1'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " address1='" . $_POST['address1'] . "'";
			}
		
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", address2='" . $_POST['address2'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " address2='" . $_POST['address2'] . "'";
			}
			
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", city='" . $_POST['city'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " city='" . $_POST['city'] . "'";
			}
		
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", state='" . $_POST['state'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " state='" . $_POST['state'] . "'";
			}
		
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", zip='" . $_POST['zip'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " zip='" . $_POST['zip'] . "'";
			}
		
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", phone='" . $_POST['phone'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " phone='" . $_POST['phone'] . "'";
			}
		
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", fax='" . $_POST['fax'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " fax='" . $_POST['fax'] . "'";
			}
		
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", webURL='" . $_POST['webURL'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " webURL='" . $_POST['webURL'] . "'";
			}
		
					if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", orderURL='" . $_POST['orderURL'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " orderURL='" . $_POST['orderURL'] . "'";
			}
			
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", mapURL='" . $_POST['mapURL'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " mapURL='" . $_POST['mapURL'] . "'";
			}
		
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", salesTax='" . $_POST['salesTax'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " salesTax='" . $_POST['salesTax'] . "'";
			}
		
			If (!empty($_POST['chkDeltax'])){ //field is populated, need to update data
				if(!empty($sv)) {  //sw clause exists, add to it
					$sv .= ", taxdelivery='1'";
				} else { //sw clause does not exist, create it now
					$sv .= " taxdelivery='1'";
				}
			} else {
				if(!empty($sv)) {  //sw clause exists, add to it
					$sv .= ", taxdelivery='0'";
				} else { //sw clause does not exist, create it now
					$sv .= " taxdelivery='0'";
				}
			}

			If (!empty($_POST['chkDeliver'])){ //field is populated, need to update data
				if(!empty($sv)) {  //sw clause exists, add to it
					$sv .= ", deliver='1'";
				} else { //sw clause does not exist, create it now
					$sv .= " deliver='1'";
				}
			} else {
				if(!empty($sv)) {  //sw clause exists, add to it
					$sv .= ", deliver='0'";
				} else { //sw clause does not exist, create it now
					$sv .= " deliver='0'";
				}
			}

			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", deliveryCharge='" . $_POST['deliveryCharge'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " deliveryCharge='" . $_POST['deliveryCharge'] . "'";
			}
			
		  if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", deltime='" . $_POST['deltime'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " deltime='" . $_POST['deltime'] . "'";
			}
			
			 if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", preptime='" . $_POST['preptime'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " preptime='" . $_POST['preptime'] . "'";
			}
			
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", email='" . $_POST['email'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " email='" . $_POST['email'] . "'";
			}
			
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", fantools_email='" . $_POST['fantoolsid'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " fantools_email='" . $_POST['fantoolsid'] . "'";
			}
			
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", fantools_pwd='" . $_POST['fantoolspwd'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " fantools_pwd='" . $_POST['fantoolspwd'] . "'";
			}
		
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", facebook='" . $_POST['facebook'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " facebook='" . $_POST['facebook'] . "'";
			}
			
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", fbpage='" . $_POST['fbpage'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " fbpage='" . $_POST['fbpage'] . "'";
			}
			
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", twitter='" . $_POST['twitter'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " twitter='" . $_POST['twitter'] . "'";
			}
			
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", twitterid='" . $_POST['twitterid'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " twitterid='" . $_POST['twitterid'] . "'";
			}
			
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", google_plus='" . $_POST['google_plus'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " google_plus='" . $_POST['google_plus'] . "'";
			}
			
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", myspace='" . $_POST['myspace'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " myspace='" . $_POST['myspace'] . "'";
			}

		If (!empty($_POST['chkChecks'])){ //field is populated, need to update data
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", acceptChecks='1'";
			} else { //sw clause does not exist, create it now
				$sv .= " acceptChecks='1'";
			}
		} else {
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", acceptChecks='0'";
			} else { //sw clause does not exist, create it now
				$sv .= " acceptChecks='0'";
			}
		}
		If (!empty($_POST['paypal_auth'])){ //field is populated, need to update data
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", paypal_auth='1'";
			} else { //sw clause does not exist, create it now
				$sv .= " paypal_auth='1'";
			}
		} else {
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", paypal_auth='0'";
			} else { //sw clause does not exist, create it now
				$sv .= " paypal_auth='0'";
			}
		}
		
		If (!empty($_POST['chkTipline'])){ //field is populated, need to update data
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", include_tipline='1'";
			} else { //sw clause does not exist, create it now
				$sv .= " include_tipline='1'";
			}
		} else {
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", include_tipline='0'";
			} else { //sw clause does not exist, create it now
				$sv .= " include_tipline='0'";
			}
		}
		
		if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", order_notice='" . $_POST['order_notice'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " order_notice='" . $_POST['order_notice'] . "'";
		}
		
		if($roladmin==1){    //***********only allow updating these two fields if logged in as ROO administrator
			If (!empty($_POST['chkFaxOrders'])){ //field is populated, need to update data
					if(!empty($sv)) {  //sw clause exists, add to it
						$sv .= ", orderByFax='1'";
					} else { //sw clause does not exist, create it now
						$sv .= " orderByFax='1'";
					}
				} else {
					if(!empty($sv)) {  //sw clause exists, add to it
						$sv .= ", orderByFax='0'";
					} else { //sw clause does not exist, create it now
						$sv .= " orderByFax='0'";
					}
				}
				
				If (!empty($_POST['chkOnline'])){ //field is populated, need to update data
					if(!empty($sv)) {  //sw clause exists, add to it
						$sv .= ", orderOnline='1'";
					} else { //sw clause does not exist, create it now
						$sv .= " orderOnline='1'";
					}
				} else {
					if(!empty($sv)) {  //sw clause exists, add to it
						$sv .= ", orderOnline='0'";
					} else { //sw clause does not exist, create it now
						$sv .= " orderOnline='0'";
					}
				}
		}  //****************END of if 'ROO Admin' loop

			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", categoryColor='" . $_POST['catcolor'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " categoryColor='" . $_POST['catcolor'] . "'";
			}
			
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", categoryFontColor='" . $_POST['catfontcolor'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " categoryFontColor='" . $_POST['catfontcolor'] . "'";
			}
			
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", orderEmail1='" . $_POST['orderemail1'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " orderEmail1='" . $_POST['orderemail1'] . "'";
			}
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", orderEmail2='" . $_POST['orderemail2'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " orderEmail2='" . $_POST['orderemail2'] . "'";
			}
			
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", analyticsID='" . $_POST['analyticsID'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " analyticsID='" . $_POST['analyticsID'] . "'";
			}
			
			if(!empty($sv)) {  //sw clause exists, add to it
				$sv .= ", paypalid='" . $_POST['paypalid'] . "'";
			} else { //sw clause does not exist, create it now
				$sv .= " paypalid='" . $_POST['paypalid'] . "'";
			}

if ($sv !==""){
	$query .= $sv;

}
//query is created, now execute:
if (!mysql_query($query)){
					echo $query;
  					die('Error: ' . mysql_error());
 			 } else {
			//echo $query .'<br>';	//for testing
				echo "<div align=center><font color=red>Store preferences updated successfully.</font></div>";
				
			}		


	}	//end of update query

		$query = "SELECT * from storePrefs";


		$rt=mysql_query($query);          // query executed 
		echo mysql_error();                    // if any error is there that will be printed to the screen



echo '<div id="single-admin-button">
<ul>
<li><a href="index.php">BACK TO HOME ADMIN</a></li>
</ul>
</div>';


echo '<div align="center"><table border=0 cellpadding=0 cellspacing=8>';




	//record found - 
	echo '<tr><td><form action="' . $_SERVER['PHP_SELF'] . '?a=update&key=' . $nt[recordKey] . '" method="post">';
echo '<div class="arrowlistmenu">';
echo "<h3 class='menuheader expandable'>Hours and Timezone</h3>";	
echo'<ul class="categoryitems">';
while($nt=mysql_fetch_array($rt)){

	echo '<tr><td valign="top">Displayed Hours: <br> <i>These are the hours displayed on your website.</i><td valign="top"><textarea name="hours1" id="hours1" class="" cols="30" rows="4">' . $nt[hours1] . '</textarea><td><img src="images/question.png" title="20 characters maximum.">';  
	echo '<tr><td valign="top">Ordering Hours: <br> <i>These are the hours that online ordering will be available.</i><td valign="top"><td><img src="images/question.png" title="Time periods that online ordering will be avialable.">';  

	echo '<tr><td valign="top">Show Open/Closed Sign: <td valign="top"><input type="checkbox" name="chkOpenSign"';
	if(!empty($nt[deliver])){
		echo 'checked=true';
	}
	echo '><td><img src="images/question.png" title="20 characters maximum.">';
	//echo '<tr><td valign="top">Hours line #2: <td valign="top"><input type="text" name="hours2" size="30" value="' . $nt[hours2] . '"><td><img src="images/question.png" title="20 characters maximum.">';  
	//echo '<tr><td valign="top">Hours line #3: <td valign="top"><input type="text" name="hours3" size="30" value="' . $nt[hours3] . '"><td><img src="images/question.png" title="20 characters maximum.">';  
echo '<tr><td valign="top">Time zone: <td valign="top"><div align="center">&nbsp;&nbsp;&nbsp;';  


//******************populate zip code list
echo '<select name="timezone" width="40">';
echo '<option value=\"NULL\">Select Time Zone</option>\n';
echo '<option value="America/Puerto_Rico"'; if ($nt[timeZone]=="America/Puerto_Rico"){echo ' selected="selected"';} echo '>America/Puerto Rico (AST)</option>';
echo '<option value="America/New_York"'; if ($nt[timeZone]=="America/New_York"){echo ' selected="selected"';} echo '>America/New York (EDT)</option>';
echo '<option value="America/Chicago"'; if ($nt[timeZone]=="America/Chicago"){echo ' selected="selected"';} echo '>America/Chicago (CDT)</option>';
echo '<option value="America/Boise"'; if ($nt[timeZone]=="America/Boise"){echo ' selected="selected"';} echo '>America/Boise (MDT)</option>';
echo '<option value="America/Phoenix"'; if ($nt[timeZone]=="America/Phoenix"){echo ' selected="selected"';} echo '>America/Phoenix (MST)</option>';
echo '<option value="America/Los_Angeles"'; if ($nt[timeZone]=="America/Los_Angeles"){echo ' selected="selected"';} echo '>America/Los Angeles (PDT)</option>';
echo '<option value="America/Juneau"'; if ($nt[timeZone]=="America/Juneau"){echo ' selected="selected"';} echo '>America/Juneau (AKDT)</option>';
echo '<option value="Pacific/Honolulu"'; if ($nt[timeZone]=="America/Pacific/Honolulu"){echo ' selected="selected"';} echo '>Pacific/Honolulu (HST)</option>';
echo '<option value="Pacific/Guam"'; if ($nt[timeZone]=="Pacific/Guam"){echo ' selected="selected"';} echo '>Pacific/Guam (ChST)</option>';
echo '<option value="Pacific/Samoa"'; if ($nt[timeZone]=="Pacific/Samoa"){echo ' selected="selected"';} echo '>Pacific/Samoa (SST)</option>';
echo '<option value="Pacific/Wake"'; if ($nt[timeZone]=="Pacific/Wake"){echo ' selected="selected"';} echo '>Pacific/Wake (WAKT)</option>';
echo '</select></div>';
date_default_timezone_set($nt[timeZone]);
 echo '<font color="red" size=1><br>Current time: ' . date('h:i:s A') . '</font>';

echo '<td><img src="images/question.png" title="Select a time zone to allow orders only at the correct times for your time zone.">';

	echo '<tr><td valign="top">Site title (business name): <td valign="top"><input type="text" name="title" size="30" value="' . $nt[title] . '"><td><img src="images/question.png" title="40 characters maximum.">'; 

	echo '<tr><td valign="top">Street address: <td valign="top"><input type="text" name="address1" size="30" value="' . $nt[address1] . '"><td><img src="images/question.png" title="40 characters maximum.">';  
  echo '<tr><td valign="top">Address line 2: <td valign="top"><input type="text" name="address2" size="30" value="' . $nt[address2] . '"><td><img src="images/question.png" title="40 characters maximum. (suite #, etc)">';
  echo '<tr><td valign="top">City: <td valign="top"><input type="text" name="city" size="30" value="' . $nt[city] . '"><td><img src="images/question.png" title="40 characters maximum.">';  
	echo '<tr><td valign="top">State: <td valign="top"><input type="text" name="state" size="30" value="' . $nt[state] . '"><td><img src="images/question.png" title="Type the name of your state or the 2-digit abbreviation.">';  
	echo '<tr><td valign="top">Zip: <td valign="top"><input type="text" name="zip" size="30" value="' . $nt[zip] . '"><td><img src="images/question.png" title="10 characters maximum.">';  
	echo '<tr><td valign="top">Phone: <td valign="top"><input type="text" name="phone" size="30" value="' . $nt[phone] . '"><td><img src="images/question.png" title="15 characters maximum.">';  
	echo '<tr><td valign="top">Fax: <td valign="top"><input type="text" name="fax" size="30" value="' . $nt[fax] . '"><td><img src="images/question.png" title="15 characters maximum.">';  
	echo '<tr><td valign="top">Email: <td valign="top"><input type="text" name="email" size="30" value="' . $nt[email] . '"><td><img src="images/question.png" title="50 characters maximum.">'; 
	echo '<tr><td valign="top">Facebook: <td valign="top"><input type="text" name="facebook" size="30" value="' . $nt[facebook] . '"><td><img src="images/question.png" title="Paste in the link to your Facebook page and this will allow visitors to access your Facebook page directly through your website.">';  
	echo '<tr><td valign="top">Facebook Page ID: <td valign="top"><input type="text" name="fbpage" size="30" value="' . $nt[fbpage] . '"><td><img src="images/question.png" title="Paste in the page ID for your Facebook business page. This is usually a 15 digit string of numbers that can be seen in the address bar when you sit your Facebook page. This will allow you to publish coupons from your ROO website directly to your Facebook Page.">';  
	echo '<tr><td valign="top">Twitter: <td valign="top"><input type="text" name="twitter" size="30" value="' . $nt[twitter] . '"><td><img src="images/question.png" title="Paste in the link to your Twitter account and this will allow your visitors to go to your Twitter page directly through your website.">';  
	echo '<tr><td valign="top">Twitter ID: <td valign="top"><input type="text" name="twitterid" size="30" value="' . $nt[twitterid] . '"><td><img src="images/question.png" title="Paste in the ID for your Twitter account. This will allow you to publish coupons from your ROO website directly to your Twitter account.">';  
	echo '<tr><td valign="top">Google+: <td valign="top"><input type="text" name="google_plus" size="30" value="' . $nt[google_plus] . '"><td><img src="images/question.png" title="Paste in the URL for your Google+ account. This will put a Google+ button on your website.">';  
	echo '<tr><td valign="top">MySpace: <td valign="top"><input type="text" name="myspace" size="30" value="' . $nt[myspace] . '"><td><img src="images/question.png" title="Paste in the link to your MySpace page and this will allow your visitors to visit your MySpace page directly through your website.">';  
	echo '<tr><td valign="top">Website URL: <td valign="top"><input type="text" name="webURL" size="30" value="' . $nt[webURL] . '"><td><img src="images/question.png" title="This is the website address you want to show up on your website.">';  
  echo '<tr><td valign="top">3rd party ordering: <td valign="top"><input type="text" name="orderURL" size="30" value="' . $nt[orderURL] . '"><br><font color="red"><i>If you use another ordering solution, <br>insert the link here.</i></font><td><img src="images/question.png" title="This is the address of a 3rd party online ordering site. (Leave off the http at the beginning.)">';

  echo '<tr><td valign="top">Map URL: <td valign="top"><textarea name="mapURL" cols="32" rows="3">' . $nt[mapURL] . '</textarea><br><font color="red"><i>Leave blank to use default google map <br>or paste in code to display a custom map.</i></font>'; 
  
	echo '<tr><td colspan="2"><ul class="acc" id="acc"><li><h3>ONLINE ORDERING</h3> <div class="acc-section"><div class="acc-content"><table>
	<tr><td valign="top">Sales tax: <td valign="top"><input type="text" name="salesTax" size="30" value="' . $nt[salesTax] . '"><br><font color="red"><i>Enter in decimal format. <br>(ex: 7.5% should be entered as .075</i></font>';  
	echo '<tr><td valign="top">Delivery charge: <td valign="top"><input type="text" name="deliveryCharge" size="30" value="' . $nt[deliveryCharge] . '"><td><img src="images/question.png" title="Any delivery charge will be added to online orders that select the delivery option.">';  
    echo '<tr><td valign="top">Prep time: <td valign="top"><input type="text" name="preptime" size="30" value="' . $nt[preptime] . '"><br><font color="red"><i>Time it usually takes to have order ready for pickup.</i></font><td><img src="images/question.png" title="This is what the customer will see on their order as the expected preparation time.">';
	echo '<tr><td valign="top">Delivery time: <td valign="top"><input type="text" name="deltime" size="30" value="' . $nt[deltime] . '"><br><font color="red"><i>Time it usually takes for delivery.</i></font><td><img src="images/question.png" title="This is what the customer will see on their order as the expected delivery time.">';

  echo '<tr><td valign="top">Delivery available: <td valign="top"><input type="checkbox" name="chkDeliver"';
	if(!empty($nt[deliver])){
		echo 'checked=true';
	}
echo '><td><img src="images/question.png" title="Check this box to allow delivery to customers.">';
  echo '<tr><td valign="top">Delivery taxable: <td valign="top"><input type="checkbox" name="chkDeltax"';
	if(!empty($nt[taxdelivery])){
		echo 'checked=true';
	}
echo '><td><img src="images/question.png" title="Check this box to apply sales tax to delivery charges.">';

  echo '<tr><td valign="top">Accept checks: <td valign="top"><input type="checkbox" name="chkChecks"';
	if(!empty($nt[acceptChecks])){
		echo 'checked=true';
	} 
echo '><td><img src="images/question.png" title="Check this box to let customers know that you accept checks.">';  
	echo '<tr><td valign="top">Online ordering: <td valign="top"><input type="checkbox" name="chkOnline"';
	if(!empty($nt[orderOnline])){
		echo 'checked="true" ';
	} 
if ($roladmin !==1){echo ' disabled="disabled"';}
echo '> <font color="red"><i>(requires subscription)</i></font><td><img src="images/question.png" title="This shows whether or not you subscribe to the online ordering service.">';

if(!empty($nt[orderOnline])){	//only show tipline option if online ordering is in use
	echo '<tr><td valign="top">Include tip field: <td valign="top"><input type="checkbox" name="chkTipline"';
	if(!empty($nt[include_tipline])){
		echo 'checked="true" ';
	} 
	if ($roladmin !==1){echo ' disabled="disabled"';}
	echo '> <font color="red"><i></i></font><td><img src="images/question.png" title="This determines whether or not you will inlude a place for customer to enter a tip while ordering.">';
}
	echo '<tr><td valign="top">Faxed orders: <td valign="top"><input type="checkbox" name="chkFaxOrders"';
	if(!empty($nt[orderByFax])){
		echo 'checked="true" ';
	}
	if ($roladmin !==1){echo ' disabled="disabled"';}
echo '> <font color="red"><i>(requires subscription)</i></font><td><img src="images/question.png" title="This shows whether or not you subscribe to the online order-to-fax service.">';
if(!empty($nt[orderOnline])){	//only show order email accounts if online ordering is activated
	echo '<tr><td valign="top">Order Email #1: <td valign="top"><input type="text" name="orderemail1" size="30" value="' . $nt[orderEmail1] . '"><td><img src="images/question.png" title="This is the store email address that online customer orders will be delivered to. 50 characters maximum.">';
	echo '<tr><td valign="top">Order Email #2: <td valign="top"><input type="text" name="orderemail2" size="30" value="' . $nt[orderEmail2] . '"><td><img src="images/question.png" title="This is the 2nd store email address that online customer orders will be delivered to. 50 characters maximum.">';
	echo '<tr><td><td><font color="red"><i>These are the email accounts that will <br>receive customer orders. You may also<br> use text email addresses to receive <br>via text message.</i></font>';
	echo '<tr><td valign="top">Order Notice: <td valign="top"><textarea name="order_notice" cols=40 rows=3>' . $nt[order_notice] . '</textarea><td><img src="images/question.png" title="This is a notice displayed at the top of each online ordering page. 100 characters maximum.">';
	}
	echo '<tr><td valign="top">Menu Bar Color: <td valign="top"><input type="text" name="catcolor" class="color" size="30" value="' . $nt[categoryColor] . '"><td><img src="images/question.png" title="The category headers on the menu will have this color background. You may enter a color name or a 6-character HTML color code. ">'; 
	echo '<tr><td valign="top">Menu Font Color: <td valign="top"><input type="text" name="catfontcolor" class="color" size="30" value="' . $nt[categoryFontColor] . '"><td><img src="images/question.png" title="The category headers on the menu will have this color text. You may enter a color name or a 6-character HTML color code. ">'; 
	echo '<tr><td valign="top">Google Analytics ID: <td valign="top"><input type="text" name="analyticsID" size="30" value="' . $nt[analyticsID] . '"><td><img src="images/question.png" title="Enter your Google Analytics ID here. It should be a number formatted similar to: UA-1234567-7 ">';
	echo '<tr><td valign="top">PayPal ID: <td valign="top"><input type="text" name="paypalid" size="30" value="' . $nt[paypalid] . '"><td><img src="images/question.png" title="Enter your PayPal ID here. This will be the email address you have registered to your PayPal account.">';
	echo '<tr><td valign="top">Use PayPal Auth: <td valign="top"><input type="checkbox" name="paypal_auth"';
	if(!empty($nt[paypal_auth])){
		echo 'checked=true';
	} 
	echo '><td><img src="images/question.png" title="This option places authorizations when customers check out via paypal, instead of collecting final payment. This allows you to add up to 15% tip before capturing.">';  
	echo '<tr><td><td width="65%"><font color="red"><i>If using PayPal, this should be your PayPal email address. If no PayPal ID is entered, customer payment info will be transmitted directly to you with the order, to be processed manually.</i></font></table></div></div></li></ul></td></tr>';
	if($fantools_subscribed==1){
		echo '<tr><td colspan="2"><ul class="acc" id="acc"><li><h3>FAN TOOLS</h3> <div class="acc-section"><div class="acc-content"><table>
	<tr><td valign="top">FanTools User ID: <td valign="top"><input type="text" name="fantoolsid" size="30" value="' . $nt[fantools_email] . '"><td><img src="images/question.png" title="This is the email address you use to log into your FanTools account.">';  
		echo '<tr><td valign="top">FanTools Password: <td valign="top"><input type="text" name="fantoolspwd" size="30" value="' . $nt[fantools_pwd] . '"><td><img src="images/question.png" title="This is the password you use to log into your FanTools account."></td></tr></table></div></div></li></ul></td></tr>';  
	}
	
		
}
echo '</ul>';
echo '<tr><td valign=top colspan=2><div align=center><input type="submit" name="save" value="Save Changes"></form>';

echo '</table><br><br>';


	
		

	echo '<br><a href="index.php"><font color="blue">Return to Main Page</font></a><br>
		
		</div></table></div>';
	

?>

<script type="text/javascript" src="includes/tinyaccordion/script.js"></script>

<script type="text/javascript">

var parentAccordion=new TINY.accordion.slider("parentAccordion");
parentAccordion.init("acc","h3",1,-1);

var nestedAccordion=new TINY.accordion.slider("nestedAccordion");
nestedAccordion.init("nested","h3",1,-1,"acc-selected");

var nestedAccordion2=new TINY.accordion.slider("nestedAccordion2");
nestedAccordion2.init("nested2","h3",1,-1,"acc-selected");


//var parentAccordion=new TINY.accordion.slider("parentAccordion");
//parentAccordion.init("acc","h3",0);

//var nestedAccordion=new TINY.accordion.slider("nestedAccordion");
//nestedAccordion.init("nested","h3",1,-1,"acc-selected");
//nestedAccordion.init("nested","h3",1,-1,"acc-selected");
</script>