var xmlHttp

function changePic(pic_num,rental_id)
{

var params = "pic_num=" + pic_num + "&rental_id=" + rental_id

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="/xxx-apartments/view_pictures.php"
xmlHttp.onreadystatechange= function() { stateChanged(xmlHttp,"rental_pictures") }
xmlHttp.open("POST",url,true)
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
xmlHttp.setRequestHeader("Content-length", params.length)
xmlHttp.setRequestHeader("Connection", "close")
xmlHttp.send(params)
}

function changeCoupons(group_num,company_id)
{

var params = "group_num=" + group_num + "&company_id=" + company_id

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="/ulynk/directory/view_coupons.php"
xmlHttp.onreadystatechange= function() { stateChanged(xmlHttp,"company_coupons") }
xmlHttp.open("POST",url,true)
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
xmlHttp.setRequestHeader("Content-length", params.length)
xmlHttp.setRequestHeader("Connection", "close")
xmlHttp.send(params)
}

function save_favorite_company(company_id)
{

var params = "company_id=" + company_id

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="/ulynk/directory/save_favorite_button.php"
xmlHttp.onreadystatechange= function() { stateChanged(xmlHttp,"save_as_favorite_button") }
xmlHttp.open("POST",url,true)
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
xmlHttp.setRequestHeader("Content-length", params.length)
xmlHttp.setRequestHeader("Connection", "close")
xmlHttp.send(params)
}

function email_company(company_id,your_name,your_email,email_message)
{

var params = "company_id=" + company_id + "&your_name=" + your_name + "&your_email=" + your_email + "&email_message=" + email_message

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="/ulynk/directory/email_company.php"
xmlHttp.onreadystatechange= function() { stateChanged(xmlHttp,"email_us") }
xmlHttp.open("POST",url,true)
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
xmlHttp.setRequestHeader("Content-length", params.length)
xmlHttp.setRequestHeader("Connection", "close")
xmlHttp.send(params)
}

function email_friend_coupon(company_id,your_name,your_email,friend_email,email_message)
{

var params = "company_id=" + company_id + "&your_name=" + your_name + "&your_email=" + your_email + "&friend_email=" + friend_email + "&email_message=" + email_message

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="/ulynk/directory/email_friend.php"
xmlHttp.onreadystatechange= function() { stateChanged(xmlHttp,"email_friend_coupon") }
xmlHttp.open("POST",url,true)
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
xmlHttp.setRequestHeader("Content-length", params.length)
xmlHttp.setRequestHeader("Connection", "close")
xmlHttp.send(params)
}  

function stateChanged(xmlHttp,div_id) 
{ 
	if (xmlHttp.readyState==4)                    
	{ 
		if (xmlHttp.status == 200) {
			document.getElementById(div_id).innerHTML=xmlHttp.responseText
		}
	}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}