$(function (){
	$(".FaceBookLikebox").hover(function(){
		$(".FaceBookLikebox").stop(true, false).animate({right:"0"},"medium");
	},function(){
		$(".FaceBookLikebox").stop(true, false).animate({right:"-205"},"medium");
	},500);
	
	$(".LeftSlideBox").hover(function(){
		$(".LeftSlideBox").stop(true, false).animate({left:"0"},"medium");
	},function(){
		$(".LeftSlideBox").stop(true, false).animate({left:"-192"},"medium");
	},500);

});

$(document).ready(function(){		
	$("a#GroupAddPostFancybox").fancybox({
		'width'				: '60%',
		'height'			: '75%',
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});
});

$(document).ready(function(){		
	$("a#GroupSeeComments").fancybox({
		'width'				: '60%',
		'height'			: '75%',
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe',
		'onClosed': function() {
    		parent.location.reload(true); ;
  		}
	});
});

$(document).ready(function(){		
	$("a#EventEdit").fancybox({
		'width'				: '80%',
		'height'			: '75%',
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe',
		'onClosed': function() {
    		parent.location.reload(true) ;
  		}
	});
});

$(document).ready(function(){		
	$("a#AddEvent").fancybox({
		'width'				: '60%',
		'height'			: '75%',
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
});

$(document).ready(function(){		
	$("a#AddTrip").fancybox({
		'width'				: '60%',
		'height'			: '75%',
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
});

$(document).ready(function(){		
	$("a#LoveEditUser").fancybox({
		'width'				: '80%',
		'height'			: '75%',
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
});

$(document).ready(function(){		
	$("a#LoveCoffeeAdd").fancybox({
		'width'				: '80%',
		'height'			: '75%',
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
});

$(document).ready(function(){		
	$("a#LoveMessage").fancybox({
		'width'				: '80%',
		'height'			: '75%',
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
});




function readCookie(name)
{
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0)
  { 
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}

function count_key(textarea,counter,limit)
{
	if((a=textarea.value.length)<=limit)
		counter.value=limit-a;
	else
		textarea.value=textarea.value.substring(0,limit);
}
				
function startTranslation(lang1, lang2){
	$('body').translate(lang1, lang2, {
    	not: 'select',
        start: function(){   $('#Translating').show() },
        complete: function(){   $('#Translating').hide()   },
        error: function(){   $('#Translating').hide()   }
                               
        })
	document.cookie="destLang="+lang2;
}

jQuery(function($){
	var destLang=readCookie('destLang');
	if((destLang)&&(destLang!='pl')){
		go=startTranslation('pl',destLang);
	}
});
