function ajaxTematy(site_host, idListy, idKategorii){
    
	wyczyscListe(idListy);
	new Ajax.Request(site_host + 'ajax_tematy.php', {
		method: 'post', 
		parameters:'id_kategorii='+escape(idKategorii)+'', 
		onComplete:function(request){
			var xmlResponse = request.responseXML.documentElement;
			dodajOption(idListy, '0', '[--- wybierz temat ---]');
			if(!xmlResponse.hasChildNodes()){
				 jQuery('table tr.ukryjtr').css('visibility','hidden');
			}
			while(xmlResponse.hasChildNodes()){
			   wartosc = xmlResponse.childNodes.item(0).childNodes.length ? xmlResponse.childNodes.item(0).firstChild.data : '';
			   id = xmlResponse.childNodes.item(0).childNodes.length ? parseInt(xmlResponse.childNodes.item(0).getAttribute('id')) : 0;
			   dodajOption(idListy, id, wartosc);
			   xmlResponse.removeChild(xmlResponse.firstChild);
			}
		}
	});
	
	return true;
	
}

function ajaxIndeksRemove(site_host,idElementu2, indeks){
	jQuery('#'+indeks+'').remove();
	val = jQuery('#indeksy').val();
	val = val.replace(';'+indeks,'');
	val = val.replace(indeks,'');
	jQuery('#indeksy').val(val);
	
	return true;
}

function ajaxIndeksRemove2(site_host,idElementu2, indeks, indeks2){
	jQuery('#'+indeks+'_'+indeks2+'').remove();
	val = jQuery('#indeksy').val();
	val = val.replace(';'+indeks+'#'+indeks2+'','');
	val = val.replace(indeks+'#'+indeks2,'');
	jQuery('#indeksy').val(val);
	
	return true;
}

function ajaxIndeksy(site_host, idElementu1, idElementu2, indeks){
	jQuery('#'+idElementu1+'').html('<img src="'+site_host+'img/loading.gif" width="16" height="16" alt="" />');
	new Ajax.Request(site_host + 'ajax_indeksy.php', {
		method: 'post', 
		parameters:'indeks='+escape(indeks)+'', 
		onComplete:function(request){
			var xmlResponse = request.responseXML.documentElement;
			if(xmlResponse.hasChildNodes()){
			   result = xmlResponse.childNodes.item(0).childNodes.length ? parseInt(xmlResponse.childNodes.item(0).firstChild.data) : 0;
			   text = xmlResponse.childNodes.item(1).childNodes.length ? xmlResponse.childNodes.item(1).firstChild.data : '';
			   if(result){
				   val = jQuery('#indeksy').val();
				   if(val.indexOf(indeks)==-1){
				       jQuery('#'+idElementu2+'').append('<div id="'+indeks+'">'+indeks+' &nbsp; <a href="javascript:void(0);" onclick="if(confirm(\'Czy chcesz usunąć wpis?\')) ajaxIndeksRemove(\''+site_host+'\',\''+idElementu2+'\', \''+indeks+'\'); else return false;"><img src="'+site_host+'img/delete.gif" width="10" height="10" alt="" /></a></div>');
					   if(val){
					      jQuery('#indeksy').val(val+';'+indeks);
					   }else{
						  jQuery('#indeksy').val(indeks); 
					   }
				   }
				   
			   }
			   jQuery('#'+idElementu1+'').html(text); 
			   
			  
			}
		}
	});
	return true;
}

function ajaxSwapForm(site_host, idElementu, rodzaj){
	
	jQuery('#'+idElementu+'').html('<img src="'+site_host+'img/loading.gif" width="16" height="16" alt="" />');
	new Ajax.Updater(idElementu,site_host + 'ajax_swap_form.php', {
		method: 'post', 
		parameters:'rodzaj='+escape(rodzaj)+'', 
		onComplete:function(request){
			jQuery('#indeksy').val(''); 
			jQuery('#idxlist').html('');
		}
	});
	return true;
}

