/**
 * oBRIK JAVASCRIPT LIB.
 * nocturnator.edgering.org
 *  
 **/   

function FileFeed(data)
{
 var str;
 
 data = data.toUpperCase();
 str = (data.substr((data.length-4),4));

 $('LetsObrikOpen').style.display = 'block';
 $('LetsObrik').disabled = (str=="JPEG" || str==".JPG") ? false : true;
}

/**/

function startCallback() 
{ 
 $('fEdt9').style.display = 'none';
 return true; 
}

/**/

function completeCallback(response) 
{   
 $('container').innerHTML = response;
 $('panel').style.display = 'block';  
 $('LetsObrikOpen').style.display = 'none';
  
 new Cropper.Img('testImage',{ onEndCrop: onEndCrop } );
}

/**/

function WriteAreaSize(dimensions)
{
 $( 'selection_size').innerHTML = dimensions.width + ' &times; ' + (dimensions.height);
}

/**/

function onEndCrop( coords, dimensions ) 
{
			$( 'x1' ).value = coords.x1;
			$( 'y1' ).value = coords.y1;
			$( 'x2' ).value = coords.x2;
			$( 'y2' ).value = coords.y2;			
      
      WriteAreaSize(dimensions);
      
      if (coords.x1>0)
       $('fEdt9').style.display = 'block';		
      	
}
