<?php
include("../../session.php");
include("../../connect.php");

$user=$_SESSION['agent'];
//echo "admin success!!!";
				
?>
<html>
<head>
<link href="../header.css" rel="stylesheet" type="text/css"/>
<link type="text/css" rel="stylesheet" href="../overflow.css" />
<script type="text/javascript" src="../jquery.js"></script>
<script type='text/javascript' src="jquery.autocomplete.js"></script>
<link rel="stylesheet" type="text/css" href="jquery.autocomplete.css" />
<script type="text/javascript">
$().ready(function() {
	$("#to").autocomplete("toauto.php", {
		width: 260,
		matchContains: true,
		//mustMatch: true,
		//minChars: 0,
		//multiple: true,
		//highlight: false,
		//multipleSeparator: ",",
		selectFirst: false
	});
});

</script>
</head>
<body>
<div id="content2">
<!-----------------Outer table--------------->
<table width=1000 border=0 cellspacing=10 cellpadding=3>
<tr>
	<td colspan=2 >
	<?php include("../head.php");?>
	</td>
	</tr>
<tr>
	<td colspan=2>
	<div class=main>&nbsp;&nbsp;>>
			<a href="<?php echo"../agent.php";?>">&nbsp;Home&nbsp;</a>>>
			<a href="<?php echo"cFeedback.php";?>">&nbsp;Company Feedback&nbsp;</a>>>
			&nbsp;New&nbsp;
			</div></td>
	</tr>
<tr>
	<td width=280 valign=top>
	<!-----------Inner table 1----------------->
	<?php include("feedbackSide.php")?>
	<!-----------------End inner table 1----------------------->
	</td>
	<td valign=top>
	<!--------------------Inner table 2----------------------->
	<h3>New</h3>
	<form action='<?php echo "sending.php";?>' method='POST' onSubmit='return finalCheck()'>
	<table width=700 cellpadding=8 border=0>
	<tr>
		<td width=150 class="mailA"><b>To :</b></td>
		<td class="mailA"><input type="text" name="send" id='to' onblur='vali(this.value)'/><div id='result'></div></td>
		</tr>
	<tr>
		<td class="mailB"><b>Title :</b></td>
		<td class="mailB"><input type="text" name="title" /></td>
		</tr>
	<tr>
		<td class="mailA"><b>Content :</b></td>
		<td class="mailA"><textarea rows=10 cols=65 name="content" id='write'></textarea></td>
		</tr>
	<tr>
		<td colspan=2 align=right>
			<input type="submit" value="Send" />
			<input type="reset" value="Reset" />
			</td>
		</tr>
	</table>
	</form>
	<!----------------------End inner table 2-------------------->
	
	</td>
	</tr>
</table>
</div>
<!-----------------------End outer table-------------------------->
<script type="text/javascript">
function vali(name){
if(name==""){
	document.getElementById("result").value="";
}

	
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById('result').innerHTML=xmlhttp.responseText;
    }
  }
  
xmlhttp.open('GET','valiSend.php?name='+name,true);

xmlhttp.send();
}

function finalCheck(){
var data=document.getElementById('result');


if(document.getElementById('to').value==''){
	alert("Please type an address in the to box");
	return false;
}
if(data.innerHTML!="OK"){
	alert("Invalid address id");
	return false;
}
return true;
}
</script>



</body>
</html>