String.prototype.trim = function () {
	return this.replace(/^\s*/, "").replace(/\s*$/, "");
}

function completareCartiere(){
	var oras1 = 'Cluj-Napoca'; 	//are value 1
	var oras2 = 'Bucuresti';	// are value 2
	var valoare = document.cautare.oras.value;
	if ( valoare == 1 ) 
	{
		document.getElementById(oras1).style.display = 'block';
		document.getElementById(oras2).style.display = 'none';
	}
	if ( valoare == 2 ) 
	{
		document.getElementById(oras2).style.display = 'block';
		document.getElementById(oras1).style.display = 'none';

	}
}

function validareContact(){
	var text = "";
	bool = true;
	if (document.contact.nume.value.trim() == "")
	{
		text = text + 'Trebuie sa completati campul cu Numele dumneavoastra!\n';
		bool = false;
	}
	if (document.contact.mail.value.trim() == "" || document.contact.mail.value.indexOf("@") < 0)
	{
		text =text + 'Trebuie sa completati campul cu adresa de mail!\n';
		bool = false;
	}
	if (bool)
		document.contact.submit();
	else
	{
		alert(text);
		return false;
	}
}

function validareComanda(){
	var text = "";
	bool = true;
	if (document.contact.nume.value.trim() == "")
	{
		text =text + 'Trebuie sa completati campul cu Numele dumneavoastra!\n';
		bool = false;
	}
	if (document.contact.mail.value.trim() == "" || document.contact.mail.value.indexOf("@") < 0)
	{
		text =text + 'Trebuie sa completati campul cu Adresa dumneavoastra!\n';
		bool = false;
	}
	if (bool)
		document.contact.submit();
	else
	{
		alert(text);
		return false;
	}
}
function continuare()
{
	var i = 1;
	var bool = true;
	var val ='';
	var valoare = document.cautare.oras.value;
	if (valoare == 1)
	while (i<=31)
	{
		val = 'cj_' + i;
		if (( document.getElementById(val).checked == true))
			{
				bool = false;
				break;
			}
			i = i+1;
	}
	if (valoare == 2)
	{
		val ='';
		var i = 1;
		bool = true;
		while (i<=27)
		{
			val = 'b_' + i;

			if (( document.getElementById(val).checked == true))
				{
					bool = false;
					break;
				}
			i =i +1;
		}
	}
	if (bool)
	{
		alert('Nu ati selectat nici un Cartier!');
	}
	else
		document.cautare.submit();
}