<?php
  $wizard_template_page = substr(__FILE__,-5,1);

  include ("wizard_common_top.php")


?>

   </header>
   <div id="wrapper" onclick="">
    <section>

      <div class="center_frame">
        <h1>Create Your Theme</h1>
          <p>Enter the 'title' for your website, and a 'tagline' if you have it.  We will put it in the right place for you.  You can easily change it later.  </p>
          <p> For example: Title = "All About You, LLC",  Tagline = "We Take Care of You!"</p>
        <center>TITLE:</center>
        <input name="header_title" type="text" id="header_title" maxlength="64" placeholder="e.g.   Breeze Website builder Template Wizard" <?php if (!empty($site_title)) echo "value='".$site_title."' ";?>>
        <br><br>
        <center>TAG-LINE:</center>
        <input name="tagline" type="text" id="tagline" maxlength="128" placeholder="   ... where building a website is a BREEZE" <?php if (!empty($tagline)) echo "value='".$tagline."' ";?>>
        <br><br>
        <h1>Add your Images</h1>
          <p>A great website has lots of images.  If you're ready, this is a great time to add them.  If you have a Logo, a Background watermark, or Header Art, upload your image(s) below.
        </p>
        <p>For each image, click where it says "Click here to place image" and we'll install it for you.  If you don't have images now, don't worry - you can always do this later.</p>
        <fieldset  class="center_frame">
          <legend>Image Selector</legend>
            <input type="hidden" id="MAX_IMAGE_SIZE" name="MAX_IMAGE_SIZE" value="<?php echo MAX_IMAGE_SIZE;?>" />
            <input type="hidden" id="USERS_IMAGE_FOLDER" name="USERS_IMAGE_FOLDER" value="<?php echo USERS_IMAGE_FOLDER;?>" />
            <div>
              <label for="fileselect">Click to Upload Images:</label>
  	        <input type="file" id="fileselect" name="fileselect[]" multiple="multiple" />
  	        <div id="filedrag">or drag and drop images here</div>
            </div>
          <div id="submitbutton">
            <button type="submit">Upload Files</button>
          </div>
        </fieldset>
      	 <div class='nav_btn_box'>
			   <label class='float_l' for='goto_page_2'>
				<img class='nav_btn' src='/wizard/images/blue_back_btn.png' alt='back_button'>
				</label>
				<label onClick='checkForContent()'  class='float_r'>
				<img class='nav_btn' src='/wizard/images/build_btn.png' alt='next_button'>
				</label>
    		</div>



        <div id="images"  class="center_frame">
