﻿function widget_login(form){ return legacy_filter('widget_login', form, 'member', 'procMemberLogin', filterAlertMessage, [], '', {}) };
(function($){
	var v=xe.getApp('validator')[0];if(!v)return false;
	v.cast("ADD_FILTER", ["widget_login", {'user_id': {required:true,rule:'user_id'},'password': {required:true}}]);

	v.cast('ADD_MESSAGE',['user_id','아이디']);
	v.cast('ADD_MESSAGE',['password','비밀번호']);
	v.cast('ADD_MESSAGE',['isnull','%s을 입력해주세요.']);
	v.cast('ADD_MESSAGE',['outofrange','%s의 글자 수를 맞추어 주세요.']);
	v.cast('ADD_MESSAGE',['equalto','%s이 잘못되었습니다.']);
	v.cast('ADD_MESSAGE',['invalid_email','%s의 형식이 잘못되었습니다. (예: xe@xpressengine.com)']);
	v.cast('ADD_MESSAGE',['invalid_userid','%s의 형식이 잘못되었습니다.\n영문, 숫자와 _로 만드실 수 있으며, 첫 글자는 영문이어야 합니다.']);
	v.cast('ADD_MESSAGE',['invalid_user_id','%s의 형식이 잘못되었습니다.\n영문, 숫자와 _로 만드실 수 있으며, 첫 글자는 영문이어야 합니다.']);
	v.cast('ADD_MESSAGE',['invalid_homepage','%s의 형식이 잘못되었습니다. (예: http://www.newjinbo.org)']);
	v.cast('ADD_MESSAGE',['invalid_korean','%s의 형식이 잘못되었습니다. 한글로만 입력하셔야 합니다.']);
	v.cast('ADD_MESSAGE',['invalid_korean_number','%s의 형식이 잘못되었습니다. 한글과 숫자로만 입력하셔야 합니다.']);
	v.cast('ADD_MESSAGE',['invalid_alpha','%s의 형식이 잘못되었습니다. 영문으로만 입력하셔야 합니다.']);
	v.cast('ADD_MESSAGE',['invalid_alpha_number','%s의 형식이 잘못되었습니다. 영문과 숫자로만 입력하셔야 합니다.']);
	v.cast('ADD_MESSAGE',['invalid_number','%s의 형식이 잘못되었습니다. 숫자로만 입력하셔야 합니다.']);
})(jQuery);

/*
function widget_login(fo_obj) {
	var oFilter = new XmlJsFilter(fo_obj, "member", "procMemberLogin", completeLogin);
	//oFilter.addFieldItem("user_id",true,0,0,"","user_id");
	oFilter.addFieldItem("user_id",true,0,0,"","");
	oFilter.addFieldItem("password",true,0,0,"","");
	oFilter.addResponseItem("error");
	oFilter.addResponseItem("message");
	return oFilter.proc();
}
function completeLogin(ret_obj, response_tags, params, fo_obj) {
    document.SSO_LoginForm.user_id.value=fo_obj.user_id.value;
    document.SSO_LoginForm.password.value=fo_obj.password.value;
    document.SSO_LoginForm.submit();

    if(fo_obj.remember_user_id && fo_obj.remember_user_id.checked) {
        var expire = new Date();
        expire.setTime(expire.getTime()+ (7000 * 24 * 3600000));
        xSetCookie('user_id', fo_obj.user_id.value, expire);
    }
    //var url =  current_url.setQuery('act','');
    //location.href = current_url.setQuery('act','');

	setTimeout("completeLogin2()", 1000);
}

function completeLogin2() {
    var url =  current_url.setQuery('act','');
    location.href = current_url.setQuery('act','');
}
*/


/*
function completeLogin(ret_obj, response_tags, params, fo_obj) {
    var url =  current_url.setQuery('act','');
    location.href = url;
}
*/

function doFocusUserId(fo_id) {
    if(xScrollTop()) return;
    var fo_obj = xGetElementById(fo_id);
    if(fo_obj.user_id) {
        try{
            fo_obj.user_id.focus();
        } catch(e) {};
    }
}

function setStartPage(a){
    if (navigator.appName.indexOf("Internet Explorer")>=0){
        a.style.behavior="url(#default#homepage)";
        a.setHomePage("http://www.newjinbo.org/");
    }else{
        alert("현재 브라우저에서는 지원되지 않는 기능입니다.");
    }
}


function addFavoritePage(a){
    if (navigator.appName.indexOf("Internet Explorer")>=0){
        window.external.AddFavorite(document.location,document.title);
    }else{
        alert("현재 브라우저에서는 지원되지 않는 기능입니다.");
    }
}

function moveTop(){
    document.location.href="#";
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
