
var View = function(model) {
	this.model = model;
	this.init();
}

View.prototype.init = function() {
	this.fillVpnList(this.model.vpnInstances);
	$("a").button();
	showPage();
};

View.prototype.fillVpnList = function(vpnInstances) {
	var rowTemplate = "<tr><td>#row_number#</td><td>#server#</td><td>#enabled#</td><td>#status#</td><td><a id='editButton_#row_number#' href='../vpn_edit/vpn_edit.html?inst=#inst#'>#edit_button_text#</a></td></tr>";

	$("#vpnList").html("");
	var counter = 1;
	for(var key in vpnInstances) {
		$("#vpnList").append(rowTemplate.replace(/#row_number#/g, counter).replace(/#server#/g, vpnInstances[key].server).replace(/#status#/g, __ML_vpn_status_text[vpnInstances[key].status]).replace(/#enabled#/g, __ML_vpn_enabled_text[vpnInstances[key].enabled]).replace(/#edit_button_text#/g, __ML_vpn_settings_modify).replace(/#inst#/g, key));
		counter++;
	}
};

