
function showvideo() {
   dajrozmery();
   var scroll=getScrollXY();
   var ele = document;
   vp.moveTo=(Math.round((winH)/2)+scroll[1],Math.round((winW)/2));
}

function blikni(ele) {
   ele.style.color='red';
   ele.style.textDecoration='blink';
}

document.onload=livecam_on();

function livecam_on() {
 var i=0; setInterval("document.getElementById('livecampict').src='http://www.mhcmartin.sk/subory/livecam.jpg?'+i;i++;",13000);
}

function livecam_show() {
 dajrozmery();
 var ele=document.getElementById('livecambig');
 ele.style.visibility='visible';
 ele.style.width=winW+'px';
 ele.style.height=winH+'px';
 ele.style.visibility='visible';
}

function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}

var scroll_speed=0;
function scrollIt(id, speed){
	if(speed){ scroll_speed=speed; }
	obj=document.getElementById(id);
	obj.scrollTop=obj.scrollTop+Math.round(scroll_speed);
	tmpid=id;
	scroll_timeout=setTimeout("scrollIt(tmpid)", 20);
}

function scrollStop(){
	clearTimeout(scroll_timeout);
}

function movepic(img_name,img_src) {
  document[img_name].src=img_src;
}

var winW, winH;
function dajrozmery() {
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    winW = window.innerWidth;
    winH = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    winW = document.documentElement.clientWidth;
    winH = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    winW = document.body.clientWidth;
    winH = document.body.clientHeight;
  }
}

function dajpagey() {
   var el = document.documentElement;
//   return document.all ? Math.max(Math.max(document.documentElement.offsetHeight, document.documentElement.scrollHeight), Math.max(document.body.offsetHeight, document.body.scrollHeight)) : (document.body ? document.body.scrollHeight : ((document.documentElement.scrollHeight != 0) ? document.documentElement.scrollHeight : 0));
//   alert(self.innerHeight+' '+(el && el.clientHeight)+' '+document.body.clientHeight);
   return document.body.clientHeight || self.innerHeight || (el && el.clientHeight);
}
function dajpagex() {
   var el = document.documentElement;
   return self.innerWidth || (el && el.clientWidth) || document.body.clientWidth;
}

function showpict(file,wid,hei) {
   dajrozmery();
   var scroll=getScrollXY();
   var ele = document.getElementById('fotka');
   ele.innerHTML='<img style="border:4px solid black;" src="'+file+'"></img>';
   ele.style.top=Math.round((winH-hei)/2)+scroll[1]+'px';
   ele.style.left=Math.round((winW-wid)/2)+'px';
   ele.style.visibility='visible';
   ele.onclick=hidepict;
   var bg=document.getElementById('fotkabg');
   bg.style.width=dajpagex()+'px';
   bg.style.height=dajpagey()+'px';
   bg.style.visibility='visible';
}

function hidepict() {
   document.getElementById('fotka').style.visibility='hidden';
// $("#fotka").hide("slow");
   document.getElementById('fotkabg').style.visibility='hidden';
}



var rev = "fwd";
function titlebar(val) {
	var msg  = ".:: MHC Martin ::.";
	var res = " ";
	var speed = 100;
	var pos = val;
	msg = "   "+msg+"   ";
	var le = msg.length;
	if(rev == "fwd"){
		if(pos < le){
		pos = pos+1;
		scroll = msg.substr(0,pos);
		document.title = scroll;
		timer = window.setTimeout("titlebar("+pos+")",speed);
		} else {
		rev = "bwd";
		timer = window.setTimeout("titlebar("+pos+")",speed);
		}
	} else {
		if(pos > 0){
		pos = pos-1;
		var ale = le-pos;
		scrol = msg.substr(ale,le);
		document.title = scrol;
		timer = window.setTimeout("titlebar("+pos+")",speed);
		} else {
		rev = "fwd";
		timer = window.setTimeout("titlebar("+pos+")",speed);
		}
	}
}




