<?php
	session_start();
	include "../correlations/includes.php";
	
	$allfields = array(	"date", "firstname", "lastname", "street", "city", "state", "zip", "country", "phone", "email", "productuse", "status", "students");
	$required  = array(	"firstname", "lastname", "zip", "email");
				  
	if (isset($_POST['Submit']))
	{
		//  capture the posted values in Session variables
		foreach($allfields as $field) {
			$_SESSION[$field] = isset($_POST[$field]) ? $_POST[$field] : '';
		}

		// check for required fields
		$_SESSION['errors'] = "";
		foreach($required as $field) {
			if (!$_POST[$field]) {
				$_SESSION['errors'] .= "	- $field is a required field <br>";
			}
		}

		// check for valid email
		if (!isValidEmail($_SESSION['email']))
		{
			$_SESSION['errors'] .= "  - Invalid email address <br>";
		}

 
		// if all fields OK
		if ($_SESSION['errors'] == "")
		{

			// create an entry in the log file
			$_SESSION['date'] = date('m/d/y H:i:s');
			$logfile = "../../logs/GuideDownloads.txt";
			$fp = fopen($logfile, "a");
            if ($fp){
                foreach($allfields as $field) {
                    fwrite($fp, $field . '="' . $_SESSION[$field] . '"  ');
                }
                fwrite($fp, "\r\n");
                fclose($fp);
            }

			// display success page
			header("Location: guideformFinish.htm");
			exit;
		}
	}
	else
	// first time through - Submit button not pressed
	{
		$_SESSION['errors'] = "";
		$_SESSION['state'] = "";
		$_SESSION['country'] = "United States";
	}
?>

<!DOCTYPE html>
<html>

<head>

<title>Download &quot;Guide to Using Technology in the Piano Studio&quot;</title>

<meta name="description" content="Harmonic Vision is the developer and publisher of the Music Ace series of music education software.">
<meta name="keywords" content="music education, piano lessons, music education software, music theory, learning music, music lessons, beginning music, music software, Music Ace, Music Doodle Pad, Music Ace 2, Music Ace Deluxe, Music Ace Maestro">

<link rel="stylesheet" href="../css/styles.css" type="text/css">

