<?php
   require_once "C:/Inetpub/charlotteparent/cmsAdmin/lib/viewer_functions.php";
   if (!$CURRENT_USER) { redirectBrowserToURL("/advertising/resources/advertiser-login.php"); }
   
    list($menu_newRecords, $menu_newMetaData) = getRecords(array(
    'tableName'   => 'menu_new',
    'allowSearch' => '0',
    'limit'       => '1',
  ));
  $menu_newRecord = @$menu_newRecords[0]; // get first record
  
  list($directories_menuRecords, $directories_menuMetaData) = getRecords(array(
    'tableName'   => 'directories_menu',
  ));
  
  list($publicationsmenuRecords, $publicationsmenuMetaData) = getRecords(array(
    'tableName'   => 'publicationsmenu',
  ));
   
  list($globalRecords, $globalMetaData) = getRecords(array(
    'tableName'   => 'global',
    'allowSearch' => '0',
    'limit'       => '1',
  ));
  $globalRecord = @$globalRecords[0]; // get first 
  
   list($directory_membershipRecords, $directory_membershipMetaData) = getRecords(array(
    'tableName'   => 'directory_membership',
    'allowSearch' => false,
    'limit'       => '1',
  ));
  $directory_membershipRecord = @$directory_membershipRecords[0]; // get first record
  
 //checkbox
  list($days_dirRecords) = getRecords(array(
	  'tableName'   => 'days_dir',
	  'loadUploads' => true,
	  'allowSearch' => false,
  ));
  
   list($dir_categoriesRecords, $dir_categoriesMetaData) = getRecords(array(
    'tableName'   => 'dir_categories',
	'where' => 'include = 0',	
	  ));

	  
  // This form requires: CMSB v2.04 Build 1
 require_once "C:/Inetpub/charlotteparent/cmsAdmin/lib/viewer_functions.php";
  $tableName       = 'dir_listings';
  $recordNum       = null; // you must set either $recordNum or $preSaveTempId to null
  $preSaveTempId   = @$_REQUEST['preSaveTempId'] ? $_REQUEST['preSaveTempId'] : uniqid('x');
  $errorsAndAlerts = '';

  ### upload actions
  if (@$_REQUEST['submitForm'] && !preg_match("/multipart\/form-data/", @$_SERVER['CONTENT_TYPE'])) { die("Upload Error: &lt;form&gt; tag must have enctype=\"multipart/form-data\""); }
    foreach (getUploadInfoArrays() as $uploadInfo) { // add uploads
    $errorsAndAlerts .= saveUpload($tableName, $uploadInfo['_fieldname'], $recordNum, $preSaveTempId, $uploadInfo, $newUploadNums);
  }
  if (@$_REQUEST['removeUpload']) { // delete upload
    $uploadNum = @$_REQUEST['removeUpload'];
    removeUpload($uploadNum, $recordNum, $preSaveTempId);
  }

  ### insert record
  $onlyUploadAction = @$_REQUEST['submitUpload'] || @$_REQUEST['removeUpload']; // don't save the record when the user uploads a file
  if (@$_REQUEST['submitForm'] && !$onlyUploadAction) {

    // error checking
	
	if (!@$_REQUEST['category'])    { $errorsAndAlerts .= "*Required: Please select a category!<br/>\n"; }
	if (!@$_REQUEST['title'])    { $errorsAndAlerts .= "*Required: Please specify a title!<br/>\n"; }
	if (!@$_REQUEST['address'])    { $errorsAndAlerts .= "*Required: Please specify a address!<br/>\n"; }
	if (!@$_REQUEST['website'])    { $errorsAndAlerts .= "*Required: Please specify a website!<br/>\n"; }
	if (!@$_REQUEST['phone'])    { $errorsAndAlerts .= "*Required: Please specify a listing phone number!<br/>\n"; }
	if (!@$_REQUEST['county'])    { $errorsAndAlerts .= "*Required: Please specify a county!<br/>\n"; }
	if (!@$_REQUEST['summary'])    { $errorsAndAlerts .= "*Required: Please enter a description!<br/>\n"; }
	if (!@$_REQUEST['contact_name'])    { $errorsAndAlerts .= "*Required: Please specify a contact name!<br/>\n"; }
	if (!@$_REQUEST['email_address'])    { $errorsAndAlerts .= "*Required: Please specify an contact e-mail address!<br/>\n"; }
	if (!@$_REQUEST['contact_phone'])    { $errorsAndAlerts .= "*Required: Please specify a contact phone number!<br/>\n"; }
	if (@$_REQUEST['category'] == "Camps: Day Camps") 
		if (!@$_REQUEST['ages'])    { $errorsAndAlerts .= "*Required: Ages: Please specify ages or type N/A!<br/>\n"; }
	if (@$_REQUEST['category'] == "Camps: Residential") 
		if (!@$_REQUEST['ages'])    { $errorsAndAlerts .= "*Required: Ages: Please specify ages or type N/A!<br/>\n"; }
	if (@$_REQUEST['category'] == "Child Care Referrals & Nannies") 
		if (!@$_REQUEST['ages'])    { $errorsAndAlerts .= "*Required: Ages: Please specify ages or type N/A!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Enrichment and After-School") 
		if (!@$_REQUEST['ages'])    { $errorsAndAlerts .= "*Required: Ages: Please specify ages or type N/A!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Party Planning") 
		if (!@$_REQUEST['ages'])    { $errorsAndAlerts .= "*Required: Ages: Please specify ages or type N/A!<br/>\n"; }
	if (@$_REQUEST['category'] == "Special Needs") 
		if (!@$_REQUEST['ages'])    { $errorsAndAlerts .= "*Required: Ages: Please specify ages or type N/A!<br/>\n"; }
	if (@$_REQUEST['category'] == "Sports Sign-Ups") 
		if (!@$_REQUEST['ages'])    { $errorsAndAlerts .= "*Required: Ages: Please specify ages or type N/A!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Camps: Day Camps") 
		if (!@$_REQUEST['fees'])    { $errorsAndAlerts .= "*Required: Fees: Please specify fees or type N/A!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Camps: Residential") 
		if (!@$_REQUEST['fees'])    { $errorsAndAlerts .= "*Required: Fees: Please specify fees or type N/A!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Child Care Referrals & Nannies") 
		if (!@$_REQUEST['fees'])    { $errorsAndAlerts .= "*Required: Fees: Please specify fees or type N/A!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Enrichment and After-School") 
		if (!@$_REQUEST['fees'])    { $errorsAndAlerts .= "*Required: Fees: Please specify fees or type N/A!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Party Planning") 
		if (!@$_REQUEST['fees'])    { $errorsAndAlerts .= "*Required: Fees: Please specify fees or type N/A!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Special Needs") 
		if (!@$_REQUEST['fees'])    { $errorsAndAlerts .= "*Required: Fees: Please specify fees or type N/A!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Sports Sign-Ups") 
		if (!@$_REQUEST['fees'])    { $errorsAndAlerts .= "*Required: Fees: Please specify fees or type N/A!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Educ: Boarding Schools") 
		if (!@$_REQUEST['ages'])    { $errorsAndAlerts .= "*Required: Grades/Ages: Please specify ages or type N/A!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Educ: Boarding Schools") 
		if (!@$_REQUEST['fees'])    { $errorsAndAlerts .= "*Required: Fees/Tuition: Please specify fees or type N/A!<br/>\n"; }									
	if (@$_REQUEST['category'] == "Educ: Charter Schools") 
		if (!@$_REQUEST['ages'])    { $errorsAndAlerts .= "*Required: Grades/Ages: Please specify ages or type N/A!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Educ: Charter Schools") 
		if (!@$_REQUEST['fees'])    { $errorsAndAlerts .= "*Required: Fees/Tuition: Please specify fees or type N/A!<br/>\n"; }		
	if (@$_REQUEST['category'] == "Educ: Continuing Education") 
		if (!@$_REQUEST['ages'])    { $errorsAndAlerts .= "*Required: Grades/Ages: Please specify ages or type N/A!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Educ: Continuing Education") 
		if (!@$_REQUEST['fees'])    { $errorsAndAlerts .= "*Required: Fees/Tuition: Please specify fees or type N/A!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Educ: Education Resources") 
		if (!@$_REQUEST['ages'])    { $errorsAndAlerts .= "*Required: Grades/Ages: Please specify ages or type N/A!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Educ: Education Resources") 
		if (!@$_REQUEST['fees'])    { $errorsAndAlerts .= "*Required: Fees/Tuition: Please specify fees or type N/A!<br/>\n"; }		
	if (@$_REQUEST['category'] == "Educ: Home School Resources") 
		if (!@$_REQUEST['ages'])    { $errorsAndAlerts .= "*Required: Grades/Ages: Please specify ages or type N/A!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Educ: Home School Resources") 
		if (!@$_REQUEST['fees'])    { $errorsAndAlerts .= "*Required: Fees/Tuition: Please specify fees or type N/A!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Educ: Preschool") 
		if (!@$_REQUEST['ages'])    { $errorsAndAlerts .= "*Required: Grades/Ages: Please specify ages or type N/A!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Educ: Preschool") 
		if (!@$_REQUEST['fees'])    { $errorsAndAlerts .= "*Required: Fees/Tuition: Please specify fees or type N/A!<br/>\n"; }			
	if (@$_REQUEST['category'] == "Educ: Private Schools") 
		if (!@$_REQUEST['ages'])    { $errorsAndAlerts .= "*Required: Grades/Ages: Please specify ages or type N/A!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Educ: Private Schools") 
		if (!@$_REQUEST['fees'])    { $errorsAndAlerts .= "*Required: Fees/Tuition: Please specify fees or type N/A!<br/>\n"; }		
	if (@$_REQUEST['category'] == "Educ: Public Schools") 
		if (!@$_REQUEST['ages'])    { $errorsAndAlerts .= "*Required: Grades/Ages: Please specify ages or type N/A!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Educ: Public Schools") 
		if (!@$_REQUEST['fees'])    { $errorsAndAlerts .= "*Required: Fees/Tuition: Please specify fees or type N/A!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Educ: Boarding Schools") 
		if (!@$_REQUEST['fee_ed'])    { $errorsAndAlerts .= "*Required: Please specify a fee schedule!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Educ: Boarding Schools") 
		if (!@$_REQUEST['program_ed'])    { $errorsAndAlerts .= "*Required: Please specify a program type!<br/>\n"; }									
	if (@$_REQUEST['category'] == "Educ: Charter Schools") 
		if (!@$_REQUEST['fee_ed'])    { $errorsAndAlerts .= "*Required: Please specify a fee schedule!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Educ: Charter Schools") 
		if (!@$_REQUEST['program_ed'])    { $errorsAndAlerts .= "*Required: Please specify a program type!<br/>\n"; }				
	if (@$_REQUEST['category'] == "Educ: Continuing Education") 
		if (!@$_REQUEST['fee_ed'])    { $errorsAndAlerts .= "*Required: Please specify a fee schedule!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Educ: Continuing Education") 
		if (!@$_REQUEST['program_ed'])    { $errorsAndAlerts .= "*Required: Please specify a program type!<br/>\n"; }			
	if (@$_REQUEST['category'] == "Educ: Education Resources") 
		if (!@$_REQUEST['fee_ed'])    { $errorsAndAlerts .= "*Required: Please specify a fee schedule!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Educ: Education Resources") 
		if (!@$_REQUEST['program_ed'])    { $errorsAndAlerts .= "*Required: Please specify a program type!<br/>\n"; }				
	if (@$_REQUEST['category'] == "Educ: Home School Resources") 
		if (!@$_REQUEST['fee_ed'])    { $errorsAndAlerts .= "*Required: Please specify a fee schedule!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Educ: Home School Resources") 
		if (!@$_REQUEST['program_ed'])    { $errorsAndAlerts .= "*Required: Please specify a program type!<br/>\n"; }		
	if (@$_REQUEST['category'] == "Educ: Preschool") 
		if (!@$_REQUEST['fee_ed'])    { $errorsAndAlerts .= "*Required: Please specify a fee schedule!<br/>\n"; }		
	if (@$_REQUEST['category'] == "Educ: Preschool") 
		if (!@$_REQUEST['program_ed'])    { $errorsAndAlerts .= "*Required: Please specify a program type!<br/>\n"; }			
	if (@$_REQUEST['category'] == "Educ: Private Schools") 
		if (!@$_REQUEST['fee_ed'])    { $errorsAndAlerts .= "*Required: Please specify a fee schedule!<br/>\n"; }	
	if (@$_REQUEST['category'] == "Educ: Private Schools") 
		if (!@$_REQUEST['program_ed'])    { $errorsAndAlerts .= "*Required: Please specify a program type!<br/>\n"; }			
	if (@$_REQUEST['category'] == "Educ: Public Schools") 
		if (!@$_REQUEST['fee_ed'])    { $errorsAndAlerts .= "*Required: Please specify a fee schedule!<br/>\n"; }		
	if (@$_REQUEST['category'] == "Educ: Public Schools") 
		if (!@$_REQUEST['program_ed'])    { $errorsAndAlerts .= "*Required: Please specify a program type!<br/>\n"; }			
	if (@$_REQUEST['category'] == "Family Dining") 
		if (!@$_REQUEST['eat_free'])    { $errorsAndAlerts .= "*Required: Kids Eat Free: Please specify Yes or No!<br/>\n"; }
	
	
	
	 // setup checkbox days
		 if(isset($_REQUEST['days'])) {
    $days_TSV = "\t" . implode("\t", $_REQUEST['days'] ) . "\t";
	}
		else {
  		  $days_TSV = "";
		}
		 

    // update record
    if (!@$errorsAndAlerts) {
      mysqlStrictMode(false); // disable Mysql strict errors for when a field isn't defined below (can be caused when fields are added later)
      $query = "INSERT INTO `{$TABLE_PREFIX}$tableName` SET
                    createdDate      = NOW(),
                    createdByUserNum = '" .intval( @$CURRENT_USER['num'] ). "',
                    updatedDate      = NOW(),
                    updatedByUserNum = '" .intval( @$CURRENT_USER['num'] ). "',
					publishDate      = NOW(),
					date      = NOW(),
					hidden = '1',
					reg_listing = '1',
					url_link = '0',
					neverRemove = '1',
					
					days      				= '". @$days_TSV ."',
					category	 			= '" .mysql_escape( @$_REQUEST['category'] ). "',
					contact_name         	= '".mysql_escape(@$_REQUEST['contact_name'])."',
					contact_phone       	= '".mysql_escape(@$_REQUEST['contact_phone'])."',
					title         			= '".mysql_escape(@$_REQUEST['title'])."',
					website         		= '".mysql_escape(@$_REQUEST['website'])."',
					address         		= '".mysql_escape(@$_REQUEST['address'])."',
					city         			= '".mysql_escape(@$_REQUEST['city'])."',
					state         			= '".mysql_escape(@$_REQUEST['state'])."',
					zipcode         		= '".mysql_escape(@$_REQUEST['zipcode'])."',
					phone         			= '".mysql_escape(@$_REQUEST['phone'])."',
					summary         		= '".mysql_escape(@$_REQUEST['summary'])."',
					email_address			= '".mysql_escape(@$_REQUEST['email_address'])."',
					county         		= '".mysql_escape(@$_REQUEST['county'])."',
					ages         			= '".mysql_escape(@$_REQUEST['ages'])."',
					fees        			= '".mysql_escape(@$_REQUEST['fees'])."',
					fee_ed        			= '".mysql_escape(@$_REQUEST['fee_ed'])."',
					program_ed        	= '".mysql_escape(@$_REQUEST['program_ed'])."',
					ratio_ed        		= '".mysql_escape(@$_REQUEST['ratio_ed'])."',
					enrollment_ed       	= '".mysql_escape(@$_REQUEST['enrollment_ed'])."',
					licensed_ed       	= '".mysql_escape(@$_REQUEST['licensed_ed'])."',
					discount_ed       	= '".mysql_escape(@$_REQUEST['discount_ed'])."',
					religious_ed       	= '".mysql_escape(@$_REQUEST['religious_ed'])."',
					financial_ed        	= '".mysql_escape(@$_REQUEST['financial_ed'])."',
					accreditation_ed      = '".mysql_escape(@$_REQUEST['accreditation_ed'])."',
					schoolcare_ed       	= '".mysql_escape(@$_REQUEST['schoolcare_ed'])."',
					publish_address     	= '".mysql_escape(@$_REQUEST['publish_address'])."',
					eat_free        		= '".mysql_escape(@$_REQUEST['eat_free'])."',
					hours         			= '".mysql_escape(@$_REQUEST['hours'])."'";
				
			
					mysql_query($query) or die("MySQL Error:<br/>\n". htmlspecialchars(mysql_error()) . "\n");
      $recordNum = mysql_insert_id();
	  
	 

      // adopt temp uploads
      adoptUploads($tableName, $preSaveTempId, $recordNum);
      removeExpiredUploads(); // erase old expired uploads

   // display thanks message and clear form
      $errorsAndAlerts = "Thanks, we've added your record!";
      $preSaveTempId = uniqid('x');
      $recordNum     = null;
	  
  
 // send message to admin

      $placeholders = array(
	'user.email'       => $_REQUEST['email_address'],
	'user.fullname'    => $_REQUEST['contact_name'],
	'category'          => $_REQUEST['category'],
	'title'          	  => $_REQUEST['title'],
	'summary'          => $_REQUEST['summary'],
	'directoryAdminUrl'  => $GLOBALS['SETTINGS']['adminUrl'] . "?menu=dir_listings",

      );

       // email admin

      $errors = sendMessage(wsc_emailTemplate_loadFromDB(array(
	'template_id'      => 'DIRECTORY-ENTRY-ADDED',
	'placeholders'     => $placeholders,

      )));

      if ($errors) { die("Error sending message: $errors\n\nPlease let us know about this error!"); }


    // send message to user

      $placeholders = array(
	'user.email'       => $_REQUEST['email_address'],
	'user.fullname'    => $_REQUEST['contact_name'],
	'contact_phone'          => $_REQUEST['contact_phone'],
	'category'          => $_REQUEST['category'],
	'title'          	  => $_REQUEST['title'],
	'website'          	  => $_REQUEST['website'],
	'address'          	  => $_REQUEST['address'],
	'city'          	  => $_REQUEST['city'],
	'state'          	  => $_REQUEST['state'],
	'zipcode'          	  => $_REQUEST['zipcode'],
	'phone'          	  => $_REQUEST['phone'],
	'county'          	  => $_REQUEST['county'],
	'summary'          => $_REQUEST['summary'],
	'ages'          	  => $_REQUEST['ages'],
	'fees'          	  => $_REQUEST['fees'],
	'eat_free'          	  => $_REQUEST['eat_free'],
	'hours'          	  => $_REQUEST['hours'],

	

      );

       // email user

      $errors = sendMessage(wsc_emailTemplate_loadFromDB(array(
	'template_id'      => 'DIRECTORY-ENTRY-USER',
	'placeholders'     => $placeholders,

      )));

      if ($errors) { die("Error sending message: $errors\n\nPlease let us know about this error!"); }

  }

  }  
  
 
