//===============================================================
// checkChar(type, word) : ¿µ¼ýÀÚ Ã¼Å©
// @param type : Á¦¾à(Numeric, Alphabet, AlphNum)
// @param word : Ã¼Å©ÇÒ¹®ÀÚ¿­
// @return Boolean 
// ex) È£ÃâÇÒ¶©....checkChar('Num','°¡³ª´Ù') => ÀÌ·±½ÄÀ¸·Î ¾ËÁö? ^^ ¹ÝÈ¯°ªÀº ºÒ¸®¾ÈÀ¸·Î...
//===============================================================
function checkChar(type, word){
	var Numeric = "1234567890";
	var Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
	var AlphNum = Numeric + Alphabet;

	if (type == 'Num')	str = Numeric;
	else if (type == 'Alpha') str = Alphabet;
	else if (type == 'AlphaNum') str = AlphNum;

	var i ; 

	for ( i=0; i < word.length; i++ )  {
		if( str.indexOf(word.substring(i,i+1)) < 0) {
			break ; 
		}
	}

	if ( i != word.length ) {
		return false ; 
	}
	else{
		return true ;
	} 

	return true;
}


//===================================================================
//°ø¹éÀÌ ÀÖ´ÂÁö È®ÀÎ
//ElementsName : elements ÀÌ¸§ => this.form.elements ÀÌ¸§
//AlertString : Alert Ã¢ÀÇ ¸Þ¼¼Áö => this.form.elements ÀÌ¸§
//===================================================================
function BlankCheck(ElementsName,AlertString)
{
	if (ElementsName.value == "")
	{
		alert(AlertString);
		ElementsName.focus();
		return 0;
	}
}


