
function printPage() 
{
  window.print();
}


$(function() {
	// zvetsovani obrazku pomoci lightbox
	//$('a.lightbox').lightBox();

	$("a[rel^='prettyPhoto']").prettyPhoto();


	var cache = [];

	$.preLoadImages = function() {
	  var args_len = arguments.length;
	  for (var i = args_len; i--;) {
	    var cacheImage = document.createElement('img');
	    cacheImage.src = $('#server_www').val() + arguments[i];
	    cache.push(cacheImage);
	  }
	}
	
	$.preLoadImages('web/img/contact_active.png', 
			'web/img/map_point_active.png', 
			'web/img/quick_menu_plastova_okna_butt_active_bg.png',
			'web/img/quick_menu_plastove_dvere_butt_active_bg.png',
			'web/img/quick_menu_posuvne_dvere_butt_active_bg.png',
			'web/img/quick_menu_reseni_na_klic_butt_active_bg.png',
			'web/img/submenu_point_active.png',
			'web/img/submenu_point_highlight_active.png',
			'web/img/visual_point_active.png',
			'web/img/page_thumbnail_3_active_bg.png',
			'web/img/page_thumbnail_2_active_bg.png');
	
	$('.page-thumbnail-2-tbl .pt-item').mouseover( function() {
		$(this).addClass('pt-item-active');
	});
	
	$('.page-thumbnail-2-tbl .pt-item').mouseout( function() {
		$(this).removeClass('pt-item-active');
	});
	
	$('.page-thumbnail-3-tbl .pt-item').mouseover( function() {
		$(this).addClass('pt-item-active');
	});
	
	$('.page-thumbnail-3-tbl .pt-item').mouseout( function() {
		$(this).removeClass('pt-item-active');
	});
});





    var actual_id = null;
    var timer = null;
    function showVisualPoint(id, auto)
    {
      if(!auto)
      {
    	clearTimeout(timer);
      }
        
      if(!$("#visual-point-"+id).length)
      {
        id = 1;
      }

      if(actual_id)
      {
	      $("#window-point-"+actual_id).css("background-image", "url('"+$('#server_www').val()+"web/img/visual_point.png')");
	      $("#window-point-"+actual_id).css("color", "#ad0000");
      }
      
      
      if(id) 
      {
        // title
    	var title = $("#visual-point-"+id+" strong").html();
    	$("#info-cell .ic-title").html(title);
    	  
        // img
        var img = $("#visual-point-"+id+" img").attr('src');
        $("#info-cell .ic-img img").attr('src', img);
        
        // text
        var text = $("#visual-point-"+id+" p").html();
        $("#info-cell .ic-text").html(text);

        $("#window-point-"+id).css("background-image", "url('"+$('#server_www').val()+"web/img/visual_point_active.png')");
        $("#window-point-"+id).css("color", "#ffffff");
        
        actual_id = id;
      }

      timer = setTimeout('showVisualPoint('+(id+1)+')', 7000);
    }

function $f(id) {
	return document.getElementById(id);
}

function show_big_img(file, height)
{
	if(!height) height=580;
	var width=560;
	var left=180;
	var top=100;

	wopener = window.open($f('server_www').value+'image/detail/?image='+file, 'image', 'toolbar=0,location=0,status=1,resizable=1,scrollbars=0,width='+ width +',height='+ height +',top='+ top +',left='+ left);
	wopener.focus();
	
	return wopener;	
}

function submenu(show, id)
{
	if(show)
	{
		$f('submenu_' + id).style.display = 'block';
	}
	else
	{
		$f('submenu_' + id).style.display = 'none';
	}
} 

function printPage() 
{
  window.print();
}

function slideSwitch() {
    var $active = $('#slideshow DIV.active');

    if ( $active.length == 0 ) $active = $('#slideshow DIV:last');

    // use this to pull the divs in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow DIV:first');

    // uncomment below to pull the divs randomly
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

function mailLink(part_1, part_2)
{
  location.href='mailto:'+part_1 + '@' + part_2;
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
});
