$(document).ready(function(){
	var URL="1ekzEPL66WgcYSj-vbr3IeyZnheZoe06ekShbAT5X7_g";

	Tabletop.init({key: URL, callback: convertToJSON, simpleSheet: true})
});

//converts data from spreadsheet to JSON format
function convertToJSON (data){
	console.log(data);
	for(i=0; i<data.length; i++){
	if (data[i]["sciences"]==="TRUE"){
		var imagecode="<div class ='col-md-7'>"+
						"<img class ='img-responsive' + src ='" + data[i]["imagelink"] + "'width='200px' height='200px'; alt=' '>" +
						"</div>";
		console.log(imagecode);
		$("#big").append(imagecode);

		var htmlcode= "<div class = 'col-md-5'>"+
						"<h3>" + data[i]["name"] + "</h3>" +
						"<h4>" + data[i]["city"] + "</h4>" +
						"<p>" + data[i]["description"] + "</p>" +
						"<a class ='btn btn-primary' href='#''>" + "Contact" + " " + data[i]["name"] + "<span class ='glyphicon glyphicon-chevron-right'></span></a>" +
						"<div style ='height:100px;''> </div>";
		$("#big").append(htmlcode);
	}

	}
}
