function copytext(copy){
	var content = "";
	if(copy=="home") content= "<h1>Welcome</h1><p>Thank you for taking a look at one of PhotoVision's newest and most cutting edge video services. For years now, we have been helping clients deliver video across the web.</p><p>Now for the first time, we are offering a live video streaming service. Click on the Wedding Video, Church Video or Funeral Video buttons on the right to see examples.</p><p>With this new, full-service product, you can provide your customers an unparalleled experience by having the event streamed live across the Internet for friends, family and fans to enjoy.</p><p><a id=\"contactform\" href=\"javascript:copytext('services');\">+ Read More</a></p>";
	if(copy=="services") content= "<h1>Services</h1><p>PhotoVision's live video pricing and packages are made to fit you, the client. For details regarding pricing, please <a id=\"contactform\" href=\"javascript:copytext('contact');\">contact us</a>.</p><br /><p><b>How it Works...</b></b><p>Using a high resolution video feed and an award-winning streaming service, we record and broadcast your event <b>LIVE</b> on the Internet.</p><p>You can expect:<ul><li>Live, crystal clear video</li><li>Amazing audience reach</li><li>Flexible online deployment</li><li>Committed customer service</li><li>Friendly, local support</li></ul></p><br /><p><a id=\"contactform\" href=\"javascript:copytext('contact');\">+ Get Started</a></p>";
	if(copy=="contact") content= "<h1>Contact</h1><p>PhotoVision, Inc.<br />1819 Sardis Road North<br />Suite 330<br />Charlotte, NC 28270<br /><br />Phone<br />1.800.533.7636</p><br /><div id=\"contactform\"><p><a id=\"contactform\" href=\"javascript:drawForm('contactform');\">+ Contact Form</a></p></div>";
	document.getElementById("copytext").innerHTML = content;
}

function drawForm(div){
	form = "<p><a id=\"contactform\" href=\"javascript:cancelForm('"+div+"');\">- Cancel Form</a><br /><br /><form>Name<br /><input type=\"text\" name=\"name\" id=\"name\"><br /><br />Email<br /><input type=\"text\" name=\"email\" id=\"email\"><br /><br />Phone<br /><input type=\"text\" name=\"phone\" id=\"phone\"><br /><br />Message:<br /><textarea name=\"message\" id=\"message\" cols=\"20\" rows=\"5\"></textarea><br /><br /><a id=\"submit\" href=\"javascript:submit();\">Submit</a><br /><br /></form></p>";
	document.getElementById(div).innerHTML = form;
}

function cancelForm(div){
	unform = "<p><a id=\"contactform\" href=\"javascript:drawForm('"+ div +"');\">+ Contact Form</a></p>";
	document.getElementById(div).innerHTML = unform;
}

function submit(){
	var name = document.getElementById("name").value;
	var email = document.getElementById("email").value;
	var phone = document.getElementById("phone").value;
	var message = document.getElementById("message").value;

	url = "js/message.php?name=" + name + "&email=" + email + "&phone=" + phone + "&message=" + message;
	if (window.XMLHttpRequest) { // Non-IE browsers
	  req = new XMLHttpRequest();
	  req.onreadystatechange = targetDiv;
	  try {
		req.open("GET", url, true);
	  } catch (e) {
		alert(e);
	  }
	  req.send(null);
	} else if (window.ActiveXObject) { // IE
	  req = new ActiveXObject("Microsoft.XMLHTTP");
	  if (req) {
		req.onreadystatechange = targetDiv;
		req.open("GET", url, true);
		req.send();
	  }
	}
}

function targetDiv() {  // send folder contents to page
	if (req.readyState == 4) { // Complete
	  if (req.status == 200) { // OK response
	  	if(req.responseText=="sent"){
			alert("Your message has been sent.\n\nWe appreciate your interest and will be in touch shortly.");
			document.getElementById("contactform").innerHTML = "<p><a id=\"contactform\" href=\"javascript:drawForm('contactform');\">+ Contact Form</a></p>";
		}else{
	  		alert("Message failed.  Please try again.");
		}
	  } else {
	  		alert("Message failed.  Please try again.");
	  }
	}
}

