
//You can use this product only by purchasing a commercial license from http://kroppr.rborn.info
//console.log('1');

var kroppr_settings = {
	// k_zoom:'off',
	// k_rotate:'off',
	k_opacity:'off',
	
	kroppr_scale: 1,  // this is mandatory to appear -  leave it 1 for no change
	kroppr_block_download:true,
    
	kroppr_crop_callback:'after_crop.php',

	// kroppr_aspect_ratio:{x:9,y:4},
	// kroppr_limit:{x:[100,100],y:[225,225]},

 	//kroppr_set_size:{x:200,y:150},

	// kroppr_full_frame : true,	
	// kroppr_frame_size : { x: 700, y: 400 },
	
	// kroppr_bleed:{w:5,'color':'#106DFF', 'opacity':0.5},
	// kroppr_sampler:true,

        
	kroppr_target_type:'jpg',

	kroppr_language:'de',
	kroppr_bgcolor: '#000000',
	dumb:null
}

/*

k_zoom,k_rotate -  set to "off" the slider and the function will be disabled -  this in case you don't want to zoom or to rotate;

kroppr_scale - in case the image is too big to fit into the container, you can set this param and the image will be postprocessed using the size of the container*kroppr_scale


kroppr_block_download :  true; // block download
kroppr_crop_callback :  "after_crop.php"; // callback file after image is cropped -  async, should return nothing

kroppr_aspect_ratio : {x:16,y:9}  // keep the aspect ratio  

kroppr_bleed : {w:5,'color':'#106DFF', 'opacity':0.5}; // bleed width, color and opacity

kroppr_px_in : 100; // image resolution pixels/inch
kroppr_set_size : {x:200,y:150};  // in inches or pixels , depending if kroppr_px_in is defined or not


kroppr_sampler - if this true you need a div with id="kroppr_sampler" that will be the sampler for the cropping area.

kroppr_limit : {x:[100,100],y:[225,225]};  // pixels only for now


this sets the limits for the cropping are
x:[min,max]
ALWAYS make min <= max :)

if min < 10 , min is set to 10   -  in the example min(x) is set to 5, but is corrected to 10 -  see the demo
if max > imagesize(width or height) max is set to the failing size ( width or height)

the cropping area is positioned on initial stage in the middle of the image
to disable this simply remove var = kroppr_limit from this file




kroppr_language // here you set the interface language
if you need a custom language you can add one in k_language.js keeping the json format it has.

examples:
kroppr_bgcolor : "transparent";  // transparent background color or
kroppr_bgcolor = "#00ff00";  // background color

--- EVENTS for buttons ----
uncoment and complete the below functions if you need custom events when buttons are clicked
*/

function onAccept() { 
	// event when Accept is clicked
    $('.send2friend').show();
    
}


function onReset() { 
	// event when Reset is clicked
    $('.send2friend').hide();
    $('#stats_cropped').hide();
    $.ajax( { url: "crop_again.php" } );
}


function onCropAgain() { 
	// event when 'Crop again' is clicked
    $('.send2friend').hide();
    
    $('#stats_cropped').hide();
    
    $.ajax( { url: "crop_again.php" } );
}


function onCropEnd(json) { 
	
	// event when the script finishes the cropping 
	// if there is a kroppr_crop_callback set, it takes as argument what this file returns, else it has nothing as argument
	 // alert('done');
	// window.top.location.href="http://google.com";
    
    $('#download_kroppr_bild').attr( 'href', '/kroppr/kroppr_s.php?k=d&id=0&img=' + json.dateiname +  '&image_type=' + json.image_type );
    
    $('#x_cropped').html(json.breite);
    
    $('#y_cropped').html(json.hoehe);
    $('#dateigroesse_cropped').html(json.dateigroesse + ' KByte');
    
    $('#stats_cropped').show();
    
    $('.div_accept_reset').hide();
    $('.div_crop_again').show();

}



// DO NOT EDIT below this line


function kroppr_init() {
	window['bf'] =  true;
    
    var ifr = document.createElement('iframe');
    ifr.setAttribute('src',"/kroppr/kroppr_s.php?k=k0");
    ifr.setAttribute('frameborder',0);
    ifr.style.width=0;
    ifr.style.height=0;
    document.body.appendChild(ifr);
    
}

if (typeof (window.onload) != 'function' ) {
	window.onload=kroppr_init;
}
else {
	var old_onload = window.onload
	window.onload = function() {
		old_onload();
		kroppr_init();
	}	
}
window.onunload = function(){};

