﻿	function SendContact() 
	{		
		gE('bSent').style.display="none";
		gE('response_captcha').style.display="none";
		gE('iLoader').style.display="block";
		
		name 	= gE('iname').value;
		email	= gE('iemail').value;
		subj 	= gE('isubj').value;
		comment = gE('icomment').value;
		sec_code = gE('iInputCode').value;
		
		parameters = '';
		parameters += 'name=' 		+ name + "&";
		parameters += 'email=' 		+ email + "&";
		parameters += 'subj=' 		+ subj + "&";
		parameters += 'sec_code=' 	+ sec_code + "&";
		parameters += 'comment=' 	+ comment;
		
		var oAjax;

		if (window.XMLHttpRequest)
		{
			oAjax = new XMLHttpRequest();
		}
		else if (window.ActiveXObject)
		{
			try 
			{
				oAjax = new ActiveXObject('Msxml2.XMLHTTP');
			} catch (e){}
			try 
			{
				oAjax = new ActiveXObject('Microsoft.XMLHTTP');
			} catch (e){}
		}

		if (oAjax)
		{
			oAjax.onreadystatechange = function()
			{
				if (oAjax.readyState == 4 && oAjax.status == 200) 
				{
					ResponseContact(oAjax);
				}
			};
			oAjax.open("POST", ROOT_HTTP + 'index.php/' + 'contacts/sendmail', true);
			oAjax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			oAjax.send(parameters);
		}
		else
		{
			alert("AJAX not init!");
		}
	}

	function ResponseContact(oAjax) 
	{	
		gE('iLoader').style.display="none";		
		gE('response_'+oAjax.responseText).style.display="block";
		if (oAjax.responseText == "captcha")
		{
			gE('bSent').style.display="block";
		}
	}
/*=================================================================================================*/

