function ShowBigPhoto(picture,bigpicture,elem){
	$('#image-selected').attr('id','');
	$(elem).attr('id','image-selected');
	$('#bigphoto').attr('src',picture);
	$('#bigphoto').parent().attr('href',bigpicture);
}

function GetCalendarByMonth(calyear,calmonth, sportid){
	$('#eventstable').html('<div style="margin: 0 auto;"><img src="/img/loader.gif" alt="Идет загрузка..." style="margin: 55px 0" /></div>');
	$.get("1.php", { year: calyear, month: calmonth, sport_id: sportid }, OnLoaded);
}

function OnLoaded(data){
	$('#eventstable').html(data);
}

function ShowBox(elem){
	element = document.getElementById(elem);
	if(element.style.display == 'block'){
		element.style.display = 'none';
	}else{
		element.style.display = 'block';
	}
}
function toggle_block(id){
	$('#'+id).slideToggle("slow");
}

function CheckSearch(elem){
	if(elem.value == 'Поиск'){
		elem.value = '';
		elem.style.color = '#000';
	}
}
$(function(){
	$('.datepicker').datepicker(
                    {dateFormat: 'dd/mm/yy'});

	$("#tour-table table tr:nth-child(even)").addClass("striped");//
	$('#tour-tables li.sportname > a').click(function(){
		$(this).parent().find('ul').toggle('blind','{}',500);
		return false;
	});
});
	
function getSelected() {
  if(window.getSelection) { return window.getSelection(); }
  else if(document.getSelection) { return document.getSelection(); }
  else {
    var selection = document.selection && document.selection.createRange();
    if(selection.text) { return selection.text; }
    return false;
  }
  return false;
}
 $(document).ready(function(){
	ReturnSelectedSport();
	$('#tour-tables li ul').css('display','none');
	 
	 $(document).keypress(function(event){
		// alert(event.which);
		 if(event.ctrlKey && event.keyCode==13){
			var text = getSelected();
			text = text.toString();
			var url = document.location;
			url = url.toString();
			var data = {'errortext': text, 'errorurl': url};
			$.post('/senderror/',data,function(){
				alert('Спасибо. Сообщение об ошибке отправлено администратору сайта');
			});
		 }
	   });
 });