function ajaxIndeksy2(site_host, idElementu1, idElementu2, indeks, indeks2){
	jQuery('#'+idElementu1+'').html('<img src="'+site_host+'img/loading.gif" width="16" height="16" alt="" />');
	new Ajax.Request(site_host + 'ajax_indeksy2.php', {
		method: 'post', 
		parameters:'indeks='+escape(indeks)+'&indeks2='+escape(indeks2)+'', 
		onComplete:function(request){
			var xmlResponse = request.responseXML.documentElement;
			if(xmlResponse.hasChildNodes()){
			   result = xmlResponse.childNodes.item(0).childNodes.length ? parseInt(xmlResponse.childNodes.item(0).firstChild.data) : 0;
			   text = xmlResponse.childNodes.item(1).childNodes.length ? xmlResponse.childNodes.item(1).firstChild.data : '';
			   if(result){
				   val = jQuery('#indeksy').val();
				   if(val.indexOf(indeks)==-1){
				       jQuery('#'+idElementu2+'').append('<div id="'+indeks+'_'+indeks2+'">'+indeks+' na '+indeks2+' &nbsp; <a href="javascript:void(0);" onclick="if(confirm(\'Czy chcesz usunąć wpis?\')) ajaxIndeksRemove2(\''+site_host+'\',\''+idElementu2+'\', \''+indeks+'\', \''+indeks2+'\'); else return false;"><img src="'+site_host+'img/delete.gif" width="10" height="10" alt="" /></a></div>');
					   if(val){
					      jQuery('#indeksy').val(val+';'+indeks+'#'+indeks2);
					   }else{
						  jQuery('#indeksy').val(indeks+'#'+indeks2); 
					   }
				   }
				   
			   }
			   jQuery('#'+idElementu1+'').html(text); 
			   
			  
			}
		}
	});
	return true;
}

function nextContact(){
	jQuery('tr.trukryj3').css('display','');
	jQuery('#id_tematu').attr('disabled',true);
	jQuery('#id_kategorii').attr('disabled',true);
	jQuery('tr.ukryjtr').css('visibility','hidden');
	jQuery('#kontaktfrm').append('<input type="hidden" name="id_tematu" id="id_tematu1" value="'+jQuery('#id_tematu').val()+'" />');
	jQuery('#kontaktfrm').append('<input type="hidden" name="id_kategorii" id="id_kategorii1" value="'+jQuery('#id_kategorii').val()+'" />');
	return true;
}

function backContact(){
	jQuery('tr.trukryj3').css('display','none');
	jQuery('#id_tematu').attr('disabled',false);
	jQuery('#id_kategorii').attr('disabled',false);
	jQuery('tr.ukryjtr').css('visibility','visible');
	jQuery('#id_tematu1').remove();
	jQuery('#id_kategorii1').remove();
	return true;
}

function ajaxOdpowiedz(site_host, idElementu, idElementu2, idTematu){
    
	new Ajax.Request(site_host + 'ajax_odpowiedz.php', {
		method: 'post', 
		parameters:'id_tematu='+escape(idTematu)+'', 
		onComplete:function(request){
			jQuery('#'+idElementu+'').html('');
			var xmlResponse = request.responseXML.documentElement;
			if(xmlResponse.hasChildNodes()){
			   wartosc = xmlResponse.childNodes.item(0).childNodes.length ? xmlResponse.childNodes.item(0).firstChild.data : '';
			   wartosc2 = xmlResponse.childNodes.item(1).childNodes.length ? xmlResponse.childNodes.item(1).firstChild.data : '';
			   jQuery('#'+idElementu+'').html(wartosc);
			   jQuery('#'+idElementu2+'').html(wartosc2);
			   if(wartosc){
				   jQuery('table tr.ukryjtr').css('visibility','visible');
				   jQuery('table tr.trukryj4').css('display','none');
			   }else{
				   jQuery('table tr.ukryjtr').css('visibility','hidden');
			   }
			}else{
				   jQuery('table tr.ukryjtr').css('visibility','hidden');
			}
		}
	});
	
	return true;
	
}

function dodajOption(elSelectId, value, label) {
    var elOption = null;
	elOption = document.createElement('option');
	elOption.value = value;
	elOption.text = label;
	elSelect = document.getElementById(elSelectId);

	if(document.all && !window.opera){
		elSelect.add(elOption);
	}else{
		elSelect.add(elOption, null);
	}
}

