function ifs_fns() {
	var obj = new Object();
	obj.sname = '';
	obj.ua = navigator.userAgent.toLowerCase();
	obj.opera = obj.ua.indexOf('opera') != -1 && opera.version();
	obj.moz = (navigator.product == 'Gecko') && obj.ua.substr(obj.ua.indexOf('firefox') + 8, 3);
	obj.ie = (obj.ua.indexOf('msie') != -1 && !obj.opera) && obj.ua.substr(obj.ua.indexOf('msie') + 5, 3);
	obj.cur = 0;

	obj.$ = function(id) {
		return document.getElementById(id);
	}
	obj.surl = obj.$('ifsfnform').action + '?searchsubmit=true&inajax=1&sname=';
	obj.$('ifsfn').onkeyup = function() {
		obj.kup();
	}

	obj.$('ifsfn').onblur = function(event) {
		setTimeout('ifs_fnsobj.hide()', 300);
	}

	obj.$('ifsfn').onfocus = function() {
		if(obj.$('ifsfn').value == obj.$('ifsfn').getAttribute('defaultvalue')) {
			obj.$('ifsfn').value = '';
			obj.$('ifsfn').style.color = '#000';
}
		if(obj.trim(obj.$('ifsfn_content').innerHTML) && obj.trim(obj.$('ifsfn').value)){setTimeout('ifs_fnsobj.show()', 100);}
	}

	obj.createajax = function() {
		var ajaxobj = false;
		var ajaxversion = ['Microsoft.XMLHTTP', 'MSXML.XMLHTTP', 'Msxml2.XMLHTTP.7.0', 'Msxml2.XMLHTTP.6.0', 'Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP'];
		if(window.XMLHttpRequest) {
			ajaxobj = new XMLHttpRequest();
			if(ajaxobj.overrideMimeType) ajaxobj.overrideMimeType('text/xml');
		} else {
			for(i = 0; i < ajaxversion.length; i++) {
				try {
					ajaxobj = new ActiveXObject(ajaxversion[i]);
					if(ajaxobj) break;
				} catch(e) {}
			}
		}
		return ajaxobj;
	}
	obj.ajax = obj.createajax();

	obj.trim = function(str) {
		return (str + '').replace(/(\s+)$/g, '').replace(/^\s+/g, '');
	}

	obj.getpos = function() {
		var showobj = obj.$('ifsfn');
		var menuobj =  obj.$('ifsfn_content');
		var offset = 0;
		if(showobj) {
			showobj.pos = obj.getoffset(showobj);
			showobj.X = showobj.pos['left'];
			showobj.Y = showobj.pos['top'];
			showobj.w = showobj.offsetWidth;
			showobj.h = showobj.offsetHeight;
			menuobj.w = showobj.offsetWidth;
			menuobj.h = menuobj.offsetHeight;
			menuobj.style.width = showobj.offsetWidth + 'px';
			menuobj.style.left = (showobj.X + menuobj.w > document.body.clientWidth) && (showobj.X + showobj.w - menuobj.w >= 0) ? showobj.X + showobj.w - menuobj.w + 'px' : showobj.X + 'px';
			menuobj.style.top = offset == 1 ? showobj.Y + 'px' : (offset == 2 || ((showobj.Y + showobj.h + menuobj.h > document.documentElement.scrollTop + document.documentElement.clientHeight) && (showobj.Y - menuobj.h >= 0)) ? (showobj.Y - menuobj.h) + 'px' : showobj.Y + showobj.h + 'px');
			if(menuobj.style.clip && !obj.opera) {
				menuobj.style.clip = 'rect(auto, auto, auto, auto)';
			}
		}
	}

	obj.getoffset = function(o) {
		var left_offset = o.offsetLeft;
		var top_offset = o.offsetTop;
		while((o = o.offsetParent) != null) {
			left_offset += o.offsetLeft;
			top_offset += o.offsetTop;
		}
		return { 'left' : left_offset, 'top' : top_offset };
	}

	obj.show = function() {
		obj.getpos();
		obj.$('ifsfn_content').innerHTML = obj.trim(obj.ajax.responseText);
		obj.$('ifsfn_content').style.display = 'block';
	}

	obj.hide = function() {
		obj.$('ifsfn_content').style.display = 'none';
	}

	obj.get = function() {
		obj.ajax.open('GET', obj.surl + encodeURIComponent(obj.sname) + '&h=' + Math.random());
		obj.ajax.send(null);
		obj.ajax.onreadystatechange = function () {
			if(obj.ajax.readyState != 4) {
				return true;
			}
			if(obj.ajax.status == 200 && obj.trim(obj.ajax.responseText)) {
				obj.show();
			} else {
				obj.$('ifsfn_content').innerHTML = '';
				obj.hide();
			}
		}
	}

	obj.kup = function() {
		if(obj.trim(obj.$('ifsfn').value) && obj.trim(obj.$('ifsfn').value) != obj.sname) {
			obj.sname = obj.trim(obj.$('ifsfn').value);
			obj.get();
		} else if(obj.trim(obj.$('ifsfn').value) != '') {
			e = window.event;
			if(obj.ie) {
				e.returnValue = false;
				e.cancelBubble = true;
			} else if(e) {
				e.stopPropagation();
				e.preventDefault();
			}
		} else {
			obj.sname = '';
			obj.hide();
		}
	}
	return obj;
}

window.onload = function() {
	ifs_fnsobj = new ifs_fns();
	window.onresize = function(){ifs_fnsobj.getpos();}
}