//===================================================================
//Email À¯È¿¼º °Ë»ç
//ElementsName : elements ÀÌ¸§ => this.form.elements ÀÌ¸§
//===================================================================
function EmailCheck(ElementsName)
{
	if(ElementsName.value == "")
	{
		alert("e-mail ÁÖ¼Ò¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
		ElementsName.focus();
		return 0;
	}

	var strAlNumcomp = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
	var strspcomp = "'~!#$%^&*()+=\<>?/:;|,";
	var strmailcomp = strAlNumcomp + "@.-_";

	if(ElementsName.value.length!=0)
	{
		var emaillen = ElementsName.value.length-1
		if(ElementsName.value.indexOf("@") < 1 || ElementsName.value.indexOf(".") < 1)
		{
			alert("¸ÞÀÏÁÖ¼ÒÀÇ Çü½ÄÀÌ Àß¸øµÇ¾ú½À´Ï´Ù!\n\n´Ù½Ã ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä!");
			ElementsName.value='';
			ElementsName.focus();
			return 0;
		}
	}
}


//===============================================================
// onkeyDown ÀÌº¥Æ®ÀÏ¶§ ¼ýÀÚ Ã¼Å©
// ÀÚÆÇÀÇ Å°¸¦ ´­·¶À»¶§ ´­·¯Áø Å°ÀÇ ASCIIÄÚµå°ªÀ» ¾ò¾î
// ¼ýÀÚ¿Í back delÅ°,TabÅ°¸¸ ½ÇÇàµÊ
// ieÀü¿ë
//===============================================================
function onlyNumber()
{ 
	var keycode = window.event.keyCode;
	var realkey = String.fromCharCode(window.event.keyCode);
				
	//alert("keycode: " + keycode  + "\nrealkey: " + realkey);
	if(keycode == 8 || keycode == 9 || keycode == 16 || keycode == 46) //8:back del,9:Tab,16:Shift,46:del
	{
		event.returnValue = true;
	}
	else if(keycode == 37 || keycode == 39) //37:left,39:right
	{
		event.returnValue = true;
	}
	else if(keycode >= 48 && keycode <= 57) //ÀÚÆÇ»ó´Ü ¼ýÀÚ0~9ÀÎ°ÍÀº È­¸é¿¡ Âï´Â´Ù.(ÀÚÆÇ»ó´Ü ¼ýÀÚµéÀÇ keycode)
	{
		event.returnValue = true;
	}
	else if(keycode >= 96 && keycode <= 105) //ÀÚÆÇ¿ìÃø ¼ýÀÚ0~9ÀÎ°ÍÀº È­¸é¿¡ Âï´Â´Ù.(ÀÚÆÇ¿ìÃø ¼ýÀÚµéÀÇ keycode)
	{
		event.returnValue = true;
	}
	else //0~9°¡ ¾Æ´Ï¸é È­¸é¿¡ ÂïÁö ¾Ê´Â´Ù.
	{
		event.returnValue = false;
	}
}


// +++++++++++++  radio buttonÀÇ checked µÈ value °ª ¹ÝÈ¯ ++++++++
function FindRadioValue(field) {
	for (i=0;i<field.length;i++ ){
		if (field[i].checked == true) {
			return field[i].value;
		}
	}
}


// +++++++++++++  radio buttonÀÇ ÃÊ±â°ª check ++++++++
function DefineRadioValue(field, defineValue) {
	for (i=0;i<field.length;i++ ){
		if (field[i].value == defineValue) {
			return field[i].checked = true;
		}
	}
}


// +++++++++++++  select ¹Ú½ºÀÇ selected µÈ value °ª ¹ÝÈ¯ ++++++++
function FindSelectValue(field) {
	for (i=0;i<field.length;i++ ){
		if (field[i].selected == true) {
			return field[i].value;
		}
	}
}


// +++++++++++++  select ¹Ú½ºÀÇ ÃÊ±â°ª select ++++++++
function DefineSelectValue(field, defineValue) {
	for (i=0;i<field.length;i++ ){
		if (field[i].value == defineValue) {
			return field[i].selected = true;
		}
	}
}


// ################## Script For Flash & ActiveX ################################
// DocumentWrite(MakeFlashString('image/ml_flash.swf','emb1','330','520','opaque'));
// SetInnerHTML(document.all.mm, MakeFlashString('image/ml_flash.swf','emb1','330','520','opaque'));
// @@ÁÖÀÇ »çÇ× 
//  - »óÈ£ÀÛ¿ë ¾ø´Â ÄÁÅÙÃ÷´Â DocumentWrite, SetInnerHTML µÑ´Ù »ç¿ë °¡´É
//  - »óÈ£ÀÛ¿ë ÀÖ´Â ÄÁÅÙÃ÷´Â SetInnerHTML¸¸ »ç¿ë °¡´É
// ###################################################################

// +++++++++++++  MakeFlashString(source,id,width,height,wmode) ++++++++
// 
// source: source url --> ÇÃ·¡½¬ ÆÄÀÏÀÇ °æ·Î
// id: flash id 
// width: source width
// height: source height
// wmode: wmode --> "none, transparent, opaque"
// otherparam : Ãß°¡ ÆÄ¶ó¹ÌÅÍ "<param name='myParam' value='myValue' />
// 
function MakeFlashString(source,id,width,height,wmode,otherParam) {
	return "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0\" width="+width+" height="+height+" id="+id+"><param name=wmode value="+wmode+" /><param name=movie value="+source+" /><param name=quality value=high />"+otherParam+"<embed src="+source+" quality=high wmode="+wmode+" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash\" width="+width+" height="+height+"></embed></object>";
}


// +++++++++++++  MakeEmbedString(source,id,width,height) ++++++++
// 
// source: source url --> EmbedµÉ ÆÄÀÏÀÇ °æ·Î
// width: source width
// height: source height
// align : align
// 
function MakeEmbedString(source,width,height,align) {
	return "<EMBED src='"+source+"' quality='high' bgcolor='#FFFFFF' WIDTH='"+width+"' HEIGHT='"+height+"' align='"+align+"' hspace=3 vspace=2></EMBED>";
}

// +++++++++++++  MakeObjectString(classid, codebase, name, id, width,height, param) ++++++++
// 
// classid: classid --> ÇÃ·¡½¬ ÆÄÀÏÀÇ °æ·Î
// codebase: cabÆÄÀÏ À§Ä¡ ¹× ¹öÀüÁ¤º¸ 
// name :
// id :
// width: source width
// height: source height
// 
// wmode: wmode --> "none, transparent, opaque"
// param : Ãß°¡ ÆÄ¶ó¹ÌÅÍ "<param name='myParam' value='myValue' />
function MakeObjectString(classid, codebase, name, id, width,height, param) {
	return "<object classid="+classid+" codebase="+codebase+" name="+name+" width="+width+" height="+height+" id="+id+"><param name=wmode value="+wmode+" />"+param+"</object>";
}

// innerHTML Type
function SetInnerHTML(target, code) { 
	target.innerHTML = code;
}

// Direct Write Type
function DocumentWrite(src) {
	document.write(src);
}


//===================================================================
//»õÃ¢À» ¶ç¿î´Ù.no,no,yes,yes
//window.open("url","Ã¢ÀÌ¸§","¼Ó¼º");
//===================================================================
function new_open_window(url,window_name,toolbar,menubar,scrollbars,resizable,width,height,top,left) {
	window_property = "toolbar=" + toolbar + ",menubar=" + menubar + ",scrollbars=" + scrollbars + ",resizable=" + resizable + ",width=" + width + ",height=" + height + ",top=" + top + ",left=" + left;
	ow=window.open(url,window_name,window_property);
	ow.focus();
}


//===================================================================
//»õÃ¢À» ¿­¶§ ¾Ö´Ï¸ÅÀÌ¼ÇÀ¸·Î ¿¬´Ù
//expandingWindow(Website,Width,Height,top_location,left_location)
//@Website:»õÃ¢À¸·Î ¿ÀÇÂÇÒ ¹®¼­ÀÇ ÀÌ¸§
//@Width : Ã¢ÀÇ °¡·ÎÆø
//@Height : Ã¢ÀÇ ³ôÀÌ
//@top_location : Ã¢ÀÇ À§ÂÊ ¸ð¼­¸® À§Ä¡
//@left_location : Ã¢ÀÇ ¿ÞÂÊ ¸ð¼­¸® À§Ä¡
//===================================================================
function expandingWindow(website,width,height,top_location,left_location)
{
	var heightspeed = 7;
	var widthspeed = 7;
	var leftdist = left_location;
	var topdist = top_location;

	var winwidth = width;
	var winheight = height;
	var sizer = window.open("","","left=" + leftdist + ",top=" + topdist + ",width=1,height=1,toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no");
	for (sizeheight = 1; sizeheight < winheight; sizeheight += heightspeed) 
	{
		sizer.resizeTo("1", sizeheight);
	}
	for (sizewidth = 1; sizewidth < winwidth; sizewidth += widthspeed)
	{
		sizer.resizeTo(sizewidth, sizeheight);
	}
	sizer.location = website;
}