<!-- Copyright (c) 2003-2005, 2007 by Cisco Systems, Inc. -->

function getWarningString(str){
	var re_restart_preflight1 = "The boot image environment variable is not set.";
	var re_restart_preflight2 = "The {0} VLAN configuration file is corrupted.";
	var re_restart_preflight3 = "The {0} private configuration file is corrupted.";
	var re_restart_preflight4 = "The flash:/config.text configuration file is corrupted.";
	var re_restart_preflight5 = "The {0} VLAN configuration file does not exist on the switch.";
	var re_restart_preflight6 = "The {0} private configuration file does not exist on the switch.";
	var re_restart_preflight7 = "The flash:/config.text configuration file does not exist on the switch.";
	var re_restart_preflight8 = "The compact flash does not exist on the switch.";
	var re_restart_preflight9 = "The {0} boot image file does not exist on the switch.";
	var re_restart_preflight10 = "The {0} boot image file is corrupted.";

	var warnstring = "";
	var clioutput = str;
	if (clioutput.indexOf("***")==-1) return warnstring;
	var clilines = clioutput.split("***");
	for (var i=1; i<clilines.length; i++){
		if (clilines[i].indexOf("Boot image variable is not set")!=-1 ){
			warnstring+=re_restart_preflight1+"<BR>";	
		}
		else if (clilines[i].indexOf("Flash device not present")!=-1 ){
			warnstring+=re_restart_preflight8+"<BR>";	
		}
		else if (clilines[i].indexOf("Config file flash:/config.text is corrupted")!=-1 ){
			warnstring+=re_restart_preflight4+"\n";	
		}
		else if (clilines[i].indexOf("Config file flash:/config.text not found")!=-1 ){
			warnstring+=re_restart_preflight7+"<BR>";	
		}
		else if (clilines[i].indexOf("Vlan Config file")!=-1 ){
			var splitarray = split(" ",clilines[i] );
			var filename = splitarray[4];
			if (splitarray[5].indexOf("not")!=-1)
				warnstring+=replaceParams(re_restart_preflight5, new Array(""+filename))+"<BR>";			
			else  
				warnstring+=replaceParams(re_restart_preflight2, new Array(""+filename))+"<BR>";
		}
		else if (clilines[i].indexOf("Private Config file")!=-1 ){
			var splitarray = split(" ", clilines[i] );
			var filename = splitarray[4];
			if (splitarray[5].indexOf("not")!=-1)
				warnstring+=replaceParams(re_restart_preflight6, new Array(""+filename))+"<BR>";			
			else  
				warnstring+=replaceParams(re_restart_preflight3, new Array(""+filename))+"<BR>";
		}
		else if (clioutput.indexOf("Boot image file")!=-1 ){
			var splitarray = split(" ", clilines[i] );
			var filename = splitarray[4];
			if (splitarray[5].indexOf("not")!=-1)
				warnstring+=replaceParams(re_restart_preflight9, new Array(""+filename))+"<BR>";			
			else  
				warnstring+=replaceParams(re_restart_preflight10, new Array(""+filename))+"<BR>";
		}
	}
	return warnstring;
}

