function SetSearchOptByVal(f, eltName, sValue)
{
	var selObj = eval('f.'+eltName);
	if (!selObj) return false;
	for ( var i=0; i < selObj.length; i++ )
	{
		var sval = selObj.options[i].value;
		if (sval == sValue)
		{
			selObj.selectedIndex = i;
			break;
		}
	}
}

function CheckFormField ( eltObj , eltValue, chkValue, sErrMsg, bfocus )
{
	if (!eltObj) return false;
	if ( eltValue == chkValue )
	{
		alert ( " " + sErrMsg + " " );
		if (bfocus) eval(eltObj).focus();
		return false;
	}
	return true;
}

function CheckEmail ( eltObj, bfocus )
{
	if (!eltObj) return false;
	var sEmail = eltObj.value;
	if ( !sEmail.match(/^[_0-9a-zA-Z-]+(\.[_0-9a-zA-Z-]+)*@[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*$/) )
	{		
		alert ( " E-Mail À» Á¤È®ÇÏ°Ô ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿À. " );
		if (bfocus) eltObj.focus();
		return false;
	}
	if (sEmail.lastIndexOf(".") < 4)
	{		
		alert ( " E-Mail À» Á¤È®ÇÏ°Ô ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿À. " );
		if (bfocus) eltObj.focus();
		return false;
	}	
	return true;
}

function SendMail ( eltObj, sEmailID )
{
	if ( !eltObj ) return false;
	if ( sEmailID == '' ) return false;
	eltObj.href = 'mailto:'+ sEmailID + '@xinics.com';
	return true;
}

function goRootList( baseurl, strSearch )
{
	var f = document.SearchFrm;
	if ( !f )
	{
		document.location.href=baseurl;
		return;
	}
	if ( strSearch != '' )
		f.SearchText.value = strSearch.replace(/\'\'/g, '\'');
//	else
//		f.SearchType.selectedIndex = 0;
	f.submit();
}

// FAQ ³ª DOWNLOAD(PDS) ¿¡¼­ Typeº° °Ë»öÀ» Áö¿øÇÑ´Ù.
function SearchByType(Obj)
{
	var f = Obj.form;
	f.SearchText.value='';
	f.submit();
}

function hrefList ( sURL, sWidth, sHeight )
{
	this.sURL = sURL;
	this.sWidth = sWidth;
	this.sHeight= sHeight;
}

function OpenContentURL( sURL, sWidth, sHeight )
{
	var w = 1014;
	var h = 739;
	if (sWidth != '' && sHeight != '' && sWidth > 10 && sHeight > 29)
	{
		w = sWidth  - 10;
		h = sHeight - 29;
	}
	window.open(sURL, 'Viewer', 'scrollbars=no, resizable = no, menubar = no, top=0, left=0, fullscreen = no, width='+w+', height='+h);
}

function deletemessage(url)
{
	var deleteWin=window.open(url,"deletemessage","height=100,width=300,dependent=yes,scrollbars=no");
	deleteWin.focus();
}


function CheckFormlength ( eltObj , eltValue, chkValue, sErrMsg, bfocus )
{
	if (!eltObj) return false;
	if ( eltValue < chkValue )
	{
		alert ( " " + sErrMsg + " " );
		if (bfocus) eval(eltObj).focus();
		return false;
	}
	return true;
}

function GoUpgrade( sURL )
{
	w = 500, h = 638;
	window.open(sURL, '_Upgrade', 'scrollbars=0, resizable = no, menubar = no, top=0, left=0, fullscreen = no, width='+w+', height='+h);
}

function DoDownload( sURL )
{
	if (sURL.length > 0) window.location.href = sURL;
}