function wyczyscListe(elId){
	elObject = document.getElementById(elId);
    if(elObject != null){
        while(elObject.hasChildNodes()){
            elObject.removeChild(elObject.firstChild);
        }
    }
}

function zwinRozwin(id){
	
	if(jQuery('#'+id+'')){
		if(jQuery('#'+id+'').css('display')!='none'){
			jQuery('#'+id+'').slideUp('slow');
		}else{
			jQuery('#'+id+'').slideDown('slow'); 
		}
	}
	return true;
}

function changeFoto(imgId, imgName1, imgName2){
	
	src = jQuery('#'+imgId+'').attr('src');
	if(src.indexOf(imgName1)!=-1){
	  jQuery('#'+imgId+'').attr('src', src.replace(imgName1, imgName2));
	}else{
	  jQuery('#'+imgId+'').attr('src', src.replace(imgName2, imgName1));
	}
	
}

function checkValue(idElementu){
	
	val = parseInt(jQuery('#'+idElementu+'').val());
	
	if(!val){
		jQuery('#'+idElementu+'').val('1');
	}else{
		jQuery('#'+idElementu+'').val('0');
	}
	
}

function pokazUkryjFVat(id, pole_id, imgid, imgcheck, imguncheck){
	  
	  pole = document.getElementById(id);
	  pole1 = document.getElementById(pole_id);
	  if(pole){
		  wlasciwosc = pole.style.display;
		  imgsrc = jQuery('#'+imgid).attr('src');
		  if(wlasciwosc=='none'){
			  //pole.style.display = 'block';
			  jQuery('#'+id+'').slideDown(0);
			  jQuery('#'+imgid).attr('src', imgsrc.replace(imguncheck,imgcheck));
			  //$(imgid).src = imgsrc.replace(imguncheck,imgcheck);
			  if(pole1){
				  pole1.value = 1;
			  }
		  }else{
			  //pole.style.display = 'none';
			  jQuery('#'+id+'').slideUp(0);
			  jQuery('#'+imgid).attr('src', imgsrc.replace(imgcheck,imguncheck));
			   if(pole1){
				  pole1.value = 0;
			  }
		  }
	  }
  }

function checkElement(formId, idElementu, wartosc){
	
	if(jQuery('#'+idElementu+'').size()){
		jQuery('#'+idElementu+'').remove();
		
	}else{
		jQuery('#'+formId+'').append('<input type="hidden" name="'+idElementu+'" id="'+idElementu+'" value="'+wartosc+'" />'); 
	}
	
	//setVisibleItem(document.location.search.substring(1));
	
}

function isset(varname) {
  if(typeof( window[ varname ] ) != "undefined") return true;
  else return false;
}

function setVisibleItem(){
	
	querystring = document.location.search.substring(1);
	tabPom = new Array();
	tabPom2 = new Array();
	tabExplode = querystring.split('&');
	tabExplode = tabExplode.reverse();
	ciag = '';
	
	for(i=0;i<tabExplode.length;i++){
		tabExplode2 = tabExplode[i].split('=');
		if(tabExplode2.length==2){
			idZm = tabExplode2[0].split('_');
			if(idZm.length==3 && idZm[0]=='atr'){
				idZm = idZm[idZm.length-2];
				if(typeof(tabPom[idZm])=='undefined'){
					
					tabPom[idZm] = tabExplode2[1];	
					
				}
			}
		}
	}
	
	return tabPom;

}

function replaceElement(idElementu1, idElementu2, srch){
	
	if(jQuery('#'+idElementu2+'').size()){
		
		val1 = jQuery('.'+idElementu1+':first').attr('href');
		val2 = jQuery('#'+idElementu2+'').val();
		
			val3 = val1.replace(srch,srch.substr(0,srch.length-1)+val2);
			jQuery('.'+idElementu1+'').each(function(index, domElem){
				jQuery(domElem).attr('href', val3);										  
			});
	}
	
}

