// Rollovers Object
// ver 1.11 - 17.09.2003
// Copyright (c) 2001-2003 Sabbagh 

// Rollovers method:
// 'out-ovr' ........ meni obrazky na "ovr" varianty u vsech odkazu
// 'same-other' ..... meni stale stejny obrazek na jine u vsech odkazu
// 'same-same' ...... meni stale stejny obrazek na stale stejny jiny u vsech odkazu
// 'other' .......... meni jeden obrazek na jinem miste nez je aktivacni odkaz

function Rollovers(numitems,name,roll,layer) {
	this.imfr = 1;
	this.imto = numitems;
	this.name = name;
	this.roll = (roll != null)? roll : 'out-ovr';	// or 'same-other' or 'same-same' or 'other'
	this.imarray = null;	// pro variantu s pismeny
	this.doclayer = 'document.';
	
	if (document.layers && layer != null) {
		for (var i=3; i<arguments.length; i++) {
			this.doclayer += arguments[i]+'.document.';
		}
	}
	
	this.spr = '_';
	this.imname = this.name+this.spr;
	this.dir = '/img';
	this.ext = 'gif';
	this.z = 0;
	
	this.Activate = Activate;
	this.Preload = Preload;
	this.Mouse = Mouse;
	this.Click = Click;
	this.Resize = Resize;
}
function Activate() {
	//alert("roll = "+this.roll+"\nimto = "+this.imto+"\ndir = "+this.dir+"\nname = "+this.name+"\next = "+this.ext);
	for (i = this.imfr; i <= this.imto; i++) {
		if (this.imarray != null) {n = this.imarray[i-1];}
		else {n = i;}
		this.Preload(this.imname+n);
		if (this.roll == 'out-ovr') {
			this.Preload(this.imname+n+'_ovr');
		}
	}
}
function Preload(imgsrc) {
	if (document.images) {
		eval(imgsrc+' = new Image()');
		var imsrc = this.dir+'/'+imgsrc+'.'+this.ext;
		eval(imgsrc+'.src = "'+imsrc+'"');
		//alert(imgsrc+'.src = "'+imsrc+'"');
	}
}
function Mouse(x,obj,ver) {
	x = (this.imarray != null)? x.toLowerCase() : x;
	var docImg = eval(this.doclayer+'images');
	if (this.roll == 'out-ovr') {
		if (x != this.z) {
			if (obj == 'ovr') { docImg[this.imname+x].src = eval(this.imname+x+'_ovr.src'); }
			else { docImg[this.imname+x].src = eval(this.imname+x+'.src'); }
		}
	} else if (this.roll == 'same-other') {
		if (x != this.z) {
			if (obj == 'ovr') { docImg[this.imname+x].src = eval(this.imname+x+'.src'); }
			else { docImg[this.imname+x].src = eval(this.imname+this.imto+'.src'); }
		}
	} else if (this.roll == 'same-same') {
		if (x != this.z) {
			if (obj == 'ovr') { docImg[this.imname+x].src = eval(this.imname+this.imto+'.src'); }
			else { docImg[this.imname+x].src = eval(this.imname+this.imfr+'.src'); }
		}
	} else if (this.roll == 'other') {
		docImg[this.name+((ver)? ver : '')].src = eval(this.imname+x+'.src');
	}
}
function Click(x,overview) {
	x = (this.imarray != null)? x.toLowerCase() : x;
	var docImg = eval(this.doclayer+'images');
	if (!overview && this.z != 0 && this.z != x) { docImg[this.imname+this.z].src = eval(this.imname+this.z+'.src'); }
	if (x != 0) { this.Mouse(x,'ovr'); }
	if (!overview) { this.z = x; }
}
function Resize() {
	var z = this.z;
	this.z = 0;
	this.Click(z);
}
// Window Status Text
function ws(txt) {
	if (!txt) {
		window.status = "EXPO 2005";
	} else {
		window.status = txt;
	}
	return true;
}

// 
function setCookie(name, value, expire) {
   document.cookie = name + "=" + escape(value)  + "; path=/" + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
}
// Reads cookie values. 
function getCookie(Name) {
   var search = Name + "="
   if (document.cookie.length > 0) { // if there are any cookies
      offset = document.cookie.indexOf(search) 
      if (offset != -1) { // if cookie exists 
         offset += search.length 
         // set index of beginning of value
         end = document.cookie.indexOf(";", offset) 
         // set index of end of cookie value
         if (end == -1) 
			 end = document.cookie.length
	         return unescape(document.cookie.substring(offset, end))
      } 
   }
}