var akt_form = 'mieszkania';

function odznacz_tag(co) {
   schowaj(co+'_on');
   pokaz2(co+'_off');
}

function zaznacz_tag(co) {
   schowaj(co+'_off');
   pokaz2(co+'_on');
}

function schowaj(id) {
	if (document.getElementById) document.getElementById(id).style.display = "none";
   else if (document.all) document.all[id].style.display = "none";
	}

function pokaz2(co) {
   jest="block";
   if (document.getElementById) document.getElementById(co).style.display = jest;
   else if (document.all) document.all[co].style.display = jest;
}

function pokaz(co) {
   if (document.getElementById) jest=document.getElementById(co).style.display;
   else if (document.all) jest=document.all[co].style.display;
   if (jest=="none") {jest="block";} else {jest="none";};
   if (document.getElementById) document.getElementById(co).style.display = jest;
   else if (document.all) document.all[co].style.display = jest;
}

function getByID(id) {
   return document.getElementById(id);
}

function pokaz_form(co) {
	schowaj(akt_form);
	schowaj('autosuggest');
   odznacz_tag(akt_form);

   akt_form = co;
   zaznacz_tag(akt_form);
	jest="block";
   if (document.getElementById) document.getElementById(co).style.display = jest;
   else if (document.all) document.all[co].style.display = jest;
}
	
function deleteConfirm(adres) {
   var x=window.confirm('Jesteś pewien, że chcesz usunąć ten element?\n\nTa akcja jest nieodwracalna');
   if (x) {
      location=adres;
   }
}

var TopBannerWidth = 468; // mo?e zosta? dalej zmieniona

function removeElement(parent, el) {
  var d = document.getElementById(parent);
  var old = document.getElementById(el);
  d.removeChild(old);
}
function pokaz_on(co) {
   jest="block";
   if (document.getElementById) document.getElementById(co).style.display = jest;
   else if (document.all) document.all[co].style.display = jest;
}
function pokaz_off(id) {
	if (document.getElementById) document.getElementById(id).style.display = "none";
   else if (document.all) document.all[id].style.display = "none";
	}
	
function makeHttpRequest(url, callback_function, return_xml) { 
            var http_request = false; 

            if (window.XMLHttpRequest) { // Mozilla, Safari,... 
               http_request = new XMLHttpRequest(); 
               if (http_request.overrideMimeType) { 
                  http_request.overrideMimeType('text/xml;'); 
               } 
            } else if (window.ActiveXObject) { // IE 
               try { 
                  http_request = new ActiveXObject("Msxml2.XMLHTTP"); 
               } catch (e) { 
                  try { 
                     http_request = new ActiveXObject("Microsoft.XMLHTTP"); 
                  } catch (e) {} 
               } 
            } 

            if (!http_request) { 
               alert('Unfortunatelly you browser doesn\'t support this feature.'); 
               return false; 
            } 
            http_request.onreadystatechange = function() { 
               if (http_request.readyState == 4) { 
                  if (http_request.status == 200) { 
                     if (return_xml) { 
                        eval(callback_function + '(http_request.responseXML)'); 
                     } else { 
                        eval(callback_function + '(repairRequest(http_request.responseText))'); 
                     } 
                  } else { 
                     alert('There was a problem with the request.(Code: ' + http_request.status + ')'); 
                  } 
               } 
            } 
            url = encodeURI(url);
            
            http_request.open('GET', url, true); 
            http_request.setRequestHeader("Content-type", "text/html;");
            http_request.send(null); 
         }

