/***************************************************************************
 * filename : FFForm.js<br>
 * FormÀ» Á¦¾îÇÏ´Â Å¬·¡½º<br>
 *
 * @version	: 1.0
 * @author	: Copyright (c) 2003 by free270. All Rights Reserved.
****************************************************************************/
if(FFFORM_CLASS!=null) {
	alert("[FFForm.js]´Â ÀÌ¹Ì include µÇ¾îÀÖ½À´Ï´Ù!!");
}
var FFFORM_CLASS = true;

function FFFormClass(){
	var form, prefix
	var defaultWritePage, defaultListPage, defaultViewPage, defaultXTDeletePage, defaultXTWritePage
	this.fileserver_url			= "";
	this.defaultListPage		= "list.asp";
	this.ceoListPage            = "life_story.asp";
	this.myListPage             = "list_my.asp";
	this.golfListPage           = "golflist.asp";
	this.whiskyListPage         = "index.asp";
	this.defaultViewPage		= "view.asp";
	this.defaultWritePage		= "write.asp";
	this.defaultXTDeletePage	= "xt_delete.asp";
	this.defaultXTWritePage		= "xt_write.asp";

    this.defaultListE1Page	    = "event_list.asp";
	
	this.toString	= FFForm_toString;

	this.getForm	= FFForm_getForm;
	this.setForm	= FFForm_setForm;
	this.setPrefix	= FFForm_setPrefix;
	this.setFileserverURL = FFForm_setFileserverURL;
	this.goView		= FFForm_goView;
	this.goBefore	= FFForm_goBefore;
	this.goNext		= FFForm_goNext;
	this.goWrite	= FFForm_goWrite;
	this.goReply	= FFForm_goReply;
	this.goEdit		= FFForm_goEdit;
	this.goXTWrite	= FFForm_goXTWrite;
	this.goDelete	= FFForm_goDelete;
	this.goXTDelete = FFForm_goXTDelete;
	this.goSubmit	= FFForm_goSubmit;
	this.search		= FFForm_search;
	this.goSearch	= FFForm_goSearch;
	
	this.goSearch_recom	= FFForm_goSearch_recom;


	this.goList		= FFForm_goList;
	this.goPage		= FFForm_goPage;
    this.gomyPage   = FFForm_gomyPage;
	this.goceoPage  = FFForm_goceoPage;
	this.gogolfPage  = FFForm_gogolfPage;
	this.gowhiskyPage  = FFForm_gowhiskyPage;
	this.reset		= FFForm_reset;
	this.goBack		= FFForm_goBack;
	this.setSearchType = FFForm_setSearchType;
	this.setSearchTypeSelectBox = FFForm_setSearchTypeSelectBox;
	this.selectedValue = FFForm_selectedValue;
	
	this.goChoView	= FFForm_goChoView;
	this.goChoEdit 	= FFForm_goChoEdit;
	this.goChoDelete	= FFForm_goChoDelete;
	this.goChoXTDelete = FFForm_goChoXTDelete;
	this.goChoPage		= FFForm_goChoPage;
	this.getChoForm	= FFForm_getChoForm;

	this.goE1Page1	= FFForm_goE1Page1;
	this.goE1Page2	= FFForm_goE1Page2;

}

var FFForm = new FFFormClass();

/*###########[¾Æ·¡ ÇÔ¼öµéÀº Å¬·¡½ºÀÇ Á¤ÀÇ¸¦       ]######################*/
/*###########[À§ÇØ¼­¸¸ »ç¿ëµË´Ï´Ù.                ]######################*/
/*###########[Á÷Á¢ »ç¿ëÇÏ½ÃÁö ¸¶½Ã°í À§¿¡ Á¤ÀÇµÈ  ]######################*/
/*###########[Å¬·¡½º¸¦ ÀÌ¿ëÇØ È£ÃâÇØ ÁÖ¼¼¿ä       ]######################*/

function FFForm_getForm(){
	if(this.form==null){
		return document.frm_act;
	}else{
		return this.form;
	}	
}
function FFForm_toString(){
	return "prefix=" + this.prefix + ", getFileserverURL() = " + this.fileserver_url + ", form = " + this.getForm();
}
function FFForm_setForm(form){
	this.form		= form;
}
function FFForm_setPrefix(prefix){
	if(prefix==null){
		this.prefix		= "";
	}else{

		this.prefix					= prefix;
		this.defaultListPage		= this.prefix + "_" + this.defaultListPage;
		this.defaultViewPage		= this.prefix + "_" + this.defaultViewPage;
		this.defaultWritePage		= this.prefix + "_" + this.defaultWritePage;
		this.defaultXTDeletePage	= this.prefix + "_" + this.defaultXTDeletePage;
		this.defaultXTWritePage		= this.prefix + "_" + this.defaultXTWritePage;
	}		
}
function FFForm_setFileserverURL(fileserver_url){
	if(fileserver_url==null){
		this.fileserver_url = "";
	}else{
		this.fileserver_url = fileserver_url;	
	}
}

