pageParts={}
pageParts.PageParts2=function(){
	this.textMore="więcej..."
	this.textHide="...ukryj"
	this.lastShowedNr=""
	this.idBase="swP2"
	this.switchBlock=function(nr){
		if(this.lastShowedNr!=""){
			this._switch(this.lastShowedNr)
		}
		if(nr==this.lastShowedNr){
			this.lastShowedNr=""
			return
		}
		this._switch(nr)
		this.lastShowedNr=nr
	}
	this._switch=function(nr){
		var newVisible=!this._isVisible(this.idBase+"C"+nr)
		this._switchVisible(this.idBase+"C"+nr,newVisible)
		this._switchVisible(this.idBase+"S"+nr,!newVisible)
		var oldHrefHTML=document.getElementById(this.idBase+"A"+nr).innerHTML
		if(oldHrefHTML.length>3 && (oldHrefHTML==this.textHide || oldHrefHTML==this.textMore)){
			document.getElementById(this.idBase+"A"+nr).innerHTML=newVisible?this.textHide:this.textMore
		}
		
	}
	this._switchVisible=function(id,visible){
		var ref=document.getElementById(id)
		if(ref){
		ref.style.display=visible?'block':'none'
		}
	}
	this._isVisible=function(id){
		return document.getElementById(id).style.display=='block'
	}
	this.decorate=function(className){
		var elements=document.getElementsByTagName("a"); 
		for(var i=0;i<elements.length;i++){
			if(elements[i].className==className){
				var nr=elements[i].id.substr(5)
				//console.log(nr)
				if (elements[i].innerHTML.length < 4) {
					elements[i].innerHTML = pageParts.instance.textMore
				}
				elements[i].name="#swP2A"+nr
				elements[i].onclick=new Function("pageParts.instance.switchBlock("+nr+");this.blur();return false")
				if(location.hash && location.hash=="#swP2A"+nr){
					pageParts.instance.switchBlock(nr)
				}
			}
		}
	}
}
pageParts.instance=new pageParts.PageParts2()
