/* Ver 1.0 */

//function brand_inf(k){
//		var ajaxobj=new AJAXRequest;
//		ajaxobj.method = "GET";
//		ajaxobj.url = "brand_data.jsp?k=" + encodeURI(k);
//		ajaxobj.callback = brand_cb;
//		ajaxobj.send();
//}
//
//function brand_cb(rs){
//	var rsps_text = rs.responseText.toString();
//	var rsps = eval("(" + rsps_text + ")");
//	if("undefined" != typeof rsps.KEYWORD){
//		$('brand').href = "http://pinpai.mapabc.com/" + rsps.COIID + "/" + rsps.TYPECODE + "/1.shtml";
//		$('brand').innerHTML = rsps.COI_NAME;
//	}else{
//		//brand = "";
//	}
//}


/* Ver 2.0 */
function brand_inf(k){
	var keyword = encodeURI(k);
	var URL="http://pinpai.mapabc.com/tour.jhtml?keyword=" + keyword + "&num=10&ra=" + Math.random();
	var mAjaxRequest = new MAjaxRequest();
	var m = new myfunc();
	mAjaxRequest.setResponseHandler(m.hello,m);
	mAjaxRequest.sendRequest(URL);

}
function myfunc(){
	this.v1="p";
}
myfunc.prototype.hello = function(data){
	rsps = eval(data)[0];
	if("null" != rsps.coiName && rsps.city == cityname){
		var imgtype = "brand";
		switch (rsps.poiTypeId){
			case "0": imgtype = "brand";
				break;
			case "3": imgtype = "inside";
				break;
			default: imgtype = "brand"
		}
		$('brand').href = "http://pinpai.mapabc.com/brand/" + rsps.coiId + "/" + rsps.poiTypeId + "/1.shtml";
		$('brand').innerHTML = rsps.coiName + "<span style='margin:-2px 0 0 0;width:30px;height:14px;'><img src='/images/" + imgtype + ".gif'></span>";
	}else{
		//brand = "";
	}
//	alert(obj.coiName);
//	alert(obj.keyWord);
//	alert(obj.poiType);
//	alert(obj.poiTypeId);
}
