function mine(t, a) {
	if(a=='add') {
		var d = new Date();
		d.setYear(d.getYear() < 1900? d.getYear() + 1901: d.getYear() + 1);
		document.cookie='mine[' + t + ']='+ t + ';expires='+d.toGMTString()+';path=/';
//		alert('Oferta została dodana do listy Państwa ofert. W każdym momencie będą mogli Państwo do nich powrócić.');
	}
	if(a=='remove') document.cookie='mine[' + t + ']=0;expires=;path=/';
}

function img(u) {
	document.write('<div class="img"><iframe id="img" src="'+u+'" frameborder="0" style="border: 0px; width: 248px; height: 186px; margin: 0px; padding: 0px; overflow: hidden;"></iframe><div id="img_nav">&nbsp;</div></div>');
}

function imgFwd(i, s) {
	imgCount += i;
	if(imgCount >= imgData.length) imgCount = imgCount - imgData.length;
	imgDraw(s);
}

function imgRew(i, s) {
	imgCount -= i;
	if(imgCount < 0) imgCount = imgData.length + imgCount;
	imgDraw(s);
}

function imgDraw(s) {
	if(imgData.length) {
		e('img_nav').innerHTML = '<span onclick="imgRew(1'+(s?',\''+s+'\'':'')+');" class="prev" style="cursor: pointer;">'+(imgCount+1)+'<\/span> z <'+'span onclick="imgFwd(1'+(s?',\''+s+'\'':'')+');" class="next" style="cursor: pointer;">'+imgData.length+'<\/span>'+desc[imgData[imgCount][1]];
		e('img').contentWindow.location.replace('/img/zdjecie'+(s?'-'+s:'')+'.html?'+imgData[imgCount][0]+','+imgData[imgCount][1]);
	}
	return true;
}

var scroll;

function scroll_fwd(s, o) {
	if(s) scroll = true;
	(o? e(o): e('img_scroll')).scrollLeft+=5;
	if(scroll) setTimeout("scroll_fwd()",10)
}

function scroll_rew(s, o) {
	if(s) scroll = true;
	(o? e(o): e('img_scroll')).scrollLeft-=5;
	if(scroll) setTimeout("scroll_rew()",10)
}

function scroll_pop(i) {
	window.open('http://'+location.host+'/img/zdjecie.html?'+i, 'zdjecie', 'menubar=no,location=no,resizable=no,scrollbars=no,status=no,width=288,height=226');
}

function scroll_check(o) {
	var scroll = o ? e(o) : e('img_scroll'), i, display = false;
	for(i in scroll.childNodes) if(scroll.childNodes[i].style) display = scroll.childNodes[i].style.display != 'none' ? true : display;
	if(!display) scroll.parentNode.style.display = 'none';
}

function o(o, i) {
	if(!i) i = 'details';
	if(!o.id) o = e(o);
	t_d = e(o.id+'_d');

	if(t_d.style.display=='inline') {
		if(o) o.src = eval('b_'+i+'_u.src');
		t_d.style.display='none';
		document.cookie='lista[' + t_d.id + ']=;expires=;path=/';
	} else {
		if(o) o.src = eval('b_'+i+'_d.src');
		t_d.style.display='inline'
		document.cookie='lista[' + t_d.id + ']=1;path=/';
	}
}

var b_details_u = new Image;
var b_details_d = new Image;

var b_regions_u = new Image;
var b_regions_d = new Image;

b_details_u.src = staticImg+'/img/btn/szczegoly-d.gif';
b_details_d.src = staticImg+'/img/btn/szczegoly-u.gif';

b_regions_u.src = staticImg+'/img/btn/regiony-d.gif';
b_regions_d.src = staticImg+'/img/btn/regiony-u.gif';

var p = false;
function sw_old(i) { // new in s.js
	e('t'+last).style.display="none";
	e('t'+i).style.display="inline";
	if(last) e('a_t'+last).className="";
	e('a_t'+i).className="c";
	last = i;

	var d = new Date();
	d.setYear(d.getYear() < 1900? d.getYear() + 1901: d.getYear() + 1);
	document.cookie='od='+ i + ';expires='+d.toGMTString()+';path=/';

	if(IE) document.selection.empty();
	else window.getSelection().removeAllRanges();
}

