<!--
/**
 *	check browser and set browser type and objects
 */
function sf_Browser()
{
	d = document;
	this.agt = navigator.userAgent.toLowerCase();
	this.major = parseInt(navigator.appVersion);
	this.dom = (d.getElementById)?1:0;
	this.ns = (d.layers);
	this.ns4up = (this.ns && this.major >=4);
	this.ns6 = (this.dom&&navigator.appName=="Netscape");
	this.op = (window.opera? 1:0);
	this.ie = (d.all);
	this.ie4 = (d.all&&!this.dom)?1:0;
	this.ie4up = (this.ie && this.major >= 4);
	this.ie5 = (d.all&&this.dom);
	this.win = ((this.agt.indexOf("win")!=-1) || (this.agt.indexOf("16bit")!=-1));
	this.mac = (this.agt.indexOf("mac")!=-1);
}
var sf_obj = new sf_Browser();
function sf_getPageX(o)
{ 
	var x=0; 
	if(sf_obj.ns) x=o.pageX; 
	else { 
		while(eval(o)) { 
			x+=o.offsetLeft; 
			o=o.offsetParent; 
		} 
	} 
	return x; 
}
function sf_getPageY(o)
{ 
	var y=0; 
	if(sf_obj.ns) y=o.pageY; 
	else { 
		while(eval(o)) { 
			y+=o.offsetTop; 
			o=o.offsetParent;
		} 
	} 
	return y; 
}

/**
 *	for menu, button function
 *	modified from www.kbca.info scripts
 */

/* Button */
function sf_BtnClick(p_oEvent)
{
	var oEvent = p_oEvent ? p_oEvent : window.event;
	var oSender = p_oEvent ? oEvent.target : oEvent.srcElement;

	if(p_oEvent) oEvent.stopPropagation();
	else oEvent.cancelBubble = true;

	//this.Event = oEvent;
	//this.Sender = oSender;

	sf_HideMenu();
	this.Menu.Button = this;
	global_oMenu = this.Menu;

	if(typeof this.ClickHandler != 'undefined') this.ClickHandler();
	else global_oMenu.Show();
	
	document.onclick = sf_DocClick;
	var _RTE = document.getElementById('sf_rteObj');
	if(_RTE) sf_rteObj.document.onclick = sf_DocClick;

	return false;
}

function sf_DropDownMenu(p_sMenuId)
{
	var oMenu = document.getElementById(p_sMenuId);

	if(oMenu)
	{
		oMenu.Show = function () { 

			if(document.all) this.style.width = this.offsetWidth+'px';

			var nTop = sf_getPageY(this.Button) + this.Button.offsetHeight;
			var nLeft = sf_getPageX(this.Button);
			
			if(sf_obj.ie && sf_obj.mac){
				nTop -= 4;
				nLeft -= 6;	
			}

			this.style.top = nTop+'px';
			this.style.left = nLeft+'px';
			this.style.visibility = 'visible'; 
		}
		return oMenu;
	}
	else return false;
}

function Button(p_sButtonId)
{
	var oButton = document.getElementById(p_sButtonId);
	
	if(oButton){
		oButton.onclick = sf_BtnClick;
		return oButton;
	}
	else return false;
}

function sf_BtnMenu(p_sButtonId, p_sMenuId)
{
	var oButton = new Button(p_sButtonId);

	if(oButton){
		oButton.Menu = new sf_DropDownMenu(p_sMenuId);
		return oButton;
	}
	else return false;	
}

function sf_HideMenu()
{
	if(typeof global_oMenu != 'undefined' && global_oMenu)
	{
		if(global_oMenu.Hide) global_oMenu.Hide();
		else global_oMenu.style.visibility = 'hidden';
		
		global_oMenu = null;
		document.onclick = null;
		window.onresize = null;
	}
	else return;
}

function sf_DocClick()
{
	if(document.Selects)
	{
		var nSelects = document.Selects.length-1;
		for(var i=nSelects;i>=0;i--) document.Selects[i].style.visibility = 'visible';
	}

	sf_HideMenu();
}

/* Image */
function sf_Img(p_imgId)
{
	var oImg = document.getElementById(p_imgId);
	
	if(oImg){
		oImg.onclick = sf_BtnClick;
		return oImg;
	}
	else return false;
}

function sf_ImgMenu(imgId, p_sMenuId)
{
	var img = new sf_Img(imgId);
	if(img){
		img.Menu = new sf_DropDownMenu(p_sMenuId);
		return img;
	}else return false;
}

/**
 *	common functions
 */
// input form onclick event function
function OnEnter(field)
{ 
	if(field.value == field.defaultValue ){ 
		field.value = ""; 
	} 
}
// input form onblur event function
function OnExit(field)
{ 
	if(field.value == ""){ 
		field.value = field.defaultValue; 
	} 
}
// site manager
function sman(key)
{
	var key = "sman.php?key=" + key;
	window.open(key,
	'sMan',
	'toolbar=no,location=(20,20),directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=800,height=600'
	);
}

// check all
function sf_checkAll(theForm, act)
{
	var elements = theForm.elements['sf_chk[]'];
	var elements_count = elements.length;

	if(elements_count){
		for(var i=0; i<elements_count; i++){
			elements[i].checked = act;
		}
	}
}

// confirm and go
function sf_confirmNgo(url, msg)
{
	if(confirm(msg)){
		location.href = url;
	}else return false;
}

// confirm
function sf_confirm(theForm, msg)
{
	if(confirm(msg)){
		theForm.submit();
	} else {
		return false;
	}
}

// delete confirm
function sf_delete(msg)
{
	if(confirm(msg)) return true;
	else return false;
}

// add form element to submit
function sf_submit(theForm, formName, value)
{
	var elmt = theForm.elements[formName];
	elmt.value = value;
	theForm.submit();
}

function sf_selectWin(url)
{
	window.open(url, 'selectWin',
		'toolbar=no,location=(20,20),directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no,width=500,height=480'
	);
}

function sf_newWin(url)
{
	window.open(url, 'newWin',
		'toolbar=no, location=(20,20), directories=no, status=yes, menubar=no, scrollbars=yes, resizable=yes, width=640, height=480'
	);
}

function sf_help(id)
{
	var url = "lib/help/" + language + "/" + id + ".htm";
	window.open(url, 'helpWin',
		'toolbar=no,location=(20,20),directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=400,height=400'
	);
}

function sf_mProfile(uid)
{
	var url = "?db=member&actKey=profile&mid=" + uid + "&hide_header=1";
	window.open(url, 'mProfile',
		'toolbar=no,location=(20,20),directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=400,height=400'
	);
}

function sf_mailer(receiver)
{
	var url = "?db=member&actKey=mailer&to=" + receiver + "&hide_header=1";
	window.open(url, 'mailer',
		'toolbar=no,location=(20,20),directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=400,height=400'
	);
}
-->