/* hide elements */
$(document).ready(function(){
	$('.bigbox_solutions').fadeOut(0,0)
	$('.bigbox_services').fadeOut(0,0)
	$('.bigbox_products').fadeOut(0, 0)
    $('.bigbox_references').fadeOut(0,0)
	$('.bigfooter_solutions').fadeOut(0,0)
	$('.bigfooter_services').fadeOut(0, 0)
	$('.bigfooter_products').fadeOut(0, 0)
	$('.bigfooter_references').fadeOut(0,0)
	
	$('ul.nav ul').fadeOut(0,0)
});

/* box riesenia */
$(document).ready(function(){ 
	$('.box_solutions').hover(
		function () {
			$('.bigbox_solutions').stop(true, true).fadeTo(0,1);
			$('.bigfooter_solutions').stop(true, true).fadeTo(0,1);
		},
		function () {
			$('.box_solutions').stop(true, true).delay(3600000).slideUp(0);  //3600000 = 1 hodina
		}
	);
	$('.bigbox_solutions').hover(
		function () {
			$('.box_solutions').stop(true, true).slideDown(0);
		},
		function () {
			$('.bigbox_solutions').stop(true, true).delay(0).slideUp(0); 
			$('.bigfooter_solutions').stop(true, true).delay(0).slideUp(0); 
		}
	);
});

/* box sluzby */
$(document).ready(function(){ 
	$('.box_services').hover(
		function () {
			$('.bigbox_services').stop(true, true).fadeTo(0,1);
			$('.bigfooter_services').stop(true, true).fadeTo(0,1);
		},
		function () {
			$('.box_services').stop(true, true).delay(3600000).slideUp(0);  //3600000 = 1 hodina
		}
	);
	$('.bigbox_services').hover(
		function () {
			$('.box_services').stop(true, true).slideDown(0);
		},
		function () {
			$('.bigbox_services').stop(true, true).delay(0).slideUp(0);
			$('.bigfooter_services').stop(true, true).delay(0).slideUp(0);
		}
	);
});

/* box produkty */
$(document).ready(function () {
    $('.box_products').hover(
		function () {
		    $('.bigbox_products').stop(true, true).fadeTo(0, 1);
		    $('.bigfooter_products').stop(true, true).fadeTo(0, 1);
		},
		function () {
		    $('.box_products').stop(true, true).delay(3600000).slideUp(0);  //3600000 = 1 hodina
		}
	);
	$('.bigbox_products').hover(
		function () {
		    $('.box_products').stop(true, true).slideDown(0);
		},
		function () {
		    $('.bigbox_products').stop(true, true).delay(0).slideUp(0);
		    $('.bigfooter_products').stop(true, true).delay(0).slideUp(0);
		}
	);
});

/* box referencie */
$(document).ready(function(){ 
	$('.box_references').hover(
		function () {
			$('.bigbox_references').stop(true, true).fadeTo(0,1);
			$('.bigfooter_references').stop(true, true).fadeTo(0,1);
		},
		function () {
			$('.box_references').stop(true, true).delay(3600000).slideUp(0);  //3600000 = 1 hodina
		}
	);
	$('.bigbox_references').hover(
		function () {
			$('.box_references').stop(true, true).slideDown(0);
		},
		function () {
			$('.bigbox_references').stop(true, true).delay(0).slideUp(0);
			$('.bigfooter_references').stop(true, true).delay(0).slideUp(0);
		}
	);
});

/* dropdown menu */
$(document).ready(function() {
	$('.nav li').hover(
		function () {
			$('ul', this).stop(true, true).slideDown(0);
		},
		function () {
			$('ul', this).stop(true, true).delay(0).slideUp(0); 
		}
	);
});

/* search focus and blur */
$(document).ready(function() {
	$('.search_panel input').focus(function() {
		var value=$(this).val();
		$(this).val("");
	});
	$('.search_panel input').blur(function() {
		if($(this).val()=="") {
			$(this).val("Vyhľadávanie");
		}
	});
});

/* autocomplete */
$(function() {
	var availableTags = [
		"Riešenia",
		"Internetový obchod – e-shop",
        "Grafický dizajn",
        "Aplikácie na mobil a smartfóny",
        "Internetové hry",
        "Firemná identita – corporate identity",
        "Intranet",
        "Úprava web stránok",
        "Aplikácie na kľúč",
		"Služby",
        "Tvorba web stránok",
        "SEO optimalizácia",
        "Internetový marketing",
        "Písanie textov - Copywriting",
        "Webhosting",
        "Registrácia domén",
        "Registrácia do vyhľadávačov",
        "Foto služby",
        "Internet reklama Google AdWords",
        "Štatistiky Google Analytics",
        "Testovanie web stránok – Web Audit",
        "Testovanie prístupnosti – Web usability",
        "Školenia a konzultácie",
        "Podpora pre zákazníkov",
        "Mapy Google",
        "Správa web stránok",
        "Tvorba newslettrov",
		"E-shop",
		"Eshop",
		"SEO",
		"Google Analytics",
		"Google AdWords",
	];
	$( ".search_panel input" ).autocomplete({
		source: availableTags
	});
});

//facebook like
(function (d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/sk_SK/all.js#xfbml=1&appId=216556841757919";
    fjs.parentNode.insertBefore(js, fjs);
} (document, 'script', 'facebook-jssdk'));
