$(document).ready (function (){
$('#dialog_upload_my_face').dialog ({
bgiframe: true,
modal: true,
autoOpen: false,
width: 800,
buttons: {
«Закрыть»: function () {
$(this).dialog («close»);
}
}
});
$(«.add_my_face»).click (function (){
$('#dialog_upload_my_face').dialog ('open');
return false;
});
var options = {
beforeSubmit: onlyFileValidator,
success: function (data, statusText){
if (data.response == 'error')
{
$.gritter.add (data.error);
return false;
};
var w;
var h;
function showPreview (coords)
{
if (parseInt (coords.w) <0) return;
var rx = 100 / coords.w;
var ry = 100 / coords.h;
$('#face_form_step2 .input_prev_image_here img').css({
width: Math.round(rx * w) + 'px',
height: Math.round(ry * h) + 'px',
marginLeft: '-' + Math.round(rx * coords.x) + 'px',
marginTop: '-' + Math.round(ry * coords.y) + 'px'
});
$('#face_form_step2 input[name="crop[x1]"]').val(coords.x);
$('#face_form_step2 input[name="crop[y1]"]').val(coords.y);
$('#face_form_step2 input[name="crop[x2]"]').val(coords.x2);
$('#face_form_step2 input[name="crop[y2]"]').val(coords.y2);
$('#face_form_step2 input[name="crop[w]"]').val(coords.w);
$('#face_form_step2 input[name="crop[h]"]').val(coords.h);
};
if(data.response == 'ok')
{
$("#face_form_step2 .input_image_here").html('');
$(«#face_form_step2 .input_prev_image_here»).html ('