?>
<!doctype html>
<!--[if lt IE 7]> <html class="ie6 oldie"> <![endif]-->
<!--[if IE 7]>    <html class="ie7 oldie"> <![endif]-->
<!--[if IE 8]>    <html class="ie8 oldie"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="">
<!--<![endif]-->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<title><?php echo $directory_membershipRecord['page_title'] ?></title>
<meta name="description" content="<?php echo $directory_membershipRecord['page_description'] ?>" />
<meta name="keywords" content="<?php echo $directory_membershipRecord['page_keywords'] ?>" />
<link href="../boilerplate.css" rel="stylesheet" type="text/css">
<link href="../../css/main.css" rel="stylesheet" type="text/css">
<link href="../../css/new.css" rel="stylesheet" type="text/css">
<link href="../../css/meganizr.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="jquery/thickbox.css" type="text/css" media="screen" />

<!--[if lt IE 9]><link href="responsive/meganizr-ie.css" rel="stylesheet" type="text/css"><![endif]-->

<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link href="../../css/boilerplate.css" rel="stylesheet" type="text/css">
<link href="../../css/main.css" rel="stylesheet" type="text/css">
<link href="../../css/new.css" rel="stylesheet" type="text/css">
<link href="../../css/meganizr.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="jquery/thickbox.css" type="text/css" media="screen" />
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery/jquery-latest.pack.js"></script>
<script type="text/javascript" src="jquery/thickbox-compressed.js"></script>
<script type="text/javascript" src="formpreview.js"></script>
<script type="text/javascript" src="niceforms.js"></script>

