// JavaScript Document
var objLiHovered = null;
var lSubIn = false;

function checkHover() {
  if(objLiHovered/* && !lSubIn*/) {
    objLiHovered.find('ul').fadeOut('fast');
    objLiHovered = null;
  }
}

$(document).ready(
		function(){
			
			$('#header_pics').fadeIn(200);
		  
			$('#header_pics').innerfade({
				speed: 'slow',
				timeout: 5000,
				type: 'sequence',
				containerheight: '321px'
			});
			
			$('#gallery_pics').innerfade({
				speed: 'slow',
				timeout: 5000,
				type: 'sequence',
				containerheight: '150px'
			});
			
			$('#webcams').innerfade({
				speed: 'slow',
				timeout: 6000,
				type: 'sequence',
				containerheight: '130px'
			});
			
			$('jqtip *').tooltip({ delay: 0});
			
			$('li#about_snk').hover(function() {
				
				$(this).find('ul').fadeIn('fast');
				$(this).find('#hovno').fadeIn('fast');
				objLiHovered = null;
			}, function() {
				objLiHovered = $(this);
				objLiHovered.find('#hovno').fadeOut('slow');
				setTimeout(
					"checkHover()",
					50);
			});
			
			setTimeout("$('#sticker').fadeIn(300);", 150);
			
			$('#snk').fadeIn(300);
			$('#logo').fadeIn(600);
			
			$("#searchRight").focus( function() {
			  if ($(this).attr("value") == "Hledat...")
			    $(this).attr("value", "");}
			);
			
			$("#searchRight").blur( function() {
			  if($(this).attr("value") == "")
			    $(this).attr("value", "Hledat...");
			});
		}
	);

// maximalni delka textarea
function ismaxlength(obj){
  var mlength = obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : 500;
  if (obj.getAttribute && obj.value.length>mlength)
    obj.value=obj.value.substring(0,mlength)
}

function reactOnBlurField(obj) {
  var lField = document.getElementById('email1');
  lField.value = "hehe" + obj.value + "haha";
}