// object prototype discribed:
//http://yehudakatz.com/2011/08/12/understanding-prototypes-in-javascript/
//http://iwiki.readthedocs.org/en/latest/javascript/js_core.html#inheritance
//http://stackoverflow.com/questions/572897/how-does-javascript-prototype-work
//http://phrogz.net/js/classes/OOPinJS.html
//https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects
//https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FObject%2Fcreate
//
//




var template = Object.create(null); // create an empty template object

// create empty template
Object.defineProperty(template, 'templateName', {
  value: "Empty template",
  writable: true,
  enumerable: true,
  configurable: true
});

function Template1() {
    var t1 =  {};
		t1.templateName = "Template1";
    console.log("templateName = " + t1.templateName);
    t1.background
}


function insertImage(){
	$('#do_creator_controls')
		.append(
			'<div id = "insert_image_name_div">'+
				'<input type="text" id="insert_image_name" placeholder="Image file name" >'+
				'<button id="insert_image_name_save" onclick="getInsertedText()">Save text</button>'+
			'</div>');
	$('#insert_image_name_div')
		.css({
			'position':'fixed',
			'top':'100px',
			'left':'100px'
		});
}

function getInsertedText() {
	var oSection = 'section'+ (inSection+1);
	var oSlide = 'slide' + (inSlide+1);
	
	doContent[oSection][oSlide] = '<img src="content/' + $('#insert_image_name').val() + '.jpg" alt="" ></img>';
	$('#insert_image_name_div').remove();
	console.log(doContent[oSection][oSlide]);
}


function insertText(){
	$('#do_creator_controls')
		.append(
			'<div id = "insert_image_name_div">'+
				'<input type="text" id="insert_image_name" placeholder="Image file name" >'+
				'<button id="insert_text_button" >Save text</button>'+
			'</div>');
	$('#insert_image_name_div')
		.css({
			'position':'fixed',
			'top':'100px',
			'left':'100px'
		});
}

function inserTextToSlide() {
	var oSection = 'section'+ (inSection+1);
	var oSlide = 'slide' + (inSlide+1);
	
	var slide = doContent[oSection][oSlide];
	
	insertText();
	$(document).keyup(function(e){
		if (e.keyCode == 13) {
			slide.text = $('#insert_image_name').val();
		}
	});
	
	
	 
}