?>
<script type="text/javascript">
function onEndCrop( coords ) {
jQuery( '#x1' ).val(coords.x);
jQuery( '#y1' ).val(coords.y);
jQuery( '#width' ).val(coords.w);
jQuery( '#height' ).val(coords.h);
}
jQuery( function() {
var xinit = <?php
echo absint( get_theme_support( 'custom-header', 'width'
) ); ?>;
var yinit = <?php
echo absint( get_theme_support( 'custom-header', 'height'
) ); ?>;
var ratio = xinit / yinit;
var ximg = jQuery('img#upload').width();
var yimg = jQuery('img#upload').height();
if ( yimg < yinit || ximg < xinit ) {
if ( ximg / yimg > ratio ) {
yinit = yimg;
xinit = yinit * ratio;
} else {
xinit = ximg;
yinit = xinit / ratio;
}
}
jQuery('img#upload').imgAreaSelect({
handles: true,
keys: true,
show: true,
x1: 0,
y1: 0,
x2: xinit,
y2: yinit,