<script src="../../jsnew/respond.min.js"></script>

<script type="text/javascript" src="//use.typekit.net/lzt6wua.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
<script src="../../js/google.js" type="text/javascript"></script>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="../word.js"></script>
<script type="text/javascript" src="count.js"></script>
	
<!-- jquery -->

<script type="text/javascript">
 $(document).ready(function () {
  if ( isset( @$_REQUEST['category'] ) ) { 
	 $('#category').show();
	 }
   });</script>

<script type="text/javascript">
  $(document).ready(function () {
	$('#ages, #fees, #grades, #tuition, #edfee, #edprogram, #ratio, #enroll, #licensed, #discount, #religious, #financial, #accreditation, #care, #eat_free, #hours, #days').hide();
	
	if ($('#category option:selected').val() == 'Camps: Day Camps') {
            $('#ages, #fees').show();
		  }
		  
	if ($('#category option:selected').val() == 'Camps: Residential') {
            $('#ages, #fees').show();
		  }
		  
	if ($('#category option:selected').val() == 'Child Care Referrals & Nannies') {
            $('#ages, #fees').show();
		  }
		  
	if ($('#category option:selected').val() == 'Educ: Boarding Schools') {
            $('#grades, #tuition, #edfee, #edprogram, #ratio, #enroll, #licensed, #discount, #religious, #financial, #accreditation, #care').show();
		  }	 
		  
	if ($('#category option:selected').val() == 'Educ: Charter Schools') {
            $('#grades, #tuition, #edfee, #edprogram, #ratio, #enroll, #licensed, #discount, #religious, #financial, #accreditation, #care').show();
		  }	 
		  
	if ($('#category option:selected').val() == 'Educ: Continuing Education') {
            $('#grades, #tuition, #edfee, #edprogram, #ratio, #enroll, #licensed, #discount, #religious, #financial, #accreditation, #care').show();
		  }	 
		  
	if ($('#category option:selected').val() == 'Educ: Education Resources') {
            $('#grades, #tuition, #edfee, #edprogram, #ratio, #enroll, #licensed, #discount, #religious, #financial, #accreditation, #care').show();
		  }	 
		  
	if ($('#category option:selected').val() == 'Educ: Home School Resources') {
            $('#grades, #tuition, #edfee, #edprogram, #ratio, #enroll, #licensed, #discount, #religious, #financial, #accreditation, #care').show();
		  }	 
		  
	if ($('#category option:selected').val() == 'Educ: Preschool') {
            $('#grades, #tuition, #edfee, #edprogram, #ratio, #enroll, #licensed, #discount, #religious, #financial, #accreditation, #care').show();
		  }	 
		  
	if ($('#category option:selected').val() == 'Educ: Private Schools') {
            $('#grades, #tuition, #edfee, #edprogram, #ratio, #enroll, #licensed, #discount, #religious, #financial, #accreditation, #care').show();
		  }
		  
	if ($('#category option:selected').val() == 'Educ: Public Schools') {
            $('#grades, #tuition, #edfee, #edprogram, #ratio, #enroll, #licensed, #discount, #religious, #financial, #accreditation, #care').show();
		  }	  
		  	  	  
	if ($('#category option:selected').val() == 'Enrichment and After-School') {
            $('#ages, #fees').show();
		  }	 	  
		  
	if ($('#category option:selected').val() == 'Family Dining') {
            $('#eat_free').show();
		  }
		  
	 if ($('#eat_free option:selected').val() == 'Yes') {
            $('#days, #hours').show();
	 	  }
		  
	 if ($('#eat_free option:selected').val() == 'No') {
            $('#eat_free').show();
	 	  }	  
		  
	if ($('#category option:selected').val() == 'Party Planning') {
            $('#ages, #fees').show();
		  }
		  
	if ($('#category option:selected').val() == 'Special Needs') {
            $('#ages, #fees').show();
		  }
		  
	if ($('#category option:selected').val() == 'Sports Sign-Ups') {
            $('#ages, #fees').show();
		  }
	
		  
    });
	</script> 

