var path2 = new Array();
var memo2 = new Array();
var sirka2 = new Array();
var vyska2 = new Array();
var nazev2 = new Array();
nazev2[0] = 'RD 4+1 Křtiny pěkná lokalita';
path2[0] = '4235';
memo2[0] = '12543407394_4235';
sirka2[0] = '640';
vyska2[0] = '481';
path2[1] = '4235';
memo2[1] = '12543407544_4235';
sirka2[1] = '640';
vyska2[1] = '480';
path2[2] = '4235';
memo2[2] = '12543407605_4235';
sirka2[2] = '640';
vyska2[2] = '480';
path2[3] = '4235';
memo2[3] = '12543407669_4235';
sirka2[3] = '360';
vyska2[3] = '480';
path2[4] = '4235';
memo2[4] = '12543407711_4235';
sirka2[4] = '640';
vyska2[4] = '480';
path2[5] = '4235';
memo2[5] = '12543407788_4235';
sirka2[5] = '640';
vyska2[5] = '480';
path2[6] = '4235';
memo2[6] = '12543407928_4235';
sirka2[6] = '480';
vyska2[6] = '640';
path2[7] = '4235';
memo2[7] = '12543408014_4235';
sirka2[7] = '640';
vyska2[7] = '480';
path2[8] = '4235';
memo2[8] = '12543408175_4235';
sirka2[8] = '640';
vyska2[8] = '480';
path2[9] = '4235';
memo2[9] = '12543408283_4235';
sirka2[9] = '360';
vyska2[9] = '480';
path2[10] = '4235';
memo2[10] = '12543408364_4235';
sirka2[10] = '640';
vyska2[10] = '480';
path2[11] = '4235';
memo2[11] = '12543408468_4235';
sirka2[11] = '640';
vyska2[11] = '480';
load_img = new Image();
load_img.src = 'http://www.real.cz/images/loader.gif';

img2 = new Image();
img2.src = 'http://www.real.cz/images/back.jpg';

img3 = new Image();
img3.src = 'http://www.real.cz/images/forward.jpg';

img4 = new Image();
img4.src = 'http://www.real.cz/images/close.jpg';

document.write('<div id="gallery"></div>');
document.write('<div id="loading"><a href="javascript:close();"><img src="http://www.real.cz/images/loader.gif" alt="loading..." border="0" /></a></div>');
document.write('<div id="shadow"></div>');

var div2 = document.getElementById('gallery');
var loading2 = document.getElementById('loading');
var shadow2 = document.getElementById('shadow');










function gallery2(id2){
  
	
	div2.style.zIndex = 10001;
	
	var ScrollPosition = document.documentElement.scrollTop; 

	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}

	shadowHeight = yWithScroll;
	if(shadowHeight < document.documentElement.clientHeight){
		shadowHeight = document.documentElement.clientHeight;
	}
	
	var browserName=navigator.appName;
	if (browserName=="Microsoft Internet Explorer"){
    shadowHeight += 400;
  }
	
	shadow2.style.height = shadowHeight + "px";
	shadow2.style.display = 'block';
	shadow2.style.zIndex = 10000;

	img = new Image();
 	img.src = 'http://www.real.cz/imgs/auta.jpg';
	
	image = 'http://www.real.cz/image_show2.php?id='+path2[id2]+'&amp;nazev='+memo2[id2];

	if(navigator.appName == 'Netscape' || navigator.appName == 'Opera'){
		ScreenHeight_half = Math.round(window.innerHeight/2);
	}
	else if(navigator.appName == 'Microsoft Internet Explorer'){
		ScreenHeight_half = Math.round(document.documentElement.clientHeight/2);
	}
	else{
		ScreenHeight_half = Math.round(window.innerHeight/2);
	}
	
	loading2.style.top = ScreenHeight_half + ScrollPosition - 8 + 'px';
	loading2.style.display = 'block';
		
	var n=0;
	
	function galleryAlpha(){
		n += 0.1;
		div2.style.opacity = n;
		div2.style.filter = "alpha(opacity=" + n*100 + ")";
		
		if(n>1){
			
			if(meter != "undefined"){
				clearInterval(meter);
			}

		}
	}
	
	var object = document.getElementsByTagName('object');
	for(i=0;i<object.length;i++){
		object[i].style.visibility = 'hidden';
	}

	function ShowImage(){
	
		var ImgWidth  = 700;
		var ImgHeight = 700;
		var ImgBorder = 0;
			
		ImgWidth_half  = Math.round(ImgWidth/2);
		ImgHeight_half = Math.round(ImgHeight/2);
		
		div2.style.top = -10 + 'px';
		
	
		document.getElementById("all_gallery").style.marginLeft = '-'+300+'px';
		div2.style.marginLeft = '-'+ImgWidth_half+'px';
	 
		div2.innerHTML = '<div id="back_image"></div><a href="javascript:close();"><img class="g_image" src="'+image+'" />';
		
		div2.innerHTML += '<span class="gallery_memo">'+nazev2[0]+'</span></a>';
		
		document.getElementById("rolling").innerHTML = '';
		
		if(path2[id2+1] != undefined){
			
			e = id2+1;
			
		document.getElementById("rolling").innerHTML += '<a class="gallery_button2" style="z-index:200000;" href="javascript:gallery2('+e+');"><img src="http://www.real.cz/images/next.png" alt="back" border="0" /></a>';
		
		}
		
		
		if(path2[id2-1] != undefined){
			
			j = id2-1;
		
		document.getElementById("rolling").innerHTML += '<a class="gallery_button1" style="z-index:200000;" href="javascript:gallery2('+j+');"><img src="http://www.real.cz/images/before.png" alt="forward" border="0" /></a>';
		
		}
		
		div2.innerHTML += '<a class="gallery_close" href="javascript:close();"><img border="0" src="http://www.real.cz/images/close.gif" alt="close" /></a>';
		
		
		
		
    
    document.getElementById("all_gallery").style.visibility = 'visible';
    
    
    
		
		
		loading2.style.display = 'none';
	
		div2.style.display = 'block';
		
	

	}
	
	if(img.complete){
		
		ShowImage();
	
	}
	else{
		
		img.onload = function(){
		
			ShowImage();
		
		}
	}
}

