var contact = "";
var path="http://pulseshared.localhost/images/contact_agent/loader.gif";

function loadForm (propid,webref,userid, url)
{
	contact = new MaJiG_BOX("<center><img src='"+path+"'></center>");
	//displayContact();
	//var arrayPageSize = getPageSize();
//	alert('loading.... '+url);

	new Ajax.Request("/",
    	{
		onSuccess : function(response, json)
		{
//			alert('success');
		    contact._set_Content(response.responseText);
		    $('title').style.display = 'block';
			//$('contactForm').innerHTML  = response.responseText;
		},
		onFailure : function(response)
		{
		    alert('Error loading contact page');
		},
		parameters : "userID="+userid+"&webref="+webref+"&propid="+propid+"&loadForm=yes&content=main&page=contact_agent"
	}
    );
}

function _removeNotification()
{
	$('notificationDiv').style.display = 'none';
}

function  submitForm(propid,webref,userid,url,sendSMS)
{
	var params = Form.serialize($('contact_agent_form'));
	new Ajax.Request('/',
	{
		onSuccess:function(response, json)
		{
			//$('contactForm').innerHTML = response.responseText;
			contact._set_Content( response.responseText);
			Effect.Pulsate('notificationDiv');
		    setTimeout("_removeNotification()",5000);
			$('title').style.display = 'block';
		},
		onFailure : function(response)
		{
			alert('failed. URL = '+url);
		},
		method: 'post',
		parameters : "page=contact_agent&userID="+userid+"&webref="+webref+"&propid="+propid+"&sendSMS="+sendSMS+"&loadForm=yes&content=main&send_msg=yes&"+params
	}
	);
}