function ar(o, i) {
	if(!i) i = o;
	if(!e('t'+o+'_c')) return false;
	if(hgw[i][0]) e('t'+o+'_c').innerHTML = hgw[i][0];
	if(hgw[i][1]) e('t'+o+'_ioz').innerHTML = '<h3>Opcje zakwaterowania<\/h3>'+hgw[i][1]+'<br\/><br\/>';
	if(hgw[i][2]) e('t'+o+'_cz').innerHTML = '<h3>Cena zawiera<\/h3>'+hgw[i][2]+'<br\/><br\/>';
	if(hgw[i][3]) e('t'+o+'_cnz').innerHTML = '<h3>Cena nie zawiera<\/h3>'+hgw[i][3]+'<br\/><br\/>';
	if(hgw[i][4]) e('t'+o+'_u').innerHTML = '<h3>Uwagi<\/h3>'+hgw[i][4]+'<br\/><br\/>';
	if(hgw[i][5]) e('t'+o+'_w').innerHTML = '<h3>Wyżywienie<\/h3>'+hgw[i][5]+'<br\/><br\/>';
	if(hgw[i][6]) e('t'+o+'_rid').value = hgw[i][6];
	if(hgw[i][6]) e('t'+o+'_qid').value = hgw[i][6];
}

var sw = {
		pointer: false,
		last: 0,
		move: function(i) {
			e('t'+this.last).style.display="none";
			e('t'+i).style.display="inline";
			if(this.last) e('a_t'+this.last).className="";
			e('a_t'+i).className="c";
			this.last = i;

			var d = new Date();
			d.setYear(d.getYear() < 1900? d.getYear() + 1901: d.getYear() + 1);
			document.cookie='last='+ i + ';expires='+d.toGMTString()+';path=/';

			if(IE) document.selection.empty();
			else window.getSelection().removeAllRanges();
		}
	}

/**
 * Usage:
 * <someTag data="callback_function_name" id="someId">
 * 	<someOtherTag data="value1" class="someSelectedClass">something1</someOtherTag>
 * 	<someOtherTag data="value2">something2</someOtherTag>
 * 	<someOtherTag data="value3">something3</someOtherTag>
 * </someTag>
 * javascript call: switcher.init("someId", "someSelectedClass", 'someUnselectedClass_optional');clear:
 */
