﻿
function flash(id,width,height)
{


    document.write( "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"\n" );
    document.write( "  codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,42,0\"\n" );
    document.write( "  id=\"Movie1\" width=\""+width+"\" height=\""+height+"\">\n" );
    document.write( "  <param name=\"movie\" value=\"ViewFlash.aspx?docid="+id+"\">\n" );
    document.write( "  <param name=\"menu\" value=\"false\">\n" );
    document.write( "  <param name=\"quality\" value=\"best\">\n" );
    document.write( "  <param name=\"wmode\" value=\"transparent\">\n" );
    document.write( "  <param name=\"bgcolor\" value=\"#CCCCCC\">\n" );
    document.write( "    <embed name=\"Movie1\" src=\"ViewFlash.aspx?docid="+id+"\"\n" );
    document.write( "     menu=\"false\" quality=\"best\" wmode=\"transparent\" bgcolor=\"#CCCCCC\" swLiveConnect=\"true\"\n" );
    document.write( "     width=\""+width+"\" height=\""+height+"\"\n" );
    document.write( "     type=\"application/x-shockwave-flash\"\n" );
    document.write( "     pluginspage=\"http://www.macromedia.com/go/getflashplayer\"></embed>\n" );
    document.write( "</object>\n" );


/*
    document.write( "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"\n" );
    document.write( "  codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,42,0\"\n" );
    document.write( "  id=\"Movie1\" width=\"500\" height=\"300\">\n" );
    document.write( "  <param name=\"movie\" value=\"Movie1.swf\">\n" );
    document.write( "  <param name=\"menu\" value=\"false\">\n" );
    document.write( "  <param name=\"quality\" value=\"best\">\n" );
    document.write( "  <param name=\"wmode\" value=\"transparent\">\n" );
    document.write( "  <param name=\"bgcolor\" value=\"#CCCCCC\">\n" );
    document.write( "    <embed name=\"Movie1\" src=\"Movie1.swf\"\n" );
    document.write( "     menu=\"false\" quality=\"best\" wmode=\"transparent\" bgcolor=\"#CCCCCC\" swLiveConnect=\"true\"\n" );
    document.write( "     width=\"500\" height=\"300\"\n" );
    document.write( "     type=\"application/x-shockwave-flash\"\n" );
    document.write( "     pluginspage=\"http://www.macromedia.com/go/getflashplayer\"></embed>\n" );
    document.write( "</object>\n" );

*/


/*
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="706" height="109">
              <param name="movie" value="ViewFlash.aspx?docid=19016143" />
              <param name="quality" value="high" />
              <param name="wmode" value="transparent" />
              <param name="loop" value="true" />
              <param name="menu" value="false" />
              <embed wmode="transparent" src="ViewFlash.aspx?docid=19016143" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="706" height="109" />
            </object>
  */
 /*
document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='706' height='109'>");          

document.write("<param name='quality' value='high' />");
document.write("<param name='wmode' value='transparent' />");
document.write("<param name='loop' value='true' />");
document.write("<param name='menu' value='false' />");
document.write("<embed wmode='transparent' src='ViewFlash.aspx?docid=19016143' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='706' height='109' />");


document.write("</object>");
*/
}



function showImg(id, width, height)
{

	if (width == 0)
	{			
		showImg2(id);		
	}
	else
	{

    width += 50;
    height+= 50;
    
    if(height + 50 > screen.height)
        height= screen.height- 200;

    if(width + 50 > screen.width)
        width = screen.width - 100;
        
    x = (screen.width  -  width) / 2;
    y = (screen.height - height) / 2;           
    
    var a = window.open("imgDetail.aspx?imgid=" + id,"imgDialog","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,left="+x+",top="+y+",resizable=yes,width="+(width)+",height="+(height));
    }
}


function showImg2(id)
{
	width = 200;
	height = 300;

    width += 50;
    height+= 50;
    
    if(height + 50 > screen.height)
        height= screen.height- 200;

    if(width + 50 > screen.width)
        width = screen.width - 100;
        
    x = (screen.width  -  width) / 2;
    y = (screen.height - height) / 2;           
    
    var a = window.open("imgDetail.aspx?res=true&imgid=" + id,"imgDialog","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,left="+x+",top="+y+",resizable=yes,width="+(width)+",height="+(height));
}



function _$() {
  var elements = new Array();

  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);

    if (arguments.length == 1)
      return element;

    elements.push(element);
  }

  return elements;
}




$(function() {
  textAreaCleanSpaces();
});

function textAreaCleanSpaces()
{
 // Smaž mezeru v Textare-ích
  $("textarea").focus(function() {
    if($(this).val().length == 1 && ($(this).val().charCodeAt(0) == 160 || $(this).val().charCodeAt(0) == 32))
      $(this).val("");
  })
}

/* Validace vyhledávajících políček - 3 znaky */
var validateError = null;
$(function()
  {
  $("form[@class*=validate]").bind("submit",function()
  {
    validateError = null;

    $(this).find("input[@class*=sValidate]").each(function() {
    if($(this).val().length > 0 && $(this).val().length < 3)
      validateError = $(this);
    });
    
    if(validateError)
    {
      alert("Hledaný řetězec musí mít alespoň 3 znaky")
      $(validateError).focus();
      return false;
    }
  });
});
  
function getCookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ';', len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}

function setCookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires ) {
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name+'='+escape( value ) +
		( ( expires ) ? ';expires='+expires_date.toGMTString() : '' ) + //expires.toGMTString()
		( ( path ) ? ';path=' + path : '' ) +
		( ( domain ) ? ';domain=' + domain : '' ) +
		( ( secure ) ? ';secure' : '' );
}

function deleteCookie( name, path, domain ) {
	if ( getCookie( name ) ) document.cookie = name + '=' +
			( ( path ) ? ';path=' + path : '') +
			( ( domain ) ? ';domain=' + domain : '' ) +
			';expires=Thu, 01-Jan-1970 00:00:01 GMT';
}
  

// Přidání metody trim() k typu string
String.prototype.trim = function()
{
    return this.replace(/(^\s*)|(\s*$)/g, "")
};

/*
ID_prvku:Chybová hláška\nID_prvku:Chybová hláška\n
*/
function displayErrors(data)
{
 
  hideErrors();
  if(data=="" || data.substring(0,9) == "RESULT_OK")
    return true;
     
  chyby = data.split("\n");
  for(var i = 0; i < chyby.length-1; i++)
  {
    casti = chyby[i].split(":");
  
    $("#"+casti[0]).before("<div class='valErr'>"+casti[1]+"</div>");
       
  }
  return false;
}


function hideErrors()
{
  // Ostranit veškerá předešlá varování
  $("div[@class*=valErr]").remove();
}


jQuery.fn.startWait = function(small)
{
  var top, left, width, height;
  
  $(this).each(function() {
    width = this.offsetWidth;
    height = this.offsetHeight;  
    left = this.offsetLeft;  
    top = this.offsetTop;    
  });
  
  $(this).find("select").attr("disabled", "disabled").attr("waitSelBug","waitSelBug");
  
  if(small)
    myClass = "waitSmall"
  else
    myClass = "wait";
  
  div = jQuery("<div>").attr("class", myClass).css({top: top, left:left, width: width, height: height, filter:"alpha(opacity=30)"});
  jQuery(jQuery(this).parent()).prepend(div);
  
}

jQuery.fn.stopWait = function()
{
  jQuery(".wait").remove();
  jQuery(".waitSmall").remove();
  jQuery(this).find("select[@waitSelBug=waitSelBug]").attr("disabled", "").attr("waitSelBug","");
}

// ticker
var ticker;
var tickerPageWidth = 670;
var leftPos = tickerPageWidth;
var tickerWidth;

$(function() 
{

  c = $("#scroller").html();

  // Vytvořím dočasný neviditelný DIV abych
  // zjistil šířku texti který budu scrollovat
  tempDiv = $("<div>");
  tempDiv.html(c);
  tempDiv.css("visibility", "hidden");
  tempDiv.css("position", "absolute");
  tempDiv.css("white-space", "nowrap");
  $(document.body).append(tempDiv);
  tempDiv.each(function()
  {
    tickerWidth = this.offsetWidth
  });
  tempDiv.remove();
  
  $("#scroller").html("");
  ticker = $("<div>")
  ticker.attr("class","ticker");
  ticker.html(c);
  
  $("#scroller").append(ticker);
  
  var scroller = document.getElementById("scroller");
  if(scroller)
  {
    tickerPageWidth = document.getElementById("scroller").offsetWidth; //670;
    leftPos = tickerPageWidth;
    //alert(tickerPageWidth);
    tickerTick();
  }
  
});

function tickerTick()
{
 
  ticker.css("left", (leftPos) + "px");
  ticker.css("width", (tickerWidth) + "px");
  leftPos -= 1;
  
  if(-leftPos > tickerWidth)
    leftPos = tickerPageWidth;
      
  setTimeout(tickerTick,20);
}



$(function()
{
  blurInput($("#nemail"));
  $("#nemail").bind("focus", function() {focusInput(this)});
  $("#nemail").bind("blur", function() {blurInput(this)});
});


function focusInput(o)
{
  o = $(o);
  if(o.val() == L_VASE_EMAILOVA_ADRESA)
  {
    o.val("");
    o.removeClass("inputTip");
  }
}
function blurInput(o)
{
  o = $(o);
  if(o.val() == "")
  {
    o.val(L_VASE_EMAILOVA_ADRESA);
    o.addClass("inputTip");
  }
}



function highlight(co) {


    $(document).ready( function() {
          searchtext=co;
          if (searchtext!='') { 
          var node = document.getElementById("left");
         // node=$("#left").get();
          $("#left").each(function() { $.highlight(node,searchtext); });
          }
          
              } );
              
              
}



        // fce otevre odkaz pro tisk do noveho okna. Pokud clanek dokumentu obsahuje iframe,
// presmerovani probehne na atribut src='' iframu - kvuli problemum s tiskem iframe.

function newPrintWin(w) {

        var iFramePath = $("#artContent IFRAME").attr("src");
        
         if (iFramePath) {
         var win1=window.open(iFramePath);
         } 
        
         else {
         var win2=window.open(w);
         }
                   
}                   