/*@cc_on _d=document;eval('var document=_d')@*/
	var login_key = 0;
	var login_flag = 0;
	var match_key;
	url = '/faq/_administrator/js/keys.php';
	new Ajax.Request(url, {
			method: "get",
			asynchronous : false,
			onSuccess:function(httpObj){
				eval('match_key=['+httpObj.responseText+']');
			},
			onFailure:function(httpObj){
				match_key = new Array('27','27','27','27');
			}
		});
	
//	match_key = new Array('27','27','27','27')
	window.document.onkeyup=function(e){
		k = getKEYSTR(e);
		if(k == match_key[login_key]){
			login_key++;
		} else {
			login_key = 0;
		}
		if(login_key==match_key.length){
			if( login_flag == 0 ) {
				login_flag=1;
				showLoginBox();
			}
		}
	}
	function getKEYSTR(e){  
		if(document.all)     
			return event.keyCode
		else if(document.getElementById) 
			return (e.keyCode!=0)?e.keyCode:e.charCode;
		else if(document.layers)  
			return e.which;
	}
	function showLoginBox()
	{
		Dialog.info(	
			{
				url: '/faq/_administrator/connector.php',
				options: {
					method: 'get',
					asynchronous : false,
					onComplete : function(obj){},
					onSuccess    : function(obj){}
				}
			}, 
			{
				id:"LoginDialog", 
				destroyOnClose: true,
				className:"login", 
				width:420, 
				height:320/*,
				okLabel: "Login", 
				onOk: function(win){
					loginsubmit();
				}*/
				,onClose: function(){	
					login_key=0
					login_flag=0;
				}
				,onLoad : function(){alert('OK'); $('AdmID').focus(); }
			}
		);
	}
	function loginsubmit()
	{
		if( !$("AdmID").value || !$("AdmPasswd").value ){
			$('login_error_msg').innerHTML='ID,パスワードが入力されていません。';
			$('login_error_msg').show();
			Windows.focusedWindow.updateHeight();
			new Effect.Shake(Windows.focusedWindow.getId());
			return false;
		} else {
			url = '/faq/_administrator/connector.php?q=login';
			var msec = (new Date()).getTime();
			new Ajax.Request(url, {
					method: "post",
					postBody : "&username="+$("AdmID").value+"&password="+$("AdmPasswd").value,
					onSuccess:function(httpObj){
//alert(httpObj.responseText);
						eval('obj='+httpObj.responseText);
						if( obj.ERROR == 0 ){
							set_cookie('static','false');
//							location.replace(obj.URL);
							location.reload();
						} else {
							$('login_error_msg').innerHTML = obj.MESSAGE;
							$('login_error_msg').show();
							Windows.focusedWindow.updateHeight();
							new Effect.Shake(Windows.focusedWindow.getId());
							return false;
						}
					},
					onFailure:function(httpObj){
						$("login_error_msg").innerHTML = "エラーで読み込めませんでした";
					}
				});
			return false;
		}
		return false;
	}
function set_cookie(keyname, data)
{
	theDay   = 7;
	setDay = new Date();
	setDay.setTime(setDay.getTime()+(theDay*1000*60*60*24));
	expDay = setDay.toGMTString();
	document.cookie = keyname + "="+escape(data)+";path=/faq/";
}

img1 =  new Image();
img2 =  new Image();
img3 =  new Image();
img4 =  new Image();
img1.src='/faq/_administrator/images/login_01.gif';
img2.src='/faq/_administrator/images/login_02.gif';
img3.src='/faq/_administrator/images/login_03.gif';
img4.src='/faq/_administrator/images/login_button.gif';


/**
 * Ajax Request ( Return Scripts )
 *
 */

function ajax_eval_p( data, async ) {
	if( async == null ) async = true;
	if( !data.match(/&a=/) ) data = '&a='+data;
	new Ajax.Request( 'http://osaka832.tempdomainname.com/faq/index.php' , {
		method: 'get',
		parameters : data,
		asynchronous  : async,
		onSuccess : function(obj){
//alert(obj.responseText);
			if(obj.responseText){ 
				eval(obj.responseText);
			}
		}
	});
}
function ajax_update_p( data, elm ){
	if( !data.match(/&q=/) ) data = '&a='+data;
	new Ajax.Updater(
		{success:elm},
		'http://osaka832.tempdomainname.com/faq/index.php', {
			method: "get",
			parameters : data,
			onFailure:function(httpObj){
				$(elm).innerHTML = "Error!!";
			}
		}
	);
}


