function browserCheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=(navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie7=(this.ver.indexOf("MSIE 7")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6||this.ie7
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie7 || this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
var browser=browserCheck()
var jsDOM0 = (document.all);
var jsDOM1 = (document.getElementById);
var jsDOM = jsDOM0 || jsDOM1;
var jsDebug = 0;

var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body


function getObj (name)
{
    if (typeof name == "object") return name;
    if (jsDOM1) return document.getElementById(name);
    if (jsDOM0) return eval('document.all.'+name);
    else return null;
}
	
function hideSelects(a) {
	if (document.getElementById) {
		var tags = ['select', 'iframe', 'object'];
		for (var t in tags) {
			var elms = document.getElementsByTagName(tags[t]);
			for (var e = 0; e < elms.length; e++) {
				elms[e].style.visibility = a ? 'visible' : 'hidden';
			}
		}
	}
}

function show(id)
{
	oLayer = getObj (id);
	oLayer.style.display = 'block';
}

function hide(id)
{
	oLayer = getObj (id);
	oLayer.style.display = 'none';
}

// pouziva sa pre elementy zobrazene s relativnou poziciou, nie absolutne. teda pre tie objekty, ktore nic neprekryvaju.
function toggleDiv(obj) {
	temp = getObj (obj);
	if (temp.style.display == 'none') {
		temp.style.display = 'block';
	} else {
		temp.style.display = 'none';
	}
}

// background change of the object. ID passed
function toggleBgr(id) {
	color1="#f8df55";
	color2="#dddddd";
	temp = getObj (id);
	temp.style.backgroundColor = temp.style.backgroundColor==color1?color2:color1;
}

// background change of the object. Object reference passed
function toggleBgrThis(obj) {
	color1="#f8df55";
	color2="#dddddd";
	obj.style.backgroundColor = obj.style.backgroundColor==color1?color2:color1;
}

function changePhoto(id)
{
	temp = getObj ('bigger');
	temp.src = 'userfiles/properties/___medium_'+images[id];
	temp = getObj ('biggerCaption');
	temp.innerHTML = captions[id];
}

function divShow(a) {
	hideSelects(0);
	document.getElementById(a).style.display='block'
}

function divHide(a) {
	document.getElementById(a).style.display='none'
	hideSelects(1);
}

// * * * photoShow * * *
function photoShow(a) {
	hideSelects(0);
	
	wTop=document.all? (document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop) : pageYOffset;	

	document.getElementById('photoShowImg').style.display='none'
	document.getElementById('photoShowLoading').style.display='block'
	document.getElementById('photoShowImg').src="userfiles/"+a
	document.getElementById('photoShow').style.top=(wTop+100)+"px"
	document.getElementById('photoShow').style.display='block'
}

function photoHide() {
	document.getElementById('photoShow').style.display='none'
	hideSelects(1);
}


// * * * slideshow * * *
var slideShowTimer;
var slideShowCurrent=0;
		
function slideShowRun(a) {
	wTop=document.all? (document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop) : pageYOffset;	

	document.getElementById('slideShow').style.top=(wTop+100)+"px"
	document.getElementById('slideShow').style.display='block'
	clearInterval(slideShowTimer);
	if (!a) a=slideShowPhotos[0][0]
	slideShowMove(a);
	slideShowTimer = setInterval(slideShowMove, 3000);
	temp = getObj ('slideShowPlay');
	temp.src = 'images/slide_show_play_i.gif';
	temp = getObj ('slideShowStop');
	temp.src = 'images/slide_show_stop.gif';
}

function slideShowStop() {
	clearInterval(slideShowTimer);
	temp = getObj ('slideShowPlay');
	temp.src = 'images/slide_show_play.gif';
	temp = getObj ('slideShowStop');
	temp.src = 'images/slide_show_stop_i.gif';
}

function slideShowMove(aa) {
	if (!aa) aa=1;
	if (aa==1 || aa==-1) {
		slideShowCurrent=slideShowCurrent-(-aa)
		if (slideShowPhotos.length<=slideShowCurrent) {
			slideShowCurrent=0;
		}
		if (slideShowCurrent<0) {
			slideShowCurrent=slideShowPhotos.length-1;
		}
	} else {
		for (var t in slideShowPhotos) {
			if (slideShowPhotos[t][0]==aa) {
				slideShowCurrent=t
			}
		}
	}
	document.getElementById('slideShowPhoto').style.display='none'
	document.getElementById('slideShowLoading').style.display='block'
	document.getElementById('slideShowPhoto').src="userfiles/"+slideShowPhotos[slideShowCurrent][0]
	document.getElementById('slideShow').style.display='block'
	document.getElementById('slideShowCaption').innerHTML=slideShowPhotos[slideShowCurrent][1]
}

function slideShowHide() {
	clearInterval(slideShowTimer);
	document.getElementById('slideShow').style.display='none'
	hideSelects(1);
}

// * * * /slideshow * * *


// * * * titleDiv * * *

fromX = -5 //How much from the actual mouse X should the description box appear?
fromY = 20 //How much from the actual mouse Y should the description box appear?

var px = browser.ns4||window.opera?"":"px";

//Capturing mousemove
var descx = 0
var descy = 0
function titleMouseMove(e) {
	descx=browser.ns4||browser.ns6?e.pageX:event.x;
	descy=browser.ns4||browser.ns6?e.pageY:event.y
}

function titleShow(text, o){
	oTitleDiv = getObj ('titleDiv');
	 if(oTitleDiv){
		if (browser.ns4) {
			oTitleDiv.write(text);oTitleDiv.close()
		} else {
			oTitleDiv.innerHTML = text
		}

		if(browser.ie5||browser.ie6||browser.ie7) descy = descy+document.body.scrollTop
		oTitleDiv.style.left = (descx+fromX)+px
		oTitleDiv.style.top = (descy+fromY)+px
		oTitleDiv.style.display = "block"
    }
	o.onmouseout = function anonymous() {
		oTitleDiv = getObj ('titleDiv');
		if (oTitleDiv) oTitleDiv.style.display = "none"
	}
}

function titleHide(){
	oTitleDiv = getObj ('titleDiv');
	if (oTitleDiv) oTitleDiv.style.display = "none"
}

function titleSetPopup(){
	if(bw.ns4)document.captureEvents(Event.MOUSEMOVE)
	document.onmousemove = titleMouseMove;
}	

titleSetPopup()