function switchContent(chosen, typ) {
	if (document.getElementById) {
	    txts = document.getElementsByTagName("div");
	    for (i=0; i<txts.length; i++) {
		txt = txts[i];
		txtid = txt.id; 
		pocz = txtid.substr(0,4);
		if (pocz == typ) {
			if (txt.id == chosen) {
				if (txt.style.display == 'none') {
					txt.style.display = 'block';
				} else {
					txt.style.display = 'none';
				}
			} else {
			    txt.style.display = 'none';
			}
		}
	    }
	} else {
	    alert('Przeglądarka jest zbyt stara na wykonanie tej operacji.');
	}
}

function check_email(e) {
	ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
	for(i=0; i < e.length ;i++)
	{
		if(ok.indexOf(e.charAt(i))<0)
		{
			return (false);
		}
	}

	if (document.images)
	{
		re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
		re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
		if (!e.match(re) && e.match(re_two))
		{
			return (-1);
		}
	}
}

function komCheckData () {
		 if (document.formularz.art_ko_nick.value == '') {
			alert('Musisz wypełnić pole nick.')
			document.formularz.art_ko_nick.focus()
			return false}
		 if (document.formularz.art_ko_text.value == '') {
			alert('Musisz wpisać komentarz.')
			document.formularz.art_ko_text.focus()
			return false}

		 if (document.formularz.art_ko_email.value == '') {
		 }
		 else {
			if (!check_email(document.formularz.art_ko_email.value)) {
				alert('Błędny format email.')
				document.formularz.art_ko_email.focus()
				return false
			}
		 }
}

function wysCheckData () {
		 if (document.getElementById('wyslijdo').send_email.value == '') {
			alert('Musisz wpisać email.')
			document.getElementById('wyslijdo').send_email.focus()
			return false
		 } else {
			if (!check_email(document.getElementById('wyslijdo').send_email.value)) {
				alert('Błędny format email.')
				document.getElementById('wyslijdo').send_email.focus()
				return false
			}
		 }
}

