var RESTAURANTS = [];
RESTAURANTS[0]={name: "Bar 1848", code: "bar1848", lat: 45.422529, lng: -75.683768, location: "University Centre - Level 2", phone: "613.562.5800 ext: 2013", ps: "", icon: "1848", iconWidth: "44", show: true, multiple: false, campus: "main", iconHeight: 27};
RESTAURANTS[1]={name: "Caf&eacute; Alt", code: "cafeAlt", lat: 45.423294, lng: -75.685871, location: "Simard - Level 0", phone: "", ps: "", icon: "cafe_alt", iconWidth: "58", show: true, multiple: false, campus: "main", iconHeight: 27};
RESTAURANTS[2]={name: "Caf&eacute; Ecolo", code: "cafeEcolo", lat: 45.422179, lng: -75.682052, location: "Lamoureux Hall - Level 1", phone: "613.562.5800 ext: 4208", ps: "Meal Plans and Taste it! card accepted", icon: "cafe_ecolo", iconWidth: "27", show: true, multiple: false, campus: "main", iconHeight: 41};
RESTAURANTS[3]={name: "Caf&eacute; Escalupe", code: "cafeEscalupe", lat: 45.402714, lng: -75.650772, location: "Roger Guindon - Level 1 (General Hospital)", phone: "613.562.5800 ext: 8007", ps: "Meal Plans and Taste it! card accepted", icon: "cafe_escalupe", iconWidth: "27", show: true, multiple: false, campus: "altaVista", iconHeight: 42};
RESTAURANTS[4]={name: "Caf&eacute; Nostalgica", code: "cafeNostalgica", lat: 45.423971, lng: -75.683972, location: "603 Cumberland St.", phone: "613.562.5800 ext: 3014", ps: "", icon: "cafe_nostalgica", iconWidth: "21", show: true, multiple: false, campus: "main", iconHeight: 56};
RESTAURANTS[5]={name: "Caf&eacute; Plus", code: "cafePlus", lat: 45.424333, lng: -75.686182, location: "Tabaret Hall - Level 0", phone: "613.562.5800 ext: 1393", ps: "Meal Plans and Taste it! card accepted", icon: "cafe_plus", iconWidth: "27", show: true, multiple: false, campus: "main", iconHeight: 42};
RESTAURANTS[6]={name: "Cafeteria", code: "cafeteria", lat: 45.419506, lng: -75.679531, location: "Colonel By Hall - Basement B Block", phone: "", ps: "", icon: "icon_cafeteria_32", iconWidth: "20", show: true, multiple: false, campus: "main", iconHeight: 32};
RESTAURANTS[7]={name: "Coyote Jack's Grill", code: "coyoteJacks", lat: 45.422552, lng: -75.683634, location: "University Centre", phone: "", ps: "", icon: "coyote_jacks", iconWidth: "40", show: true, multiple: true, campus: "main", iconHeight: 43};
RESTAURANTS[8]={name: "Coyote Jack's Grill", code: "coyoteJacks", lat: 45.419321, lng: -75.679112, location: "SITE Building", phone: "", ps: "", icon: "coyote_jacks", iconWidth: "40", show: false, multiple: true, campus: "main", iconHeight: 43};
RESTAURANTS[9]={name: "Extreme Pita", code: "extremePita", lat: 45.422458, lng: -75.683827, location: "University Centre", phone: "", ps: "", icon: "extreme_pita", iconWidth: "35", show: true, multiple: false, campus: "main", iconHeight: 40};
RESTAURANTS[10]={name: "Food Services Info Centre", code: "foodServices", lat: 45.422635, lng: -75.683709, location: "University Centre, Jock Turcot Hall - Level 0", phone: "613.562.5893", ps: "", icon: "food_services_info_center", iconWidth: "20", show: true, multiple: false, campus: "main", iconHeight: 49};
RESTAURANTS[11]={name: "Food Court", code: "foodCourt", lat: 45.422492, lng: -75.683709, location: "University Centre, Jock Turcot Hall - Level 1", phone: "613.562.5893", ps: "Meal Plans and Taste it! card accepted", icon: "food_courts", iconWidth: "33", show: true, multiple: true, campus: "main", iconHeight: 30};
RESTAURANTS[12]={name: "Food Court", code: "foodCourt", lat: 45.419336, lng: -75.678892, location: "SITE Building - Level 1", phone: "613.562.5800 ext: 2385", ps: "Meal Plans and Taste it! card accepted", icon: "food_courts", iconWidth: "33", show: false, multiple: true, campus: "main", iconHeight: 30};
RESTAURANTS[13]={name: "Fresh&euml;ns", code: "freshens", lat: 45.422499, lng: -75.683613, location: "University Centre", phone: "", ps: "", icon: "freshens", iconWidth: "68", show: true, multiple: false, campus: "main", iconHeight: 28};
RESTAURANTS[14]={name: "Jazzy Restaurant", code: "jazzy", lat: 45.422511, lng: -75.683886, location: "University Centre, Jock Turcot Hall - Level 1", phone: "613.562.5800 ext: 4293", ps: "Meal Plans and Taste it! card accepted", icon: "jazzy", iconWidth: "30", show: true, multiple: false, campus: "main", iconHeight: 52};
RESTAURANTS[15]={name: "L'Alibi", code: "lAlibi", lat: 45.423531, lng: -75.682331, location: "Fauteux Hall - Level 3", phone: "613.562.5800 ext: 3823", ps: "Meal Plans and Taste it! card accepted", icon: "l_alibi", iconWidth: "27", show: true, multiple: false, campus: "main", iconHeight: 46};
RESTAURANTS[16]={name: "Le Bac &agrave; Frites", code: "leBac", lat: 45.423403, lng: -75.685228, location: "Parking Lot 'K' southeast corner of Simard Hall, exterior location", phone: "613.234.5454", ps: "", icon: "le_bac_a_frites", iconWidth: "19", show: true, multiple: false, campus: "main", iconHeight: 55};
RESTAURANTS[17]={name: "Le Petit Caf&eacute;", code: "lePetitCafe", lat: 45.423874, lng: -75.685582, location: "Arts Hall - Level 0", phone: "613.562.5800 ext: 1775", ps: "Meal Plans and Taste it! card accepted", icon: "le_petit_cafe", iconWidth: "19", show: true, multiple: false, campus: "main", iconHeight: 45};
RESTAURANTS[18]={name: "Le Rez", code: "rez", lat: 45.422394, lng: -75.684562, location: "90 University - Level 1", phone: "613.564.5400 ext: 5815", ps: "Meal Plans and Taste it! card accepted", icon: "rez", iconWidth: "31", show: true, multiple: false, campus: "main", iconHeight: 33};
RESTAURANTS[19]={name: "Le Snack", code: "leSnack", lat: 45.420496, lng: -75.681499, location: "Marion Hall - Level 0", phone: "613.562.5800 ext: 6426", ps: "Meal Plans and Taste it! card accepted", icon: "le_snack", iconWidth: "34", show: true, multiple: false, campus: "main", iconHeight: 37};
RESTAURANTS[20]={name: "Pivik", code: "pivik", lat: 45.422368, lng: -75.683854, location: "University Centre - Level 0", phone: "613.562.5800 ext: 4372", ps: "", icon: "pivik", iconWidth: "33", show: true, multiple: false, campus: "main", iconHeight: 44};
RESTAURANTS[21]={name: "Pizza Pizza", code: "pizzaPizza", lat: 45.422435, lng: -75.683752, location: "University Centre", phone: "", ps: "", icon: "pizza_pizza", iconWidth: "113", show: true, multiple: false, campus: "main", iconHeight: 18};
RESTAURANTS[22]={name: "Second Cup", code: "secondCup", lat: 45.424849, lng: -75.684316, location: "Hyman Soloway Residence - Main Level", phone: "613.232.6921", ps: "", icon: "second_cup", iconWidth: "28", show: true, multiple: true, campus: "main", iconHeight: 42};
RESTAURANTS[23]={name: "Second Cup", code: "secondCup", lat: 45.423309, lng: -75.683945, location: "Morisset Hall", phone: "613.562.5800 ext: 3934", ps: "Meal Plans and Taste it! card accepted", icon: "second_cup", iconWidth: "28", show: false, multiple: true, campus: "main", iconHeight: 42};
RESTAURANTS[24]={name: "Second Cup", code: "secondCup", lat: 45.423557, lng: -75.682427, location: "Fauteux Hall", phone: "613.562.5800 ext: 3823", ps: "Meal Plans and Taste it! card accepted", icon: "second_cup", iconWidth: "28", show: false, multiple: true, campus: "main", iconHeight: 42};
RESTAURANTS[25]={name: "Starbucks Coffee", code: "starbucks", lat: 45.423599, lng: -75.687143, location: "Desmarais Hall - Main Level", phone: "613.562.5800 ext: 3935", ps: "Meal Plans and Taste it! card accepted", icon: "starbucks", iconWidth: "20", show: true, multiple: false, campus: "main", iconHeight: 50};
RESTAURANTS[26]={name: "Tim Hortons", code: "timHortons", lat: 45.422326, lng: -75.683860, location: "University Centre, Jock Turcot Hall - Level 2", phone: "613.562.5800 ext: 2091", ps: "Meal Plans and Taste it! card accepted", icon: "tim_hortons", iconWidth: "93", show: true, multiple: true, campus: "main", iconHeight: 22};
RESTAURANTS[27]={name: "Tim Hortons", code: "timHortons", lat: 45.419276, lng: -75.678999, location: "SITE Building - Level 1", phone: "613.562.5800 ext: 2385", ps: "Meal Plans and Taste it! card accepted", icon: "tim_hortons", iconWidth: "93", show: false, multiple: true, campus: "main", iconHeight: 22};
RESTAURANTS[28]={name: "Upper Crust", code: "upperCrust", lat: 45.422691, lng: -75.683779, location: "University Centre, Jock Turcot Hall - Level 0", phone: "613.562.5800 ext: 4385", ps: "Meal Plans and Taste it! card accepted", icon: "upper_crust", iconWidth: "36", show: true, multiple: false, campus: "main", iconHeight: 39};
RESTAURANTS[29]={name: "Zampub", code: "zampub", lat: 45.419483, lng: -75.677036, location: "801 King Edward - Level 2", phone: "613.234.4310", ps: "", icon: "zampub", iconWidth: "37", show: true, multiple: false, campus: "main", iconHeight: 43}; 