function zwinRozwin1(id){
	
	if(jQuery('#'+id+'')){
		if(jQuery('#'+id+'').css('display')=='none'){
			jQuery('#'+id+'').slideDown(10); 
		}
	}
	return true;
}


function setSize(containerId, labelId, formElemId, value, text){
	
	jQuery('#'+labelId+'').html(text);
	jQuery('#'+formElemId+'').val(value);
	jQuery('#'+containerId+'').slideUp('fast'); 
	
	return true;
	
}


function pokazUkryjPole(nazwaPola, poleCheckbox){
	
	tabPom = poleCheckbox.split('_');
	tabPom2 = nazwaPola.split('_');
	ciag2 = tabPom2[0]+'_'+tabPom2[1];
	
	if(tabPom.length==5){
		pp = document.getElementById(poleCheckbox);
		zz = document.getElementById(nazwaPola);
		if(pp.checked){
	       zz.className = 'pokaz';
		}else{
		   zz.className = 'ukryj';
		}
		ciag = tabPom[0]+'_'+tabPom[1]+'_'+tabPom[2]+'_'+tabPom[3];
		tabCheckbox = document.getElementsByTagName('input');
		for(i=0;i<tabCheckbox.length;i++){
			tabPom1 = tabCheckbox[i].id.split('_');
			ciag1 = tabPom1[0]+'_'+tabPom1[1]+'_'+tabPom1[2]+'_'+tabPom1[3];
			if((tabPom1.length==5) && (tabCheckbox[i].type=='checkbox') && (ciag1==ciag) && (poleCheckbox!=tabCheckbox[i].id)){
				pm = document.getElementById(ciag2+'_'+tabPom1[4]);
				if(pp.checked){
					tabCheckbox[i].checked = false;
					pm.className = 'ukryj';
				}
			}
		}
	}
	
	return true;
}

function pokazUkryjPola(id, znacznik, ukryjClass, pokazClass){
	elts = document.getElementsByTagName(znacznik);
	check = document.getElementById(id);
	for(i=0;i<elts.length;i++){
		if(check.checked){
			if(elts[i].className==ukryjClass){
			   elts[i].className=pokazClass;
			}
		}else{
			if(elts[i].className==pokazClass){
			     elts[i].className=ukryjClass;
			}
		}
	}
	return true;
}

function ajaxKoszty(siteHost, form, poleDostawa, polePlatnosci){
	idDostawy = 0;
	idPlatnosci = 0;
	for(i=0; i < $(form).elements.length; i++){
		if($(form).elements[i].type == 'radio'){
			if($(form).elements[i].name == poleDostawa && $(form).elements[i].checked){
				idDostawy = $(form).elements[i].value;
			}else if($(form).elements[i].name == polePlatnosci && $(form).elements[i].checked){
				idPlatnosci = $(form).elements[i].value;
			}
		}
	}

	new Ajax.Request(siteHost + 'ajax_koszty.php', {
		method: 'get', 
		parameters:'id_dostawy='+escape(idDostawy)+'&id_platnosci='+escape(idPlatnosci), 
		onComplete:function(request){
			var xmlResponse = request.responseXML.documentElement;
			$('koszty-info').innerHTML = xmlResponse.childNodes.length ? xmlResponse.childNodes.item(0).firstChild.data : 'error: 034';
		}
	});
	
	return true;
}

function kopiujDane(){
	kopiujWartosc('usr_imie', 'imie');
	kopiujWartosc('usr_nazwisko', 'nazwisko');
	kopiujWartosc('usr_ulica', 'ulica');
	kopiujWartosc('usr_nr_domu', 'nr_domu');
	kopiujWartosc('usr_nr_mieszkania', 'nr_mieszkania');
	kopiujWartosc('usr_kod_pocztowy', 'kod_pocztowy');
	kopiujWartosc('usr_miejscowosc', 'miejscowosc');
	kopiujWartosc('usr_telefon', 'telefon');
	kopiujWartosc('usr_email', 'email');
	return true;
}

