﻿function BodyGaleryView(src, title)
{
	if ((src==null)||(src==""))
		return false;

	var pwb='<html>\r\n'+
		'<head><title>Byty-Ostrava.cz</title></head>\r\n'+
		'<scr'+'ipt type="text/javascript" src="/_JS/custom.js"></scr'+'ipt>\r\n'+
		'<body leftMargin=0 topMargin=0  style="cursor:pointer; font-family:Verdana; font-size:14px;font-weight:bold;">\r\n'+
		'<div style="display:none;width:100%;padding-top:25px;text-align:center;" id="errTxt">THE PICTURE IS NOT AVAILABLE.</div>\r\n'+
		'<img src="'+src+'" onClick="window.close();" alt="" id=foto onload="popupResizeWin()" onerror="popupNotLoaded()">\r\n'+
		
		'</body>\r\n'+
		'</html>\r\n';

	var _child=window.open("about:blank","","left=0,top=0,height=200,width=200,scrollbars=yes");
	_child.document.write(pwb);
}

function popupResizeWin()
{
	var foto=document.getElementById("foto");

	var iWidth=document.body.clientWidth;
	iWidth=foto.width-iWidth;
	window.resizeBy(iWidth,0); 
	
	var iHeight=document.body.clientHeight;
	iHeight=foto.height-iHeight;
	window.resizeBy(0,iHeight);
	
	window.moveTo(0,0);
}

function popupNotLoaded()
{
	document.getElementById("foto").style.display="none";
	document.getElementById("errTxt").style.display="block";
	window.resizeTo(350,40);
}

function newWin(url)
    {
		window.open(url, "newBox","width=600,height=400")
	}









function ClickEvent(e)
{
	var obj;
	var i=0;
	var title = "Fyzioterapie fotogalerie";
	
	if (Br.IE)
		obj = window.event.srcElement;
	else
		obj = e.target;

	/*
	while(obj.parentNode.tagName!="TBODY" && obj.parentNode.tagName!="TABLE" && i<20)
	{
		obj = obj.parentNode;
		i++;
	}
	obj = obj.childNodes[0].childNodes[0];
	*/

	if (typeof(obj)=='object')
		if (obj.tagName=='IMG')
		{
			if (obj.alt!="") title=obj.alt;
			GaleryView(obj, title);
		}
} 

function GaleryView(obj, title)
{
	var ImgURL="";
	var nDot=0;
	var nWidth=10, nHeight=60;
	var _child;
	if (typeof(obj)!='object') return false;
	ImgURL = obj.src;
	if (ImgURL=="" && ImgURL=="undefined") return false;
	nDot = ImgURL.lastIndexOf(".");
	ImgURL = ImgURL.substr(0, nDot) + "big" + ImgURL.substr(nDot, ImgURL.length);

	if (Br.NS)
	{
		nWidth += 14;
		nHeight += 23;
	}

	_child=window.open("about:blank","","height=200,width=200");
	_child.document.write('<html>\n')
	_child.document.write(' <head><title>' + title + '</title></head>\n')
	_child.document.write(' <body leftMargin=0 topMargin=0  style="cursor:pointer; font-family:Verdana; font-size:14px;font-weight:bold;">\n')
	_child.document.write('<script language="javascript">\n');
	_child.document.write('function ResizeWin()');
	_child.document.write('	{window.resizeTo(document.getElementById("foto").width+' + nWidth + ',document.getElementById("foto").height+' + nHeight + ');}\n');
	_child.document.write('function notLoaded()');
	_child.document.write('	{document.getElementById("foto").style.display="none";\n');
	_child.document.write('	document.getElementById("errTxt").style.display="block";');
	_child.document.write('	window.resizeTo(350, 40)}');
	_child.document.write('</script>\n');
	_child.document.write('<div style="display:none;width:100%;padding-top:25px;text-align:center;" id="errTxt">THE PICTURE IS NOT AVAILABLE.</div>\n');
	_child.document.write('<img src="' + ImgURL + '" alt="" id=foto onload="ResizeWin()" onerror="notLoaded()">\n');
	_child.document.write(' </body>\n');
	_child.document.write('</html>\n');
}




function fnLogIN()
{
if (typeof(Page_ClientValidate) == 'function') 
{Page_ClientValidate();}

SetInternal('LogInClicked');

document.forms[0].submit();
} 
// ------ overeni formulare  napiste nam---------------------- //

