
function sprawdz_login_i_haslo()
{	if(document.login_form.login_edit.value == "")
	{	alert("Wpisz nazwę użytkownika!");
		document.login_form.login_edit.focus();
		return false;
	}
	if(document.login_form.password_edit.value == "")
	{	alert("Wpisz hasło!");
		document.login_form.password_edit.focus();
		return false;
	}
//document.login_form.button.disabled=true;
return true;
}   

function sprawdz_pola()
{	if(document.post.postTopic.value == "")
	{	alert("Musisz wpisać temat!");
		document.post.postTopic.focus();
		return false;
	}
	if(document.post.postContents.value == "")
	{	alert("Wpisz tekst!");
		document.post.postContents.focus();
		return false;
	}
document.post.button.disabled=true;
return true;
}  


function potwierdzenie(theLink, tresc) {

    var is_confirmed = confirm(tresc);
    if (is_confirmed) {
        theLink.href += '&potwierdzenie=ok';
    }

    return is_confirmed;
} 

function high(which2)
{
 theobject=which2
 highlighting=setInterval("highlightit(theobject)",30)
}

function low(which2)
{
 clearInterval(highlighting)
 if (which2.style.MozOpacity)
  which2.style.MozOpacity=0.3
 else if (which2.filters)
 which2.filters.alpha.opacity=30
}


function highlightit(cur2){
if (cur2.style.MozOpacity<1)
cur2.style.MozOpacity=parseFloat(cur2.style.MozOpacity)+0.1
else if (cur2.filters&&cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=10
else if (window.highlighting)
clearInterval(highlighting)
}

//Funkcja wstawia emotkę w miejscu kursora
function emoticon(text)
{	text = ' ' + text + ' ';
	if (document.post.postContents.createTextRange && document.post.postContents.caretPos)
	{	var caretPos = document.post.postContents.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
		document.post.postContents.focus();
	} else
	{	document.post.postContents.value  += text;
		document.post.postContents.focus();
	}
}

//Funkcja dodaje podane tagi na początku i końcu zaznaczenia
function add(bcopen, bcclose)
{	theSelection = document.selection.createRange().text;
	if (theSelection)
	{	if ((bcopen == '[url]') && (theSelection.indexOf('http://', 0) == -1))
			theSelection = 'http://' + theSelection;
		document.selection.createRange().text = bcopen + theSelection + bcclose;
		document.post.postContents.focus();
	} else
	{	document.post.postContents.value += bcopen + bcclose;
		document.post.postContents.focus();

	}
storeCaret(document.post.body-4);
}

//Funkcja dodaje tag zmiany czcionki dla zaznaczonego fragmentu
function fontstyle(bbcode, bbend)
{	theSelection = document.selection.createRange().text;

	if (theSelection)
	{	document.selection.createRange().text = bbcode + theSelection + bbend;
		document.post.postContents.focus();
	} else
	{	document.post.postContents.value += bbcode + bbend;
		document.post.postContents.focus();
	}
	document.post.color.selectedIndex = 0;
	document.post.size.selectedIndex = 0;
	storeCaret(document.post.body);
}

//Funkcja zapamiętuje położenie kursora
function storeCaret(textEl)
{	if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}