﻿// osetruje vysku #footer elementu

// on ready
$(document).ready(function(){
	
	// kraceni pro jednotlive stranky
	if ($(".shortplease.dsc").length){
		$(".shortplease.dsc").ThreeDots({
			max_rows: 4
		});
	}
	
	if ($(".shortplease.title").length){
		$(".shortplease.title").ThreeDots({
			max_rows: 2
		});
	}
	
	if ($(".shortplease.dscblog").length){
		$(".shortplease.dscblog").ThreeDots({
			max_rows: 4
		});
	}
	
	if ($(".shortplease.dscshortmsgs").length){
		$(".shortplease.dscshortmsgs").ThreeDots({
			max_rows: 2
		});
	}
	
	if ($(".shortplease.dscfotogalerie").length){
		$(".shortplease.dscfotogalerie").ThreeDots({
			max_rows: 2
		});
	}
	
	// pretty foto
	$("a[rel^='prettyPhoto']").prettyPhoto();
	
	$('input#hledat').click(
		function() {
			if (this.value == this.defaultValue) {
				this.value = '';
			}
		}
	);
	
	$('input#hledat').blur(
		function() {
			if (this.value == '') {
				this.value = this.defaultValue;
			}
		}
	);
});

function checkbox(obj)
{
	var img = obj + "placeholder";
	var val = $("#" + obj).val();
	
	if(val != 1)
	{
		$("#" + obj).val("1");
		$("#" + img).attr("src", "ui/images/b-checkbox-active.png");
	}
	else
	{
		$("#" + obj).val(0);
		$("#" + img).attr("src", "ui/images/b-checkbox.png");
	}
}

jQuery(function()
{
	var loader = '<img class="submit" src="ui/images/loader.gif" alt="..." />';
	
	var v = jQuery("#kontaktInfo").validate(
	{
		submitHandler: function(form)
		{
			jQuery("#submitdestination").html(loader);
			
			jQuery(form).ajaxSubmit({
				target: "#returnmsg"
			});
		}
	});

});

var Slider = new Object();
Slider.datas = new Array();
Slider.c = 0;

Slider.start = function()
{
	Slider.showMsg();
}
Slider.showMsg = function()
{
	$("#actual").fadeOut('slow', function() {
		document.getElementById("actual").href = Slider.datas[Slider.c]['link'];
		document.getElementById("actual").innerHTML = Slider.datas[Slider.c]['title'];
		$("#actual").fadeIn("slow", function() {
			setTimeout(Slider.showMsg, 6000);
		});
	});
	
	if(Slider.c == Slider.datas.length - 1)
		Slider.c = 0;
	else
		Slider.c++;
}

function hoverImage(img)
{
	if(document.getElementById("souhlas").value != 1)
		document.getElementById("souhlasplaceholder").src = img;
}
