function $getid(eid){
  return(document.getElementById(eid));
}

var animated = true
var tm
var corner_time_delay = 7000

//jkmegamenu.definemenu("popup-link", "popup", "mouseover")

function CornerAnimation() {

	if (animated == true) {

	$(".top-left-corner").animate(

		{width: '57px', height: '60px'}, 
		500, 
		function() {
			$(".top-left-corner").animate({width: '45px', height: '49px'}, 500)
		}
	);
	}
	tm = setTimeout('CornerAnimation();', corner_time_delay);
}

$(document).ready(function(){

	$('.popup').hover(
			function() {
				$(this).addClass('hovered');
				$(this).show();
			},
			function() {
				$(this).removeClass('hovered');
				$(this).hide();
			}
		)

	$('#popup-link').hover(
		function() {

			$('.popup').show();
			//$('.popup').addClass('hovered')

			animated = false
			clearTimeout(tm)
		},

		function() {
			if ($('.popup').hasClass('hovered')!= 'true') {	
				$('.popup').hide();
			}
		}
	)

CornerAnimation();

	//$(".top-left-corner").hover(function() {
      //$(".top-left-corner").stop().animate({width: '62px', height: '67px'}, 500);
	 // $('.puls').fadeIn(200);
	 // animated = false
      //} , function() {
      //	$(".top-left-corner").stop().animate({width: '45px', height: '49px'}, 200);
		//$('.puls').fadeOut(200);
		//animated = true
      //});

	$("div#slider-scroll").scrollable({clickable: false, keyboard: false}).circular();
	$('#slider-next').click(function() {$("div#slider-scroll").scrollable().next();});
	$('#slider-prev').click(function() {$("div#slider-scroll").scrollable().prev();});

	$("ul.tabs").tabs(
		"div.tabs-content div.tab",
		{
			effect: 'fade',
			fadeOutSpeed: 0,
			fadeInSpeed: 400,
			tabs: 'a'
		}
	);

function DropCloseAll() {
        $('.drop-list').find('.opened').each(
                                function() {                                                                     
                                        $(this).removeClass('opened');
                                        $(this).find('.list-content').slideUp(300);
                                }           
        );      
}

        
$('.drop-list .list-item .list-tlt').click(
                function() {
                        if ( $(this).closest('.list-item').hasClass('opened') != true) {
                                DropCloseAll()
                                $(this).closest('.list-item').addClass('opened');
                                $(this).closest('.list-item').find('.list-content').slideDown(300);       
                        }
                        else {
                                DropCloseAll()
                        }              
                }        
)	  

$('.serv-cells').find('.bottom').each(
        function() {
                var rh = $(this).closest('.row').height();
                var ch = $(this).height();
                if (ch < rh) {
                        $(this).css('height', rh - 22 + 'px');
                }
        }
)

var seo = $('.seo').html();
$('.seo-b').html(seo);

$('.seo-btn').click(function(){
							 
	if ($(this).parent().hasClass('seo-b-opened') != true) {

		$('.seo-b').css('background-position', 'bottom left');
		
		$('.seo-b').slideDown(600, function() {
				$.scrollTo($('.seo-b'), {duration: 800});
		});
		$(this).parent().addClass('seo-b-opened');

	}
	else {
	
		$('.seo-b').slideUp(600);
		$(this).parent().removeClass('seo-b-opened');		
	
	}

})

});

function switchDetails(c) {
  var i = c.getElementsByTagName('IMG')[0];
  var t = c.getElementsByTagName('TABLE')[0];
  var f = (t.offsetHeight == 0);
 
  i.src = f? '/common/img/uploaded/ikon/ned.gif' : '/common/img/uploaded/ikon/pl.gif';
  t.style.display = f? '' : 'none'
}