function OverNewsletter ()
{
    if (document.design.inpNewsMail.value == "")
    {
       document.design.inpNewsMail.focus();
       alert ("Nezadal(a) jste Váš e-mail");
       return false;
    }
    inpMail=document.design.inpNewsMail.value;
    mail=/^.+@.+\..{2,4}$/;
    if (!mail.test(inpMail))
    {
       document.design.inpNewsMail.focus();
       alert ("Chybný formát e-mailu");
       return false;
    }
 //    if (document.design.Element5.value == "")
//    {
//       document.design.Element5.focus();
//       alert ("Nezadal(a) jste Váš e-mail");
//       return false;
//    }
//    inpMail=document.design.Element5.value;
//    mail=/^.+@.+\..{2,3}$/;
//    if (!mail.test(inpMail))
//    {
//       document.design.Element5.focus();
//       alert ("Chybný formát e-mailu");
//       return false;
//    }

 }
 
 

 // ------------------- END --------------------- //





function RemoveSubscriber() {
		 SetInternal('RemoveDailySubscriber');
		 document.forms[0].submit();
}

function ValidateSubscriber() {
     if(!IsEmail(GetElement('SubMail'),true,'Neplatná emailová adresa !',false)) return false;
SetInternal('ActivateSubscriber');
document.forms[0].submit();
}




function fnSearch() {
    if (GetElement('EXPS').value.length<3) 
	  {alert('Minimální délka hledaného slova jsou 3 znaky.');return false;
} 
    else {
   		 SetForm('/cz/hledej/default.aspx?layID=1&catid=2561&txbSearch=' + GetElement('EXPS').value,true);
		 } 
}




function FitWindowToImage(oimg)
{
 //elm = document.getElementById('Image');
 if (oimg)
 {
    //alert("width: " + elm.width + "; Image.height: " + elm.height);
    window.resizeTo(oimg.width + 40, oimg.height + 90)
  }

}

// ------ overeni formulare  napiste nam---------------------- //

function OverNapisteNam ()
{
   if (document.design.Element0.value == "")
   {
      document.design.Element0.focus();
      alert ("Nezadal(a) jste Vaše jméno");
      return false;
   }
   if (document.design.Element1.value == "")
   {
      document.design.Element1.focus();
      alert ("Nezadal(a) jste Vaše příjmení");
      return false;
   }
     
   if (document.design.Element2.value == "")
   {
      if (document.design.Element3.value == "")
      {
          alert("Zadejte e-mail nebo telefon");
          return false;
      }
      else
      {
          inpCell=document.design.Element3.value;
          tel=/^[0-9]{9,12}$/
          if (!tel.test(inpCell))
          {
              document.design.Element3.focus();
              alert ("Chybný formát telefonního èísla");
              return false;
          }
      }
   }
   else
   {
      inpMail=document.design.Element2.value;
      mail=/^.+@.+\..{2,4}$/;
      if (!mail.test(inpMail))
      {
         document.design.Element2.focus();
         alert ("Chybný formát e-mailu");
         return false;
      }
   } 
   
//    if (document.design.Element5.value == "")
//    {
//       document.design.Element5.focus();
//       alert ("Nezadal(a) jste Váš e-mail");
//       return false;
//    }
//    inpMail=document.design.Element5.value;
//    mail=/^.+@.+\..{2,3}$/;
//    if (!mail.test(inpMail))
//    {
//       document.design.Element5.focus();
//       alert ("Chybný formát e-mailu");
//       return false;
//    }
//    if (document.design.Element6.value == "")
//    {
//       document.design.Element6.focus();
//       alert ("Nezadal(a) jste telefonní èíslo");
//       return false;
//    }
//    inpCell=document.design.Element6.value;
//    tel=/^[0-9]{9,12}$/
//    if (!tel.test(inpCell))
//    {
//       document.design.Element6.focus();
//       alert ("Chybný formát telefonního èísla");
//       return false;
//    }
   
   
   
   
   
   if (document.design.Element7.value == "")
   {
      document.design.Element7.focus();
      alert ("Nezadal(a) jste typ ÈOV");
      return false;
   }
   if (document.design.Element8.value == "")
   {
      document.design.Element8.focus();
      alert ("Nezadal(a) jste poèet osob na ÈOV");
      return false;
   }
//   inpPocet=document.design.Element8.value;
//   cov=/^[0-9]{7}$/
//   if (!cov.test(inpPocet))
//   {
//      document.design.Element8.focus();
//      alert ("Chybný formát");
//      return false;
//   }
   if (document.design.Element9.value == "")
   {
      document.design.Element9.focus();
      alert ("Nezadal(a) jste místo dodání");
      return false;
   }
   if (document.design.Element10.value == "")
   {
      document.design.Element10.focus();
      alert ("Nezadal(a) jste pøedbìžné datum dodání");
      return false;
   }
   if (document.design.Element11.value == "")
   {
      document.design.Element11.focus();
      alert ("Nezadal(a) jste zda požadujete montáž ÈOV");
      return false;
   }
 }
 // ------------------- END --------------------- //


//--- Soukroma Inzerce ---//
function zobrazSkryj(idecko, obj){
el=document.getElementById(idecko).style; 
el.display=(el.display == 'block')?'none':'block';

}