var switcher = {
	index: {},
	callback: {},
	selected: {},
	selectedClass: {},
	init: function(o, selClass, unSelClass) {
		if(typeof(o) == 'string') o = e(o);
		if(o === null || typeof(o) != 'object' || !o.id || !o.getAttribute) return false;
		if(typeof(unSelClass) == 'undefined') var unSelClass = '';
		this.callback[o.id] = o.getAttribute('data');
		this.selectedClass[o.id] = [selClass, unSelClass];
		o.onselectstart = function() { if(IE) document.selection.empty(); else window.getSelection().removeAllRanges(); }
//			o.onmouseout =
		o.ondragstart = function(event) { with(event ? event : window.event) { if(typeof(preventDefault) !== 'undefined') preventDefault(); else returnValue = false; return false; } }
//			o.onmousedown = o.onfocus = function() { this.focus(); for(var i in switcher.selected) switcher.selected[i] = false; switcher.selected[o.id] = true; };
//			o.onmouseup = o.onblur = o.onmouseup = function() { for(var i in switcher.selected) switcher.selected[i] = false; };
		o.onkeyup = function(event) { switch(window.event ? window.event.keyCode : (event ? event.which : null)) { case 37: case 38: switcher.prev(o.id); break; case 39: case 40: switcher.next(o.id); break; } };
//			if(!IE) o.onmouseout = o.onmouseup;
//			if(IE) o.onmousein = function() { if(window.button != 1) this.onmouseup(); };
//			window.onmouseup = o.onmouseup;
//			if(window.addEventListener) window.addEventListener('mouseup', window.onmouseup, true);
//			if(window.attachEvent) window.attachEvent('onmouseup', o.onmouseup);
		var first, sel;
		this.index[o.id] = {};
		if(o.childNodes.length) for(var i = 0; i < o.childNodes.length; i++) if(o.childNodes[i].getAttribute && o.childNodes[i].getAttribute('data')) {
			if(typeof(first) == 'undefined') first = o.childNodes[i].getAttribute('data');
			if(o.childNodes[i].className == selClass) sel = o.childNodes[i].getAttribute('data');
			this.index[o.id][o.childNodes[i].getAttribute('data')] = o.childNodes[i];
		}
		if(this.index[o.id]) for(var i in this.index[o.id]) {
//				this.index[o.id][i].onmousedown =
			this.index[o.id][i].onclick = function() { switcher.move(o.id, this.getAttribute('data')); };
//				this.index[o.id][i].onmousemove = function() { if((IE ? window.button == 1 : true) && switcher.selected[o.id]) switcher.move(o.id, this.getAttribute('data')); };
//				this.index[o.id][i].onmouseup = o.onmouseup;
//				this.index[o.id][i].onmousemove = function() { if(switcher.selected[o.id]) switcher.move(o.id, this.getAttribute('data')); };
		}
		return {'selected': sel, 'first': first};
	}, move: function(o, cur) {
		if(typeof(o) == 'string') o = e(o);
		if(o === null || typeof(o) != 'object' || !o.id || !o.getAttribute) return false;
		try {
			var className = this.selectedClass[o.id][1];
			for(var i in this.index[o.id]) {
				className = i == cur ? this.selectedClass[o.id][0] : this.selectedClass[o.id][1];
				if(className != this.index[o.id][i].className) this.index[o.id][i].className = className;
			}
			with(new Date()) {
				setYear(getYear() < 1900? getYear() + 1901: getYear() + 1);
				document.cookie = o.id + '='+ cur + ';expires=' + toGMTString() + ';path=/';
			}
			eval(this.callback[o.id]+'("'+cur+'")');
		} catch(error) {}
		if(IE) document.selection.empty();
		else window.getSelection().removeAllRanges();
	}, next: function(o) {
		if(typeof(o) == 'string') o = e(o);
		if(o === null || typeof(o) != 'object' || !o.id || !o.getAttribute) return false;
		var last = false, stop = false;
		for(var i in this.index[o.id]) {
			last = i;
			if(stop) break;
			stop = this.index[o.id][i].className == this.selectedClass[o.id][0];
		}
		this.move(o.id, last);
	}, prev: function(o) {
		if(typeof(o) == 'string') o = e(o);
		if(o === null || typeof(o) != 'object' || !o.id || !o.getAttribute) return false;
		var last = false, stop = false;
		for(var i in this.index[o.id]) {
			if(!last) last = i;
			stop = this.index[o.id][i].className == this.selectedClass[o.id][0];
			if(stop) break;
			last = i;
		}
		this.move(o.id, last);
	}
};