function close(){
/*	n = 1;
	function galleryAlpha2(){
		n -= 0.1;
		div.style.opacity = n;
		div.style.filter = "alpha(opacity=" + n*100 + ")";
		
		m = n - 0.4;
		
		if(m>=0){
		
			shadow.style.opacity = m;
			shadow.style.filter = "alpha(opacity="+ m*100 + ")";
		
		}
		
		if(n<0){
	
			div.innerHTML = '';
			loading.style.display = 'none';	
			div.style.display = 'none';
			shadow.style.display = 'none';
			div.style.opacity = 0;
			div.style.filter = "alpha(opacity=0)";
			shadow.style.opacity = 0.6;
			shadow.style.filter = "alpha(opacity=60)";
			
			var object = document.getElementsByTagName('object');
			for(i=0;i<object.length;i++){
				object[i].style.visibility = 'visible';
			}
		
		}
		
		if(n<0){
			
			if(interval != "undefined"){
				clearInterval(interval);
			}

		}
	}
	
	interval = setInterval(galleryAlpha2,300);
*/	

  document.getElementById("all_gallery").style.visibility = 'hidden';
	div2.innerHTML = '';
	loading2.style.display = 'none';	
	div2.style.display = 'none';
	shadow2.style.display = 'none';
	
	shadow2.style.opacity = 0.6;
	shadow2.style.filter = "alpha(opacity=60)";
	
	var object = document.getElementsByTagName('object');
	for(i=0;i<object.length;i++){
		object[i].style.visibility = 'visible';
	}

}




//1) Set width of the "neutral" area in the center of the gallery.
var restarea=6;
 //2) Set top scroll speed in pixels. Script auto creates a range from 0 to top speed.
var maxspeed=7;
 //3) Set to maximum width for gallery - must be less than the actual length of the image train.
var maxwidth=1000;
 //4) Set to 1 for left start, 0 for right, 2 for center.
var startpos=0;
 //5) Set message to show at end of gallery. Enter "" to disable message.
var endofgallerymsg='<span style="font-size: 11px;">End of Gallery</span>';

function enlargeimage(path, optWidth, optHeight){ //function to enlarge image. Change as desired.
var actualWidth=typeof optWidth!="undefined" ? optWidth : "600px" //set 600px to default width
var actualHeight=typeof optHeight!="undefined" ? optHeight : "500px" //set 500px to  default height
var winattributes="width="+actualWidth+",height="+actualHeight+",resizable=yes"
window.open(path,"", winattributes)
}

////NO NEED TO EDIT BELOW THIS LINE////////////

