

try{
	//rates definition
	frontPageRates = [
		["Haiti ", 0.18  ],
		["Cameroon", 0.21],
		["Dominican rep.", 0.11],
		["Lebanon ", 0.14],
		["Syria ", 0.23],
		["Brazil ", 0.09]
	];
}
catch(e){
	alert("Incorectly defined rates")	
}

function generateRates(){
	var header = '<table width="100%"  border="0" cellspacing="0" cellpadding="3">' +
						'<tr>'+
       					'<td colspan="2" class="header1">FEATURED RATES </td>'+
       				'</tr>' + 
					   '<tr>' +
					       '<td class="frontRates" width=50%><b>Country</b></td>' + 
					       '<td class="frontRates" width=50%><b>Rate</b> [USD/min]</td>' + 
					    '</tr>';
	var footer = '</table>';
	var body = "";
	
	try{
		for(var i=0; i < frontPageRates.length; i++){
			body += 	'<tr>' + 
							'<td class="frontRates">' 		+ frontPageRates[i][0] + '</td>' +
							'<td class="frontRates"><b>' 	+ frontPageRates[i][1] + '</b></td>' +
						'</tr>';
		}
	}
	catch(e){
		alert("Incorectly defined rates")
	}
	
	return header + body + footer;
}

document.write( generateRates());