// Change element content based on config.js

// document.getElementById('maintitle').innerHTML = config.title;

/*

function init() {
    // Initialize Canvas
    canvas = document.getElementById("canvas");
    ctx = canvas.getContext('2d');

	var background = new Image();
	background.src = "images/base.png";

	// Make sure the image is loaded first otherwise nothing will draw.
	background.onload = function(){
		ctx.drawImage(background,0,0);
	}
	//stage.update();


    // Load image on the canvas
	var img = new Image();
    img.onload = function() {
        ctx.drawImage(img, 0, 0);
    }
    img.src = "images/synthikes-isorropias.svg";

}


// init();
*/


// Set default values
$("#power_f1").val(config.f1_value);
$("#num_power_f1").val(config.f1_value);
$("#distance_r1").val(config.r1_value);
$("#num_distance_r1").val(config.r1_value);

$("#power_f2").val(config.f2_value);
$("#num_power_f2").val(config.f2_value);
$("#distance_r2").val(config.r2_value);
$("#num_distance_r2").val(config.r2_value);


// Calculate initial Ropes
calc_ropes();




// Initilize Drawings

// Set the F1, F2 power length based on initial values
// resize_power_f1(f1_power.x, f1_power.y);
// resize_power_f2(f2_power.x, f2_power.y);


// Set the R1, R2 radius based on initial values
resize_radius_f1(config.r1_value);
resize_radius_f2(config.r2_value);





// Show Coordinates on MouseDown (x,y)
// source: https://www.html5canvastutorials.com/advanced/html5-canvas-mouse-coordinates/
/*
function writeMessage(canvas, message) {
	var context = canvas.getContext('2d');
	context.clearRect(0, 0, canvas.width, canvas.height);
	// context.clearRect(0, 0, 400, 200);
	context.font = '14pt Arial';
	context.fillStyle = 'black';
	context.fillText(message, 10, 25);
	stage.update();
}

function getMousePos(canvas, evt) {
	var rect = canvas.getBoundingClientRect();

	return {
          x: evt.clientX - rect.left,
          y: evt.clientY - rect.top
	};
}

var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');

canvas.addEventListener('mousemove', function(evt) {
	var mousePos = getMousePos(canvas, evt);
	var message = 'x,y: ' + mousePos.x + ',' + mousePos.y;
	writeMessage(canvas, message);
},false);

*/
