function __Year_Month_day_Check(__type,__yearId,__monthId,__dayId){
	__year = document.getElementById(__yearId);
	__month = document.getElementById(__monthId);
	__day = document.getElementById(__dayId);
	__yearValue = Number(__year.value);
	__monthValue = Number(__month.value);
	__dayValue = Number(__day.value);
	if(__type == 'year'){
		for (var i = __month.options.length;i > 1;i--){
			__month.remove(i-1);
		}
		for (var i = __day.options.length;i > 1;i--){
			__day.remove(i-1);
		}
		if (__yearValue != '0000') {
			for (var i = 0;i < 12;i++){
				var n = i<9?'0'+(i+1):(i+1);
				__month.options[i+1] = new Option(n,n);
			}
		}
	}else if(__type == 'month'){
		if (__monthValue == '00') {
			for (var i = __day.options.length;i > 1;i--){
				__day.remove(i-1);
			}
		}else{
			var __monthDays = new Array(31,29,31,30,31,30,31,31,30,31,30,31);
			__monthDays[1] = (__yearValue % 4 == 0)&&(__yearValue % 100 != 0)||(__yearValue % 400 == 0)?29:28;
			var __newDay = __monthDays[__monthValue-1];
			for (var i = __day.options.length;i > __newDay +1 ;i--){
				__day.remove(i-1);
			}
			for (var i = __day.options.length;i < __newDay +1 ;i++){
				var n = i<10?'0'+ i:i;
				__day.options[i] = new Option(n,n);
			}
		}
	}
};

Element.observe(window,'load',function(){
	$$('.a_menu_parent').each(function(a_tag){
		$(a_tag).observe('click',function(){
			$('menu').childElements().each(function(ele){
				if(ele.tagName.toLowerCase() == 'dd'){
					var dt = $(a_tag).up('dt');
					var tmp = $(dt).next();
					if(tmp == ele){
						if($(ele).style.display == 'none')
							$(ele).blindDown({duration: 0.2});
						else
							$(ele).blindUp({duration: 0.2});
					}else{
						$(ele).blindUp({duration: 0.2});
					}
				}else if(ele.tagName.toLowerCase() == 'dt'){
					var dt = $(a_tag).up('dt');
					if(dt == ele){
						$(ele).addClassName('current');
					}else{
						$(ele).removeClassName('current');
					}
				}
			});
		});
	});
});

G_Browser = {
	IE: !!(window.attachEvent && !window.opera),
	Opera: !!window.opera,
	WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
	Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
	MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
};

function G_initSearchInput(defaultKey){
	var ipt = $('searchKeyword');
	if(ipt.value == ''){
		ipt.value = defaultKey;
		ipt.writeAttribute('key_default','on');
	}
	ipt.observe('focus',function(){
		var key_default = ipt.readAttribute('key_default');
		if(key_default == 'on'){
			ipt.value = '';
			ipt.writeAttribute('key_default','off');
		}
	});
	ipt.observe('blur',function(){
		if(ipt.value == ''){
			ipt.value = defaultKey;
			ipt.writeAttribute('key_default','on');
		}
	});
};
function G_valSearchInput(){
	var ipt = $('searchKeyword');
	var key_default = ipt.readAttribute('key_default');
	if(key_default == 'on'){
		ipt.value = '';
		ipt.writeAttribute('key_default','off');
	}
};

function myScrollTo(e,callback){
	scroller(e,1000,callback);
};
function chgSelClass(aTag){
	$(aTag).addClassName('current');
	$$('.a_menu').each(function(a){
		if(a != aTag){
			$(a).removeClassName('current');
		}
	});
};
function submit_step(num){
	if(num == 3){
		$('STEP_2').show();
	}
	if(num == 2){
		$('a_submit_step_3').show();
	}
	var div = 'STEP_'+num;
	$(div).show();
	myScrollTo(div);
};
function G_isMouseLeaveOrEnter(e, handler){		
	if (e.type != 'mouseout' && e.type != 'mouseover') return false;
	if($(handler).hasAttribute('LeaveOrEnter')){
		if($(handler).getAttribute('LeaveOrEnter') == e.type){
			return false;
		};
	};
	$(handler).setAttribute('LeaveOrEnter',e.type);
	var reltg = e.relatedTarget ? e.relatedTarget :
	e.type == 'mouseout' ? e.toElement : e.fromElement;
	while (reltg && reltg != handler) reltg = reltg.parentNode;
	return (reltg != handler);
};
Ajax.xRequest=Class.create(Ajax.Request,{initialize:function($super,url,options){
		options=options||{};
		var onSuccess=options.onSuccess||Prototype.K;
		if(!Ajax.xRequest.cache[url]||options.reload){
			options.onSuccess=function(transport){
				Ajax.xRequest.cache[url]=transport;
				onSuccess(transport);
			};
			$super(url,options);
		}else {
			var transport=Ajax.xRequest.cache[url];
			this.dispatch.defer();
			[options.onLoading,onSuccess,options.onComplete].each(function(m){
				m&&m(transport);
			});
		}
	},dispatch:function(){
		Ajax.Responders.dispatch("onComplete",null);
	}});
Ajax.xUpdater=Class.create(Ajax.Request,{initialize:function($super,id,url,options){
		options=options||{};
		var onSuccess=options.onSuccess||Prototype.K;
		if(!Ajax.xRequest.cache[url]||options.reload){
			options.onSuccess=function(transport){
				Ajax.xRequest.cache[url]=transport;
				$(id).update(transport.responseText);
				onSuccess(transport);
			};
			$super(url,options);
		}else {
			var transport=Ajax.xRequest.cache[url];
			$(id).update(transport.responseText);
			this.dispatch.defer();
			[options.onLoading,onSuccess,options.onComplete].each(function(m){
				m&&m(transport);
			});
		}
	},dispatch:function(){
		Ajax.Responders.dispatch("onComplete",null);
	}});
Ajax.xRequest.cache={};
function G_input_default(ipt,text,color,color2){
	if($(ipt)){
		$(ipt).style.color=color;
		$(ipt).value=text;
		$(ipt).observe("blur",function(){
			if(this.value.blank()){
				this.value=text;
				this.style.color=color;
			}
		});
		$(ipt).observe("focus",function(){
			this.style.color=color2;
			if(this.value==text){
				this.value="";
			}
		});
	}
}