<!--

function setDefault() {

	initColPos("default");
	writeColPosCookie();
	
	initVisible(Horse_Base);
	writeColSelectCookie();
	
	buildTable();
}

function setViewBase(BaseType) {	
	
	if ( BaseType == Default_Base) {
	   initColPos("default");
	   writeColPosCookie();
	}
	initVisible(BaseType);
	writeColSelectCookie();
	
	buildSelect();
	
	buildTable();
}

function Refresh() {
	writeColSelectCookie();
	selectProfile = "Customise";
	buildSelect();
	buildTable();
}


function openHelpWin() {
}

function buildSelect() {
    var count = 1;
    var ColNum = 5;
    var TableWidth = 750;
    var ColWidth = TableWidth / ColNum;
    var group = ColSelectGrouping.split("|") ;
    var td_bgcolor = "#cccccc";
  	
	strHTML = "<table border='0' width='" + TableWidth  + "' class=\"subheader\"><tr><td><table border=0 cellspacing=1 cellpadding=1>" ;
	
		strHTML = strHTML + "<tr bgcolor =\"#eeeeee\"><td colspan=\"" + ColNum + "\">";
		strHTML = strHTML + "<table bgcolor =\"#eeeeee\" width=\"100%\"><tr>";
		
		if (selectProfile == "Default") 
			strHTML = strHTML + "<td width=\"15%\" bgcolor=\"" + td_bgcolor + "\" ><font face=" + fontface + " size=\"2\"><a href=\"javascript:setViewBase(Default_Base);\">Default</a></font></td>";
		else
			strHTML = strHTML + "<td width=\"15%\"><font face=" + fontface + " size=\"2\"><a href=\"javascript:setViewBase(Default_Base);\">Default</a></font></td>";
		
		if (PageName == "declaration") {
		/*	if (selectProfile == "Horse-Based") 	
				strHTML = strHTML + "<td width=\"15%\" bgcolor=\"" + td_bgcolor + "\"><font face=" + fontface + " size=\"2\"><a href=\"javascript:setViewBase(Horse_Base);\">Horse-Based</a></font></td>";
			else
				strHTML = strHTML + "<td width=\"15%\"><font face=" + fontface + " size=\"2\"><a href=\"javascript:setViewBase(Horse_Base);\">Horse-Based</a></font></td>";
		
			if (selectProfile == "Jockey-Focus") 	
				strHTML = strHTML + "<td width=\"15%\" bgcolor=\"" + td_bgcolor + "\"><font face=" + fontface + " size=\"2\"><a href=\"javascript:setViewBase(Jockey_Base);\">Jockey-Focus</a></font></td>";
			else
				strHTML = strHTML + "<td width=\"15%\"><font face=" + fontface + " size=\"2\"><a href=\"javascript:setViewBase(Jockey_Base);\">Jockey-Focus</a></font></td>";
				
			if (selectProfile == "Statistical") 		
				strHTML = strHTML + "<td width=\"15%\" bgcolor=\"" + td_bgcolor + "\"><font face=" + fontface + " size=\"2\"><a href=\"javascript:setViewBase(Stat_Base);\">Statistical</a></font></td>";
			else
				strHTML = strHTML + "<td width=\"15%\"><font face=" + fontface + " size=\"2\"><a href=\"javascript:setViewBase(Stat_Base);\">Statistical</a></font></td>";
		*/
		}
		
		if (selectProfile == "Customise") 
			strHTML = strHTML + "<td width=\"15%\" bgcolor=\"" + td_bgcolor + "\"><font face=" + fontface + " size=\"2\"><a href=\"javascript:Refresh();\">Refresh</a></font></td>";
		else
			strHTML = strHTML + "<td width=\"15%\"><font face=" + fontface + " size=\"2\"><a href=\"javascript:Refresh();\">Refresh</a></font></td>";
				
		strHTML = strHTML + "<td width=\"20%\"><font face=" + fontface + " size=\"2\">&nbsp;</font></td>";
		strHTML = strHTML + "<td width=\"15%\" align=right></td>";
		strHTML = strHTML + "</tr></table>";
		strHTML = strHTML + "</td></tr>";
		strHTML = strHTML + "<tr></tr>"; //add bold line
	
	
	for (j = 0; j < group.length; j++) {
		var groupElements = group[j].split("^");
		var colNum = groupElements[1].split("&");
						
		strHTML = strHTML + "<tr bgcolor=\"#ffffff\">" ;
				
		if (groupElements[0] == "GROUP" ) {
			count = 1;
		} else	{
			// show grouping name
			strHTML = strHTML + "<td align=left nowrap width='" + ColWidth + "' class=\"subsubheader\" style=\"text-align:left\"><b>" + groupElements[0] + "</b></td>" ;
			count = 2;
		}
		
		for ( k = 0; k < colNum.length; k++) {
			Col = TableCol[colNum[k]];
			if (Col[1] != "notshow") {
				
				if ( Col[1]=="show") {
					strChecked = "CHECKED";
				} else {
					strChecked = "";
				}
				
				// Beginning <tr>
				if ((count % ColNum) == 1 && count != 1) {
					strHTML = strHTML + "<tr bgcolor=\"#ffffff\">";				
				}
				
				// Handle first cell needed grouping
				if ((count % ColNum) == 1 && count != 1 && groupElements[0] != "GROUP") {						
					strHTML = strHTML + "<td width='" + ColWidth + "'>&nbsp;</td>";
					count ++;	// skip first column for grouped item						
				}
				
				// Others cells in a row
				if (Col[10]=="CARD_NO" || Col[10]=="BAR_DRAW" || Col[10]=="HORSE_NAME")
					strHTML = strHTML + "<td align=left nowrap width='" + ColWidth  + "'><input type=checkbox id=chk_" + colNum[k] + " " + strChecked +  " value=" + colNum[k] + " name=" + Col[0] + " onClick=\"colRefresh(form2);\" disabled><font face=" + fontface + " size=\"1\">" + Col[6] + "</font></td>";	 				
				else
					strHTML = strHTML + "<td align=left nowrap width='" + ColWidth  + "'><input type=checkbox id=chk_" + colNum[k] + " " + strChecked +  " value=" + colNum[k] + " name=" + Col[0] + " onClick=\"colRefresh(form2);\"><font face=" + fontface + " size=\"1\">" + Col[6] + "</font></td>";	 
				
				// Ending <tr> 				
				if ((count % ColNum) == 0) {		
					strHTML = strHTML + "</tr>";					
				}		
							 
				count ++;
			}										
		}
		
		// Padding remaining empty cells
		if ( (count % ColNum) != 1 ) {
			while ( (count % ColNum) != 1) {
				strHTML = strHTML + "<td width='" + ColWidth + "'>&nbsp;</td>" ;
				count ++;
			}
			strHTML = strHTML + "</tr>";	
		}		
		
		if ( j < group.length -1 ) {
			strHTML = strHTML + "<tr></tr>" ;
		}
	}
	
	strHTML = strHTML + "</table></td></tr></table>";
	
	if (ie4) {
		SelectArea.innerHTML = strHTML;
	}

	if (ns4) {
		SelectArea.document.open();
		SelectArea.document.write(strHTML);
		SelectArea.document.close();
	}
}


-->