function FFForm_goView( number, url){
	if (number==0) return;
	this.getForm().encoding = "application/x-www-form-urlencoded";

	if(url!=null){
		this.getForm().action = url;
	}else{
		this.getForm().action = this.defaultViewPage;
	}

	this.getForm().cnum.value = number;
	this.getForm().encoding = "application/x-www-form-urlencoded";
	this.getForm().submit();
}
function FFForm_goBefore( num , url){
	if(num<0){
		alert("ÀÌÀü³»¿ëÀÌ ¾ø½À´Ï´Ù.");
		return;
	}
	this.getForm().encoding = "application/x-www-form-urlencoded";
	if(url!=null){
		this.getForm().action = url;
	}else{
		this.getForm().action = this.defaultViewPage;
	}
	this.getForm().cnum.value = num;
	this.getForm().encoding = "application/x-www-form-urlencoded";
	this.getForm().submit();
}
function FFForm_goNext( num , url){
	if(num<0){
		alert("´ÙÀ½ ³»¿ëÀÌ ¾ø½À´Ï´Ù.");
		return;
	}
	this.getForm().encoding = "application/x-www-form-urlencoded";
	if(url!=null){
		this.getForm().action = url;
	}else{
		this.getForm().action = this.defaultViewPage;
	}
	this.getForm().cnum.value = num;
	this.getForm().encoding = "application/x-www-form-urlencoded";
	this.getForm().submit();
}
function FFForm_goWrite(url){
	if(url!=null){
		this.getForm().action = url;
	}else{
		this.getForm().action = this.defaultWritePage;
	}
	this.getForm().wt.value= "add";
	this.getForm().encoding = "application/x-www-form-urlencoded";
	this.getForm().submit();
}
function FFForm_goReply(url){
	if(url!=null){
		this.getForm().action = url;
	}else{
		this.getForm().action = this.defaultWritePage;
	}
	this.getForm().wt.value = "reply";
	this.getForm().encoding = "application/x-www-form-urlencoded";
	this.getForm().submit();
}
function FFForm_goEdit(url){
	if(url!=null){
		this.getForm().action = url;
	}else{
		this.getForm().action = this.defaultWritePage;
	}	
	this.getForm().wt.value = "edit";
	this.getForm().encoding = "application/x-www-form-urlencoded";
	this.getForm().submit();
}
function FFForm_goXTWrite(url){
	if(url!=null){
		this.getForm().action = this.fileserver_url + url;
	}else{		
		this.getForm().action = this.fileserver_url + this.defaultXTWritePage;
	}

	this.getForm().submit();
}
function FFForm_goDelete( url ){
	if(url==null){
		url = this.defaultXTDeletePage;
	}

	this.goXTDelete(url,true);
}
function FFForm_goXTDelete(url, showmsg){
	if(showmsg==null||showmsg){
		if(confirm("Á¤¸»·Î »èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?")==false){	
			return;
		}
	}
	if(url!=null){
		this.getForm().action = this.fileserver_url + url;
	}else{
		this.getForm().action = this.fileserver_url + this.defaultXTDeletePage;
	}
	this.getForm().encoding = "application/x-www-form-urlencoded";
	this.getForm().submit();
}


function FFForm_setSearchType(data){
	if(this.getForm().cstype.type!="select-one"){
		FFCheckbox.checkByData(this.getForm().cstype,data,", ");
	}else{
		this.getForm().cstype.value = data;
	}
}
function FFForm_setSearchTypeSelectBox(data){
	this.getForm().cstype.value = data;
}

function FFForm_selectedValue(obj){
	FFSelectbox.selectedValue(obj);
}
function FFForm_goSubmit(){	

	this.getForm().submit();
}
function FFForm_search(url){
	if(!this.goSearch(url)){
		return;
	}
	this.goSubmit();
}