<script type="text/javascript"> 
if ("ontouchstart" in document.documentElement){
$('html').addClass('touch');
}	</script> 
 
</head>
<body>
<div class="gridContainer clearfix">
  <div id="headertop">
  <div id="news"><? include "C:/Inetpub/charlotteparent/templates/headernews.php"; ?> <!--End news--></div>
    <div id="info-social"><? include "C:/Inetpub/charlotteparent/templates/headerinfo-social.php"; ?><!--End info-social--></div>
    <div id="search"><? include "C:/Inetpub/charlotteparent/templates/search.php"; ?></div>
  <!--End headertop--></div>
  
  <div id="header">
    <div id="adres"><? include "C:/Inetpub/charlotteparent/templates/headeradres.php"; ?><!--End adres--></div>
    <div id="logo"><? include "C:/Inetpub/charlotteparent/templates/headerlogo.php"; ?><!--End logo--></div>
    <div id="ad"><?php echo $directory_membershipRecord['banner_ad'] ?><!--End ad--></div>
  <!--End header--></div>
  
   <div id="logo-res"><? include "C:/Inetpub/charlotteparent/templates/headerlogores.php"; ?><!--End logo-res--></div>
  
 <div id="nav"><? include "C:/Inetpub/charlotteparent/templates/newnavigation.php"; ?> <!--End nav--></div>
 <div id="tablet-nav"><? include "C:/Inetpub/charlotteparent/templates/tabletnav.php"; ?> <!--End res-nav--></div>
  <div id="responsive-nav"><? include "C:/Inetpub/charlotteparent/templates/resnav.php"; ?> <!--End res-nav--></div>
  
