function flip_fontimage(size, set) {
	imgelm = window.document.getElementById('font_'+size);
	if (size == 'small')
		imgelm.src = set? '/img/btn_fontsp.gif': '/img/btn_fontsd.gif';
	else if (size == 'medium')
		imgelm.src = set? '/img/btn_fontmp.gif': '/img/btn_fontmd.gif';
	else if (size == 'large')
		imgelm.src = set? '/img/btn_fontlp.gif': '/img/btn_fontld.gif';
}
function update_cookie_basefont(size) {
	update_cookie('font='+size);
}
function update_cookie(param) {
	if (window.XMLHttpRequest)
		http = new XMLHttpRequest();
	else if (window.ActiveXObject) {
		http = new ActiveXObject('Msxml2.XMLHTTP');
		if (http == null) http = new ActiveXObject('Microsoft.XMLHTTP');
	}
	if (http != null) {
		http.open('GET', '/_update_cookie.php?'+param, true);
		http.send(null);
	}
}
function update_basefont(size) {
	if (window.document.body.className != size &&
		(size == 'small' || size == 'medium' || size == 'large')) {
		flip_fontimage(document.body.className, false);
		window.document.body.className = size;
		flip_fontimage(size, true);
		update_cookie_basefont(size);
	}
}
function hover_basefont(size, hover) {
	if (hover) {
		imgelm = window.document.getElementById('font_'+size);
		if (size == 'small')
			imgelm.src = (window.document.body.className == size)? '/img/btn_fontsp.gif': '/img/btn_fonts.gif';
		else if (size == 'medium')
			imgelm.src = (window.document.body.className == size)? '/img/btn_fontmp.gif': '/img/btn_fontm.gif';
		else if (size == 'large')
			imgelm.src = (window.document.body.className == size)? '/img/btn_fontlp.gif': '/img/btn_fontl.gif';
	} else {
		flip_fontimage(size, (window.document.body.className == size));
	}
}
function hover_button(elm, img) {
	elm.src= img;
}
function hover_item(elm, hover) {
	elm.className = hover? "hover_on": "hover_off";
}
function GMapLoad(lat, lng, zoom, mapname) {
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById(mapname));
		map.setCenter(new GLatLng(lat,lng), zoom);
		map.addControl(new GSmallMapControl());
		map.addOverlay(new GMarker(new GLatLng(lat, lng)));
	}
}

function addEvent(obj,handle,lstnr) {
/*
	if(obj.addEventListener){
		obj.addEventListener(handle,lstnr,false);
	}else if(obj.attachEvent){
		handle = "on" + handle;
		var oldfunc = obj[handle];
		if(typeof oldfunc != "function"){
			obj[handle] = lstnr;
		}else{
			obj.attachEvent(handle,lstnr);
		}
	}else{ // MacIE
		handle = "on"+handle;
		var oldfunc = obj[handle];
		if(typeof oldfunc != "function"){
			obj[handle] = lstnr;
		}else{
			obj[handle] = function(){oldfunc();lstnr();};
		}
	}
*/
	try {
		obj.addEventListener(handle, lstnr, false);
	} catch(e) {
		obj.attachEvent("on"+handle, lstnr);
	}
}
