function $( id ) {
	return document.getElementById( id );
}

function toggle( id ){
//
//toggle( "calendar-admin" );
//
	var elem = $( id );
	if( elem.style.display == "" ) {
		elem.style.display = "none";
	} else {
		elem.style.display = "";
	}
}

function addListener( target, eventType, eventListener ){
	if( target.addEventListener ){
		target.addEventListener( eventType, eventListener, false );
	}else if( target.attachEvent ){
		target.attachEvent( "on" + eventType, eventListener );
	}
}

function removeListener( target, eventType, eventListener ){
	if( target.removeEventListener ){
		target.removeEventListener( eventType, eventListener, false );
	}else if( target.detachEvent ){
		target.detachEvent( "on" + eventType, eventListener );
	}
}

function ajaxLoad( id, url, option ){
//
//ajaxLoad( "top-news", "rss.php",{ arg: "url=hoge", method; "POST" } );
//
//method:デフォルトはGET
//
	$( id ).innerHTML = "読み込み中...";
	var s = new sack();
	s.requestFile = url;
	option = option || "";
	s.URLString = option.arg || "";
	s.method = option.method || "GET";
	s.element = id;
	s.onCompletion = function(){
		s = false;
	}
	s.runAJAX();
}

function ajaxGet( url, option ){
/*
	ajaxGet( "20_calendar.php", 
		{
			arg: "pwd="+$( "pwd" ).value,
			callback: function( arg ){
				if( arg == "ng" ){
					showResult( "passwordが違います" );
				} else {
					$( "calendar-admin" ).innerHTML = arg;
				}
			}
	});
*/
	var s = new sack();
	s.requestFile = url;
	option = option || "";
	s.URLString = option.arg || "";
	s.method = "GET";
	s.onCompletion = function(){
		var func = option.callback;
		func( s.response );
		s = false;
	}
	s.runAJAX();
}

function ajaxPost( url, option ){
	var s = new sack();
	s.requestFile = url;
	option = option || "";
	s.URLString = option.arg || "";
	s.method = "POST";
	s.onCompletion = function(){
		var func = option.callback;
		func( s.response );
		s = false;
	}
	s.runAJAX();
}