function sendMail()
{
			var url = SITE_URL+'user/sendMess';
			var params = 'nume='+escape($F('nume'))+'&email='+escape($F('email'))+'&subiect='+escape($F('subiect'))+'&mesaj='+escape($F('mesaj'));
			var eroare = 0;
			var mesaj  = '';
			var ajaxRequest; // The variable that makes Ajax possible!
 				if (document.getElementById('nume').value == '')
				{
							eroare = 1;
							mesaj  += 'Nu ati completat campul Nume \n';
				}
				if (document.getElementById('email').value == '')
				{
							eroare = 1;
							mesaj  += 'Nu ati completat campul Email \n';
				}
				if (document.getElementById('subiect').value == '')
				{
							eroare = 1;
							mesaj  += 'Nu ati completat campul Subiect \n';
				}
				if (document.getElementById('mesaj').value == '')
				{
							eroare = 1;
							mesaj  += 'Nu ati completat campul Mesaj \n';
				}
				if (eroare == 1)
				{
							alert(mesaj);
				}
				else
				{
					document.getElementById('buton-trimite').style.display='none';
        			document.getElementById('upload_form_loader').style.display='block';
									
								try{
									// Opera 8.0+, Firefox, Safari
									ajaxRequest = new XMLHttpRequest();
								}
								catch (e){
								// Internet Explorer Browsers
									try{
										ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
										}
									catch (e) {
										try{
											ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
											}
										catch (e){
											// Something went wrong
											alert("Your browser broke!");
											return false;
												}
										}
								}
								ajaxRequest.open("POST", url, true);
								
								ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
								ajaxRequest.setRequestHeader("Content-length", params.length);
								ajaxRequest.setRequestHeader("Connection", "close");
								ajaxRequest.send(params);
								
								ajaxRequest.onreadystatechange = function()
								{
									if (ajaxRequest.readyState == 4)
									{
				
												 document.getElementById('content-sendmess').innerHTML = ajaxRequest.responseText;
									}
									
									}
								  }
									
}

function styleFocus(elem)
	 {
     //nickname_reg password_reg repassword email
     elem_array = new Array();
     elem_array[0] = "nume";
     elem_array[1] = "email";
	 elem_array[2] = "subiect";
	 elem_array[3] = "mesaj";
     

     id = elem.id;
   

     for ( var i in elem_array)
     {
        if( elem_array[i] == id)
		{
            document.getElementById(elem_array[i]).style.backgroundColor='#FFFFFF';
        }
		else
		{
            if(document.getElementById(elem_array[i])!=null)
			{
                document.getElementById(elem_array[i]).style.backgroundColor='#e7ebee';
            }
        }
     }
 }
 
function sendMailProp(id)
{
			var url = SITE_URL+'user/sendMessProp/'+id;
			var params = 'nume='+escape($F('nume'))+'&email='+escape($F('email'))+'&telefon='+escape($F('telefon'))+'&mesaj='+escape($F('mesaj'));
			var eroare = 0;
			var mesaj  = '';
			var ajaxRequest; // The variable that makes Ajax possible!
 				if (document.getElementById('nume').value == '')
				{
							eroare = 1;
							mesaj  += 'Nu ati completat campul Nume \n';
				}
				if (document.getElementById('email').value == '')
				{
							eroare = 1;
							mesaj  += 'Nu ati completat campul Email \n';
				}
				if (document.getElementById('telefon').value == '')
				{
							eroare = 1;
							mesaj  += 'Nu ati completat campul Telefon \n';
				}
				if (document.getElementById('mesaj').value == '')
				{
							eroare = 1;
							mesaj  += 'Nu ati completat campul Mesaj \n';
				}
				if (eroare == 1)
				{
							alert(mesaj);
				}
				else
				{
					document.getElementById('buton-trimite').style.display='none';
        			document.getElementById('upload_form_loader').style.display='block';
									
								try{
									// Opera 8.0+, Firefox, Safari
									ajaxRequest = new XMLHttpRequest();
								}
								catch (e){
								// Internet Explorer Browsers
									try{
										ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
										}
									catch (e) {
										try{
											ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
											}
										catch (e){
											// Something went wrong
											alert("Your browser broke!");
											return false;
												}
										}
								}
								ajaxRequest.open("POST", url, true);
								
								ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
								ajaxRequest.setRequestHeader("Content-length", params.length);
								ajaxRequest.setRequestHeader("Connection", "close");
								ajaxRequest.send(params);
								
								ajaxRequest.onreadystatechange = function()
								{
									if (ajaxRequest.readyState == 4)
									{
				
												// document.getElementById('contact-proprietar').innerHTML = ajaxRequest.responseText;
												document.getElementById('commsendd').innerHTML = ajaxRequest.responseText;
									}
									
									}
								  }
									
}
function sendMailParc(id)
{
			var url = SITE_URL+'user/sendMailParc/'+id;
			var params = 'nume='+escape($F('nume'))+'&email='+escape($F('email'))+'&telefon='+escape($F('telefon'))+'&mesaj='+escape($F('mesaj'));
			var eroare = 0;
			var mesaj  = '';
			var ajaxRequest; // The variable that makes Ajax possible!
 				if (document.getElementById('nume').value == '')
				{
							eroare = 1;
							mesaj  += 'Nu ati completat campul Nume \n';
				}
				if (document.getElementById('email').value == '')
				{
							eroare = 1;
							mesaj  += 'Nu ati completat campul Email \n';
				}
				if (document.getElementById('telefon').value == '')
				{
							eroare = 1;
							mesaj  += 'Nu ati completat campul Telefon \n';
				}
				if (document.getElementById('mesaj').value == '')
				{
							eroare = 1;
							mesaj  += 'Nu ati completat campul Mesaj \n';
				}
				if (eroare == 1)
				{
							alert(mesaj);
				}
				else
				{
					document.getElementById('buton-trimite').style.display='none';
        			document.getElementById('upload_form_loader').style.display='block';
									
								try{
									// Opera 8.0+, Firefox, Safari
									ajaxRequest = new XMLHttpRequest();
								}
								catch (e){
								// Internet Explorer Browsers
									try{
										ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
										}
									catch (e) {
										try{
											ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
											}
										catch (e){
											// Something went wrong
											alert("Your browser broke!");
											return false;
												}
										}
								}
								ajaxRequest.open("POST", url, true);
								
								ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
								ajaxRequest.setRequestHeader("Content-length", params.length);
								ajaxRequest.setRequestHeader("Connection", "close");
								ajaxRequest.send(params);
								
								ajaxRequest.onreadystatechange = function()
								{
									if (ajaxRequest.readyState == 4)
									{
				
												// document.getElementById('contact-proprietar').innerHTML = ajaxRequest.responseText;
												document.getElementById('commsendd').innerHTML = ajaxRequest.responseText;
									}
									
									}
								  }
									
}

function styleFocusProp(elem)
{
     elem_array = new Array();
     elem_array[0] = "nume";
     elem_array[1] = "email";
	 elem_array[2] = "telefon";
	 elem_array[3] = "mesaj";
     

     id = elem.id;
   

     for ( var i in elem_array)
     {
        if( elem_array[i] == id)
		{
            document.getElementById(elem_array[i]).style.backgroundColor='#FFFFFF';
        }
		else
		{
            if(document.getElementById(elem_array[i])!=null)
			{
                document.getElementById(elem_array[i]).style.backgroundColor='#e7ebee';
            }
        }
     }
 }
