

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

View.prototype.init = function() {
	globalView.addButtonClass();
	
	var wanSelectOptionTemplate = "<option value='#value#'>#text#</option>";
	$("#wan").html("");
	$.each(this.model.wanList, function(key, wan) {
		$("#wan").append(wanSelectOptionTemplate.replace(/#value#/g, key).replace(/#text#/g, wan.name));
	});
	$("tr:has(td):has(#wan)").remove();
	showPage();
};

View.prototype.showHidePassword = function() {
	var $pass = $('#password');
    var $tempObj = $("<span>").insertAfter($pass);
    var $newObj = $("<input>").attr("id", "password");
    
    $.each($pass.data("events"), function(key, events){
		$.each(events, function(index, element){
			$newObj.on(key, element.handler);
		});
	});

	if ($pass.attr("type") == "text") {
		$newObj.attr("type", "password");
	} else {
		$newObj.attr("type", "text");
	}
	$newObj.val($pass.val());
	$pass.remove();
	$newObj.insertBefore($tempObj);
	$tempObj.remove();
};


