function showSub(id) {
	document.getElementById('submenu'+id).style.display='block';
}
function hideSub(id) {
	document.getElementById('submenu'+id).style.display='none';
}

function resizeWin() {
	foto = document.getElementById('imgMain');
	height = screen.height > foto.height ? (foto.height+100) : (screen.height-20);
	width = screen.width > foto.width ? (foto.width) : (screen.width-20);
	window.resizeTo(width,height);
}

theSeo = '';
v=0;
s=0;
cas="";
cas2="";
initTop=0;
jsdb = document.getElementById("jsdebug");

function init(seo,vyska) {
	
	if(vyska == undefined) {
		vyska = 0;
	}
	theSeo = seo;
	
	v=eval(vyska);
	initTop = v;
  document.getElementById("scroll").style.top = v + "px";
	if(navigator.appName == 'Opera') {
		document.getElementById('matrjoska2').style.left='300';
	}
    con = document.getElementById('content');
	document.body.style.width=con.style.width;
}


function stop(){
	window.clearTimeout(cas);
}

function savePos() {
	makeRequest('/a.php?seo='+theSeo+'&pos='+v);
}

function makeRequest(url) {
  http_request = false;
  if (window.XMLHttpRequest) { // Mozilla, Safari,...
      http_request = new XMLHttpRequest();
    if (http_request.overrideMimeType) {
      http_request.overrideMimeType('text/xml');
    }   
  } else if (window.ActiveXObject) { // IE
    try {
      http_request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        http_request = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {}
    }
  }
  if (!http_request) {
    alert('Cannot create XMLHTTP instance');
    return false;
  }
  http_request.onreadystatechange = loadXML;
  http_request.open('GET', url, true);
  http_request.send(null);
}

function loadXML() {
	// do nothing
}

function nahoru(){
 if (document.getElementById("scroll").style.top >= "0px"){
  window.clearTimeout(cas);
  document.getElementById("scroll").style.top ="0px";
 }else{
  v += 5;
  document.getElementById("scroll").style.top = v + "px";
  cas = window.setTimeout("nahoru()",10);
	//jsdb.innerHTML = v;
 }
}
 
function dolu(){
par1 = document.getElementById("obsah").offsetHeight;
par2 = document.getElementById("scroll").offsetHeight;
top1 = document.getElementById("scroll").offsetTop;
 
par = par1 - par2;

 if(top1 < par){
  window.clearTimeout(cas);
 }else{
  v -= 5;
  document.getElementById("scroll").style.top = v + "px";
  cas = window.setTimeout("dolu()",10);
 }
}
