/*
	UniScript - univerzalne funkcie na pracu s layermi a dokumentom
	zalozene na 1K DHTML API (http://www.dithered.com/experiments/1kdhtml/index.html)
	modifikoval, rozsiril a dopolnil Riki Fridrich (http://www.fczbkk.sk)

	Z verzie Rikiho Fridricha modifikoval a rozsiril martin*cohen (http://www.martincohen.info/)
*/

d=document;l=(d.layers)?1:0;op=navigator.userAgent.toLowerCase().indexOf('opera')!=-1;ie=(d.all)?1:0;
function gE(e,f){if(l){f=(f)?f:self;var V=f.document.layers;if(V[e])return V[e];for(var W=0;W<V.length;)t=gE(e,V[W++]);return t;}if(d.all)return d.all[e];return d.getElementById(e);}

function sE(e){if(l)e.visibility='show';else e.style.visibility='visible';}
function hE(e){if(l)e.visibility='hide';else e.style.visibility='hidden';}

function sX(e,x){if(l)e.left=x;else if(op)e.style.pixelLeft=x;else e.style.left=x+'px';}
function gX(e){if(l)return e.left;else if(op)return e.style.pixelLeft;else return parseInt(e.style.left);}
function sY(e,y){if(l)e.top=y;else if(op)e.style.pixelTop=y;else e.style.top=y+'px';}
function gY(e){if(l)return e.top;else if(op)return e.style.pixelTop;else return parseInt(e.style.top);}
function sW(e,w){if(l)e.clip.width=w;else if(op)e.style.pixelWidth=w;else e.style.width=w;}
//function gW(e){if(l)return e.clip.width;else if(op)return e.style.pixelWidth;else return parseInt(e.style.width);}
function gW(e){if(l)return e.clip.width;else if(op)return e.style.pixelWidth;else return parseInt(e.offsetWidth);}
function sH(e,h){if(l)e.clip.height=h;else if(op)e.style.pixelHeight=h;else e.style.height=h;}
//function gH(e){if(l)return e.clip.height;else if(op)return e.style.pixelHeight;else return parseInt(e.style.height);}
function gH(e){if(l)return e.clip.height;else if(op)return e.style.pixelHeight;else return parseInt(e.offsetHeight);}

function mT(e,x,y){sX(e,x);sY(e,y);}
function mB(e,x,y){sX(e,gX(e)+x);sY(e,gY(e)+y);}

function wH(e,h){if(l){Y=e.document;Y.write(h);Y.close();} if(e.innerHTML || op){  e.innerHTML=h; }}
function sC(e,t,r,b,x){if(l){X=e.clip;X.top=t;X.right=r;X.bottom=b;X.left=x;}else e.style.clip='rect('+t+'px '+r+'px '+b+'px '+x+'px)';}

function winW(){if(window.innerWidth)return window.innerWidth;else return d.body.clientWidth;}
function winH(){if(window.innerHeight)return window.innerHeight;else return d.body.clientHeight;}
function winL(){if(ie)return d.body.scrollLeft;else return window.pageXOffset;}
function winT(){if(ie)return d.body.scrollTop;else return window.pageYOffset;}

function sA(e,o) {
	if (e.filters)
	{
		e.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity="+o+")";
	} else {
		e.style.MozOpacity = (o/100);
	}

	e.style.opacity = (100/o)+'%';
}

//========================================================================================================
//========================================================================================================
//========================================================================================================
//========================================================================================================
//========================================================================================================
//========================================================================================================
//========================================================================================================

//various useful functions from fczbkk.com
//functions may vary from originals beeing found at fczbkk.com

function fixE(e) {
	if (!e && window.event) e = window.event;
	if (!e.target) e.target = e.srcElement;
	return e;
}

getElementsByClassName = function(srcElm, clName, dive) {
   if (document.getElementsByTagName) {
      this.srcElm = srcElm;
      this.clName = clName;
      this.dive = (dive) ? true : false;
      this.foundElements = [];
	  if (document.all && (srcElm==document.body))
	  {
		  this.allElements = document.all;
	  } else {
	      this.allElements = this.srcElm.getElementsByTagName("*");
	  }

      
      for (var i = 0; i < this.allElements.length; i++) {
         if (this.allElements[i].className.indexOf(this.clName)>=0) {
            if (this.dive) {
               if (this.allElements[i].parentNode == this.srcElm) {
                  this.foundElements[this.foundElements.length] = this.allElements[i];
               }
            } else {
               this.foundElements[this.foundElements.length] = this.allElements[i];
            }
         }
      }
      
      return this.foundElements;
   } else {
      return [];
   }
}

/*
Scott Andrew's event attacher
http://www.scottandrew.com/

Modified by Riki 'Fczbkk' Fridrich to work correctly with Opera 7+. You should
find actual version of this script at
http://js.fczbkk.sk/event_attacher/
*/


function addEvent(obj, evType, fn, useCapture){
	// Operu 7+ hacks
	if (window.opera) {
		// Opera doesn't accept attaching events on object window, but accepts them on object document
		if (obj == window) {
			obj = document;
		}
	}
	
	if (obj.addEventListener){
		obj.addEventListener(evType, fn, useCapture);
		return true;
	} else if (obj.attachEvent){
		var r = obj.attachEvent("on"+evType, fn);
		return r;
	} else {
		return false;
	}
}

function removeEvent(obj, evType, fn, useCapture) {
	// Operu 7+ hacks
	if (window.opera) {
		// Opera doesn't accept detaching events on object window, but accepts them on object document
		if (obj == window) {
			obj = document;
		}
	}

	if (obj.removeEventListener) {
		obj.removeEventListener(evType, fn, useCapture);
		return true;
	} else if (obj.detachEvent) {
		var r = obj.detachEvent("on"+evType, fn);
		return r;
	} else {
		return false;
	}
}


//fix for IE4 to IE5
/*
function ie_getElementsByTagName(str) {
 // Map to the all collections
 alert('foook');
 if (str=="*")
  return document.all
 else
  return document.all.tags(str)
}

if (document.all) {
 document.body.getElementsByTagName = ie_getElementsByTagName
}
*/

function changeImage(to) {
	e=gE('mainImage');
	e.src=to;
}