var cityname="";
var colfill="";




function printList(){
	var tbox = document.getElementById("printList");
	var trows = '<table id="tablerows" valign="middle" class="sortable" cellspacing="6"><thead><tr><th>City</th><th>Address</th><th>Descriptions</th></tr></thead>';
	
	for(var i=0; i< holidaylights.length; i++){
		var h = holidaylights[i][0];
		
		if(cityname != h['city']){
			cityname = h['city'];
			colfill= "<h3>"+cityname+"</h3>";
			
		}else{
			colfill="";
		}
	
		if(i%2==1)
			trows +="<tr valign='top'><td>"+colfill+"</td><td>"+h['address']+"</td><td>"+h['narrative']+"..."+h['description']+"</td></tr>";//+getPicture(h['pictures'])+"</td></tr>";
		else
			trows +="<tr style='background: #ccc' valign='top'><td>"+colfill+"</td><td>"+h['address']+"</td><td>"+h['narrative']+"..."+h['description']+"</td></tr>";//+getPicture(h['pictures'])+"</td></tr>";

		
	}

	trows += "</table>";
	tbox.innerHTML = trows;	
	
}

/*
function getPicture(arrpics){

	if(isEmpty(arrpics))
		return "";
		
	var arr = arrpics.split(";");
	var txt="";

	
		txt +='<div class="picture">';
		txt +='<img alt="Picture of display" src="'+imgpath+arr[0]+'" />';
		txt +='</div>';

	return txt;

}

*/


function isEmpty(val){

	if(val==null || val==undefined || val=="")
		return true;
	else
		return false;

}

window.onload = printList;