<style type="text/css">
.style34 {color: #000000; font-family: Arial, Helvetica, sans-serif; font-size: 18px;}
.style2 {font-family: Arial, Helvetica, sans-serif}
.style27 {font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #000000;
}
.style31 {font-size: 10px; font-family: Arial, Helvetica, sans-serif; color: #FF0000; }
.style32 {color: #FF0000}
.style4 {font-family: Arial, Helvetica, sans-serif; font-size: 14px; }
.styleRED {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #FF0000;
	background-color: #dddddd;
}
.style36 {font-size: 36px}
</style>
</head>

<body OnLoad="document.F1.firstname.focus();">
<br>  <!--  <br> to push the whole page down 1 line from the browser top  -->

<!-- ===============================  start page container table (entire page is enclosed by this table) ===== -->
<table border="1" cellpadding="0" cellspacing="0" width="800" align="center" bgcolor="#fffffe"><tr><td valign="top">

<!-- =================================== start Logo Header ======================================= --><!-- #BeginLibraryItem "/Library/header.lbi" -->
<table width="788" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
  <tr><td><img src="../images/spacer.gif" alt="" width="784"  height="5"></td></tr>
  <tr><td><img src="../images/insidetop.gif" alt="" width="784"  height="57"></td></tr>
</table>
<!-- #EndLibraryItem --><!-- =================================== end Logo Header ======================================= -->

<!-- =================================== start Navigation Buttons ======================================= --><!-- #BeginLibraryItem "/Library/navbuttons.lbi" --><table width="771" border="0" cellspacing="0" cellpadding="0" align="center"><tr><td>
  <div class="navBar"" align="left">
    <ul id="nav">
	<li><a href="#">Products</a>
		<ul>
			<li><a href="../madfact.htm">Music Ace Deluxe</a></li>
			<li><a href="../mamfact.htm">Music Ace Maestro</a></li>
			<li><a href="../mafact.htm">Music Ace</a></li>
			<li><a href="../ma2fact.htm">Music Ace 2</a></li>
			<li><a href="../pafact.htm">Piano Ace</a></li>
			<li><a href="../mampupg.htm">Product Upgrades</a></li>
		</ul>
	</li>
	
	<li><a href="#">At Home</a>
		<ul>
			<li><a href="../hs/index.htm">Homeschool</a></li>
			<li><a href="../products_home.htm">Individual or family</a></li>
			<li><a href="../pianostudent/index.htm">Piano Student</a></li>
		</ul>
	</li>
    	
	<li><a href="#">School</a>
		<ul>
			<li><a href="../products_edu.htm">Products</a></li>
			<li><a href="../educatorresources.htm">Resources</a></li>
		</ul>
	</li>	
	
	<li><a href="#">Studio</a>
       <ul>
            <li><a href="../pianoteacher/index.htm">Studio Teachers</a></li>
			<li><a href="../educatorresources.htm">Resources</a></li>
       </ul>
	</li>
			
	<li><a href="../mampupg.htm">Upgrades</a></li>	
    
	<li><a href="#">Support</a>
      <ul>
            <li><a href="../techsupport/index.htm">Technical Support</a></li>
            <li><a href="../dealer.htm">Dealer support</a></li>
            <li><a href="../news.htm">Press/media</a></li>
            <li><a href="../contactus.html">Contact Us</a></li>
       </ul>
    </li>	
    
	<!-- <li><a href="demoform.php">Free Demo</a></li> -->
  </ul>
  </div>
</td></tr></table>
<!-- #EndLibraryItem --><!-- =================================== end Navigation Buttons ======================================= -->

<!-- ========================== start Breadcrumb - update this for each page  ============ -->
<table width="771" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td>
<div id="breadcrumb"><a href="../index.htm">Home</a></div>
    </td>
  </tr>
</table>
<!-- ================================= end Breadcrumb ==================================== -->

<!-- ================================= Start Content container table ================================== -->
  <div><table border="0" cellpadding="0" cellspacing="0" width="784" bgcolor="#FFFFFF" align="center"><tr><td>
	 
<!-- ============================== START CONTENT - put page content here =============================== -->	 
		 
<table width="730" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><table width="524" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td valign="top" align="center"><span class="style34"><br>Download &quot;<em>Guide to Using Technology in the Piano Studio</em>&quot;</span> <br><br>
          <span class="verdana-11">To download a free PDF version of the &quot;Guide to Using Technology in the Piano Studio&quot;, please fill out the form below and click the &quot;<strong>Submit</strong>&quot; button at the bottom of 
            the page.<br>Your personal information will not be sold or given to any third 
            parties.</span><br>
            <br>
			</td>
      </tr>
    </table>
      <table width="514" border="1" align="center" cellpadding="0" cellspacing="0" bgcolor="#dddddd">
        <tr>
          <td align="right" class="style2">
		  <form name="F1" action="guideform.php" method="POST" class="style4">
            <span class="style31">* Required field&nbsp;&nbsp; </span>
              <?php
// if missing fields were detected, display a table with all the missing fields
if (isset($_SESSION['errors']) && $_SESSION['errors'] <> "") {
    echo '<table width="513" border="0">
	        <tr>
            <td  align="center" width="500"><span class="styleRED">Required fields are missing or invalid - please correct the fields and Submit again <br>' . 
                $_SESSION['errors'] . '</span></td>
            </tr>
           </table>';
}
?>
              <table width="500" border="0" cellspacing="5" cellpadding="0" align="center">
                <tr>
                  <td width="532" align="left"><span class="verdana-11" >First Name<span class="style32">*</span><img src="../images/spacer2.gif" width="70" height="10" alt="">Last Name<span class="style32">*</span><br>
                        <input name="firstname" type="text" value="<?php echo isset($_SESSION['firstname']) ? $_SESSION['firstname'] : '' ;?>" class="style27"
					   id="firstname" size="15">
                        <img src="../images/spacer2.gif" alt="">
                        <input name="lastname" type="text" value="<?php echo isset($_SESSION['lastname']) ? $_SESSION['lastname'] : '' ;?>" class="style27" id="lastname" size="30">
                  </span></td>
                </tr>
                <tr>
                  <td width="532" align="left"><span class="verdana-11">Street Address<img src="../images/spacer2.gif" width="190" height="10" alt=""></span><span class="verdana-11">City</span><br>
                      <input name="street" type="text" value="<?php echo isset($_SESSION['street']) ? $_SESSION['street'] : '';?>" class="style27" size="42">
                      <img src="../images/spacer2.gif" width="10" height="10" alt="">
                      <input name="city" type="text" value="<?php echo isset($_SESSION['city']) ?  $_SESSION['city'] : '' ;?>" class="style27" size="30"></td>
                </tr>
                <tr>
                  <td width="532" align="left"><span class="verdana-11">State/Province<img src="../images/spacer2.gif" width="80" height="10" alt="">Zip/Postal Code<span class="style32">*</span><img src="../images/spacer2.gif" width="20" height="10" alt="">Country</span><br>
                      <label>
                      <select name="state" size="1" class="style27" id="state">
                        <?php
//------------------------------------------------------------------------------------------------------
//  dynamically build the State/Province select option list from the $state array
//------------------------------------------------------------------------------------------------------
$state= array (	"" => "",
				" "  => "outside USA/Canada",
				"AL" => "Alabama", "AK" => "Alaska", "AB" => "Alberta", "AS" => "American Samoa" , "AZ" => "Arizona",
				"AR" => "Arkansas", "BC" => "British Columbia", "CA" => "California", "CO" => "Colorado", "CT" => "Connecticut", 
				"DE" => "Delaware", "DC" => "Dist.of Columbia", "FL" => "Florida", "GA" => "Georgia",
				"GU" => "Guam", "HI" => "Hawaii", "ID" => "Idaho", "IL" => "Illinois",
				"IN" => "Indiana", "IA" => "Iowa", "KS" => "Kansas", "KY" => "Kentucky",
 				"LA" => "Louisiana", "ME" => "Maine", "MB" => "Manitoba", "MH" => "Marshall Islands",
 				"MD" => "Maryland", "MA" => "Massachusetts", "MI" => "Michigan", "MN" => "Minnesota",
 				"MS" => "Mississippi", "MO" => "Missouri", "MT" => "Montana", "NE" => "Nebraska",
 				"NV" => "Nevada", "NB" => "New Brunswick", "NH" => "New Hampshire", "NJ" => "New Jersey",
 				"NM" => "New Mexico", "NY" => "New York", "NF" => "Newfoundland", "NC" => "North Carolina",
 				"ND" => "North Dakota", "NT" => "Northwest Terr.", "NS" => "Nova Scotia", "OH" => "Ohio",
 				"OK" => "Oklahoma", "ON" => "Ontario", "OR" => "Oregon", "PW" => "Palau Island",
 				"PA" => "Pennsylvania", "PE" => "Prince Edward Is.", "PR" => "Puerto Rico", "QC" => "Quebec",
 				"RI" => "Rhode Island", "SK" => "Saskatchewan", "SC" => "South Carolina", "SD" => "South Dakota",
 				"TN" => "Tennessee", "TX" => "Texas", "UT" => "Utah", "VT" => "Vermont",
 				"VI" => "Virgin Islands", "VA" => "Virginia", "WA" => "Washington", "WV" => "West Virginia",
 				"WI" => "Wisconsin", "WY" => "Wyoming", "YT" => "Yukon Territory");

foreach($state as $field => $label) {
	echo '<option value="' . $field . '"'; if(isset($_SESSION['state']) && $_SESSION['state'] == $field) echo " selected"; echo '>' . $label . '</option>';
}
//------------------------------------------------------------------------------------------------------
?>
                      </select>
                      <img src="../images/spacer2.gif" alt=""></label>
                      <input name="zip" type="text" class="style27" value="<?php echo isset($_SESSION['zip']) ? $_SESSION['zip'] : '';?>" size="10" maxlength="10">
                      <img src="../images/spacer2.gif" alt="">
                      <label>
                      <select name="country" size="1" class="style27" id="country" style="font-family: Arial" >
                        <?php
//------------------------------------------------------------------------------------------------------
// dynamically build the Country select option list from the $country array
//------------------------------------------------------------------------------------------------------
$country= array (	"" => "",
"United States" => "United States",
"Afghanistan" => "Afghanistan",
"Albania" => "Albania",
"Algeria" => "Algeria",
"American Samoa" => "American Samoa",
"Andorra" => "Andorra",
"Angola" => "Angola", 
"Anguilla" => "Anguilla", 
"Antarctica" => "Antarctica", 
"Antigua" => "Antigua", 
"Argentina" => "Argentina", 
"Armenia" => "Armenia", 
"Aruba" => "Aruba", 
"Australia" => "Australia", 
"Austria" => "Austria", 
"Azerbaijan" => "Azerbaijan", 
"Bahamas" => "Bahamas", 
"Bahrain" => "Bahrain", 
"Bangladesh" => "Bangladesh", 
"Barbados" => "Barbados", 
"Belarus" => "Belarus", 
"Belgium" => "Belgium", 
"Belize" => "Belize", 
"Benin" => "Benin", 
"Bermuda" => "Bermuda", 
"Bhutan" => "Bhutan", 
"Bolivia" => "Bolivia", 
"Bosnia and Herzegovina" => "Bosnia and Herzegovina", 
"Botswana" => "Botswana", 
"Brazil" => "Brazil", 
"British Virgin Islands" => "British Virgin Islands", 
"Brunei" => "Brunei", 
"Bulgaria" => "Bulgaria", 
"Burkina Faso" => "Burkina Faso", 
"Burma" => "Burma", 
"Burundi" => "Burundi", 
"Cambodia" => "Cambodia", 
"Cameroon" => "Cameroon", 
"Canada" => "Canada", 
"Cayman Islands" => "Cayman Islands", 
"Cape Verde" => "Cape Verde", 
"Central African Republic" => "Central African Republic", 
"Chad" => "Chad", 
"Chile" => "Chile", 
"China" => "China", 
"Colombia" => "Colombia", 
"Comoros" => "Comoros", 
"Congo (Zaire)" => "Congo (Zaire)", 
"Congo" => "Congo", 
"Cook Islands" => "Cook Islands", 
"Costa Rica" => "Costa Rica", 
"Cote d'Ivoire" => "Cote d'Ivoire", 
"Croatia" => "Croatia", 
"Cuba" => "Cuba", 
"Cyprus" => "Cyprus", 
"Czech Republic" => "Czech Republic", 
"Denmark" => "Denmark", 
"Djibouti" => "Djibouti", 
"Dominica" => "Dominica", 
"Dominican Republic" => "Dominican Republic", 
"Ecuador" => "Ecuador", 
"Egypt" => "Egypt", 
"El Salvador" => "El Salvador", 
"Equatorial Guinea" => "Equatorial Guinea", 
"Eritrea" => "Eritrea", 
"Estonia" => "Estonia", 
"Ethiopia" => "Ethiopia", 
"Falkland Islands" => "Falkland Islands", 
"Fiji" => "Fiji", 
"Finland" => "Finland", 
"France" => "France", 
"French Guiana" => "French Guiana", 
"French Polynesia" => "French Polynesia", 
"Gabon" => "Gabon", 
"The Gambia" => "The Gambia", 
"Gaza Strip and West Bank" => "Gaza Strip and West Bank", 
"Georgia" => "Georgia", 
"Germany" => "Germany", 
"Ghana" => "Ghana", 
"Gibraltar" => "Gibraltar", 
"Greece" => "Greece", 
"Greenland" => "Greenland", 
"Grenada" => "Grenada", 
"Guadeloupe" => "Guadeloupe", 
"Guam" => "Guam", 
"Guatemala" => "Guatemala", 
"Guinea" => "Guinea", 
"Guinea-Bissau" => "Guinea-Bissau", 
"Guyana" => "Guyana", 
"Haiti" => "Haiti", 
"The Holy See" => "The Holy See", 
"Honduras" => "Honduras", 
"Hong Kong" => "Hong Kong", 
"Hungary" => "Hungary", 
"Iceland" => "Iceland", 
"India" => "India", 
"Indonesia" => "Indonesia", 
"Iran" => "Iran", 
"Iraq" => "Iraq", 
"Ireland" => "Ireland", 
"Israel" => "Israel", 
"Italy" => "Italy", 
"Ivory Coast" => "Ivory Coast", 
"Jamaica" => "Jamaica", 
"Japan" => "Japan", 
"Jordan" => "Jordan", 
"Kazakhstan" => "Kazakhstan", 
"Kenya" => "Kenya", 
"Kiribati" => "Kiribati", 
"Kuwait" => "Kuwait", 
"Kyrgyzstan" => "Kyrgyzstan", 
"Laos" => "Laos", 
"Latvia" => "Latvia", 
"Lebanon" => "Lebanon", 
"Lesotho" => "Lesotho", 
"Liberia" => "Liberia", 
"Libya" => "Libya", 
"Liechtenstein" => "Liechtenstein", 
"Lithuania" => "Lithuania", 
"Luxembourg" => "Luxembourg", 
"Macau" => "Macau", 
"Macedonia" => "Macedonia", 
"Madagascar" => "Madagascar", 
"Malawi" => "Malawi", 
"Malaysia" => "Malaysia", 
"Maldives" => "Maldives", 
"Mali" => "Mali", 
"Malta" => "Malta", 
"Marshall Islands" => "Marshall Islands", 
"Martinique" => "Martinique", 
"Mauritania" => "Mauritania", 
"Mauritius" => "Mauritius", 
"Mayotte" => "Mayotte", 
"Mexico" => "Mexico", 
"Federated States of Micronesia" => "Federated States of Micronesia", 
"Moldova" => "Moldova", 
"Monaco" => "Monaco", 
"Mongolia" => "Mongolia", 
"Montserrat" => "Montserrat", 
"Morocco" => "Morocco", 
"Mozambique" => "Mozambique", 
"Namibia" => "Namibia", 
"Nauru" => "Nauru", 
"Nepal" => "Nepal", 
"Netherlands" => "Netherlands", 
"Netherlands Antilles" => "Netherlands Antilles", 
"New Caledonia" => "New Caledonia", 
"New Zealand" => "New Zealand", 
"Nicaragua" => "Nicaragua", 
"Niger" => "Niger", 
"Nigeria" => "Nigeria", 
"North Korea" => "North Korea", 
"Northern Mariana Islands" => "Northern Mariana Islands", 
"Norway" => "Norway", 
"Oman" => "Oman", 
"Pakistan" => "Pakistan", 
"Palau" => "Palau", 
"Panama" => "Panama", 
"Papua New Guinea" => "Papua New Guinea", 
"Paraguay" => "Paraguay", 
"Peru" => "Peru", 
"Philippines" => "Philippines", 
"Pitcairn Islands" => "Pitcairn Islands", 
"Poland" => "Poland", 
"Portugal" => "Portugal", 
"Puerto Rico" => "Puerto Rico", 
"Qatar" => "Qatar", 
"Reunion" => "Reunion", 
"Romania" => "Romania", 
"Russia" => "Russia", 
"Rwanda" => "Rwanda", 
"Saint Kitts and Nevis" => "Saint Kitts and Nevis", 
"Saint Lucia" => "Saint Lucia", 
"Saint Pierre and Miquelon" => "Saint Pierre and Miquelon", 
"Saint Vincent and the Grenadines" => "Saint Vincent and the Grenadines", 
"Samoa" => "Samoa", 
"San Marino" => "San Marino", 
"Sao Tome and Principe" => "Sao Tome and Principe", 
"Saudi Arabia" => "Saudi Arabia", 
"Senegal" => "Senegal", 
"Serbia and Montenegro" => "Serbia and Montenegro", 
"Seychelles" => "Seychelles", 
"Sierra Leone" => "Sierra Leone", 
"Singapore" => "Singapore", 
"Slovakia" => "Slovakia", 
"Slovenia" => "Slovenia", 
"Solomon Islands" => "Solomon Islands", 
"Somalia" => "Somalia", 
"South Africa" => "South Africa", 
"South Korea" => "South Korea", 
"Spain" => "Spain", 
"Sri Lanka" => "Sri Lanka", 
"Sudan" => "Sudan", 
"Suriname" => "Suriname", 
"Swaziland" => "Swaziland", 
"Sweden" => "Sweden", 
"Switzerland" => "Switzerland", 
"Syria" => "Syria", 
"Taiwan" => "Taiwan", 
"Tajikistan" => "Tajikistan", 
"Tanzania" => "Tanzania", 
"Thailand" => "Thailand", 
"Togo" => "Togo", 
"Tonga" => "Tonga", 
"Trinidad and Tobago" => "Trinidad and Tobago", 
"Tunisia" => "Tunisia", 
"Turkey" => "Turkey", 
"Turkmenistan" => "Turkmenistan", 
"Turks and Caicos Islands" => "Turks and Caicos Islands", 
"Tuvalu" => "Tuvalu", 
"Uganda" => "Uganda", 
"Ukraine" => "Ukraine", 
"United Arab Emirates" => "United Arab Emirates", 
"United Kingdom" => "United Kingdom", 
"United States" => "United States", 
"United States Virgin Islands" => "United States Virgin Islands", 
"Uruguay" => "Uruguay", 
"Uzbekistan" => "Uzbekistan", 
"Vanuatu" => "Vanuatu", 
"Venezuela" => "Venezuela", 
"Vietnam" => "Vietnam", 
"West Bank and Gaza Strip" => "West Bank and Gaza Strip", 
"Western Sahara" => "Western Sahara", 
"Yemen" => "Yemen",
"Yugoslavia" => "Yugoslavia",
"Zaire" => "Zaire",
"Zambia" => "Zambia",
"Zimbabwe" => "Zimbabwe" 
);

foreach($country as $field) {
	echo '<option value="' . $field . '"'; if($_SESSION['country'] == $field) echo " selected"; echo '>' . $field . '</option>';
}

//------------------------------------------------------------------------------------------------------
?>
                      </select>
                      </label>                  </td>
                </tr>
                <tr>
                  <td width="532" align="left"><span class="verdana-11">E-mail Address <span class="style32">*</span></span><img src="../images/spacer2.gif" width="185" height="10" alt=""><span class="verdana-11">Music Ace Product Used</span><br>
                      <input name="email" type="text" size="45" maxlength = "50" value="<?php echo isset($_SESSION['email']) ? $_SESSION['email'] : '';?>" class="style27">
                      <img src="../images/spacer2.gif" width="15" height="10" alt="">
                      <select name="productuse">
                        <option></option>
                        <option>Music Ace Maestro</option>
                        <option>Music Ace</option>
                        <option>Music Ace 2</option>
                        <option>Music Ace Deluxe</option>
                        <option>None</option>
                    </select></td>
                </tr>
                <tr>
                  <td align="left"><label><span class="verdana-11">I am a:</span><br>
                        <span class="verdana-11">
                        <select name="status">
                          <option>Parent</option>
                          <option>Student</option>
                          <option selected>Piano Teacher</option>
                          <option>Other Music Teacher</option>
                          <option>Other</option>
                        </select>
                        <img src="../images/spacer2.gif" width="40" height="10" alt="">number of students you teach
                          <input type="text" name="students" class="style27" size="4" maxlength="4" >
                      </span></label></td>
                </tr>
                <tr>
                  <td><div align="center">
                      <input name="Submit" type="submit" id="Submit" value="Submit">
                  </div></td>
                </tr>
              </table>
          </form></td>
        </tr>
      </table>
</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<br>
	
<!-- ==============================   END CONTENT ====================================================== -->

<!-- ================================= End Content container table ================================== -->
  </td></tr></table></div>
  
<!-- ================================= start Footer ============================================ --><!-- #BeginLibraryItem "/Library/footer.lbi" --><table width="771" border="0" cellspacing="0" cellpadding="0" align="center" class="footer">
  <tr>
    <td>
       <div id="footernav">
          <a href="../index.htm" target="_parent">Home</a>
          <a href="../privacy.htm" target="_parent">Privacy Policy</a>
          <a href="../contactus.html" target="_parent">Contact Us</a></div>
       <div align="center">Copyright &copy; 2013 Harmonic Vision Inc.<br><br></div>
	</td>
  </tr>
</table>
<!-- #EndLibraryItem --><!-- ===============================  end Footer =============================================== -->

<br>

<!-- ==============================  close container table ======================== -->
</tr></td></table>

</body>
</html>
