//////////////////////////////////////////////////////////////////////////////////////////////////////////
// INFOSOFT SA DE CV
// Fecha: 01-23-2005
// Updates:01-28-2005
// Author:Rodolfo Machon
// Nombre del archivo: prof.js
// Description:Save(),ConstructTable()
//////////////////////////////////////////////////////////////////////////////////////////////////////////
function Save(){
	var opts  = document.report.gi.value;
	document.report.gh.value="";
	document.report.gb.value="";
	document.report.gf.value="";	
	document.report.submit();
}
function ConstructTable(){
	var grid_header		= document.report.gh.value.split("~~");	
	var grid_body		= document.report.gb.value.split("~~");
	var T  				= document.getElementById('t1');
	var header_length	= (grid_header.length*1);
	var Cells 			= new Array(header_length);
	var element_type	= new Array(header_length);
	var NewRow			= T.insertRow(0);
	var options			= "";
	for (j=0;j<grid_header.length-1;j++){
		record			= grid_header[j].split("|");
		Cells[j]  		= NewRow.insertCell(j);
		Cells[j].innerHTML	= record[0];
		element_type[j]		= record[1];
	}
	for (var i=0;i<grid_body.length-1;i++){
		record			= grid_body[i].split("|");
		NewRow			= T.insertRow(i+1);
		for (j=0;j<grid_header.length-1;j++){
			var checked = "";
			if(element_type[j]=="text"){
				href	= record[j+1];
			}else{
				if (record[j+1]=="YES"){checked = "checked"}
				href	= "<input type=checkbox name=c"+i+j+" value=1 "+checked+">";			
			}
			Cells[j]  		= NewRow.insertCell(j);
			Cells[j].innerHTML	= href;
		}
		options += record[1]+"|";
	}
	document.report.gi.value = options;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////