var terminy = {
	selected: {
		dni: null, wyzywienie: null, wyjazd: null
	}, index: {
		wyjazd:{}
	}, init: function(dni, wyzywienie, wyjazd) {
		this.create.coder = new Nibbler({dataBits:8,codeBits:5,keyString:'ABCDEFGHIJKL234567MNOPQRSTUVWXYZ',pad:'='});
		this.selected = {'dni': this.create.decode('dni', dni), 'wyzywienie': this.create.decode('wkod', wyzywienie), 'wyjazd': this.create.decode('kod', wyjazd)};
		if(this.nav) this.create.switcher();
		var obj = e('warianty').childNodes, selected = this.selected.dni+this.selected.wyzywienie+this.selected.wyjazd;
		for(var i = 0; i < obj.length; i++) if(typeof(obj[i]) == 'object' && obj[i].getAttribute && obj[i].getAttribute('data')) {
			if(obj[i].className.match(/warianty/) || obj[i].className.match(/wyjazd/)) {
				var tmp = obj[i].getElementsByTagName('*');
				for(var j = 0; j < tmp.length; j++) if(typeof(tmp[j]) == 'object' && tmp[j].getAttribute && tmp[j].getAttribute('data')) this.create[tmp[j].getAttribute('data').replace(/^([a-z]+)\|.*$/i, '$1')](tmp[j]);
			}
			var d = obj[i].style.display, show = false;
			if(selected == obj[i].getAttribute('data')) show = true;
			if(d == 'none' && show) obj[i].style.display = '';
			else if(d != 'none' && !show) obj[i].style.display = 'none';
		}
		this.show();
	}, sdni: function(ile) {
		this.selected.dni = ile;
		this.create.switcher();
		this.show();
	}, swyzywienie: function(wyzywienie) {
		this.selected.wyzywienie = wyzywienie;
		this.create.switcher();
		this.show();
	}, swyjazd: function(kod) {
		this.selected.wyjazd = kod;
		if(typeof(this.index.wyjazd[kod]) != 'undefined' && e('wyjazdy_wiecej')) switch(this.index.wyjazd[kod]) {
			case 0:
				e('ostatnio-wyjazd').scrollTop = 0;
				e('wyjazdy_wiecej').innerHTML = 'kolejne miasta';
				break;
			case 1:
				e('ostatnio-wyjazd').scrollTop = 21;
				e('wyjazdy_wiecej').innerHTML = 'poprzednie miasta';
				break;
		}
		this.show();
	}, stab: function(obj) {
		with(e('ostatnio-wyjazd')) {
			scrollTop = scrollTop + (21*2) > scrollHeight ? 0 : scrollTop + 21;
			e('wyjazdy_wiecej').innerHTML = scrollTop + (21*2) > scrollHeight ? 'poprzednie miasta' : 'kolejne miasta';
			e('wyjazdy_wiecej').className = scrollTop + (21*2) > scrollHeight ? 'prev' : 'next';
		}
	}, show: function() {
		var obj = e('warianty', false).childNodes, selected = this.selected.dni+this.selected.wyzywienie+(!this.wlasny && this.selected.wyjazd != '&nbsp;' ? this.selected.wyjazd : '');
		try{
			for(var i = 0; i < obj.length; i++) if(typeof(obj[i]) != 'undefined' && obj[i].getAttribute && obj[i].getAttribute('data')) {
				var d = obj[i].style.display, show = false;
				if(selected == obj[i].getAttribute('data')) show = true;
				if(d == 'none' && show) obj[i].style.display = '';
				else if(d != 'none' && !show) obj[i].style.display = 'none';
				if(obj[i].className == 'warianty' && show && obj[i].firstChild.tagName == 'DIV') new enovatis.ui.scroller({boxHeight:153, content:obj[i].firstChild, boxMarginRight:1});
			}
		} catch(error) {}
	}, details: function(obj, i) {
		with(obj.previousSibling){
			onmouseout = function(event) { var div = obj.previousSibling; if(onMouseOut(window.event ? window.event : (event ? event : null), div)) div.style.display='none'; };
			firstChild.innerHTML=this.create.decode('szczegoly', i);
			style.display='block';
		};
		obj.blur();
	}, post: function(n, v) {
		var f = e('warianty');
		switch(n) {
			case 'id': f.action = f.action.replace(/rezerwacje/, 'zapytania'); break
			case 'xid': f.action = f.action.replace(/zapytania/, 'rezerwacje'); break
		}
		with(e('hid')) {name=n;value=v;}
		f.submit();
	}, create: {
		ws: function(obj) {
			var data = obj.getAttribute('data').split('|');
			if(data[2]) obj.appendChild('TR'.object({className: 'wylot'}, [
			  'TD'.object({className: 'info', innerHTML: 'Wylot - '+ this.decode('data', data[2])}),
			  'TD'.object({className: 'z', innerHTML: '<span class="wz"></span><span class="godzina">'+this.decode('godzina', data[3])+'</span> '+this.decode('nazwa', data[4])}),
			  'TD'.object({className: 'd', innerHTML: '<span class="wd"></span><span class="godzina">'+this.decode('godzina', data[5])+'</span> '+this.decode('nazwa', data[6])})
			]));
			if(data[7]) obj.appendChild('TR'.object({className: 'powrot'}, [
			  'TD'.object({className: 'info', innerHTML: 'Powrót - '+ this.decode('data', data[7])}),
			  'TD'.object({className: 'z', innerHTML: '<span class="pz"></span><span class="godzina">'+this.decode('godzina', data[8])+'</span> '+this.decode('nazwa', data[9])}),
			  'TD'.object({className: 'd', innerHTML: '<span class="pd"></span><span class="godzina">'+this.decode('godzina', data[10])+'</span> '+this.decode('nazwa', data[11])})
			]));
			obj.appendChild('TR'.object({}, ['TD'.object({className: 'header', colSpan: 3, innerHTML: 'W terminie <b>'+ (data[2] != '' ? this.decode('data', data[2])+' - '+ this.decode('data', data[7]) : this.decode('daty', data[12]))+'</b>, przelot <b>samolotem</b>, '+ this.decode('wnazwa', data[1])})]));
			this.wh(obj);
		}, wb: function(obj) {
			var data = obj.getAttribute('data').split('|');
			if(data[2]) obj.appendChild('TR'.object({className: 'wylot'}, [
   			  'TD'.object({className: 'info', innerHTML: 'Wyjazd - '+ this.decode('data', data[2])}),
   			  'TD'.object({className: 'z', innerHTML: '<span class="wz"></span>'+this.decode('nazwa', data[4])}),
   			  'TD'.object({className: 'd', innerHTML: '<span class="wd"></span>'+this.decode('nazwa', data[6])})
   			]));
   			if(data[7]) obj.appendChild('TR'.object({className: 'powrot'}, [
   			  'TD'.object({className: 'info', innerHTML: 'Powrót - '+ this.decode('data', data[7])}),
   			  'TD'.object({className: 'z', innerHTML: '<span class="pz"></span>'+this.decode('nazwa', data[9])}),
   			  'TD'.object({className: 'd', innerHTML: '<span class="pd"></span>'+this.decode('nazwa', data[11])})
   			]));
   			obj.appendChild('TR'.object({}, ['TD'.object({className: 'header', colSpan: 3, innerHTML: 'w terminie <b>'+ (data[2] != '' ? this.decode('data', data[2])+' - '+ this.decode('data', data[7]) : this.decode('daty', data[12]))+'</b>, przejazd <b>autokarem</b>, '+ this.decode('wnazwa', data[1])})]));
			this.wh(obj);
		}, ww: function(obj) {
			var data = obj.getAttribute('data').split('|');
			obj.appendChild('TR'.object({}, ['TD'.object({className: 'header', colSpan: 3, innerHTML: 'W terminie <b>'+ (data[2] != '' ? this.decode('data', data[2])+' - '+ this.decode('data', data[3]) : this.decode('daty', data[4]))+'</b>, przejazd <b>własny</b>, '+ this.decode('wnazwa', data[1])})]));
			this.wh(obj);
		}, wh: function(obj) {
//			obj.appendChild('TR'.object({}, ['TD'.object({className: 'header second', colSpan: 3, innerHTML: 'Opcje zakwaterowania i <b>łączna cena za pokój</b>:'})]));
		}, wa: function(obj) {
			var r=0;
			for(var i in obj.parentNode.childNodes) if(obj.parentNode.childNodes[i].tagName == 'TR') {
				if(obj.parentNode.childNodes[i] == obj) break;
				r++;
			}
			obj.className = r % 2 ? 'd' : 'l';
			var data = obj.getAttribute('data').split('|');
			if(data[5] > 0) var szczegoly = '<br/><a href="javascript:void(0);" onclick="var el=e(\'popSzczegoly\');el.style.left=getX(this)-300+\'px\';el.style.top=getY(this)+\'px\';el.style.display=\'block\';this.blur();el.innerHTML=\'<div>\'+terminy.create.decode(\'szczegoly\', '+data[5]+')+\'</div>\';" class="next">szczegóły</a>'
			if(data[3] > 0) var opis = '<a href="javascript:void(0);" onclick="var el=e(\'popOpis\');el.style.left=getX(this)-15+\'px\';el.style.top=getY(this)+\'px\';el.style.display=\'block\';el.style.width=\'auto\';this.blur();el.innerHTML=\'<div>\'+terminy.create.decode(\'zopis\', '+data[3]+')+\'</div>\';"><span class="questionmark">?</span>' + this.decode('zkod', data[2]) + '</a>'
			obj.appendChild('TD'.object({className: 'zakwaterowanie', innerHTML: this.decode('wzakwaterowanie', data[1])}));
//			obj.appendChild('TD'.object({className: 'opis', innerHTML: this.decode('zkod', data[2])}, 'A'.object({className: 'questionmark', title: this.decode('zopis', data[3]), innerHTML: '?'})));
			obj.appendChild('TD'.object({className: 'opis', innerHTML: (opis ? opis : this.decode('zkod', data[2]))}));
			obj.appendChild('TD'.object({className: 'cena', innerHTML: '<b>'+data[4]+' zł</b>/pok.'+(szczegoly ? szczegoly : '')}));
			obj.appendChild('TD'.object({className: 'buttons', innerHTML: '<input type="image" onclick="terminy.post(\'xid\',\''+data[6]+'\');" onkeypress="switch(window.event?window.event.keyCode:(event?event.which:null)){case 13: case 32: this.onkeypress(); break;}" title="Rezerwuj" src="'+staticImg+'/img/btn/rezerwuj-new.gif" /><input type="image" onclick="terminy.post(\'id\',\''+data[6]+'\');" onkeypress="switch(window.event?window.event.keyCode:(event?event.which:null)){case 13: case 32: this.onkeypress(); break;}" title="Zadaj pytanie" src="'+staticImg+'/img/btn/pytanie-new.gif" />'}));
		}, switcher: function() {
			with(e('ostatnio-dni')) {
				innerHTML = '<span class="l">&nbsp;</span>';
				for(var i in terminy.nav) {
					var value = this.decode('dni', i);
					innerHTML = innerHTML+'<span data="'+value+'"'+(terminy.selected.dni == value ? ' class="c"' : '')+' title="'+value+' dni">'+value+'</span>';
				}
				innerHTML = innerHTML+'<span class="r">&nbsp;</span>';
				var result = switcher.init(id, 'c');
				if(!result.selected) switcher.move(id, result.first);
			}
			with(e('ostatnio-wyzywienie')) {
				innerHTML = '<span class="l">&nbsp;</span>';
				for(var i in terminy.nav[this.index('dni', terminy.selected.dni)]) {
					var value = this.decode('wkod', i);
					innerHTML = innerHTML+'<span data="'+value+'"'+(terminy.selected.wyzywienie == value ? ' class="c"' : '')+' title="'+this.decode('wnazwa', i).replace(/<\/?b>/g, '')+'">'+value+'</span>';
				}
				innerHTML = innerHTML+'<span class="r">&nbsp;</span>';
				var result = switcher.init(id, 'c');
				if(!result.selected) switcher.move(id, result.first);
			}
			var wyjazd = terminy.nav[this.index('dni', terminy.selected.dni)][this.index('wkod', terminy.selected.wyzywienie)];
			terminy.wlasny = false;
			switch(wyjazd.replace(/^([a-zŁ]+)\|.*$/i, '$1')) {
				case 'SAM':
					var wyjazdy = wyjazd.split('|');
					if(wyjazdy[1] != '0:') with(e('ostatnio-wyjazd')) {
						style.height = '21px';
						innerHTML = '';
						var j = 0;
						for(var i in wyjazdy) if(i > 0) {
							var tmp = wyjazdy[i].split(':'), value = this.decode('kod', tmp[0]), title = this.decode('nazwa', tmp[1]);
							terminy.index.wyjazd[value] = Math.floor(j / 5);
							innerHTML = innerHTML+'<span data="'+value+'"'+(terminy.selected.wyjazd == value ? ' class="c"' : '')+' title="'+title+'">'+title+'</span>';
							j++;
						}
						try{
							e('wyjazdy_wiecej').style.display = j <= 5 ? 'none' : '';
						} catch(error) {}
						var result = switcher.init(id, 'c');
						if(!result.selected) switcher.move(id, result.first);
						else terminy.swyjazd(result.selected);
					} else with(e('ostatnio-wyjazd')) {
						style.height = '0';
					}
					break;
				case 'BUS':
					var wyjazdy = wyjazd.split('|');
					if(wyjazdy[1] != '0:') with(e('ostatnio-wyjazd')) {
						style.height = '';
						for(var i = options.length - 1; i >= 0; i--) remove(i);
						for(var i in wyjazdy) if(i > 0) {
							var tmp = wyjazdy[i].split(':');var val = this.decode('kod', tmp[0]), title = this.decode('nazwa', tmp[1]);
							options[options.length] = new Option(title, val, terminy.selected.wyjazd == val);
						}
						onchange();
					} else with(e('ostatnio-wyjazd')) {
						style.height = '0';
					}
					break;
				case 'WŁA':
					terminy.wlasny = true;
					try{with(e('ostatnio-wyjazd')) {
						style.height = '0';
					}}catch(error){}
					break;
			}
		}, decode: function(k, w) {
			return terminy[k] && terminy[k][parseInt(w)] ? decodeURIComponent((this.coder.decode(terminy[k][parseInt(w)].toUpperCase())).replace(/\+/g, '%20')) : '&nbsp;';
		}, index: function(k, w) {
			for(var i in (terminy[k] || [])) if(w == this.decode(k, i)) return i;
			return 0;
		}, coder: {

		}
	}
};

