
// © 2002-2004 Supernavigator s.r.o., Vsetky prava vyhradene!
// Riesenie je priemyselno-pravne chranene a je predmetom chraneneho autorskeho diela!
// Precitajte si podmienky pouzitia (http://www.supernavigator.sk/navigator/conditions.php)

var undefined;function return_false(){return false}
function nocontextmenu(e){stopBubbling(e);if(!e&&window.event)e=window.event;e.returnValue=false;return false;}
function eventElement(e){return e?e.target:event.srcElement;}
function isCtrlPressed(e){return e?e.ctrlKey:event.ctrlKey;}
function stopBubbling(e){if(e){e.stopPropagation();e.preventDefault();}
else event.cancelBubble=true;}
Number.prototype.zerofill=function(pocetCifier){var stringoveCislo=this+"";while(stringoveCislo.length<pocetCifier)stringoveCislo="0"+stringoveCislo;return stringoveCislo;}
Number.prototype.isCeil=function(){return this==Math.floor(this);}
String.prototype.trim=function(){var newString=this;while(newString.charAt(0)==" ")newString=newString.slice(1);while(newString.charAt(newString.length-1)==" ")newString=newString.slice(0,-1);return newString;}
String.prototype.bootless=function(){var newString=this;return newString.LCFirst().replace(/è/,'cý').replace(/ï/,'dý').replace(/¾/,'lý').replace(/ò/,'ný').replace(/ø/,'rý').replace(/š/,'sý').replace(/|/,'tý').replace(/ž/,'zý');}
String.prototype.UCFirst=function(){return this.charAt(0).toUpperCase()+this.substr(1);}
String.prototype.LCFirst=function(){return this.charAt(0).toLowerCase()+this.substr(1);}
Array.prototype.unique=function(){var novePole=this.slice(0).sort();for(a=0;a<novePole.length;a++)while(novePole[a]==novePole[a+1])novePole.splice(a+1,1);return novePole;}
Array.prototype.count=function(){var idx;var pocet=0;for(idx in this)if(typeof(this[idx])!="function"&&this[idx])pocet++;return pocet;}
Array.prototype.implode=function(separator){var idx;var returnStr="";for(idx in this)if(typeof(this[idx])!="function"&&this[idx]!==null)returnStr+=this[idx]+separator;returnStr=returnStr.slice(0,-(separator.length));return returnStr;}
Array.prototype.contain=function(value){for(idx in this)if(this[idx]===value)return true;return false;}
function StopWatch(){this.startTime=0;this.stopTime=0;this.time=0;}
StopWatch.prototype.start=function(){this.startTime=new Date().getTime();this.stopTime=0;this.time=0;}
StopWatch.prototype.stop=function(){this.stopTime=new Date().getTime();this.time=this.stopTime-this.startTime;this.startTime=this.stopTime=0;return this.time;}
StopWatch.prototype.getActualTime=function(){return new Date().getTime()-this.startTime;}
StopWatch.prototype.time=function(){return this.time;}
var stopWatch=new StopWatch();var browser=new Object();browser.isIE;browser.isNS;browser.isOP;browser.detectUserAgent=function(){var agent=navigator.userAgent.toLowerCase();this.isNS=(!document.all&&!window.opera&&document.getElementById)?true:false;this.isIE=(document.all&&!window.opera)?true:false;this.isOP=(agent.indexOf("opera")>0&&window.opera)?true:false;if(this.isIE){if(document.fireEvent&&document.createComment)this.version=6;else if(document.fireEvent&&!document.createComment)this.version=5.5;else this.version=5;}
if(this.isNS){if(window.getSelection&&!document.compatMode)this.version=6;if(window.getSelection&&window.atob)this.version=7;}
if(this.isOP){if(!document.createElement)this.version=5;if(document.releaseEvents)this.version=6;if(document.compatMode)this.version=7;}
var time=0;for(var k=1;k<=5;k++){stopWatch.start();for(var i=0;i<100000;i++){i++;i--;}
time+=stopWatch.stop();}
time=72000/(time/(k-1));if(this.isNS)time/=1.2;if(this.isOP)time*=3.5;this.speed=time;}
function Stack(name){this.name=name;this.processes=new Array();this.blockedByObj=new Array();this.procID=null;this.time=33;this.visible=false;this.imagesTogether=4;this.isStack=true;this.div=vytvorHTMLElement("div","stack",document.body);this.div=getById('stack');if(this.visible&&this.div){sds=this.div.style;sds.position="absolute";sds.padding="4px";sds.fontSize="9px";sds.left="4px";sds.top="4px";sds.width="220px";}}
Stack.prototype.addProcess=function(funkcia,processCode){var argumentsCopy=new Array();for(var i=2;i<arguments.length;i++)argumentsCopy[i-2]=arguments[i];this.processes.push(new Process(funkcia,processCode,argumentsCopy));if(this.processes.length==1&&!this.procID)stack.next();if(this.visible)this.printMe();}
Stack.prototype.next=function(){if(!this.procID)this.procID=setInterval(this.name+".next()",this.time);if(this.blockedByObj.length>0&&this.blockedByObj.length<this.imagesTogether&&this.blockedByObj[0].nodeName=="IMG"&&this.processes&&this.processes.length>0&&this.processes[0]&&(!this.processes[0].parametre||(this.processes[0].parametre&&this.processes[0].funkcia==SuperNavigator.load_picture&&(!this.processes[0].parametre[0]||this.processes[0].parametre[0].indexOf("blank")<0)))){this.runFirst();return false;}
for(var i=0;i<this.blockedByObj.length;i++){if(this.blockedByObj[i]&&this.complete)this.free(this.blockedByObj[i]);if(this.blockedByObj[i])return false;}
if(!this.runFirst()){clearInterval(this.procID);this.procID=null;this.blockedByObj=new Array();}
if(this.visible)this.printMe();}
Stack.prototype.runFirst=function(){if(this.processes.length>0){var ktore=this.processes[0];this.processes.shift();ktore.funkcia.apply(this,ktore.parametre);return true;}
else return false;}
Stack.prototype.block=function(obj){this.blockedByObj.push(obj);}
Stack.prototype.free=function(){if(arguments[0]){for(var i=0;i<this.blockedByObj.length;i++)if(this.blockedByObj[i]==arguments[0])this.blockedByObj.splice(i,1);}
else this.blockedByObj.shift();}
Stack.prototype.clear=function(){switch(arguments.length){case 0:this.processes.splice(0,this.processes.length);break;case 1:for(var i=0;i<this.processes.length;i++)if((typeof(arguments[0])!="function"&&this.processes[i].processCode==arguments[0])||(typeof(arguments[0])=="function"&&this.processes[i].funkcia==arguments[0]))this.processes.splice(i,1);break;case 2:for(var i=0;i<this.processes.length;i++)if(this.processes[i].processCode>=arguments[0]||this.processes[i].processCode<=arguments[1])this.processes.splice(i,1);break;}}
Stack.prototype.actualProcessCode=function(){if(this.processes[0])return this.processes[0].processCode;else return null;}
Stack.prototype.printMe=function(){this.div.innerHTML="<b>Stack::<font size=2>"+this.name+"</font><b><br><br>";var ktore;for(var k=0;k<this.processes.length;k++){ktore=this.processes[k];this.div.innerHTML+="<font color=\"red\">["+ktore.processCode+"]</font> "+"funkcia"+"(";for(var i=0;i<ktore.parametre.length;i++){if(typeof(ktore.parametre[i])=="string")this.div.innerHTML+="'";this.div.innerHTML+=ktore.parametre[i];if(typeof(ktore.parametre[i])=="string")this.div.innerHTML+="'";if(i+1!=ktore.parametre.length)this.div.innerHTML+=", ";}
this.div.innerHTML+=")<br>";}}
function Process(funkcia,processCode,parametre){this.funkcia=funkcia;this.processCode=processCode;this.parametre=parametre;}
var stack;var icons=new Array();function addHalfIcon(obj){obj.half=new Size(parseInt(parseInt(obj.width)/2),parseInt(parseInt(obj.height)/2));}
function loadIcon(id){if(!icons[id]){var obj=new Image();obj.name=id;obj.src=SuperNavigator.iconFolder+id+".gif";icons[id]=obj;}}
function haveParent(){try{parent.document.title+="";}catch(e){return false}return parent.location!=window.location;}
function offset_objektu(objekt){var pos=new Position(objekt.offsetLeft,objekt.offsetTop);while(objekt=objekt.offsetParent){pos.setX(pos.getX()+objekt.offsetLeft);pos.setY(pos.getY()+objekt.offsetTop);}
return pos;}
function offsetSize_objektu(objekt){if(!objekt)return null;return new Position(objekt.offsetWidth,objekt.offsetHeight);}
function print_obj(objekt){var vlastnosti=new Array();for(var vlastnost in objekt){vlastnosti[vlastnost]=objekt[vlastnost];}
var text='';for(var vlastnost in vlastnosti)text+=vlastnost+"<font color=red>="+vlastnosti[vlastnost]+"</font><br>\n";win=window.open();win.document.write(text);win.document.close();}
function getScrollPosition(){if(typeof(window.pageYOffset)=="number")return new Position(window.pageXOffset,window.pageYOffset);if(document.documentElement&&typeof(document.documentElement.scrollTop)=="number")return new Position(document.documentElement.scrollLeft,document.documentElement.scrollTop);if(document.body&&typeof(document.body.scrollTop)=="number")return new Position(document.body.scrollLeft,document.body.scrollTop);return Position(0,0);}
function getWindowSize(){if(typeof(window.innerWidth)=='number')return new Size(window.innerWidth,window.innerHeight);else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight))return new Size(document.documentElement.clientWidth,document.documentElement.clientHeight);else if(document.body&&(document.body.clientWidth||document.body.clientHeight))return new Size(document.body.clientWidth,document.body.clientHeight);else
return new Size(0,0);}
function getDocumentSize(){return new Size(document.body.offsetWidth,document.body.offsetHeight);}
function rightMouse(e){if(!e)var e=event;return(browser.isNS&&e.which>1)||(browser.isIE&&e.button>1);}
getMousePosition=function(e){return(browser.isNS)?new Position(e.pageX,e.pageY):new Position(event.clientX,event.clientY).plus(getScrollPosition());}
function renderCSSforIE5(){if(browser.isIE&&browser.version<=5.5){var pocet=document.all.length;for(var i=0;i<pocet;i++)renderElementforIE5(document.all[i]);}}
function renderElementforIE5(obj){var style=obj.style;var curStyle=obj.currentStyle;if(curStyle&&browser.isIE&&browser.version<=5.5){function getNewSize(){var actualSize=arguments[0];if(actualSize.indexOf("px")>0){actualSize=parseInt(actualSize);for(var i=1;i<arguments.length;i++)if(curStyle[arguments[i]].indexOf("px")>0&&parseInt(curStyle[arguments[i]]))actualSize+=parseInt(curStyle[arguments[i]]);}
return actualSize;}
if(curStyle.width.indexOf("%")<0&&parseInt(curStyle.width))style.width=getNewSize(curStyle.width,"paddingLeft","paddingRight","borderLeftWidth","borderRightWidth")+"px";if(curStyle.height.indexOf("%")<0&&parseInt(curStyle.height))style.height=getNewSize(curStyle.height,"paddingTop","paddingBottom","borderTopWidth","borderBottomWidth")+"px";}}
vytvorHTMLElement=function(tag,id,parent){var element;if(parent&&!(element=getById(id))){element=document.createElement(tag);element.id=id;parent.appendChild(element);renderElementforIE5(element);}
return element;}
function getById(ElementID){return document.getElementById(ElementID);}
function HTMLElementOpacity(percent){if(percent>100)percent=100;if(browser.isIE){if(percent==100)this.style.filter="";else
this.style.filter="Alpha(Opacity="+parseInt(percent)+")";}
if(browser.isNS){if(percent==100)this.style.MozOpacity="";else
this.style.MozOpacity=percent/100;}}
function HTMLElementWithPicturesZoom(percent,nepovinnyPocetNaSirku){var childWidth=parseInt(this.childNodes[0].width);var pocet=(childWidth!=0)?Math.round(parseInt(this.style.width)/childWidth):nepovinnyPocetNaSirku;percent/=100;this.style.width=(Math.round(percent*Map.puzzle.width)*pocet)+"px";var deti=this.childNodes;for(var i=0;i<deti.length;i++){deti[i].width=Math.round(percent*Map.puzzle.width);deti[i].height=Math.round(percent*Map.puzzle.height);}}
function checkEmail(email){if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))return true
else
return false;}
function createOption(selectObj,id,text,selected){selectObj.options.add(document.createElement("OPTION"));var last=selectObj.options.length-1;selectObj.options[last].text=text;selectObj.options[last].value=id;if(selected)selectObj.options[last].selected=true;}
function getKeyCode(e){return(browser.isNS&&e)?e.which:event.keyCode;}
function Angle(alfa){this.alfa=alfa;this.cos=Math.cos(alfa*Angle.deg2rad);this.sin=Math.sin(alfa*Angle.deg2rad);Angle.last=this;}
Angle.deg2rad=Math.PI/180;Angle.last=null;Angle.create=function(alfa){return(Angle.last&&alfa==Angle.last.alfa)?Angle.last:new Angle(alfa);}
Angle.getFromVectors=function(vector1,vector2){var v1=vector1.getCopy().unitize();var v2=vector2.getCopy().unitize();var cos=Position.scalarMultiply(v1,v2);var uhol=Math.acos(cos)/Angle.deg2rad;if(v1.x*v1.y>=0&&v2.x*v2.y>=0&&uhol>90)uhol=360-uhol;if(v1.x*v1.y<=0&&v2.x*v2.y<=0&&uhol<90)uhol=360-uhol;return Angle.create(uhol);}
function Position(x,y){this.x=x;this.y=y;this.limit=null;}
function Size(width,height){this.width=width;this.height=height;this.limit=null;}
Position.make=function(x,y){if(typeof(x)=="object"&&x.constructor==Position)return x;if(typeof(x)=="object"&&x.constructor==Size)return new Position(x.width,x.height);if(typeof(y)!="number")return new Position(x,x);return new Position(x,y);}
Size.make=function(x,y){if(typeof(x)=="object"&&x.constructor==Size)return x;if(typeof(x)=="object"&&x.constructor==Position)return new Position(x.x,x.y);if(typeof(y)!="number")return new Size(x,x);return new Size(x,y);}
Position.prototype.getX=function(){return this.x;}
Position.prototype.getY=function(){return this.y;}
Size.prototype.getX=function(){return this.width;}
Size.prototype.getY=function(){return this.height;}
Position.prototype.setX=function(x){this.x=x;this.check();}
Position.prototype.setY=function(y){this.y=y;this.check();}
Size.prototype.setX=function(width){this.width=width;this.check();}
Size.prototype.setY=function(height){this.height=height;this.check();}
Position.prototype.isSameWith=Size.prototype.isSameWith=function(posOrSize){return this.getX()==posOrSize.getX()&&this.getY()==posOrSize.getY();}
Position.prototype.getCopy=Size.prototype.getCopy=function(){return new this.constructor(this.getX(),this.getY());}
Position.prototype.valueOf=function(){return"Position ["+this.getX()+", "+this.getY()+"] "}
Size.prototype.valueOf=function(){return"Size ["+this.getX()+", "+this.getY()+"] "}
Position.prototype.set=Size.prototype.set=function(x,y){if(typeof(x)=="object"&&x.getX&&x.getY){this.setX(x.getX());this.setY(x.getY());}
else
{this.setX(x);this.setY(y);}
this.check();}
Position.prototype.setLimit=Size.prototype.setLimit=function(area){this.limit=area;this.check();}
Position.prototype.check=Size.prototype.check=function(){if(this.limit){if(this.limit.cornerUL){if(typeof(this.limit.cornerUL.x)=="number"&&this.limit.cornerUL.x>this.getX())this.setX(this.limit.cornerUL.x);if(typeof(this.limit.cornerUL.y)=="number"&&this.limit.cornerUL.y>this.getY())this.setY(this.limit.cornerUL.y);}
if(this.limit.cornerBR){if(typeof(this.limit.cornerBR.x)=="number"&&this.limit.cornerBR.x<this.getX())this.setX(this.limit.cornerBR.x);if(typeof(this.limit.cornerBR.y)=="number"&&this.limit.cornerBR.y<this.getY())this.setY(this.limit.cornerBR.y);}}}
Position.prototype.isInArea=Size.prototype.isInArea=function(area){return this.getX()>=area.cornerUL.getX()&&this.getY()>=area.cornerUL.getY()&&this.getX()<=area.cornerBR.getX()&&this.getY()<=area.cornerBR.getY();}
Position.prototype.rotate=Size.prototype.rotate=function(alfa){var angle=Angle.create(alfa);this.set(angle.cos*this.getX()+angle.sin*this.getY(),-angle.sin*this.getX()+angle.cos*this.getY());this.check();return this;}
Position.prototype.plus=Size.prototype.plus=function(x,y){var pos=this.constructor.make(x,y);this.setX(this.getX()+pos.getX());this.setY(this.getY()+pos.getY());this.check();return this;}
Position.prototype.minus=Size.prototype.minus=function(x,y){var pos=this.constructor.make(x,y);this.setX(this.getX()-pos.getX());this.setY(this.getY()-pos.getY());this.check();return this;}
Position.prototype.multiply=Size.prototype.multiply=function(x,y){var pos=this.constructor.make(x,y);this.setX(this.getX()*pos.getX());this.setY(this.getY()*pos.getY());this.check();return this;}
Position.prototype.divide=Size.prototype.divide=function(x,y){var pos=this.constructor.make(x,y);this.setX(this.getX()/pos.getX());this.setY(this.getY()/pos.getY());this.check();return this;}
Position.prototype.printToStyleHTML=Size.prototype.printToStyleHTML=function(){if(this.constructor==Position)return'left: '+parseInt(this.x)+'px; top: '+parseInt(this.y)+'px;';if(this.constructor==Size)return'width: '+parseInt(this.width)+'px; height: '+parseInt(this.height)+'px;';}
Position.prototype.getLength=Size.prototype.getLength=function(){return Math.sqrt(Math.pow(this.getX(),2)+Math.pow(this.getY(),2));}
Position.prototype.unitize=Size.prototype.unitize=function(){return this.divide(this.getLength());}
Position.prototype.sizeKoefTo=Size.prototype.sizeKoefTo=function(anotherPosition){return this.getLength()/anotherPosition.getLength();}
Position.prototype.getVectorTo=Size.prototype.getVectorTo=function(targetPosition){var thisPosition=targetPosition.getCopy();thisPosition.minus(this);return thisPosition;}
Position.prototype.getVectorTo=Size.prototype.getVectorTo=function(targetPosition){var thisPosition=targetPosition.getCopy();thisPosition.minus(this);return thisPosition;}
Position.getMin=Size.getMin=function(pos1,pos2){return new this((pos1.getX()<pos2.getX())?pos1.getX():pos2.getX(),(pos1.getY()<pos2.getY())?pos1.getY():pos2.getY());}
Position.getMax=Size.getMax=function(pos1,pos2){return new this((pos1.getX()>pos2.getX())?pos1.getX():pos2.getX(),(pos1.getY()>pos2.getY())?pos1.getY():pos2.getY());}
Position.getDistance=Size.getDistance=function(pos1,pos2){return Math.sqrt(Math.pow(pos1.x-pos2.x,2)+Math.pow(pos1.y-pos2.y,2));}
Position.scalarMultiply=Size.scalarMultiply=function(vec1,vec2){return vec1.getX()*vec2.getX()+vec1.getY()*vec2.getY();}
Position.prototype.round=Size.prototype.round=function(){this.setX(Math.round(this.getX()));this.setY(Math.round(this.getY()));return this;}
Position.prototype.roundMinimum=Size.prototype.roundMinimum=function(){if(Math.abs(this.getX()-Math.round(this.getX()))<0.01)this.setX(Math.round(this.getX()));if(Math.abs(this.getY()-Math.round(this.getY()))<0.01)this.setY(Math.round(this.getY()));return this;}
Position.prototype.floor=Size.prototype.floor=function(){this.setX(Math.floor(this.getX()));this.setY(Math.floor(this.getY()));return this;}
Position.prototype.ceil=Size.prototype.ceil=function(){this.setX(Math.ceil(this.getX()));this.setY(Math.ceil(this.getY()));return this;}
Position.setPositionHTML=Size.setPositionHTML=function(position){if(isNaN(position.getX()))position.setX(0);if(isNaN(position.getY()))position.setY(0);if(position.getX()!==null)this.style.left=Math.round(position.getX())+"px";if(position.getY()!==null)this.style.top=Math.round(position.getY())+"px";}
Position.setSizeHTML=Size.setSizeHTML=function(size){if(isNaN(size.getX()))size.setX(0);if(isNaN(size.getY()))size.setY(0);if(size.getX()!==null)this.style.width=Math.round(size.getX())+"px";if(size.getY()!==null)this.style.height=Math.round(size.getY())+"px";}
function Area(position1,position2){if(!position1||!position2){this.cornerUL=position1;this.cornerBR=position2;}
else
{this.cornerUL=Position.getMin(position1,position2);this.cornerBR=Position.getMax(position1,position2);}}
Area.make=function(position,size){var halfsize=size.getCopy().divide(2);return new Area(position.getCopy().minus(halfsize),position.getCopy().plus(halfsize));}
Area.prototype.valueOf=function(){return"AREA("+this.cornerUL+"; "+this.cornerBR+") ";}
Area.prototype.getCopy=function(){return new Area(this.cornerUL.getCopy(),this.cornerBR.getCopy());}
Area.prototype.getCenter=function(){return this.cornerUL.getCopy().plus(this.cornerBR).divide(2);}
Area.prototype.getWidth=function(){return Math.abs(this.cornerBR.getX()-this.cornerUL.getX());}
Area.prototype.getHeight=function(){return Math.abs(this.cornerBR.getY()-this.cornerUL.getY());}
Area.prototype.getSize=function(){return new Size(this.getWidth(),this.getHeight());}
Area.prototype.resize=function(koef){var stred=this.getCenter();var halfSize=this.getSize().multiply(koef/2);this.cornerUL=stred.getCopy().minus(halfSize);this.cornerBR=stred.getCopy().plus(halfSize);return this;}
Area.prototype.isInArea=function(area){if(!this.cornerUL||!this.cornerBR||!area.cornerUL||!area.cornerBR)return false;return this.cornerUL.x>=area.cornerUL.x
&&this.cornerBR.x<=area.cornerBR.x
&&this.cornerUL.y>=area.cornerUL.y
&&this.cornerBR.y<=area.cornerBR.y;}
Area.prototype.isPartlyInArea=function(area){if(!this.cornerUL||!this.cornerBR||!area.cornerUL||!area.cornerBR)return false;return this.cornerBR.x>=area.cornerUL.x
&&this.cornerUL.x<=area.cornerBR.x
&&this.cornerBR.y>=area.cornerUL.y
&&this.cornerUL.y<=area.cornerBR.y;}
Area.compound=function(area1,area2){if(!area1.cornerUL||!area1.cornerBR)return area2.getCopy();if(!area2.cornerUL||!area2.cornerBR)return area1.getCopy();return new Area(Position.getMin(area1.cornerUL,area2.cornerUL),Position.getMax(area1.cornerBR,area2.cornerBR));}
Area.prototype.toBase=function(map){return new Area(this.cornerUL.toBase(map),this.cornerBR.toBase(map));}
Area.prototype.toThisMap=function(map){return new Area(this.cornerUL.toThisMap(map),this.cornerBR.toThisMap(map));}