//set the bookmark image position(topright,topleft,bottomright,bottomleft)
//var corner = "bottomright";
//var url = window.location;
//document.write('<div id="ddd" style="position: absolute; visibility: visible; top: 5px; left:5px;">');
//document.write('<a style="font-size:10px; text-decoration: none;" href="javascript:bookmark(\'MHC Martin\', url)" title="click here to bookmark this page"><img src="./images/book.gif" title="BOOKMARK" border=0><span style="background-color: seashell; font-size:10px;"></span></a></div>');

//var os;
//if(document.layers)
// os = "n4";
//else if(document.getElementById&&!document.all)
// os = "n6";
//else if(document.all)
// os = "ie";

function run()
{
 if(os == "ie"){
   pwidth = window.document.body.offsetWidth;
   pheight = window.document.body.offsetHeight;
   stop = document.body.scrollTop;
   sleft = document.body.scrollLeft;
 }else{
   pwidth = window.innerWidth;
   pheight = window.innerHeight;
   stop = window.pageYOffset;
   sleft = window.pageXOffset;
 }

  var dda = document.getElementById('ddd');
  if(corner == "topleft"){
    dda.style.top = (stop)+"px";
    dda.style.left = (sleft+15)+"px";
  }else if(corner == "topright"){
    dda.style.top = (stop)+"px";
    dda.style.left = (sleft+pwidth-110)+"px";
  }else if(corner == "bottomleft"){
    dda.style.top = (stop+pheight-45)+"px";
    dda.style.left = (sleft+15)+"px";
  }else if(corner == "bottomright"){
    dda.style.top = (stop+pheight-40)+"px";
    dda.style.left = (sleft+pwidth-110)+"px";
  }
  setTimeout('run()',5);
}

function bookmark(title,url){
	if(window.sidebar)
          window.sidebar.addPanel(title,url,"");
	else if(window.opera && window.print){
          var elem = document.createElement('a');
          elem.setAttribute('href',url);
          elem.setAttribute('title',title);
          elem.setAttribute('rel','sidebar');
          elem.click();
	}
	else if(os == "ie")
          window.external.AddFavorite(url,title);
}


/***********************************************
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
/* Modified to support Opera */
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
}
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}


var Window = {
	//Returns an integer representing the width of the browser window (without the scrollbar).
	getWindowWidth : function() {
	return (document.layers||(document.getElementById&&!document.all)) ? window.outerWidth : (document.all ? document.body.clientWidth : 0);
	},

	//Returns an integer representing the height of the browser window (without the scrollbar).
	getWindowHeight : function() {
	return window.innerHeight ? window.innerHeight :(document.getBoxObjectFor ? Math.min(document.documentElement.clientHeight, document.body.clientHeight) : ((document.documentElement.clientHeight != 0) ? document.documentElement.clientHeight : (document.body ? document.body.clientHeight : 0)));
	},

	//Returns an integer representing the scrollWidth of the window.
	getScrollWidth : function() {
	return document.all ? Math.max(Math.max(document.documentElement.offsetWidth, document.documentElement.scrollWidth), document.body.scrollWidth) : (document.body ? document.body.scrollWidth : ((document.documentElement.scrollWidth != 0) ? document.documentElement.scrollWidth : 0));
	},

	//Returns an integer representing the scrollHeight of the window.
	getScrollHeight : function(){
		return document.all ? Math.max(Math.max(document.documentElement.offsetHeight, document.documentElement.scrollHeight), Math.max(document.body.offsetHeight, document.body.scrollHeight)) : (document.body ? document.body.scrollHeight : ((document.documentElement.scrollHeight != 0) ? document.documentElement.scrollHeight : 0));
	},

	//Returns an integer representing the scrollLeft of the window (the number of pixels the window has scrolled from the left).
	getScrollLeft : function() {
		return document.all ? (!document.documentElement.scrollLeft ? document.body.scrollLeft : document.documentElement.scrollLeft) : ((window.pageXOffset != 0) ? window.pageXOffset : 0);
	},

	//Returns an integer representing the scrollTop of the window (the number of pixels the window has scrolled from the top).
	getScrollTop : function() {
		return document.all ? (!document.documentElement.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop) : ((window.pageYOffset != 0) ? window.pageYOffset : 0);
	}
}