var iedom=document.all||document.getElementById, scrollspeed=0, movestate='', actualwidth='', cross_scroll, ns_scroll, statusdiv, loadedyes=0, lefttime, righttime;

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function creatediv(){
statusdiv=document.createElement("div")
statusdiv.setAttribute("id","statusdiv")
document.body.appendChild(statusdiv)
statusdiv=document.getElementById("statusdiv")
statusdiv.innerHTML=endofgallerymsg
}

function positiondiv(){
var mainobjoffset=getposOffset(crossmain, "left"),
menuheight=parseInt(crossmain.offsetHeight),
mainobjoffsetH=getposOffset(crossmain, "top");
statusdiv.style.left=mainobjoffset+(menuwidth/2)-(statusdiv.offsetWidth/2)+"px";
statusdiv.style.top=menuheight+mainobjoffsetH+"px";
}

function showhidediv(what){
if (endofgallerymsg!="") {
positiondiv();
statusdiv.style.visibility=what;
}
}

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft: what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function moveleft(){
if (loadedyes){
movestate="left";
if (iedom&&parseInt(cross_scroll.style.left)>(menuwidth-actualwidth)){
cross_scroll.style.left=parseInt(cross_scroll.style.left)-scrollspeed+"px";
showhidediv("hidden");
}
else
showhidediv("visible");
}
lefttime=setTimeout("moveleft()",10);
}

function moveright(){
if (loadedyes){
movestate="right";
if (iedom&&parseInt(cross_scroll.style.left)<0){
cross_scroll.style.left=parseInt(cross_scroll.style.left)+scrollspeed+"px";
showhidediv("hidden");
}
else
showhidediv("visible");
}
righttime=setTimeout("moveright()",10);
}

function motionengine(e){
var mainobjoffset=getposOffset(crossmain, "left"),
dsocx=(window.pageXOffset)? pageXOffset: ietruebody().scrollLeft,
dsocy=(window.pageYOffset)? pageYOffset : ietruebody().scrollTop,
curposy=window.event? event.clientX : e.clientX? e.clientX: "";
curposy-=mainobjoffset-dsocx;
var leftbound=(menuwidth-restarea)/2;
var rightbound=(menuwidth+restarea)/2;
if (curposy>rightbound){
scrollspeed=(curposy-rightbound)/((menuwidth-restarea)/2) * maxspeed;
clearTimeout(righttime);
if (movestate!="left") moveleft();
}
else if (curposy<leftbound){
scrollspeed=(leftbound-curposy)/((menuwidth-restarea)/2) * maxspeed;
clearTimeout(lefttime);
if (movestate!="right") moveright();
}
else
scrollspeed=0;
}

function contains_ns6(a, b) {
if (b!==null)
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function stopmotion(e){
if (!window.opera||(window.opera&&e.relatedTarget!==null))
if ((window.event&&!crossmain.contains(event.toElement)) || (e && e.currentTarget && e.currentTarget!= e.relatedTarget && !contains_ns6(e.currentTarget, e.relatedTarget))){
clearTimeout(lefttime);
clearTimeout(righttime);
movestate="";
}
}

function fillup(){
if (iedom){
crossmain=document.getElementById? document.getElementById("motioncontainer") : document.all.motioncontainer;
if(typeof crossmain.style.maxWidth!=='undefined')
crossmain.style.maxWidth=maxwidth+'px';
menuwidth=crossmain.offsetWidth;
cross_scroll=document.getElementById? document.getElementById("motiongallery") : document.all.motiongallery;
actualwidth=document.getElementById? document.getElementById("trueContainer").offsetWidth : document.all['trueContainer'].offsetWidth;
if (startpos)
cross_scroll.style.left=(menuwidth-actualwidth)/startpos+'px';
crossmain.onmousemove=function(e){
motionengine(e);
}

crossmain.onmouseout=function(e){
stopmotion(e);
showhidediv("hidden");
}
}
loadedyes=1
if (endofgallerymsg!=""){
creatediv();
positiondiv();
}
if (document.body.filters)
onresize()
}
window.onload=fillup;

onresize=function(){
if (typeof motioncontainer!=='undefined'&&motioncontainer.filters){
motioncontainer.style.width="0";
motioncontainer.style.width="";
motioncontainer.style.width=Math.min(motioncontainer.offsetWidth, maxwidth)+'px';
}
menuwidth=crossmain.offsetWidth;
cross_scroll.style.left=startpos? (menuwidth-actualwidth)/startpos+'px' : 0;
}