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="gallery2"></div>');


var div = document.getElementById('gallery2');
var loading = document.getElementById('loading');
var shadow = document.getElementById('shadow');



function validate(formular)
{
  if(formular.jmeno.value=="")
  {
    alert("JmÃ©no musÃ­te vyplnit!");
	formular.jmeno.focus();
	return false;
  }
  else if(formular.telefon.value=="")
  {
    alert("Telefon musÃ­te vyplnit!");
	formular.telefon.focus();
	return false;
  }
  else if(formular.vzkaz.value=="")
  {
    alert("DalÅ¡Ã­ informace musÃ­te vyplnit!");
	formular.vzkaz.focus();
	return false;
  }
  else if(formular.email.value=="")
  {
    alert("Email musÃ­te vyplnit.!");
	formular.email.focus();
	return false;
  }
  else if(window.RegExp)
  {
    re=new RegExp("^[^@]+@[^.]+\..+$");
	if(!re.test(formular.email.value))
	{
	  alert("ZadanÃ½ email nemÃ¡ sprÃ¡vnÃ½ formÃ¡t!");
	  formular.email.focus();
	  return false;
	}
  }
  else return true;
}

function validate_poslu(formular)
{
  if(formular.email.value=="")
  {
    alert("Email musÃ­te vyplnit.!");
	formular.email.focus();
	return false;
  }
  else if(window.RegExp)
  {
    re=new RegExp("^[^@]+@[^.]+\..+$");
	if(!re.test(formular.email.value))
	{
	  alert("ZadanÃ½ email nemÃ¡ sprÃ¡vnÃ½ formÃ¡t!");
	  formular.email.focus();
	  return false;
	}
	else if(formular.email_od.value != "" && !re.test(formular.email_od.value))
	{
	  alert("ZadanÃ½ email nemÃ¡ sprÃ¡vnÃ½ formÃ¡t!");
	  formular.email_od.focus();
	  return false;
	}
  }
  else return true;
}


function nabidka(id){
  
	
	div.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;
  }

	
	shadow.style.height = shadowHeight + "px";
	shadow.style.display = 'block';
	shadow.style.zIndex = 10000;

	img = new Image();
 	img.src = 'http://www.real.cz/imgs/auta.jpg';
	
	

	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);
	}
	
	loading.style.top = ScreenHeight_half + ScrollPosition - 8 + 'px';
	loading.style.display = 'block';
		
	var n=0;
	
	function galleryAlpha(){
		n += 0.1;
		div.style.opacity = n;
		div.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  = 500;
		var ImgHeight = 300;
		var ImgBorder = 10;
			
		ImgWidth_half  = Math.round(ImgWidth/2);
		ImgHeight_half = Math.round(ImgHeight/2);
		
		div.style.top = ScreenHeight_half + ScrollPosition - ImgHeight_half - ImgBorder + 'px';
		
		
		div.style.marginLeft = '-'+ImgWidth_half+'px';
	 
		div.innerHTML = '';
		div.innerHTML += '<form id="form1" method="post" action="http://www.real.cz/info2.php" onsubmit="return validate(this)" target="_parent">';
		
    document.getElementById("form1").innerHTML += '<a class="close" href="javascript:close2();"><img border="0" src="http://www.real.cz/images/close.gif" alt="close" /></a>';
    document.getElementById("form1").innerHTML += '<h1>MÃ¡m zÃ¡jem a tuto nabÃ­dku</h1>';
		document.getElementById("form1").innerHTML += '<div class="label"><label for="jmeno">jmÃ©no a pÅ™Ã­jmenÃ­</label></div>';
		document.getElementById("form1").innerHTML += '<div class="input"><input name="jmeno" id="jmeno" type="text" class="s-policko" size="20" maxlength="40" /></div><br />';
		
		
		document.getElementById("form1").innerHTML += '<div class="label"><label for="telefon">telefon / mobil</label></div>';
		document.getElementById("form1").innerHTML += '<div class="input"><input name="telefon" id="telefon" type="text" class="s-policko" size="9" maxlength="40" /></div><br />';
		
		document.getElementById("form1").innerHTML += '<div class="label"><label for="email">e-mail</label></div>';
		document.getElementById("form1").innerHTML += '<div class="input"><input name="email" id="email" type="text" class="s-policko" size="20" maxlength="40" /></div><br />';
		
		
		document.getElementById("form1").innerHTML += '<div class="label"><label for="vzkaz">dalÅ¡Ã­ informace</label></div>';
		document.getElementById("form1").innerHTML += '<div class="textarea"><textarea name="vzkaz" id="vzkaz" class="s-policko"></textarea></div><br />';
		
		document.getElementById("form1").innerHTML += '<div class="odeslat"><input name="vlozit" id="vlozit" type="submit" class="hledej" value="ODESLAT" /></div><br />';
		
    
    
    
    document.getElementById("form1").innerHTML += '<input name="id" type="hidden" value="4235" />';
    document.getElementById("form1").innerHTML += '<input name="nazev" type="hidden" value="RD 4+1 Køtiny pìkná lokalita" />';
    div.innerHTML += '</form>';
    
		
		
		
		
		
		loading.style.display = 'none';
	
		div.style.display = 'block';
		
		

	}
	
	if(img.complete){
		
		ShowImage();
	
	}
	else{
		
		img.onload = function(){
		
			ShowImage();
		
		}
	}
}