<div id="article">
<div id="breadcrumb"><script type="text/javascript" src="../../js/MPBackLinks.js"></script></div>
<div id="page-header"><h1>Free directory Listing Form</h1></div>
<div id="divider"><img src="../../imagesnew/newdivider1.jpg" alt="divider"></div>

<div id="content">
       

   <?php if (@$errorsAndAlerts): ?>
  <div style="color: red; font-weight: bold; font-size: 16px;"><br/>
    <?php echo $errorsAndAlerts; ?>
  </div>
<?php endif ?><br /><br />

<span class="red">* = Required</span><br />
<br />
 <h3 class="diagonal-header"><span><img src="../../imagesnew/step1_30.png" vertical-align="text-top" alt=""/> - Select a Category</span></h3><br> 
 
<form method="post" name="uploadForm"  action="?preSaveTempId=<?php echo $preSaveTempId ?>" enctype="multipart/form-data" id="mailsend"  >
<p>

  <input type="hidden" name="submitForm" value="1" />
  <input type="hidden" name="num" value="<?php echo $recordNum ?>" />
  <input type="hidden" name="preSaveTempId" value="<?php echo $preSaveTempId ?>" />
  <input type="hidden" name="removeUpload" id="removeUpload" value="0" />
  
<div class="form-label"><span class="red">*</span>Category:</div>
<div class="form-field" id="category">

<select name="category">
<option value = "">-Select-</option>
<?php foreach ($dir_categoriesRecords as $record): ?>
<option value = "<?php echo htmlspecialchars($record['name']);?>" <?php selectedIf($record['name'], @$_REQUEST['category']);?>> <?php echo htmlspecialchars($record['name']);?> </option>
<?php endforeach ?>
</select>

</div>  
    
<div class="content"><br>
<h3 class="diagonal-header"><span><img src="../../imagesnew/step2.png" alt=""/>  - Listing Details</span></h3><br></div>

<div class="form-label"><span class="red">*</span>Listing Name:</div>
<div class="form-field"><input class="text-input medium-input" type="text" name="title" value="<?php echo htmlspecialchars(@$_REQUEST['title']) ?>" size="50" /></div>

<div class="form-label"><span class="red">*</span>Website:</div>
<div class="form-field"><input class="text-input medium-input" type="text" name="website" value="<?php echo htmlspecialchars(@$_REQUEST['website']) ?>" size="50" /></div>

<div class="form-label"><span class="red">*</span>Address:</div>
<div class="form-field"><input class="text-input medium-input" type="text" name="address" value="<?php echo htmlspecialchars(@$_REQUEST['address']) ?>" size="50" /></div>