<?php

  if (!empty($cached_user_images)) {

    $myString = "";
    $image_count = count($cached_user_images);
    foreach ($cached_user_images as $key => $val) {
      $file_url = USERS_IMAGE_FOLDER . $val['file_name'];
      if ($finfo = getimagesize(HOME_PATH . $file_url)) {
        $fmime = image_type_to_mime_type($finfo[2]);
        $fdim = $finfo[0] . "W x " . $finfo[1] . "H";
      }
      // ignore duplicate image uploads
      $image_collection[] = $val['file_name'];

  //    $myString .= str_pad("", 2) . "<div id='file_" . $key . "' class='file_id'>\n";
      $myString .= str_pad("", 2) . "<div class='file_id'>\n";
      $myString .= str_pad("", 4) . "<div id='file_tag_" . $key . "' class='file_tag'>\n";
      $myString .= str_pad("", 6) . "<a class='view_value'\n";
      $myString .= str_pad("", 7) . "onclick='return toggle_child(this);'\n";
      $myString .= str_pad("", 9) . "title='Select where to place image:'\n";
      $myString .= str_pad("", 11) . "alt='Select where to place image:'>\n";
      $myString .= str_pad("", 7) . $image_tags[$val['image_tag']] . "\n";
      $myString .= str_pad("", 6) . "</a>\n";
      $myString .= get_image_label_selector($key,$val['image_tag']) . "\n";
      $myString .= str_pad("", 6) . "<span class='i_del'>\n";
      $myString .= str_pad("", 8) . "<a onclick=\"delete_image(this,'".$val['file_name']."','select');\"\n";
      $myString .= str_pad("", 13) . "title='delete image'\n";
      $myString .= str_pad("", 15) . "alt='delete image'\n";
      $myString .= str_pad("", 16) . "id='file_delete_" . $key . "'>\n";
      $myString .= str_pad("", 8) . "</a>\n";
      $myString .= str_pad("", 6) . "</span>\n";
//      $myString .= str_pad("", 6) . "<input id='image_file_" . $key . "' name='image_file_";
      $myString .= str_pad("", 6) . "<input name='file_name_";
      $myString .= $key . "' value='" . $val['file_name'] . "' type='hidden'>\n";
      $myString .= str_pad("", 4) . "</div>\n";
 //     $myString .= str_pad("", 4) . "<div id='file_display_" . $key . "' class='file_display'>\n";
      $myString .= str_pad("", 4) . "<div id='file_display_" . $key . "'\n";
      $myString .= str_pad("", 6) . "class='file_display' title='" . $val['file_name'] . "'\n";
      $myString .= str_pad("", 6) . "style='background-image: url(\"" . $file_url . "\")'>\n";
      $myString .= str_pad("", 4) . "</div>\n";
//      $myString .= str_pad("", 6) . "<img id='img_" . $key . "' class='image_tn' src='";
//      $myString .= str_pad("", 6) . "<img class='image_tn' src='";
//      $myString .= $file_url . "'></div>\n";
//      $myString .= str_pad("", 4) . "<div id='file_info_" . $key . "' class='file_info'>\n";
      $myString .= str_pad("", 4) . "<div class='file_info'>\n";
      $myString .= str_pad("", 6) . "<span class='file_name_legend'>Name:&nbsp;&nbsp;</span>";
      $myString .= "<span class='file_name' id='file_name_info_" . $key;
      $myString .= "'>" . $val['file_name'] . "</span>\n";
      $myString .= str_pad("", 6) . "<span class='file_type_legend'>Type:&nbsp;&nbsp;</span>";
      $myString .= "<span class='file_type'>" . $fmime . "</span>\n";
      $myString .= str_pad("", 6) . "<span class='file_size_legend'>Size:&nbsp;&nbsp;</span>";
      $myString .= "<span class='file_size'><span id='file_size_" . $key . "'>";
      $myString .= filesize(HOME_PATH.$file_url) . "</span>&nbsp;bytes</span>\n";
      $myString .= str_pad("", 6) . "<span class='file_resolution_legend'>Resolution:";
      $myString .= "&nbsp;&nbsp;</span><span class='file_resolution' id='file_img_resolution_";
      $myString .= $key . "'>" . $fdim . "</span>\n";
      $myString .= str_pad("", 6) . "<div class='file_progress' id='file_progress_" . $key . "'>";
      $myString .= "<span class='".get_image_progress_class($key,$val['image_tag']) . "'>Image has been uploaded</span></div>\n";
      //$myString .= "<span class='tagged'>Image has been uploaded</span></div>\n";
      $myString .= str_pad("", 4) . "</div>\n";
      $myString .= str_pad("", 2) . "</div>\n";/*  */
    }
  echo $myString;
  }

?>

        </div>

      </div> <!-- END center_frame -->

<?php
  echo "<script type='text/javascript' language='JavaScript'>\n";
  echo "  var image_counter=" . (!empty($image_count)?$image_count:"0") . ";\n";
  $php_array = get_image_label_list();
  $js_array = json_encode($php_array);
  echo "var image_label_array = ". $js_array . ";\n";
  if (!empty($image_collection) && is_array($image_collection)) {
    $js_array = json_encode($image_collection);
    echo "image_collection = ". $js_array . ";\n";
  }
  echo "</script>\n\n";
/*print "<pre style=\"text-align:right;\">";
echo "this is menu_row_cache";
print_r($menu_row_cache);
echo "this is $ post";
print_r($_POST);
print "</pre>";*/
?>
    </section> <!-- END -->
    
    <div id="setup_site_intro_div"><?php include ("setup_site_intro_body_code.html"); ?></div>
    <div id="setup_site_complete_div">&nbsp;</div>

<?php
  include ("wizard_common_bottom.php")

?>