function in_nodes(needle, haystack) { var i; if(haystack === needle) return true; if(haystack.childNodes) with(haystack) { for(i in childNodes) if(childNodes[i] === needle || in_nodes(needle, childNodes[i])) return true; } else return false; }

var pop = {
	debug: false,
	si: [],
	fr: false,
	obj: false,
	div: false,
	max: 250,
	posX: 0,
	posY: 0,
	offY: 0,
	bgcolor: '#ffffff',
	brstyle: '1px solid #999999',
	visible: false,
	timeout: 2000,
	timeleft: 0,
	interval: 100,
	pop: function(_evt, _txt, _width) { with(this) {

		if(!_txt || _txt.length == 0) return;
		obj = _evt[IE ? 'srcElement' : 'target'] || obj;
		if(obj) {
			with(obj) {
				if(tagName == 'SELECT') onclick = hide;
			}
			posX = getX(obj);
			posY = getY(obj);
			offY = obj.offsetHeight;
			onmouseover = function(event) { onover(event); }
			onmouseout = function(event) { onout(event); }
		}
		if(typeof(selector) != 'undefined') selector.hide();
		if(typeof(acp) != 'undefined') acp.hide();
		if(visible) hide();
		if(!div) {
			div = document.createElement('div');
			with(document.getElementsByTagName('body')[0]) {
				if(typeof(ifr) != 'undefined') {
					this.fr = ifr.install();
					if(this.fr) insertBefore(this.fr, childNodes[0]);
				}
				insertBefore(div, childNodes[0]);
			}
		}
		with(div) {
			style.display = 'block';
			className = 'epop max';
			innerHTML = '<div>' + _txt + '</div>';
			with(style) {
				display = 'block'; zIndex = '99999998'; visibility = 'visible'; position = 'absolute'; textAlign = 'left'; left = posX + 'px'; top = posY + offY + 'px'; backgroundImage = "url('/img/_geoicons/top.gif')"; backgroundPosition = '-15px 0px'; backgroundRepeat = 'no-repeat'; margin = '0px'; padding = '0px'; paddingTop = '5px';
			}
			with(childNodes[0].style) {
				backgroundColor = bgcolor; borderLeft = borderBottom = borderRight = !debug ? brstyle : '1px solid red'; padding = '5px';
			}
			childNodes[0].style.width = typeof(_width) == 'number' ? _width + 'px' : (childNodes[0].scrollWidth > max && _width != 'auto' ? max + 'px' : 'auto');
			onmouseover = function(event) { onover(event); }
			onmouseout = function(event) { onout(event); }
		}
		if(fr) with(fr.style) {
			zIndex = '99999997'; position = 'absolute'; textAlign = 'left'; margin = '0px'; padding = '0px'; left = posX + 'px'; top = posY + offY + 5 + 'px'; height = div.childNodes[0].scrollHeight + 'px'; width = div.clientWidth + 'px'; display = 'block';
		}
		visible = true;
		tic();
		return false;
	}},
	tic: function() { with(this) {

		if(visible) {
			timeleft = timeout;
			si.push(setInterval('pop.tac();', interval));
		}
	}},
	tac: function() { with(this) {

		if(timeleft - interval > 0) timeleft -= interval;
		else hide();
	}},
	hide: function() { with(this) {

		var i;

		visible = false;
		timeleft = 0;
		for(i in si) clearInterval(si[i]);
		if(div) with(div.style) {
			display = 'none'; top = '0px'; left = '0px'; visibility = 'hidden';
		}
		if(typeof(ifr) != 'undefined') ifr.remove();
		return false;
	}},
	onout: function(_evt) { with(pop) {

		if(visible) tic();
	}},
	onover: function(_evt) { with(pop) {

		var _check = IE ? (_evt ? _evt.srcElement : (window.event || {srcElement:false}).srcElement) : _evt[IE ? 'srcElement' : 'target'], i;

		if(typeof(_check) == 'object' && (in_nodes(_check, obj) || in_nodes(_check, div))) {
			for(i in si) clearInterval(si[i]);
			timeleft = timeout;
		}
	}}
};