function kopiujAdres(){
	kopiujWartosc('firma', 'firma_koresp');
	kopiujWartosc('telefon', 'telefon_koresp');
	kopiujWartosc('imie', 'imie_koresp');
	kopiujWartosc('nazwisko', 'nazwisko_koresp');
	kopiujWartosc('ulica_glowny', 'ulica_koresp');
	kopiujWartosc('nr_domu_glowny', 'nr_domu_koresp');
	kopiujWartosc('nr_mieszkania_glowny', 'nr_mieszkania_koresp');
	kopiujWartosc('kod_pocztowy_glowny', 'kod_pocztowy_koresp');
	kopiujWartosc('miejscowosc_glowny', 'miejscowosc_koresp');
	return true;
}

function kopiujAdres2(){
	
	kopiujWartosc('firma_koresp', 'firma_faktura');
	kopiujWartosc('imie_koresp', 'imie_faktura');
	kopiujWartosc('nazwisko_koresp', 'nazwisko_faktura');
	kopiujWartosc('ulica_koresp', 'ulica_faktura');
	kopiujWartosc('nr_domu_koresp', 'nr_domu_faktura');
	kopiujWartosc('nr_mieszkania_koresp', 'nr_mieszkania_faktura');
	kopiujWartosc('kod_pocztowy_koresp', 'kod_pocztowy_faktura');
	kopiujWartosc('miejscowosc_koresp', 'miejscowosc_faktura');
	return true;
	
}

function kopiujAdres3(){
	
	kopiujWartosc('firma', 'firma_faktura');
	kopiujWartosc('nip', 'nip_faktura');
	kopiujWartosc('imie', 'imie_faktura');
	kopiujWartosc('nazwisko', 'nazwisko_faktura');
	kopiujWartosc('ulica_glowny', 'ulica_faktura');
	kopiujWartosc('nr_domu_glowny', 'nr_domu_faktura');
	kopiujWartosc('nr_mieszkania_glowny', 'nr_mieszkania_faktura');
	kopiujWartosc('kod_pocztowy_glowny', 'kod_pocztowy_faktura');
	kopiujWartosc('miejscowosc_glowny', 'miejscowosc_faktura');
	return true;
	
}

function kopiujAdres4(){
	
	kopiujWartosc('firma_koresp', 'firma_zamawiajacy');
	kopiujWartosc('imie_koresp', 'imie_zamawiajacy');
	kopiujWartosc('nazwisko_koresp', 'nazwisko_zamawiajacy');
	kopiujWartosc('ulica_koresp', 'ulica_zamawiajacy');
	kopiujWartosc('nr_domu_koresp', 'nr_domu_zamawiajacy');
	kopiujWartosc('nr_mieszkania_koresp', 'nr_mieszkania_zamawiajacy');
	kopiujWartosc('kod_pocztowy_koresp', 'kod_pocztowy_zamawiajacy');
	kopiujWartosc('miejscowosc_koresp', 'miejscowosc_zamawiajacy');
	kopiujWartosc('telefon_koresp', 'telefon_zamawiajacy');
	return true;
	
}

function kopiujWartosc(objIdBaza, objIdCel){
	$(objIdCel).value = $(objIdBaza).value;
	return true;
}

function czLoadForm(siteHost, sklepOutlet){
	$('zone1').innerHTML = '<form name="logform" method="post" action="'+siteHost+'login.html" onsubmit="return false;">'
	+ 'login: <input type="text" name="log_login" id="log_login" class="inp" size="14" maxlength="32" /> &nbsp; '
	+ 'hasło: <input type="password" name="log_pass" id="log_pass" class="inp" size="14" maxlength="32" /> &nbsp; '
	+ '<input name="submit_log" type="image" src="'+siteHost+'/img/bt_zaloguj_'+sklepOutlet+'.gif" align="top" onclick="ajaxLogin($(log_login).value,$(log_pass).value,\''+siteHost+'\')" />'
	+ '</form>';

}

function ajaxLogin(login, pass, siteHost){
	new Ajax.Request(siteHost + 'login2.html', {
		method: 'post', 
		parameters:'login='+escape(login)+'&pass='+escape(pass), 
		onComplete:function(request){
			var xmlResponse = request.responseXML.documentElement;
			$('zone1').innerHTML = xmlResponse.childNodes.length ? xmlResponse.childNodes.item(0).firstChild.data : 'error: 034';
			ifReload = xmlResponse.childNodes.length ? xmlResponse.childNodes.item(1).firstChild.data : 0;
			if(ifReload != 0){
				document.location.href = document.location.href;
			}
		}
	});
	
	return true;
}


