var allHTMLTags = new Array();

function getElementByClass(theClass)
{

	//Create Array of All HTML Tags
	var allHTMLTags=document.getElementsByTagName("*");

	//Loop through all tags using a for loop
	for (i=0; i<allHTMLTags.length; i++) {

		//Get all tags with the specified class name.
		if (allHTMLTags[i].className==theClass) {

			//Place any code you want to apply to all
			//pages with the class specified.
			//In this example is to ?display:none;? them
			//Making them all dissapear on the page.

			allHTMLTags[i].style.display="none";

		}
	}
}

function openMenu($id)
{

	getElementByClass("contentMenu");
	document.getElementById("contentMenu_" + $id).style.display = "block";

}

function przeliczWalute()
{

	box = document.getElementById("p_waluta");
	waluta = box.options[box.selectedIndex].value;

	document.getElementById("p_ilosc").value = document.getElementById("p_ilosc").value.replace(new RegExp("[^0-9\.]{1,}", "gi"), '');

	if ( document.getElementById("p_ilosc").value > 0 )
	{

		document.getElementById("p_wynik").innerHTML = parseFloat(waluta * document.getElementById("p_ilosc").value).toFixed(4);

	}

}

function sendForm(id)
{

	if ( document.getElementById("name").value.length < 2 )
	{

	    alert("Błąd: brak podpisu...");
	    return false;

	}

	if ( document.getElementById("email").value.length < 8 )
	{

	    alert("Błąd: niepoprawny adres e-mail");
	    return false;

	}

	if ( document.getElementById("text").value.length < 10 )
	{

	    alert("Błąd, wiadomość jest za krótka...");
	    return false;

	}

	input = document.createElement("input");
	input.type = "hidden";
	input.value = id;
	input.name = "message_send";
	document.getElementById(id).appendChild(input);

	document.getElementById(id).submit();

}

