$(document).ready(function() {
	$("body.team #sidenav li, body.inner #sidenav li, body.home #sidenav li, .blog-latest li div").click(function() {
		location.href = $(this).children('a').attr('href');
	});
	
	$('div.blog-item a').each(function(index) {
		var itemHeight = $(this).css('height').replace("px", "");
		if (itemHeight < 22) {
			$(this).css('paddingTop', itemHeight/2);
		}
	});
	
	var height1 = $("#sidenav").height();
	var height2 = parseFloat(height1);
	
	$("div.right-section").css("height", height2); 
	$("div.right-section").css("top", height2);
	$("#support-home, #services-home").css("top", 0);
	
	
	$("body:not(.home) #sidenav li, body:not(.inner) #sidenav li").click( function() {
		var className = $(this).attr("class");
		$('div.right-section').stop().animate({ 
			top: height2,
			opacity: 0
		}, 500, function() {
			$('#'+className).stop().animate({ 
				top: 0,
				opacity: 1
			}, 500 );
		});
		return false;
    });
	
	$("a.goback").click( function() {
		$('div.right-section').stop().animate({ 
			top: height2,
			opacity: 0
		}, 500, function() {
			$('#support-home').stop().animate({ 
				top: 0,
				opacity: 1
			}, 500 );
		});
		return false;
    });
	
	$("a.services-more").click( function() {
		$(this).closest('.right-section').stop().animate({ 
			top: -height2,
			opacity: 0
		}, 500, function() {
			$(this).next().stop().animate({ 
				top: 0,
				opacity: 1
			}, 500 );
		});
		return false;
    });
	
	$("a.services-less").click( function() {
		$(this).closest('.right-section').stop().animate({ 
			top: height2,
			opacity: 0
		}, 500, function() {
			$(this).prev().stop().animate({ 
				top: 0,
				opacity: 1
			}, 500 );
		});
		return false;
    });
	
	function livechat() {
		$('div.livechat').toggleClass('hover');
		if ($('div.livechat').hasClass("hover")) {
			$('div.livechat').stop().animate({ 
				right: "0"
			 }, 500 );
		}
		else {
			 $('div.livechat').stop().animate({ 
				right: "-223px"
			 }, 500 );
		}	
	}
	
	$("#livechat").click(function(){
		livechat();
	});
});

(function() {
    var license = '1066282',
        params = '',
        lang = 'en',
        skill = '0';

    __lc_load = function (p) { if (typeof __lc_loaded != 'function')
      if (p) { var d = document, l = d.createElement('script'), s =
 d.getElementsByTagName('script')[0], a = unescape('%26'),
        h = ('https:' == d.location.protocol ? 'https://' : 'http://'); l.type = 'text/javascript'; l.async = true;
        l.src = h + 'gis' + p +'.livechatinc.com/gis.cgi?serverType=control'+a+'licenseID='+license+a+'jsonp=__lc_load';
        if (!(typeof p['server'] !== 'string' || typeof __lc_serv === 'string')) {
          l.src = h + (__lc_serv = p['server']) + '/licence/'+license+'/script.cgi?lang='+lang+a+'groups='+skill;
          l.src += (params == '') ? '' : a+'params='+encodeURIComponent(encodeURIComponent(params)); s.parentNode.insertBefore(l, s);
        } else setTimeout(__lc_load, 1000); if(typeof __lc_serv != 'string'){ s.parentNode.insertBefore(l, s);}
      } else __lc_load(Math.ceil(Math.random()*5)); }
    __lc_load();
  })();
  
var __lc_buttons = __lc_buttons || [];
	__lc_buttons.push({
		elementId: 'LiveChat_1313162317',
		language: 'en',
		skill: '0'
});