UORESTAURANTS = function (){
}

UORESTAURANTS.prototype.plotRestaurant = function(map, i, code, forTool){
	var icon = new GIcon(G_DEFAULT_ICON, "images/icons/rest_icon.png");
	var markerOpts = {icon: icon, clickable: forTool?false:true, draggable: forTool?true:false, hide: code==RESTAURANTS[i].code?false:true};
	var marker = new GMarker(new GLatLng(RESTAURANTS[i].lat, RESTAURANTS[i].lng), markerOpts);
	if (!forTool) {
		GEvent.addListener(marker, "click", function() {
			var height = RESTAURANTS[i].iconHeight + 50;
			var html = "<img src='images/icons/"+RESTAURANTS[i].icon+".jpg' /><br><br><b>Name:</b> "+RESTAURANTS[i].name+"<br><b>Location:</b> "+RESTAURANTS[i].location;
			if (RESTAURANTS[i].phone != "") {
				html = html + "<br><b>Phone:</b> "+RESTAURANTS[i].phone;
				height += 20;
			}
			if (RESTAURANTS[i].ps != "") {
				html = html + "<br><br>"+RESTAURANTS[i].ps;
				height += 20;
			}
			if (UOM.isIE6()) {
				marker.openInfoWindowHtml("<div style='height:"+height+"px;width:300px;'>"+html+"</div>");
			} else {
				marker.openInfoWindowHtml("<div style='height:"+height+"px'>"+html+"</div>");
			}
		});
	} else {
		GEvent.addListener(marker, "dragend", function(latlng) {
			for (var j = 0; j < restaurantsMarkers.length; j++) {
				if (i == restaurantsMarkers[j][0]) {
					restaurantsMarkers.splice(j,1);
				}
			}
			restaurantsMarkers.push([i, latlng.lat().toFixed(6), latlng.lng().toFixed(6)]);
	    });
	}
	return marker;
}

UORESTAURANTS.prototype.plotRestaurantTool = function(map, i, index){
	var icon = new GIcon(G_DEFAULT_ICON, "images/icons/rest_icon.png");
	var markerOpts = {icon: icon, hide: i==index?false:true};
	var marker = new GMarker(new GLatLng(RESTAURANTS[i].lat, RESTAURANTS[i].lng), markerOpts);
	marker.index = i;
	GEvent.addListener(marker, "click", function() {
		var bounds = new GLatLngBounds();
		var lat = marker.getLatLng().lat() + 0.001;
		var lng = marker.getLatLng().lng();
		var point = new GLatLng(lat, lng);
		bounds.extend(point);
		marker.checked = "";
		if (UOM._poiCategory == "restaurant" && UOM._poiId == i) {
			marker.checked = "checked";
		}
		marker.openInfoWindowHtml("<input type='checkbox' value='"+this.index+"' "+this.checked+" onclick='UOM._map.selectPoi(this);' />Select Point of Interest");
		map.setCenter(bounds.getCenter());
	});
	return marker;
}