var IE = (document.all && document.getElementById && !window.opera );
var FF = (!document.all && document.getElementById && !window.opera);
var OP = (document.all && document.getElementById && window.opera);

function zmienFoto(ktory){
	$('mFoto').src = pomImgLoad.src;

	var pomImg2 = new Image();
	pomImg2.src = mSiteHost + 'foto/' + tabFoto[ktory][0];
	pomImg2.onload = function(){
		$('mFoto').src = pomImg2.src;
	}
	if(pomImg2.complete == true){
		$('mFoto').src = pomImg2.src;
	}

	setCssBackgroundImage(mBoxId, mSiteHost + '/img/loading.gif', '50%', '50%');
	mBoxBgImage = mSiteHost + 'foto/' + tabFoto[ktory][1];
	mBoxBgImageIsLoaded = false;
	mBoxBgImageWidth = tabFoto[ktory][2];
	mBoxBgImageHeight = tabFoto[ktory][3];
	mBoxShow();
	mBoxHide();

	ileZdjec = tabFoto.length;
	for(i=0; i < ileZdjec; i++){
		$('mp'+i+'').className = '';	
	}
	$('mp'+ktory).className = 'cur';
}

function mMoveXY(event){
	if(mBoxBgImageIsLoaded){
		mouseX = 0;
		mouseY = 0;
		if(!event){
			var event = window.event;
		}
		if(IE){
			mouseX = event.clientX + document.documentElement.scrollLeft;
			mouseY = event.clientY + document.documentElement.scrollTop;
		}else{ 
			mouseX = event.pageX;
			mouseY = event.pageY;
		}
		mouseX -= $(mContainerId).offsetLeft;
		mouseY -= $(mContainerId).offsetTop;
	
		mFrameOffsetX = parseFloat(mFrameWidth / 2);
		mFrameOffsetY = parseFloat(mFrameHeight / 2);
	
		mBoxBgX = parseInt((-imagesWidthRatio * mouseX) + parseFloat(mBoxWidth / 2));
		mBoxBgY = parseInt((-imagesHeightRatio * mouseY) + parseFloat(mBoxHeight / 2));
	
		if(mBoxBgX > 0){
			mBoxBgX = 0;
		}else if(mBoxBgX < -(mBoxBgImageWidth - mBoxWidth)){
			mBoxBgX = -(mBoxBgImageWidth - mBoxWidth); 
		}
		if(mBoxBgY > 0){
			mBoxBgY = 0;
		}else if(mBoxBgY < -(mBoxBgImageHeight - mBoxHeight)){
			mBoxBgY = -(mBoxBgImageHeight - mBoxHeight); 
		}
		
		setCssBackgroundPosition(mBoxId, mBoxBgX, mBoxBgY);
		
		mFrameY = mouseY - mFrameOffsetY;
		mFrameX = mouseX - mFrameOffsetX;
	
		if(mouseX + mFrameOffsetX > mBaseWidth){
			mFrameX = mBaseWidth - (2 * mFrameOffsetX);
		}else if(mFrameX < 0){
			mFrameX = 0;
		}
			
		if(mouseY + mFrameOffsetY > mBaseHeight){
			mFrameY = mBaseHeight - (2 * mFrameOffsetY);
		}else if(mFrameY < 0){
			mFrameY = 0;
		}
	
		setCssPosition(mFrameId, mFrameY, mFrameX);
		//setCssBackgroundImage(mFrameId, mBoxBgImage, mFrameY, mFrameX);
		//setCssBackgroundImage(mFrameId, '/img/loading.gif', '50%', '50%');
	}
	return true;
}

function calculatemFrameSize(objId, width1, height1, width2, height2){
	width = Math.floor(parseInt(width2) / parseInt(width1));
	height = Math.floor(parseInt(height2) / parseInt(height1));
	setCssSize(objId, height * mFrameRatio, width * mFrameRatio);
	return true;
}

