
var current_id_mm;
var current_id_sm;

function menu(id_mm, id_sm, stan, first) {

	if ( stan == "on" ) {
		if ( current_id_sm && current_id_sm != id_sm ) document.getElementById(current_id_sm).style.display = "none";
		if ( current_id_mm && current_id_mm != id_mm ) document.getElementById(current_id_mm).className = "";
	}

	if (first == 1) {
		document.getElementById(id_mm).className=(stan=="on") ? "active first": "first";
	}
	else {
		document.getElementById(id_mm).className=(stan=="on") ? "active": "";
	}

	if ( id_sm && document.getElementById(id_sm) ) {
		document.getElementById(id_sm).style.display=(stan=="on") ? "block" : "none";
	}

	if ( stan == "off" ) {
		if ( current_id_sm) document.getElementById(current_id_sm).style.display = "block";
		if ( current_id_mm) document.getElementById(current_id_mm).className = "active";
	}
}

function setCurrentIds(id_sm, id_mm)
{
	current_id_mm = id_mm;
	current_id_sm = id_sm;
}

function flipFaqItem(id)
{
	if ( document.getElementById('fp_' + id).style.display == 'none' ) {
		document.getElementById('fp_' + id).style.display = 'block';
		document.getElementById('fi_' + id).src = 'html/img/ico_minus.gif';
	}
	else {
		document.getElementById('fp_' + id).style.display = 'none';
		document.getElementById('fi_' + id).src = 'html/img/ico_plus.gif';
	}
}

function openAllFaqItems()
{
	var cont = document.getElementById('faqContainer').getElementsByTagName('div');
	for(i=0;i<cont.length;i++) {
		if ( cont[i].id ) {
			var s = new String(cont[i].id);
			var id = s.substring(3);
			document.getElementById('fp_' + id).style.display = 'block';
			document.getElementById('fi_' + id).src = 'html/img/ico_minus.gif';
		}
	}
}

function wybor_wojewodztwa(id)
{
	window.location.href = "biura?pr_id=" + id;
}

function clearField(e,v)
{
	if ( e && v ) {
		if ( e.value == v ) e.value = "";
	}
}

function changeProvince(p)
{
	$("#rightContent").load($("#get_divisions_for_province").text() + "?pr=" + p);
}

function setSelectedProvince(pr_id)
{
	$("#provinceSelect").val(pr_id);
}
