<?php
	if(isset($_POST['submit'])){
		//recebendo dados do form
		$company = strip_tags(trim($_POST['company']));
		$city = strip_tags(trim($_POST['city']));
		$country = strip_tags(trim($_POST['country']));
		$contact = strip_tags(trim($_POST['contact']));
		$position = strip_tags(trim($_POST['position']));
		$e_mail = strip_tags(trim($_POST['e_mail']));
		$phone = strip_tags(trim($_POST['phone']));
		$company_profile = strip_tags(trim($_POST['company_profile']));
		$support = strip_tags(trim($_POST['support']));
		$comment = strip_tags(trim($_POST['comment']));

		$mensagem = "Company/Society name: " .$company. "\n"; 
		$mensagem .= "City: " .$city. "\n";
		$mensagem .= "Country: " .$country. "\n";
		$mensagem .= "Contact person: " .$contact. "\n";
		$mensagem .= "Position of contact person within the company/society: " .$position. "\n";
		$mensagem .= "E-mail:  " .$e_mail. "\n";
		$mensagem .= "Phone:  " .$phone. "\n";
		$mensagem .= "Company profile:  " .$company_profile. "\n";
		$mensagem .= "Type of support:  " .$support. "\n";
		$mensagem .= "Questions/comments: " .$comment. "\n";

		$header = "From: " .$e_mail;
		mail("wsof2008@ifi.unicamp.br","Support",$mensagem,$header);
	}
?>
<html>
	<head>
		<title>Exhibit/sponsoring oportunities</title>
		<link href="estilos.css" rel="stylesheet" type="text/css" />
		<script language="JavaScript" >
			function enviardados(){
				if(document.inscricao.company.value==""){
					alert( "Fill out the field Company / Society name correctly" );
					document.inscricao.company.focus();
					return false;
				}
				
				if(document.inscricao.city.value==""){
					alert( "Fill out the field City correctly" );
					document.inscricao.city.focus();
					return false;
				}
				
				if(document.inscricao.country.value==""){
					alert( "Fill out the field Country correctly" );
					document.inscricao.country.focus();
					return false;
				}

				if(document.inscricao.contact.value==""){
					alert( "Fill out the field Contact person correctly" );
					document.inscricao.contact.focus();
					return false;
				}
				
				if(document.inscricao.position.value==""){
					alert( "Fill out the field Position of contact person correctly" );
					document.inscricao.position.focus();
					return false;
				}
				
				if(document.inscricao.e_mail.value=="" || document.inscricao.e_mail.value.indexOf("@")<0 || document.inscricao.e_mail.value.indexOf(".")<0){
					alert( "Fill out the field E-mail correctly" );
					document.inscricao.e_mail.focus();
					return false;
				}
				
				if(document.inscricao.company_profile.value==""){
					alert( "Fill out the field Company Profile correctly" );
					document.inscricao.company_profile.focus();
					return false;
				}

				if(document.inscricao.support.value==""){
					alert( "Fill out the field Type Support correctly" );
					document.inscricao.support.focus();
					return false;
				}
				return true;
			}
		</script>
	</head>
	<body>
		<div id="conteudo">
			<table border="0" cellspacing="0" cellpadding="0" width="100%" id="cont">
				<tr>
					<td>
						<?php	if(isset($_POST['submit'])){
									echo'<script>window.alert("Thanks for sending your Exhibit/sponsoring oportunities form.");</script>';
								}?>
						<h2>Exhibit/sponsoring oportunities</h2>
						<form id="inscricao" name="inscricao" action="" method="post" onSubmit="return enviardados();">
							<p>
								Company / Society name:<br>
								<input name="company" type="text" id="company"><br>
								City: <br>
								<input name="city" type="text" id="city"><br>
								Country:<br>
								<input name="country" type="text" id="country"><br>
								Contact person:<br>
								<input name="contact" type="text" id="contact"><br>
								Position of contact person within the company/society:<br>
								<input name="position" type="text" id="posintion"><br>
								E-mail: <br>
								<input name="e_mail" type="text" id="e_mail"><br>
								Phone: <br>
								<input name="phone" type="text" id="phone"><br>
								Company profile:<br>
								<input name="company_profile" width="300" type="text" id="company_profile"><br>
								Type of support:<br>
								<select name="support" id="suport" size="1">
									<option value="WSOF supporter">WSOF supporter</option>
									<option value="WSOF sponsor">WSOF sponsor</option>
									<option value="WSOF exhibitor">WSOF exhibitor</option>
									<option value="WSOF supporter + exhibitor" selected>WSOF supporter + exhibitor</option>
									<option value="WSOF sponsor + exhibitor">WSOF sponsor + exhibitor</option>
								</select><br>
								Questions/comments:<br>
								<textarea id="comment" name="comment" rows="3" cols="50"></textarea><br>
								<input type="submit" id="submit" name="submit" value="Send"><br>
							</p>
						</form>
					</td>
				</tr>
			</table>
		</div>
		<script language=JavaScript>
			window.parent.muda_frame(window.name,document.all.cont.clientHeight);
		</SCRIPT>
	</body>
</html>