function setCssBackgroundPosition(objId, x, y){
	$(objId).style.backgroundPosition = ''+x+'px '+y+'px';
}

function setCssPosition(objId, top, left){
	$(objId).style.top = parseInt(top)+'px';
	$(objId).style.left = parseInt(left)+'px';
}

function setCssSize(objId, width, height){
	$(objId).style.width = parseInt(width)+'px';
	$(objId).style.height = parseInt(height)+'px';
}

function setCssBackgroundImage(objId, img, left, top){
	$(objId).style.backgroundImage = 'url('+img+')';
	$(objId).style.backgroundPosition = left+' '+top;
}

function mBoxHide(){
	//$(mBaseId).className ='';
	//$(mFrameId).style.display = 'none';
	//$(mBoxId).style.display = 'none';
	$(mBaseId).style.cursor = 'default';
	return true;
}
function mBoxShow(){
	$(mBaseId).style.cursor = 'crosshair';
	//$(mFrameId).style.display = 'block';
	//calculatemFrameSize(mFrameId, mBaseWidth, mBaseHeight, mBoxBgImageWidth, mBoxBgImageHeight);
	mFrameWidth = parseInt(getCssStyleProperties($(mFrameId), 'width'));
	mFrameHeight = parseInt(getCssStyleProperties($(mFrameId), 'height'));
	//$(mBaseId).className = 'trans';	
	$(mBoxId).style.display = 'block';
	setCssBackgroundImage(mBoxId, mSiteHost + '/img/loading.gif', '50%', '50%');
	if(mBoxBgImageIsLoaded){
		setCssBackgroundImage(mBoxId, mBoxBgImage, '50%', '50%');
	}else{
		var pomImg = new Image();
		pomImg.src = mBoxBgImage;
		pomImg.onload = function(){
			mBoxBgImageIsLoaded = true;
			setCssBackgroundImage(mBoxId, mBoxBgImage, '50%', '50%');
		}
		if(pomImg.complete == true){
			mBoxBgImageIsLoaded = true;
			setCssBackgroundImage(mBoxId, mBoxBgImage, '50%', '50%');
		}
	}
	return true;
}

function getCssStyleProperties(objId,styleProperties){
	if ($(objId).currentStyle){
		return $(objId).currentStyle[styleProperties];
	}else if (window.getComputedStyle){
		return document.defaultView.getComputedStyle($(objId),null).getPropertyValue(styleProperties);
	}
}

function trim(txt){
    return txt.replace(/(^\s+)|(\s+$)/g, '');
}

function ukryjObiektOId(elId){
	elObject = document.getElementById(elId);
	elObject.style.display = 'none';
}

function wyswietlObiektOId(elId){
	elObject = document.getElementById(elId);
	elObject.style.display = 'block';
}

function przeladuj(loc){
		document.location.href = loc;
}

function limit_dla_pola(limit, pole, span_pole){
	if (document.getElementById(pole).value.length > limit){
		document.getElementById(pole).value = document.getElementById(pole).value.substring(0, limit);
	}
	if(span_pole.length > 0){
		txt = '';
		ile_pozostalo = limit - document.getElementById(pole).value.length;
		txt = '<br />Pozostało ' + ile_pozostalo + ' z ' + limit + ' znaków.';
		document.getElementById(span_pole).innerHTML = txt;
	}
}

function wklej(nazwa_pola){
	document.getElementById(nazwa_pola).value = window.clipboardData.getData('Text');
	return true;
}

function kopiuj(nazwa_pola){
	window.clipboardData.setData('Text', document.getElementById(nazwa_pola).value);
	return true;
}

function limit_dla_pola(limit, pole, span_pole){
	if (document.getElementById(pole).value.length > limit){
		document.getElementById(pole).value = document.getElementById(pole).value.substring(0, limit);
	}
	if(span_pole.length > 0){
		txt = '';
		ile_pozostalo = limit - document.getElementById(pole).value.length;
		txt = '<br />Pozostało ' + ile_pozostalo + ' z ' + limit + ' znaków.';
		document.getElementById(span_pole).innerHTML = txt;
	}
}
