	function new_window2(dokument,sirka,vyska,centrovat,pozice_l,pozice_h) {
	  if (centrovat == 1) {
			so = screen.width;
			vo = screen.height;
			zleva = ((so - sirka) / 2) - 13;
	//		shora = (vo - vyska) / 2;
			shora = 100;
		} else {
		  zleva = pozice_l;
		  shora = pozice_h;
		}
	  popup_win = window.open(dokument,"popup_okno","width="+sirka+",height="+vyska+",left="+zleva+",top="+shora+",location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0");
	  popup_win.resizeTo(sirka+75,vyska+100);
	  popup_win.focus();
	}


function new_window(adress) {
	window.open(adress,"","");
}
		
	
	//=============================================================================
// SHARED FILE: Various common functions
//
// 
// $Header: /Web/SHS-CMS/mycommon.js 1     15.06.04 10:29 Otas $
//=============================================================================
//
// Each function has to have following descriptions (no blank lines) which are
// used to generate documentation.
//
//
// EXAMPLE:
//
//   //-----------------------------------------------------------------
//   function MyFunction (nCount, sMessage)
//   // #@Description: Function description
//   // #@Input: item count (integer), message (string)
//   // #@Output: return code (boolean)
//   // #@Author: Author Name
//   // #@Modified: Modification date


function IsNumber( inputVal, bSelect, sMessage ) {
//-------------------
// #@Description: Return true if 'inputVal' is possible to convert to number. Normalizing 'inputVal'. If bSelect is set to true and object is not number, object will be selected.   
// #@Input:  input object, bSelect( default false )   
// #@Output: boolean 
   var bRet = false;
   var cVal;
   
   if( typeof( bMessage ) != "boolean" )
       bMessage=true;
   
   if( typeof(inputVal.value)=="string" ) {
       cVal=inputVal.value;
       cVal=cVal.replace(",",".");       
       if( !isNaN(parseFloat(cVal)) ) {
           bRet=true;
           inputVal.value=parseFloat(cVal);
       }    
   }
   else    
   if( typeof(inputVal.value)=="number" ) 
       bRet=true;
       
   if( !bRet && bSelect) {
         alert( "Musíte zadat číselnou hodnotu '" + sMessage + "' !" );
         inputVal.select();        
         inputVal.focus();

   }
   
   return bRet;
}

function ToNumber( inputVal ) {
//-------------------
// #@Description: Return numeric value of 'inputVal' or 0   
// #@Input:  numeric expression    
// #@Output: numeric value 
   var expression;
   var nRet=0, nVal;    
   
   if( typeof(inputVal)=="string" ) {
       nVal=parseFloat(inputVal);
       if( !isNaN(nVal) )
           nRet=nVal;
   }
   else    
   if( typeof(inputVal)=="number" ) 
       nRet=inputVal;
       
   return nRet;
}


function Trim( cInput ) {
//-------------------
// #@Description: Return trimed string or "" if input is not string   
// #@Input:  string expression
// #@Output: trimed string 
   var cStr="";
   var nLength,i;
   var nFirst,nLast;
   
   if( typeof(cInput)=="string" ) {
       nLength=cInput.length;
       nFirst=0;
       while( cInput.charCodeAt(nFirst)<33 && nFirst<nLength ) nFirst++;
       cStr=cInput.substr(nFirst,nLength);
       nLast=cStr.length-1;
       while( cStr.charCodeAt(nLast)<33 && nLast>0 ) nLast--; 
       cStr=cStr.substr(0,nLast+1);
   }
   
   return cStr; 
} 



function IsDate( inputVal, bSelect ) {
//-----------------------
// #@Description: Return true if inputVal.value is formated date dd.mm.yyyy, ignore empty inputVal   
// #@Input:  object expression, bSelect( default false )
// #@Output: bool 
   var aStr="";
   var bRet=true;

   if( typeof(inputVal.value)=="string" && Trim(inputVal.value).length>0 ) {
       // testing length
       aStr=inputVal.value.split(".");
       if( aStr.length!=3 ) 
           bRet=false;
       else {
           dDate= new Date(aStr[2], aStr[1]-1, aStr[0]);  
           if( dDate.getDate() != parseInt(aStr[0]) ||
               dDate.getMonth()+1 != parseInt(aStr[1]) ||
               dDate.getFullYear() != parseInt(aStr[2]) )
                  bRet=false;
       }
   }
   else
      bRet=false;
       
   if( !bRet ) {           
       alert( "Musíte zadat datum ve formátu DD.MM.YYYY !" );
       if( bSelect==true ) {        
         inputVal.select();        
         inputVal.focus();
       }          
   }
       
   return bRet; 
} 


function NotEmpty( inputVal, sMessage, bSelect ) {
//-----------------
// #@Description: Return true if 'inputVal' is not empty. If object is empty, print sMessage. If bSelect is set to true and object is empty, object will be selected.   
// #@Input:  input object, sMessage, bSelect( default false )   
// #@Output: boolean 
// #@Author: Otto Lustig
   var bRet = false;
   var cVal;
   
   if( typeof(inputVal.value)=="string" ) {
       cVal=Trim(inputVal.value);
       if( cVal.length>0 )
           bRet=true;                        
   }
       
   if( !bRet && bSelect) {
       alert( "Zadejte prosím "+ sMessage +"." );
       inputVal.select();        
       inputVal.focus();

   }
   
   return bRet;
}


function IsEmail( inputVal, bSelect ) {
//===============
  var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
  var check=/@[\w\-]+\./;
  var checkend=/\.[a-zA-Z]{2,3}$/;
  var emailad=inputVal.value.trim();

  inputVal.value=emailad;
  
	if(((emailad.search(exclude) != -1)||(emailad.search(check)) == -1)||(emailad.search(checkend) == -1)){
		 alert("Prosím zadejte správnou emailovou adresu.");
     if( bSelect ) { 
         inputVal.select();        
         inputVal.focus();
     }    
     return false;
	}
  return true;
}

function openform(param, winname ) {
	//******************
	var lwidth=780
	var lheight=screen.height-25
	var New_win = window.open(param, "","menubar=no,location=no,personalbar=no,titlebar=no,status=no,toolbar=no,directories=no,scrollbars=yes,resizable=no")
	
	New_win.resizeTo(lwidth,lheight)
	New_win.moveTo((screen.width-lwidth)/2,0)
}

/*
Notes:
'exclude' checks 5 conditions:
a) characters that should not be in the address
b) characters that should not be at the start
c) & d) characters that shouldn't be together
e) there's not more than one '@'
'check' checks there's at least one '@', later followed by at least one '.'
'checkend' checks the address ends with a period followed by 2 or 3 alpha characters
N.B. Javascript 1.2 only works with version 4 browsers and higher.
*/


// Add a function called trim as a method of the prototype 
// object of the String constructor.
String.prototype.trim = function()
{
    // Use a regular expression to replace leading and trailing 
    // spaces with the empty string
    return this.replace(/(^\s*)|(\s*$)/g, "");
}

//funkce pro obsluhu kliku na Odpovedet v diskusi
function reply(id) {
	document.getElementById('reply_to').value = id;
	document.getElementById('reply_to_text_id').innerHTML = id;
	document.getElementById('reply_to_text').style.display = 'block';
	document.getElementById('post_text').focus();
	return false;
}