<div class="form-label">City:</div>
<div class="form-field"><input class="text-input medium-input" type="text" name="city" value="<?php echo htmlspecialchars(@$_REQUEST['city']) ?>" size="50" /></div>

<div class="form-label">State:</div>
<div class="form-field"><input class="text-input medium-input" type="text" name="state" value="<?php echo htmlspecialchars(@$_REQUEST['state']) ?>" size="50" /></div>

<div class="form-label">Zipcode:</div>
<div class="form-field"><input class="text-input medium-input" type="text" name="zipcode" value="<?php echo htmlspecialchars(@$_REQUEST['zipcode']) ?>" size="50" /></div>

<div class="form-label">Publish address:</div>
<div class="form-field"><input type = "checkbox" name = "publish_address" value = "1" <?php checkedIf(1, @$_REQUEST['publish_address']);?> /> Check box to NOT have your address published.</div>

<div class="form-label"><span class="red">*</span>Phone:</div>
<div class="form-field"><input class="text-input medium-input" type="text" name="phone" value="<?php echo htmlspecialchars(@$_REQUEST['phone']) ?>" size="50" /></div>

<div class="form-label"><span class="red">*</span>County:</div>
<div class="form-field">
<select name="county">
<option value = "">-Select-</option>
<?php foreach (getListOptions($tableName, 'county') as $value => $label): ?>
<option value = "<?php echo htmlspecialchars($value);?>" <?php selectedIf($value, @$_REQUEST['county']);?>> <?php echo htmlspecialchars($label);?> </option>
<?php endforeach ?>
</select></div>

<div class="form-label"><span class="red">*</span>Brief Description:</div>
<div class="form-field">
<textarea id="demo1"  rows="5" cols="50" type="text" name="summary" value="<?php echo htmlspecialchars(@$_REQUEST['summary']) ?>" size="50" /></textarea><br>
<p>35 word limit. You have <span id="counter"></span> words left.</p><br></div>

<div id="ages" >
 <div class="form-label"><span class="red">*</span>Ages:</div>
<div class="form-field"><input class="text-input medium-input" type="text" name="ages" value="<?php echo htmlspecialchars(@$_REQUEST['ages']) ?>"  size="50" /><br>
If not applicable, please type N/A.<br><br></div></div>
<div id="fees" >
 <div class="form-label"><span class="red">*</span>Fees:</div>
<div class="form-field"><input class="text-input medium-input" type="text" name="fees" value="<?php echo htmlspecialchars(@$_REQUEST['fees']) ?>"  size="50" /><br>
If not applicable, please type N/A.<br><br></div></div>

<div id="grades" >
 <div class="form-label"><span class="red">*</span>Grades/Ages:</div>
<div class="form-field"><input class="text-input medium-input" type="text" name="ages" value="<?php echo htmlspecialchars(@$_REQUEST['ages']) ?>"  size="50" /></div></div>

<div id="tuition" >
 <div class="form-label"><span class="red">*</span>Fees/Tuition:</div>
<div class="form-field"><input class="text-input medium-input" type="text" name="fees" value="<?php echo htmlspecialchars(@$_REQUEST['fees']) ?>"  size="50" /></div></div>

<div id="edfee" >
<div class="form-label"><span class="red">*</span>Fee Schedule:</div>
<div class="form-field">
<select name="fee_ed">
<option value = "">-Select-</option>
<?php foreach (getListOptions($tableName, 'fee_ed') as $value => $label): ?>
<option value = "<?php echo htmlspecialchars($value);?>" <?php selectedIf($value, @$_REQUEST['fee_ed']);?>> <?php echo htmlspecialchars($label);?> </option>
<?php endforeach ?>
</select></div></div>

<div id="edprogram" >
<div class="form-label"><span class="red">*</span>Program Type:</div>
<div class="form-field">
<select name="program_ed">
<option value = "">-Select-</option>
<?php foreach (getListOptions($tableName, 'program_ed') as $value => $label): ?>
<option value = "<?php echo htmlspecialchars($value);?>" <?php selectedIf($value, @$_REQUEST['program_ed']);?>> <?php echo htmlspecialchars($label);?> </option>
<?php endforeach ?>
</select></div></div>

<div id="ratio" >
 <div class="form-label">Student-Teacher Ratio:</div>
<div class="form-field"><input class="text-input medium-input" type="text" name="ratio_ed" value="<?php echo htmlspecialchars(@$_REQUEST['ratio_ed']) ?>"  size="50" /></div></div>

<div id="enroll" >
 <div class="form-label">Enrollment:</div>
<div class="form-field"><input class="text-input medium-input" type="text" name="enrollment_ed" value="<?php echo htmlspecialchars(@$_REQUEST['enrollment_ed']) ?>"  size="50" /></div></div>

<div id="licensed" >
<div class="form-label">Licensed:</div>
<div class="form-field">
<select name="licensed_ed">
<option value = "">-Select-</option>
<?php foreach (getListOptions($tableName, 'licensed_ed') as $value => $label): ?>
<option value = "<?php echo htmlspecialchars($value);?>" <?php selectedIf($value, @$_REQUEST['licensed_ed']);?>> <?php echo htmlspecialchars($label);?> </option>
<?php endforeach ?>
</select></div></div>

<div id="discount" >
<div class="form-label">Sibling Discount:</div>
<div class="form-field">
<select name="discount_ed">
<option value = "">-Select-</option>
<?php foreach (getListOptions($tableName, 'discount_ed') as $value => $label): ?>
<option value = "<?php echo htmlspecialchars($value);?>" <?php selectedIf($value, @$_REQUEST['discount_ed']);?>> <?php echo htmlspecialchars($label);?> </option>
<?php endforeach ?>
</select></div></div>

