/* Effect */
function entryGrow(obj){
	obj.style.color = "#0A0";
}

function entryNotGrow(obj){
	obj.style.color = "";
}

/**
 * 独自ダイアログ
 */
var tmpl_dlog;
function insertElement (tWithd, theight, tpl, oldVal, id, newVal) {
	readTemplate(tpl);
	replaceTmplVal(oldVal, newVal, id);
	var myDiv = '<div id="dlog" style="z-index: 100;">' + tmpl_dlog +  
	'</div>';
	new Insertion.Top('body', myDiv);
}

/* テンプレートの読み込み */
function readTemplate (tplFile) {
var a = new Ajax.Request(  
    "./template/" + tplFile, { 
    	asynchronous    : false,
        onSuccess: 		function(request) {
        	switch (tplFile) {
				/* 固有のセットアップはここへ */
				case "iconList.tpl": tmpl_icon = request.responseText; break;
        		default:
        			tmpl_dlog = request.responseText;
        			break;
        	}
        }, 
        onFailure: 		function(request) { alert("読み込みに失敗しました。"); }, 
        onException: 	function(request) { alert("読み込み中にエラーが発生しました。"); } 
    } 
);
}

/* replace TMPL val. */
function replaceTmplVal (oldVal, newVal, id) {
	var rgexp = new RegExp(oldVal, "g");
	tmpl_dlog = tmpl_dlog.replace(rgexp, newVal);
	
	var rgexp_id = new RegExp('{##ID##}', "g");
	tmpl_dlog = tmpl_dlog.replace(rgexp_id, id);
	return tmpl_dlog;
}

/* close Dlog (calcel) */
function cancelDlg() {
	Element.remove($('dlog'));
}


/* 独自アイコンの生成 */
function createBIcon (iconX, iconY) {
	/* 以下アイコンの前置設定　アイコンのサイズやメッセの指すポイント */
	bicon =new GIcon();
	//60x60
	bicon.iconSize = new GSize(iconX, iconY);
	/*iconimageの左上が0ポイント　icon表示位置をオフセット*/
	if (iconX == 45 ){
		bicon.iconAnchor = new GPoint(14, iconY);
		/*iconimageの左上が0ポイント　吹出し表示位置をオフセット*/
		bicon.infoWindowAnchor = new GPoint((iconX / 2) - 12, 8);
//		bicon.infoWindowAnchor = new GPoint(0, 0);
	}else{
		bicon.iconAnchor = new GPoint((iconX / 2), iconY);
		/*iconimageの左上が0ポイント　吹出し表示位置をオフセット*/
		bicon.infoWindowAnchor = new GPoint((iconX / 2), 0);
//		bicon.infoWindowAnchor = new GPoint(0, 0);
	}
	
	return bicon;
}


   
/* icon & window*/
function createMarker(point, image, htmls, iconX, iconY) {
//	var icon =new GIcon(createBIcon());
	var icon = createBIcon(iconX, iconY);
	icon.image = image;
	var marker = new GMarker(point, icon);
	GEvent.addListener(marker, "mouseover", function(point) {
		marker.openInfoWindowHtml(htmls);
	});	
	return marker;
}


