function getClientSize()
{
	var d = document;
	
	if (d.clientHeight)
		return {width: d.clientWidth, height: d.clientHeight}; 
	else
		return {width: d.body.clientWidth, height: d.body.clientHeight};
}

function getId(idAttr)
{
    return idAttr.substring(idAttr.indexOf('-') + 1);
}

function confirmAction(action, location)
{
	var msg = (action == 'delete') 
				? 'Вы действительно хотите удалить запись?' 
				: 'Вы уверены, что хотите выполнить данное действие?';
	
	var result = confirm(msg);
	if (location && result) window.location.href = location;
	return result;
}

function winopen(url, param)
{
	window.open(url, '', param, 'left=0, top=0');
}

function preventSubmition(event)
{
	if (event.keyCode == 13)
		{
//		event.keyCode = 9;
		return false;
		}
}

$(document).ready(function() {
	focus_field = document.getElementById('focus_field');
	if (focus_field)
		focus_field.focus();
	
	calendar_exists = $('.datepicker').length;
	
	if (calendar_exists)
	{
		$.datepicker.setDefaults($.datepicker.regional['ru']);
		$('.datepicker').datepicker({
			dateFormat: 'dd.mm.yy',
			changeMonth: true,
			changeYear: true,
			duration: 'fast',
			showButtonPanel: true
		});
	}
	
	$('#seo').addClass("hidden");
	$('#seo_details').click(function() {
		$('#seo').toggleClass("hidden");
		
		if ($('#seo').hasClass("hidden"))
			text = "Подробнее";
		else
			text = "Скрыть";
			
		$('#seo_details').text(text);
	});
});
