
var arrMarkers = new Array();

function createMarker(point, strname, minprice, imgurl, address, desc, index, href) 
{
	var letter = String.fromCharCode("A".charCodeAt(0) + index);

	var letteredIcon = new GIcon(G_DEFAULT_ICON);
	index = index+1;
	
	var imageName = "blank";
	if((""+index).length == 1 ) {
		imageName = "00" + index;
	}else if((""+index).length == 2) {
		imageName = "0" + index;
	}else if((""+index).length == 3) {
		imageName = index;
	}
	
	//letteredIcon.image = "http://www.google.com/mapfiles/marker" + letter + ".png";
	//letteredIcon.image = "/images/hotels_marker/hotels_marker_" + ((""+index).length==1? "00"+index : (""+index).length==2?"0"+index : index) + ".png";
	letteredIcon.image = "/images/hotels_marker/hotels_marker_" + imageName + ".png";

	markerOptions = { icon:letteredIcon };
	var marker = new GMarker(point, markerOptions);
	var findIndex = -1;

	for(i =0;i<arrMarkers.length;i++){
		var item = arrMarkers[i];
		if(item.index == index){
			findIndex = i;
			break;
		}
	}

	GEvent.addListener(marker, "click", function() 
	{
		if(imgurl.indexOf("getImage/htpp")==0){
			imgurl = "http"+imgurl.substring("getImage/htpp".length);
		}

		//var moreInfo = "<a style=\"color:blue; font-size: 10px;\" href=\"" + href + "\">more info</a>" ;
		//var html = "<div style=\"float:left; width: 180px;\"><b><span style=\"color: rgb(27, 60, 124);\">" + strname + "</span></b>"
		
		var moreInfo = "<div style=\" width: 180px;\"><a style=\"color:#238CC3; font-size: 10px;\" href='" + href + "'>more info</a></div>" ;

		var html = 
		"<div style=\"width: 280px;\">"
			+"<div style=\"float:left; width: 180px;height:85px;\">"
				+"<div style=\"color: #238CC3;font-weight:bold;width: 180px;white-space: nowrap; overflow: hidden;\">" 
					+ "<a style=\" font-size: 10px;\" href='" + href + "'>" + strname + "</a>"
				+"</div>"
				+ "<div style=\"color:#939598; font-size: 10px;width: 180px;white-space: nowrap; overflow: hidden;\">" + address + "</div>"
				+ "<div style=\"font-weight:bold;width: 180px;\">from " + minprice + "</div>"
				+ "<div style=\"font-size: 10px;width: 180px;\">" + desc + "...</div>"
				+ (href != null && href.length > 0 ? moreInfo : '')
			+ "</div>"
			+ "<div style=\"float:right; width: 80px; border: solid 1px #cccccc;\">"
				+"<a style=\" font-size: 10px;\" href='" + href + "'>"
					+"<img onerror=\"this.src='images/default_image.jpg'\" src=\"" + imgurl + "\" style=\"width: 78px; height: 73px;\"/>"
				+"</a>"
			+ "</div>"
		+ "</div>";

		marker.openInfoWindowHtml(html);
	});

	
	if(findIndex!=-1){
		arrMarkers[findIndex].marker = marker;
	}else{
		arrMarkers[arrMarkers.length] = {'index':index,'marker':marker};
	}
	return marker;
}