function makeHttpRequestPost(url, callback_function, params) { 
            var http_request = false; 

            if (window.XMLHttpRequest) { // Mozilla, Safari,... 
               http_request = new XMLHttpRequest(); 
               if (http_request.overrideMimeType) { 
                  http_request.overrideMimeType('text/html;'); 
               } 
            } else if (window.ActiveXObject) { // IE 
               try { 
                  http_request = new ActiveXObject("Msxml2.XMLHTTP"); 
               } catch (e) { 
                  try { 
                     http_request = new ActiveXObject("Microsoft.XMLHTTP"); 
                  } catch (e) {} 
               } 
            } 

            if (!http_request) { 
               alert('Unfortunatelly you browser doesn\'t support this feature.'); 
               return false; 
            } 
            http_request.onreadystatechange = function() { 
               if (http_request.readyState == 4) { 
                  if (http_request.status == 200) { 
                     eval(callback_function + '(repairRequest(http_request.responseText))'); 
                  } else { 
                     alert('There was a problem with the request.(Code: ' + http_request.status + ')'); 
                  } 
               } 
            } 
            //url = encodeURI(url);
            
            http_request.open('POST', url, true); 
            http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            http_request.setRequestHeader("Content-length", params.length);
            http_request.setRequestHeader("Connection", "close");
            http_request.send(params); 
         }
         
function repairRequest(msg) {
   if (msg.length>4) {
      var pom=0;
      if (msg.charCodeAt(0)==65279)
         pom++;
      if (msg.charCodeAt(1)==65279)
         pom++;
      if (msg.charCodeAt(2)==13 && msg.charCodeAt(10))
         pom+=2;
      return msg.substring(pom);
   }
   return msg;
}

function ord(string) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: Onno Marsman
    // *     example 1: ord('K');
    // *     returns 1: 75
    msg='';
   for(var i=0;i<string.length;i++)
      msg+=string.charCodeAt(i)+' ';
   window.alert(msg+' '+string);
}
     
function flashUpload(adres, tytul) {
   newwindow=window.open('/FlashUpload'+adres+'/'+decodeURI(tytul),'FlashUpload','height=500,width=500,resizable=false,scrollbars=no,toolbar=no,menubar=no,location=no,screenX=400,screenY=200');
   if (window.focus) {newwindow.focus()}
}     
function loaderGraphic(id) {
               var div = getByID(id); 
               div.innerHTML = '<div style=\"width:200px;background:white\"><center><br /><br /><br /><img src=\"imgMain/loader.gif\"><br /><br /><br /><br /></center></div>';
            }
function miniLoaderGraphic(id) {
               var div = getByID(id); 
               div.innerHTML = '&nbsp;Zapisuję...&nbsp;';
            }            
function wysOkna() {
            if (window.innerHeight != null)
               return window.innerHeight;
            if (document.body.clientHeight != null)
               return document.body.clientHeight;
            return (0);
         }

         function szerOkna() {
            if (window.innerWidth != null)
               return window.innerWidth;
            if (document.body.clientWidth != null)
               return document.body.clientWidth;
            return (0);
         }

         function getVPos() {
            var scrolled; //Declaring a local variable
            if (document.documentElement && document.documentElement.scrollTop) { scrolled = document.documentElement.scrollTop; } //Sniffing for IE5
            else if (document.body) { scrolled = document.body.scrollTop; } //Sniffing for IE6
            else { scrolled = window.pageYOffset; } //Sniffing for Netscape
            return scrolled; //Returning the variable
         }
      
         function ustawTop(co, ile) {
            if (document.getElementById) document.getElementById(co).style.top = ile+'px';
            else if (document.all) document.all[co].style.top = ile+'px';
         }
         
function getElementTop(Elem) {

		if(document.getElementById) {	
			var elem = document.getElementById(Elem);
		} else if (document.all) {
			var elem = document.all[Elem];
		}
		yPos = elem.offsetTop;
		tempEl = elem.offsetParent;
		while (tempEl != null) {
  			yPos += tempEl.offsetTop;
	  		tempEl = tempEl.offsetParent;
  		}
		return yPos;
}

function markRowsInit() {
               
               var rows = document.getElementsByTagName('tr');
               for ( var i = 0; i < rows.length; i++ ) {
                  
                  if ( 'podswietl' != rows[i].className.substr(0,9)) 
                     continue;
                  //window.alert(rows[i].className);
                  //if ( navigator.appName == 'Microsoft Internet Explorer' ) {
                     
                     rows[i].onmouseover = function() {
                        this.className += ' hover';
                     }
                     rows[i].onmouseout = function() {
                        this.className = this.className.replace( ' hover', '' );
                     }
                  //}
               }
            }
            