<div id="religious" >
<div class="form-label">Religious Affiliation:</div>
<div class="form-field">
<select name="religious_ed">
<option value = "">-Select-</option>
<?php foreach (getListOptions($tableName, 'religious_ed') as $value => $label): ?>
<option value = "<?php echo htmlspecialchars($value);?>" <?php selectedIf($value, @$_REQUEST['religious_ed']);?>> <?php echo htmlspecialchars($label);?> </option>
<?php endforeach ?>
</select></div></div>

<div id="financial" >
<div class="form-label">Financial Aid:</div>
<div class="form-field">
<select name="financial_ed">
<option value = "">-Select-</option>
<?php foreach (getListOptions($tableName, 'financial_ed') as $value => $label): ?>
<option value = "<?php echo htmlspecialchars($value);?>" <?php selectedIf($value, @$_REQUEST['financial_ed']);?>> <?php echo htmlspecialchars($label);?> </option>
<?php endforeach ?>
</select></div></div>

<div id="accreditation" >
 <div class="form-label">Accreditation and/or License No:</div>
<div class="form-field"><input class="text-input medium-input" type="text" name="accreditation_ed" value="<?php echo htmlspecialchars(@$_REQUEST['accreditation_ed']) ?>"  size="50" /></div></div>

<div id="care" >
<div class="form-label">Before/After School Care:</div>
<div class="form-field">
<select name="schoolcare_ed">
<option value = "">-Select-</option>
<?php foreach (getListOptions($tableName, 'schoolcare_ed') as $value => $label): ?>
<option value = "<?php echo htmlspecialchars($value);?>" <?php selectedIf($value, @$_REQUEST['schoolcare_ed']);?>> <?php echo htmlspecialchars($label);?> </option>
<?php endforeach ?>
</select></div></div>


<div id="eat_free" >
 <div class="form-label"><span class="red">*</span>Kids Eat Free:</div>
<div class="form-field">
<select name="eat_free" > 
<option value = "">-Select-</option>
<?php foreach (getListOptions($tableName, 'eat_free') as $value => $label): ?>
<option value = "<?php echo htmlspecialchars($value);?>" <?php selectedIf($value, @$_REQUEST['eat_free']);?>> <?php echo htmlspecialchars($label);?> </option>
<?php endforeach ?>
</select> </div></div>

<div id="hours" >
 <div class="form-label">Hours:</div>
<div class="form-field"><input class="text-input medium-input" type="text" name="hours" value="<?php echo htmlspecialchars(@$_REQUEST['hours']) ?>"  size="50" /></div></div>


<div id="days" >
 <div class="form-label">Days of Week:</div>
<div class="form-field">

    <fieldset>
       <?php foreach($days_dirRecords as $record): ?>
	   <input type="checkbox" value="<?php echo $record['habbit']; ?>"  <?php echo checkIfInArray($record['habbit'], @$_REQUEST["days"]) ?>	 name="days[]" />&nbsp;<?php echo $record['habbit']; ?>
	   <br />
       <?php endforeach; ?>
    </fieldset>


</div></div>

<div class="content"><br><br>
<h3 class="diagonal-header"><span><img src="../../imagesnew/step3.png" alt=""/>  - Contact Details</span></h3></div>

<div class="form-label"></div>
<div class="form-field">This information is used for internal purposes only and will not be published.<br><br></div>
<div class="form-label"><span class="red">*</span>Contact Name:</div>
<div class="form-field"><input class="text-input medium-input" type="text" name="contact_name" value="<?php echo htmlspecialchars(@$_REQUEST['contact_name']) ?>" size="50" /></div>

<div class="form-label"><span class="red">*</span>Contact Email:</div>
<div class="form-field"><input class="text-input medium-input" type="text" name="email_address" value="<?php echo htmlspecialchars(@$_REQUEST['email_address']) ?>" size="50" /></div>

<div class="form-label"><span class="red">*</span>Contact Phone:</div>
<div class="form-field"><input class="text-input medium-input" type="text" name="contact_phone" value="<?php echo htmlspecialchars(@$_REQUEST['contact_phone']) ?>" size="50" /></div>


<div class="content"><br><div class="diagonal-header">&nbsp;</div></div>
<div class="form-divider">
<div class="form-empty">&nbsp;</div>
<div class="form-button"><input class="button" type="submit" name="submitForm" value="Submit" /></div>
<div class="form-button">
<fieldset class="action">
				<input type="button" value="Preview" id="previewbutton" class="thickbox" alt="#TB_inline?width=700&height=700&inlineId=mailpreview&modal=true" />
				<script type="text/javascript">
					$('#previewbutton').click(function(){
						formPreview( 'mailsend', 'mailpreview.php', 'mailpreviewiframe');
					});
				</script>
			
			</fieldset></div>


<div id="mailpreview" style="display: none;">
	 <iframe name="mailpreviewiframe" style="border: 0; width: 700px; height: 695px; "></iframe>
   		</div>
        
        </div>
        
        
 <div class="form-res">

<div class="form-button"><input class="button" type="submit" name="submitForm" value="Submit" />&nbsp;&nbsp;&nbsp;</div>
<div class="form-button">
<fieldset class="action">
				<input type="button" value="Preview" id="previewbuttonres" class="thickbox" alt="#TB_inline?width=300&height=700&inlineId=mailpreview&modal=true" />
				<script type="text/javascript">
					$('#previewbuttonres').click(function(){
						formPreview( 'mailsend', 'mailpreview.php', 'mailpreviewiframe');
					});
				</script>
			
			</fieldset></div>


<div id="mailpreview" style="display: none;">
	 <iframe name="mailpreviewiframe" style="border: 0; width: 300px; height: 695px; "></iframe>
   		</div>
        
        </div>       

