function hidephotos() { document.getElementById('photos').style.display='none'; }
function showphotos() { document.getElementById('photos').style.display='block'; }
function hidewithphotos() { document.getElementById('withphotos').style.display='none'; }

function multiselector(list_target, max)
{
	this.list_target = list_target;
	this.count = 0;
	this.id = 0;
	if (max) { this.max = max; } else { this.max = -1; };
	this.addElement = function(element)
	{
		if(element.tagName=='INPUT' && element.type=='file')
		{
			element.name = 'file_' + this.id++; 
			element.multi_selector = this;
			element.onchange = function()
			{
				var new_element = document.createElement( 'input' );
				new_element.type = 'file';
				this.parentNode.insertBefore( new_element, this );
				this.multi_selector.addElement( new_element );
				this.multi_selector.addListRow( this );
				this.style.display='none';
			};
			if( this.max != -1 && this.count >= this.max )
			{ element.disabled = true; };
			this.count++; this.current_element = element;
		} else { alert( 'Error: not a file input element' ); };
	};
	this.addListRow = function(element)
	{
		var new_row = document.createElement('div');
		var new_row_button = document.createElement('input');
		new_row_button.type = 'button';
		new_row_button.className ='delete';
		new_row.element = element;
		new_row_button.onclick= function()
		{
			this.parentNode.element.parentNode.removeChild( this.parentNode.element );
			this.parentNode.parentNode.removeChild( this.parentNode );
			this.parentNode.element.multi_selector.count--;
			this.parentNode.element.multi_selector.current_element.disabled = false;
			return false;
		};
		new_row.innerHTML = element.value;
		new_row.appendChild(new_row_button);
		this.list_target.appendChild(new_row);
		this.list_target.style.position='absolute';
		this.list_target.style.left='10px';
		this.list_target.style.top='40px';
		this.list_target.style.margin='0px 0px 5px 0px';
	};
};

function pokaz_()
{
  var rodzaj_ = document.getElementById('rodzaj').value;
  if (rodzaj_=='d') { pokaz_dom_(); };
  if (rodzaj_=='m') { pokaz_mieszkanie_(); };
  if (rodzaj_=='lu') { pokaz_lokaluzytkowy_(); };
  if (rodzaj_=='dz') { pokaz_dzialka_(); };
  if (rodzaj_=='hm') { pokaz_hala_(); };
  if (rodzaj_=='in') { pokaz_inne_(); };
}

function show_(object_) { document.getElementById(object_).style.display='block'; }
function hide_(object_) { document.getElementById(object_).style.display='none'; }
function dseth_(height)
{
  document.getElementById('dodfr').style.height=(height+2+35) + 'em';
  document.getElementById('dodaj').style.height=(height+0+35) + 'em';
  document.getElementById('dodaj2').style.top=(height+0) + 'em';
}
function gmtop_(postop)
{
  document.getElementById('gmap').style.top=(postop+0) + 'em';
  document.getElementById('gmap2').style.top=(postop-40) + 'em';
  //show_('gmap2');
}

function pokaz_dom_() { dseth_(96); gmtop_(92); show_('pdom'); hide_('pmieszkanie'); hide_('plokal'); hide_('pdzialka'); hide_('phala'); hide_('pinne'); }
function pokaz_mieszkanie_() { dseth_(82); gmtop_(78); hide_('pdom'); show_('pmieszkanie'); hide_('plokal'); hide_('pdzialka'); hide_('phala'); hide_('pinne'); }
function pokaz_lokaluzytkowy_() { dseth_(82); gmtop_(78); hide_('pdom'); hide_('pmieszkanie'); show_('plokal'); hide_('pdzialka'); hide_('phala'); hide_('pinne'); }
function pokaz_dzialka_() { dseth_(60); gmtop_(56); hide_('pdom'); hide_('pmieszkanie'); hide_('plokal'); show_('pdzialka'); hide_('phala'); hide_('pinne'); }
function pokaz_hala_() { dseth_(51); gmtop_(47); hide_('pdom'); hide_('pmieszkanie'); hide_('plokal'); hide_('pdzialka'); show_('phala'); hide_('pinne'); }
function pokaz_inne_() { dseth_(51); gmtop_(47); hide_('pdom'); hide_('pmieszkanie'); hide_('plokal'); hide_('pdzialka'); hide_('phala'); show_('pinne'); }