function poslu_to(id){
  
	
	div.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;
  }
	
	shadow.style.height = shadowHeight + "px";
	shadow.style.display = 'block';
	shadow.style.zIndex = 10000;

	img = new Image();
 	img.src = 'http://www.real.cz/imgs/auta.jpg';
	
	

	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);
	}
	
	loading.style.top = ScreenHeight_half + ScrollPosition - 8 + 'px';
	loading.style.display = 'block';
		
	var n=0;
	
	function galleryAlpha(){
		n += 0.1;
		div.style.opacity = n;
		div.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  = 500;
		var ImgHeight = 300;
		var ImgBorder = 10;
			
		ImgWidth_half  = Math.round(ImgWidth/2);
		ImgHeight_half = Math.round(ImgHeight/2);
		
		div.style.top = ScreenHeight_half + ScrollPosition - ImgHeight_half - ImgBorder + 'px';
		
		div.style.marginLeft = '-'+ImgWidth_half+'px';
	 
		div.innerHTML = '';
		div.innerHTML += '<form id="form1" class="small" method="post" action="http://www.real.cz/poslu_to.php" onsubmit="return validate_poslu(this)" target="_parent">';
		
    document.getElementById("form1").innerHTML += '<a class="close" href="javascript:close2();"><img border="0" src="http://www.real.cz/images/close.gif" alt="close" /></a>';
    document.getElementById("form1").innerHTML += '<h1>Chci to poslat e-mailem</h1><br />';

    document.getElementById("form1").innerHTML += '<div class="label"><label for="jmeno">jmÃ©no a pÅ™Ã­jmenÃ­</label></div>';
		document.getElementById("form1").innerHTML += '<div class="input"><input name="jmeno" id="jmeno" type="text" class="s-policko" size="20" maxlength="40" /></div><br />';
		
		
		document.getElementById("form1").innerHTML += '<div class="label"><label for="email_od">odesÃ­latel e-mail</label></div>';
		document.getElementById("form1").innerHTML += '<div class="input"><input name="email_od" id="email_od" type="text" class="s-policko" size="20" maxlength="40" /></div><br />';
		

		document.getElementById("form1").innerHTML += '<div class="label"><label for="email">pÅ™Ã­jemce e-mail*</label></div>';
		document.getElementById("form1").innerHTML += '<div class="input"><input name="email" id="email" type="text" class="s-policko" size="20" maxlength="40" /></div><br />';
		
		document.getElementById("form1").innerHTML += '<div class="label"><label for="vzkaz">komentÃ¡Å™</label></div>';
		document.getElementById("form1").innerHTML += '<div class="textarea"><textarea name="vzkaz" id="vzkaz" class="s-policko"></textarea></div><br />';
		
		
		
		document.getElementById("form1").innerHTML += '<div class="odeslat"><input name="vlozit" id="vlozit" type="submit" class="hledej" value="ODESLAT" /></div><br />';
		
    document.getElementById("form1").innerHTML += '<span>*povinnÃ¡ poloÅ¾ka</span>';
    
    
    document.getElementById("form1").innerHTML += '<input name="id" type="hidden" value="4235" />';
    document.getElementById("form1").innerHTML += '<input name="nazev" type="hidden" value="RD 4+1 Køtiny pìkná lokalita" />';
    div.innerHTML += '</form>';
    
		
		
		
		
		
		loading.style.display = 'none';
	
		div.style.display = 'block';
		
		

	}
	
	if(img.complete){
		
		ShowImage();
	
	}
	else{
		
		img.onload = function(){
		
			ShowImage();
		
		}
	}
}






function close2(){
/*	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);
*/	
	div.innerHTML = '';
	loading.style.display = 'none';	
	div.style.display = 'none';
	shadow.style.display = 'none';
	
	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';
	}

}