</form>

 <!--End content--></div>
    
  
  <!--End article--></div>
  
  <div id="aside">


 <div id="photosponsor-adres"><?php echo $directory_membershipRecord['mobilead_1'] ?>
   <?php echo $directory_membershipRecord['mobilead_2'] ?>
   <?php echo $directory_membershipRecord['mobilead_3'] ?></div>
  <div id="toggle">
	  <h3><a href="#"><?php echo $menu_newRecord['sidebar_directoriestext'] ?></a></h3>
		<div><ul class="toggle-list">
                        <?php foreach ($directories_menuRecords as $record): ?>
                            <li><a href="<?php echo $record['dirurl'] ?>"><?php echo $record['title'] ?></a></li>
                          <?php endforeach; ?>                           
                        </ul></div></div>
    <div id="toggle">
		<h3><a href="#"><?php echo $menu_newRecord['sidebar_publicationstext'] ?></a></h3>
		<div><ul class="toggle-list">
                       <?php foreach ($publicationsmenuRecords as $record): ?>
                            <li><a href="<?php echo $record['puburl'] ?>"><?php echo $record['title'] ?></a></li>
                            <?php endforeach; ?>                            
                        </ul></div></div>
                        
  <!----Ads---->                       
    <div class="aside-ads">
<?php echo $directory_membershipRecord['tower_ad1'] ?>
<?php echo $directory_membershipRecord['tower_ad2'] ?>
<?php echo $directory_membershipRecord['tower_ad3'] ?></div>

<!----Global Text Area---->
<div class="container">
 <h3 class="green"><?php echo $globalRecord['title_text'] ?></h3>
<div class="container-content">
		<?php foreach ($globalRecord['photo'] as $upload): ?>
          <?php if ($upload['isImage']): ?> 
            <div class="center"><img src="<?php echo $upload['urlPath'] ?>" title="<?php echo $upload['info1'] ?>" /></div><br/><br />

          <?php endif ?>
        <?php endforeach ?>
        <p><?php echo $globalRecord['content_text'] ?></p>
       
</div></div> 

<!----Tip---->
 <div class="container">
	 <h3 class="blue"><?php echo $globalRecord['title'] ?></h3>
      <div id="quote-container">
        <blockquote>
         <img class="leftquote" src="../../images/leftquote.png"><?php echo $globalRecord['content'] ?><img class="rightquote" src="../../images/rightquote.png">
        </blockquote>
 
        <p><a href="<?php echo $globalRecord['link_url'] ?>"><?php echo $globalRecord['link_title'] ?></a></p>

</div></div>

<div id="newsres"><? include "C:/Inetpub/charlotteparent/templates/headernewsressec.php"; ?> <!--End newsres--></div>
 <div id="info-socialres">
<a  href="https://www.facebook.com/cltparent"><img src="../../imagesnew/facebook-icon.png" class="info-icon"></a>
<a href="https://twitter.com/CharlotteParent"><img src="../../imagesnew/twitter-icon.png" class="info-icon" ></a>
<a  href="http://pinterest.com/charlotteparent/"><img src="../../imagesnew/pinterest-icon.png" class="info-icon"></a>

<!--End info-social--></div>
  <!--End aside--></div>
    <!--End grid--></div>
    
 <div id="footerwrapper">
<div class="gridContainer clearfix">
    <div id="footer">
    	<div id="footerlft"><? include "C:/Inetpub/charlotteparent/templates/footerlft.php"; ?></div>
     	<div id="footerrgt"><? include "C:/Inetpub/charlotteparent/templates/footerrgt.php"; ?></div>
     	<div id="footerrgttab"><? include "C:/Inetpub/charlotteparent/templates/footerrgttab.php"; ?></div>
    <!--End footer--></div>
    <div id="responsive-footer"><? include "C:/Inetpub/charlotteparent/templates/resfooter.php"; ?> <!--End res-footer--></div>
    
    <div id="copyright"><?php echo $globalRecord['copyright'] ?> <!--End copyright--></div>
  <div id="mmlogo"><? include "C:/Inetpub/charlotteparent/templates/footerlogo.php"; ?></div>
    
 <!--End grid--></div>
<!--End footerwrapper--></div>



<!-- Share This Scripts -->
<script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "19f48c6c-364e-4e0a-9e27-f4b71609270b", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script>

<!-- Meganizr Scripts -->

<script src="../../jsnew/meganizr.js"></script>
<!-- end Meganizr Scripts -->



 <!-- The JavaScript -->
        <script type="text/javascript">
            $(function() {
                $('#activator').click(function(){
                    $('#overlay').fadeIn('fast',function(){
                        $('#box').animate({'top':'160px'},500);
                    });
                });
                $('#boxclose').click(function(){
                    $('#box').animate({'top':'-200px'},500,function(){
                        $('#overlay').fadeOut('fast');
                    });
                });

            });
        </script>	
        
<script src="../hide.js"></script>
<script src="../view.js"></script>


<script src="../../jsnew/jquery.ui-custom.js"></script>
<script src="../../jsnew/jquery.easing.1.3.js"></script>
<script src="../../jsnew/scripts.js"></script>

	<!-- easing plugin ( optional ) -->
	<script src="../../jsnew/easing.js" type="text/javascript"></script>
	<!-- UItoTop plugin -->
	<script src="../../jsnew/jquery.ui.totop.js" type="text/javascript"></script>
	<!-- Starting the plugin -->
	<script type="text/javascript">
		$(document).ready(function() {
			/*
			var defaults = {
	  			containerID: 'toTop', // fading element id
				containerHoverID: 'toTopHover', // fading element hover id
				scrollSpeed: 1200,
				easingType: 'linear' 
	 		};
			*/
			
			$().UItoTop({ easingType: 'easeOutQuart' });
			
		});
	</script>

    <script type="text/javascript"> 
var $buoop = {} 
$buoop.ol = window.onload; 
window.onload=function(){ 
 try {if ($buoop.ol) $buoop.ol();}catch (e) {} 
 var e = document.createElement("script"); 
 e.setAttribute("type", "text/javascript"); 
 e.setAttribute("src", "http://browser-update.org/update.js"); 
 document.body.appendChild(e); 
} 
</script>  

</body>
</html>