function open_print_window(){
		pp = new Array();
		pp = getSceeneSize();
		x = (pp["Width"] / 2 - 630 / 2);
		y = (pp["Height"] / 2 - 700 / 2);
		
	print_window = window.open("template/poupis/print_window.html", "subWindow", "height=700,width=630");
	print_window.focus();
}

function show_map(show){
	/*if(document.clickc == undefined) document.clickc = 0;
	if(document.clickc == 0){
		ss = true;
		document.clickc = 1;
	}else{
		ss = false;
		document.clickc = 0;
	}*/
	
	document.getElementById("map_absolute").style.visibility= show ? "visible" : "hidden";
	if(show){
		//alert(thisMovie("map_d").getVariable( "time"));
		thisMovie("map_d").SetVariable( "time", 0 ) ;
		thisMovie("map_d").SetVariable( "p", 1 ) ;
		/*thisMovie("map_d").setAttribute("0", variable); = 0;
		thisMovie("map_d").p = 1;*/
	}
}

function getSceeneSize(){
var viewportwidth;
 var viewportheight;
 
 var tar = new Array();
 
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
 }
 
 // older versions of IE
 
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }
 tar["Width"] = viewportwidth;
  tar["Height"] = viewportheight;
 return tar;
}

function thisMovie(movieName) {
  // IE and Netscape refer to the movie object differently.
  // This function returns the appropriate syntax depending on the browser.
  if (navigator.appName.indexOf ("Microsoft") !=-1) {
    return window[movieName]
  } else {
    return document[movieName]
  }
}

function flash(anme, width, height, name)
{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ' + 
	'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" ' + 
	'id="'+name+'" ' +
	'width="' + width + '" ' + 
	'height="' + height + '" ' + 
	'id="aqua_root" ' + 
	'align="middle">' +
	' ' + 
	'<param name="allowScriptAccess" value="always" />' + 
	'<param name="movie" value="' + anme + '" />' + 
	'<param name="quality" value="high" />' + 
	'<param name="scale" value="noscale" />' + 
	'<param name="wmode" value="transparent">' +
	'<param name="time" value="0">' +
	'<param name="p" value="1">' +
	' ' + 
	'<embed ' +
	'name="'+name+'" ' +
	'swLiveConnect="true" ' +
	'src="' + anme + '" ' + 
	'quality="high" ' + 
	'scale="noscale" ' + 
	'time="0" ' + 
	'p="1" ' + 
	'width="' + width + '" ' + 
	'height="' + height + '" ' + 
	'align="middle" ' + 
	'wmode="transparent" ' +
	'allowScriptAccess="always" ' + 
	'type="application/x-shockwave-flash" ' +
	'pluginspage="http://www.macromedia.com/go/getflashplayer" />' + 
	'</object>');
}

function putFlash(anme, width, height, name, id)
{
	document.getElementById(id).innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ' + 
	'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" ' + 
	'id="'+name+'" ' +
	'width="' + width + '" ' + 
	'height="' + height + '" ' + 
	'id="aqua_root" ' + 
	'align="middle">' +
	' ' + 
	'<param name="allowScriptAccess" value="always" />' + 
	'<param name="movie" value="' + anme + '" />' + 
	'<param name="quality" value="high" />' + 
	'<param name="scale" value="noscale" />' + 
	'<param name="wmode" value="transparent">' +
	'<param name="time" value="0">' +
	'<param name="p" value="1">' +
	' ' + 
	'<embed ' +
	'name="'+name+'" ' +
	'swLiveConnect="true" ' +
	'src="' + anme + '" ' + 
	'quality="high" ' + 
	'scale="noscale" ' + 
	'time="0" ' + 
	'p="1" ' + 
	'width="' + width + '" ' + 
	'height="' + height + '" ' + 
	'align="middle" ' + 
	'wmode="transparent" ' +
	'allowScriptAccess="always" ' + 
	'type="application/x-shockwave-flash" ' +
	'pluginspage="http://www.macromedia.com/go/getflashplayer" />' + 
	'</object>';
}

function hideie(target){
	if (navigator.appName == "Microsoft Internet Explorer"){
		document.getElementById(target).style.visibility="hidden";
	}
}

function showimage(url){
	var loader = document.getElementById('loading_content');
	loader.style.visibility="visible";
	loader.style.left = getSceeneSize()["Width"]/2 - 60/2+"px";
	loader.style.top = getSceeneSize()["Height"]/2 - 60/2+"px";
	var window_fill = document.getElementById('fill_window');
	window_fill.style.visibility = "visible";
	var window_photo = document.getElementById('image_window');	
	var photo = document.getElementById('photo');
	var photo_div = document.getElementById('photo_div');
	window_fill.onclick = function(){
		showhide(true);
		loader.style.visibility = "hidden";
	}
	
	window_photo.onclick = function(){
		showhide(true);
		loader.style.visibility = "hidden";
	}
	
	photo.onclick = function(){
		showhide(true);
		loader.style.visibility = "hidden";
	}
	
function showhide(hide){
	var hideis = hide ? "hidden" : "visible";
	window_photo.style.visibility = hideis;
	window_fill.style.visibility = hideis;
}
	
if (navigator.appName == "Microsoft Internet Explorer"){
		photo.onload = function(){
			ifie();
	}
	}else{

		photo.addEventListener ( 'load' , function (event){
			ifie();
		} , false );
	}
	
	function ifie(){
		loader.style.visibility="hidden";
		if(navigator.appName == "Microsoft Internet Explorer"){
			photo_div.runtimeStyle.backgroundImage="url('"+photo.src+"')";
		}else{
			photo_div.style.background="url('"+photo.src+"')";
		}
		photo_div.style.width = photo.width+"px";
		photo_div.style.height = photo.height+"px";
		var xn = Number(photo_div.style.width.replace("px", ""));
		var yn = Number(photo_div.style.height.replace("px", ""));
		window_photo.style.width = xn+14+"px";
		showhide(false);
		change_position();
	}
	
	photo.src="";
	photo.src=url;	

	var WindowHeight=0;
	
	document.body.onresize = function(){
		change_position();
	}
	function change_position(){	
		/*WindowHeight = document.body.clientHeight;
		alert(document.getElementsByTagName('body')[0].clientHeight);
		if(document.body.clientHeight == 0){
			WindowHeight = window.innerHeight;
		}*/
		pp = new Array();
		pp = getSceeneSize();
		window_photo.style.left = (pp["Width"] / 2 - window_photo.clientWidth / 2)+"px";
		window_photo.style.top = (pp["Height"] / 2 - window_photo.clientHeight / 2)+"px";
	}
}

function getSceeneSize(){
var viewportwidth;
 var viewportheight;
 
 var tar = new Array();
 
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
 }
 
 // older versions of IE
 
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }
 tar["Width"] = viewportwidth;
  tar["Height"] = viewportheight;
 return tar;
}

function change_image(dir, name, format ,min, max, place){
	var img = dir+name+RandomMinMax(min, max)+format;
	document.getElementById(place).src = img;
}

function RandomMinMax(x, y){
	return(Math.floor(Math.random()*((y+1)-x))+x);
}

function submit_form(target)
{
	document.forms[target].submit();
}

function clear_form()
{
	document.forms["ats_form"].text_.value = "";
	document.forms["ats_form"].name_.value = "";
	document.forms["ats_form"].email_.value = "";
}