﻿var tipApi = null
$(document).ready(function() {

    $(".tip").tooltip({position: 'bottom left',
                        onShow: function(ev) {
                            $(this.getTrigger()).addClass('gyorsmenu_active')
                        },
                        onHide: function(ev) {
                            $('.gyorsmenu_active').removeClass('gyorsmenu_active')
                        }

        });
	tipApi = $(".tip").data("tooltip"); 

	$.tools.tooltip.addEffect("toggle",

		function(done) {
			var conf = this.getConf(), tip = this.getTip(), o = conf.opacity;


			if (o < 1) { tip.css({opacity: o}); }
			tip.css({top: '48px', left: '-2px'});


			tip.show();
			done.call();
		},

		function(done) {
			this.getTip().hide();
			done.call();
		}
	);

// select //

	$('.selectbox').sSelect({
        defaultText: '- Válasszon!',
		scrollHeight: '500px',
		showType: 'click',
		isWrap: 'true'
	});

// datepicker //

    curDate = new Date();

    $('.date').datepicker({
            dateFormat: 'yy-mm-dd',
            minDate: new Date(curDate.getFullYear(), curDate.getMonth(), curDate.getDate() + 1),
            maxDate: new Date(curDate.getFullYear()+2, curDate.getMonth()+1, curDate.getDate()),
            buttonImageOnly: false,
            changeMonth: true,
            changeYear: true,
            showMonthAfterYear: true,
            showOn: 'both'
    });
    
// left menu //

	$(".subsub").hide();
	
	$("a.subsublink").click(function(){
		$(this).toggleClass("opened").next().toggle();
	});    

});


// keresés box //

function searchDown() {
	$(".search_details").animate({height: "240px"}, 200, function(){
		$(".search_details_in").css({display: 'block'});
		$("#searchOn").css({display: 'none'});
		$("#searchOff").css({display: 'block'});
	});
}
function searchUp() {
	$(".search_details").animate({height :"0"}, 200, function(){
		$(".search_details_in").css({display: 'none'});
		$("#searchOff").css({display: 'none'});
		$("#searchOn").css({display: 'block'});
	});
}


// aktuális idő //

function timeDisplay() {
	display = document.getElementById('time');
	var digital = new Date();
	var hours = digital.getHours();
	var minutes = digital.getMinutes(); 
	var seconds = digital.getSeconds();
 
	if (minutes <= 9) { minutes = '0' + minutes; }
	if (seconds <= 9) { seconds = '0' + seconds; }

	display.innerHTML = hours + ':' + minutes + ':' + seconds
	setTimeout('timeDisplay()', 1000);
}

