$(function() {
	$(document).ready(function(){	
		$("#behaviorEditor").on("focusout",".editor input",function(){
		    var input = $(this);
		    if(input.attr("required") == "required" && input.val() == ""){
		    	information("Please fill in the parameter");
		    	input.focus();
		    }	    
		})
	});
});

function checkPluginsInput(plugins) {
	for (var i = 0; i < plugins.length; i++){
		for (var j = 0; j < plugins[i].parameters.length; j++){
			if (plugins[i].parameters[j].check =="false")
				return false;
		}
	}
	return true;
}

function checkPagesInput(pages) {
	for (var i = 0;i < pages.length; i++){
		for (var j = 0; j < pages[i].batches.length; j++){
			for (var k = 0; k < pages[i].batches[j].behaviors.length; k++){
				for (var q = 0; q < pages[i].batches[j].behaviors[k].parameters.length; q++){
					if (pages[i].batches[j].behaviors[k].parameters[q].check == "false"){
						return false;
					}					
				}
				
			}
		}
	}
	return true;
}