JFD = {
	find:function(lv) {
		fr = document.forms["ffind"];
		text = fr.keyword.value;
		if(_vL('lblsearch') != text) {
			text = JSTR.replace(text, " ", "");
			if(text == "") {
				alert(_vL('msgsearch') + '!');
				fr.keyword.focus();
				return false;
			} else
			if(text.length < 3) {
				alert(_vL('msgkeyword') + '!');
				fr.keyword.focus();
				return false;
			} else {
				if(lv == 0) {
					params = "&keyword=" + encodeURIComponent(fr.keyword.value) + "&action=123";
					JAJAX.commit('ajax.php?o=modules&n=search&f=search' + params, {'onComplete': JCB.inback});
					return false;
				} else {
					text1 = encodeURIComponent(fr.keyword.value);
					urlpage = "http://www.google.com.vn/search?hl=vi&q=" + text1;
					wopen = window.open(urlpage);
					wopen.focus();	
				}
			}
		}
	},
	onfind:function(lv) {
		JFD.find(lv);
	},
	ofocus:function(field) {
		if(field.value == _vL('lblsearch'))
			field.value = '';
	},
	oblur:function(field) {
		if(field.value == '')
			field.value = _vL('lblsearch');
	},
	search:function(view) {
		date = _vL("finddate");
		if(date.length < 2) 
			date = "0" + date;
		month = _vL("findmonth");
		if(month.length < 2) 
			month = "0" + month;
		year = _vL("findyear");
		url = _vL("findurl");
		if(!JDATE.check(date, month)) {
			alert("Date invalid, please select date again!");
			return;
		} else {
			page = url;
			page += "/ketqua/" + year + "-" + month + "-" + date;
			if(date == "00")
				page += "/ketqua/" + year + "-" + month + "-";
			goText(page, view);
		}
	},
	obj:function(s, i) {
		ss = s.split(";");
		if (ss.length > 1) {
			for (j = 0; j < (ss.length - 1); j++) {
				sss =  ss[j].split("=");
				if(sss[0] == i)
					return sss[1];
			}
		}
		return "";
	},
	city:function(fr) {
		key1 = fr.idcity.options[fr.idcity.selectedIndex].value;
		num = parseInt(JFD.obj(fr.elements["sub1"].value, key1));
		key = JFD.obj(fr.elements["sub2"].value, key1);
		name = JFD.obj(fr.elements["sub3"].value, key1);
		sublen = fr.elements["iddist"].length;
		for(ijk = 0; ijk < sublen; ijk++)
			fr.iddist.options[0] = null;
		if(key1 != "") {
			if(num > 0) {
				text1 = JSTR.split(name, num);
				id1 = JSTR.split(key, num);
				for(iik = 0; iik < num; iik++) {
					opt1 = new Option();
					opt1.text = text1[iik];
					opt1.value = id1[iik];
					fr.iddist.options[iik] = opt1;
				}
			}
		}
	},
	show:function(o) {
		return true;
	}
}