function FFForm_goSearch(url){	


	if(this.getForm().cstype !=null){
		var cstype_type = this.getForm().cstype.type;
		if(cstype_type !="select-one"){
			if(cstype_type==null){
				if(FFCheckbox.checkedCount(this.getForm().cstype)<1 && this.getForm().ckey.value != ""){
					alert("°Ë»ö Ç×¸ñÀ» ¼±ÅÃÇÏ¼¼¿ä!!");
					return false;
				}
				if(FFCheckbox.checkedCount(this.getForm().cstype)>0 && this.getForm().ckey.value == ""){
					alert("Å°¿öµå¸¦ ÀÔ·ÂÇÏ¼¼¿ä!!");
					return false;
				}
			}
		}else{
		
		
		}
	}
	if(url!=null){
		this.getForm().action = url;
	}else{
		this.getForm().action = this.defaultListPage;
	}
	this.getForm().encoding = "application/x-www-form-urlencoded";
	this.getForm().cpage.value	= "1";
	return true;

}

function FFForm_goSearch_recom(){	
	return false;
}

function FFForm_goList(){		
	
	this.getForm().action	= this.defaultListPage;
	this.getForm().encoding = "application/x-www-form-urlencoded";
	this.getForm().submit();
	//history.back();
}	

function FFForm_goPage(page){		
	this.getForm().cpage.value = page;
	this.getForm().action	= this.defaultListPage;
	this.getForm().encoding = "application/x-www-form-urlencoded";
	this.getForm().submit();
	//history.back();
}
function FFForm_goceoPage(page){		
	this.getForm().cpage.value = page;
	this.getForm().action	= this.ceoListPage;
	this.getForm().encoding = "application/x-www-form-urlencoded";
	this.getForm().submit();
	//history.back();
}


function FFForm_gomyPage(page){		
	this.getForm().cpage.value = page;
	this.getForm().action	= this.myListPage;
	this.getForm().encoding = "application/x-www-form-urlencoded";
	this.getForm().submit();
	//history.back();
}

function FFForm_gogolfPage(page){		
	this.getForm().cpage.value = page;
	this.getForm().action	= this.golfListPage;
	this.getForm().encoding = "application/x-www-form-urlencoded";
	this.getForm().submit();
	//history.back();
}
function FFForm_gowhiskyPage(page){		
	this.getForm().cpage.value = page;
	this.getForm().action	= this.whiskyListPage;
	this.getForm().encoding = "application/x-www-form-urlencoded";
	this.getForm().submit();
	//history.back();
}

function FFForm_goE1Page1(page, url){		
	this.getForm().cpage1.value = page;
	this.getForm().action	= this.defaultListE1Page;
	this.getForm().encoding = "application/x-www-form-urlencoded";
	this.getForm().submit();
	//history.back();
}

function FFForm_goE1Page2(page, url){		
	this.getForm().cpage2.value = page;
	this.getForm().action	= this.defaultListE1Page;
	this.getForm().encoding = "application/x-www-form-urlencoded";
	this.getForm().submit();
	//history.back();
}


function FFForm_reset(){
	this.getForm().reset();
}
function FFForm_goBack(){
	window.history.go(-1);
}



/*°´¿ø¸¶ÄÉÅÍ¿ë*/
function FFForm_goChoView(fname, num , url){
	fname.encoding = "application/x-www-form-urlencoded";
	if(url!=null){
		fname.action = url;
	}else{
		fname.action = this.defaultViewPage;
	}
	fname.idx.value = num;
	fname.submit();
}
function FFForm_goChoEdit(fname, url){
	if(url!=null){
		fname.action = url;
	}else{
		fname.action = this.defaultWritePage;
	}	
	fname.wt.value = "edit";
	fname.submit();
}
function FFForm_goChoDelete( fname, url ){
	if(url==null){
		url = this.defaultXTDeletePage;
	}

	this.goChoXTDelete(fname, url,true);
}
function FFForm_goChoXTDelete(fname, url, showmsg){
	if(showmsg==null||showmsg){
		if(confirm("Á¤¸»·Î »èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?")==false){	
			return;
		}
	}
	fname.encoding = "application/x-www-form-urlencoded";
	if(url!=null){
		fname.action = this.fileserver_url + url;
	}else{
		fname.action = this.fileserver_url + this.defaultXTDeletePage;
	}
	fname.submit();
}
function FFForm_goChoPage(page, URL){		
	this.getChoForm().cpage.value = page;
	this.getChoForm().action	= URL; //this.defaultListPage;
	this.getChoForm().encoding = "application/x-www-form-urlencoded";
	this.getChoForm().submit();
}
function FFForm_getChoForm(){
	if(this.form==null){
		return document.mission;
	}else{
		return this.form;
	}	
}
