/*********************************
	Á¦¸ñ : Mediagate »ç¿ë javascript ÇÔ¼ö
	ÀÛ¼ºÀÏ : 2006.04.26
	ÃÖÁ¾¼öÁ¤ÀÏ : 2006.04.26
	ÀÛ¼ºÀÚ : atjoon
**********************************/

// MG »çÀÌÆ®ºÎÅÍ Ãß°¡ ½ÃÀÛ --

function CreateFlash(file, width, height, wmode)
{
	// file : ÇÃ·¡½Ã ¼Ò½º
	// width : °¡·Î»çÀÌÁî
	// height : ¼¼·Î»çÀÌÁî
	// wmode : wmode ¼³Á¤ (window, opaque, transparent)

	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+width+'" height="'+height+'">');
	document.write('<param name="movie" value="'+file+'">');
	document.write('<param name="quality" value="high">');
	document.write('<PARAM NAME=menu VALUE=false>');
	document.write('<PARAM NAME=quality VALUE=high>');
	document.write('<PARAM NAME=wmode VALUE='+wmode+'>');
	document.write('<embed src="'+file+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed>');
	document.write('</object>');
}


// MG »çÀÌÆ®ºÎÅÍ Ãß°¡ ³¡ --







// ±Û ÀÛ¼º ½Ã ±âº»»çÇ× Ã¼Å© (°ü¸®ÀÚ) --
function WriteChkAdmin()
{
	f = document.write;

	if(!f.name.value)
	{
		alert("ÀÌ¸§À» ÀÔ·ÂÇÏ¼¼¿ä.");
		f.name.focus();
		return;
	}

	if(!f.email.value)
	{
		alert("ÀÌ¸ÞÀÏÀ» ÀÔ·ÂÇÏ¼¼¿ä.");
		f.email.focus();
		return;
	}

	if(!f.tel.value)
	{
		alert("¿¬¶ôÃ³¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		f.tel.focus();
		return;
	}

	if(!f.subject.value)
	{
		alert("Á¦¸ñÀ» ÀÔ·ÂÇÏ¼¼¿ä.");
		f.subject.focus();
		return;
	}

	if(!f.product.value)
	{
		alert("¸ðµ¨À» ¼±ÅÃÇÏ¼¼¿ä.");
		f.product.focus();
		return;
	}

	if(!f.contents.value)
	{
		alert("³»¿ëÀ» ÀÔ·ÂÇÏ¼¼¿ä.");
		f.contents.focus();
		return;
	}

	if(f.attach.value)
	{
		FormatChk(f.attach, f.attach.value, "jpg|gif|doc|pdf|zip|exe|htm|upgrade|iso");
		if(chk_result == false)
		{
			f.attach.select();
			document.selection.clear();
			f.attach.focus();
			return;
		}
		alert(f.attach.value);
	}

	if(f.attach2.value)
	{
		FormatChk(f.attach2, f.attach2.value, "jpg|gif|doc|pdf|zip|exe|htm");
		if(chk_result == false)
		{
			f.attach2.select();
			document.selection.clear();
			f.attach2.focus();
			return;
		}
		alert(f.attach2.value);
	}

	if(f.attach.value || f.attach2.value)
	{
		show('msg_layer');
	}

	document.getElementById("ok_btn").style.display='none';

	f.submit();
}


// È¸¿ø°¡ÀÔ ½Ã ½Ç¸íÀÎÁõ ºÎºÐ Ã¼Å© --
function RealnameChk()
{
	f = realname_chk_frm;

	if(f.agreement.checked == false)
	{
		alert("°¡ÀÔ ¾à°ü¿¡ µ¿ÀÇÇÏ¼Å¾ß È¸¿ø°¡ÀÔÀÌ °¡´ÉÇÕ´Ï´Ù.");
		f.agreement.focus();
		return;
	}

	if(!f.name.value)
	{
		alert("ÀÌ¸§À» ÀÔ·ÂÇÏ¼¼¿ä.");
		f.name.focus();
		return;
	}

	if(!f.jumin1.value || f.jumin1.value.length < 6)
	{
		alert("¿Ã¹Ù¸¥ ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		f.jumin1.focus();
		return;
	}

	if(!f.jumin2.value || f.jumin2.value.length < 7)
	{
		alert("¿Ã¹Ù¸¥ ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		f.jumin2.focus();
		return;
	}

	f.submit();
}



// Á¦Ç°µî·Ï ½Ã ±¸ÀÔÃ³ ¼±ÅÃÇÏ¸é »ó¼¼ ±¸ÀÔÃ³ ³ª¿À°Ô ÇÏ´Â ÇÔ¼ö --
function ShowSpan(obj)
{
	shop_dtl = new Array('place_01', 'place_02', 'place_03', 'place_04');
	size = shop_dtl.length;
	for(i=0;i<size;i++)
	{
		if(shop_dtl[i] == obj)
		{
			eval(shop_dtl[i]).style.display = '';
		}
		else
		{
			eval(shop_dtl[i]).style.display = 'none';
		}
	}
}

// Á¦Ç° µî·Ï ½Ã total Á¦Ç° Á¤º¸ ¸¸µé±â --
function ProductTotal(mode, id)
{
	f = myProduct;
	i = f.cnt.value;

	if(i == 0)
	{
		if(mode == "del") f.product_total.value = "";
		else if(mode == "add") f.product_total.value = f.product.value;
	}

	else if (i == 1)
	{
		if(mode == "del") f.product_total.value = "";
		else if (mode == "add")
		{
			if(f.product_pid.value > f.product.value) f.product_total.value = f.product.value + "-" + f.product_pid.value + "-";
			else f.product_total.value = f.product_pid.value + "-" + f.product.value + "-";
		}
	}

	else
	{
		tmp = "";
		ins_chk = "N";
		for(j=0; j<i; j++)
		{
			if(mode == "del")
			{
				if(id == f.product_id[j].value) tmp = tmp;
				else tmp = tmp + f.product_pid[j].value + "-";
			}
			else if (mode == "add")
			{
				if((f.product_pid[j].value > f.product.value) && ins_chk == "N")
				{
					tmp = tmp + f.product.value + "-" + f.product_pid[j].value + "-";
					ins_chk = "Y";
				}
				else tmp = tmp + f.product_pid[j].value + "-";
			}
		}
		if(mode == "add" && ins_chk == "N") tmp = tmp + f.product.value + "-";
		f.product_total.value = tmp;
	}
//	alert(f.product_total.value);
}


// °æ·Î °¨Ãß±â ============================
//window.defaultStatus = "Áñ°Å¿î µðÁöÅÐ ¶óÀÌÇÁ! - MediaGate!";

// document.onmouseover = hidestatus();
// document.onmouseout = hidestatus();

function hidestatus()
{
	window.status = "Welcome To AL Tech!";
	return;
}
// ===================================

// 1. IE ¹öÀü¿¡ µû¶ó ¼îÇÎ¸ô Àå¹Ù±¸´Ï ±â´ÉÀÌ Àû¿ëµÇÁö ¾Ê´Â ¹®Á¦ ÇØ°á À§ÇØ »ç¿ë (»ó´ë°æ·Î/Àý´ë°æ·Î ¹®Á¦) =========
function shop(type, val)
{
	top.location.replace("shop_link.php?type="+type+"&val="+val);
}
// ==================================================================================================


// 2. Ã·ºÎÆÄÀÏ ´Ù¿î·Îµå È¸¼ö Ã¼Å© ½Ã »ç¿ë ÇÔ¼ö ==========================================================
function AttachCnt(class2, uid, attach, attach_val)
{
	next_url = "attach_cnt.php?class2="+class2+"&uid="+uid+"&attach="+attach+"&attach_val="+attach_val;
//	alert(next_url);
	fileframe.location.replace(next_url);
}
// ==================================================================================================


// 3. ·¹ÀÌ¾î º¸¿©ÁÖ°í ¼û±â´Â ÇÔ¼ö ======================================================================
function show(obj)
{
	eval("window."+obj+".style.visibility='visible'");
}

function hide(obj)
{
	eval("window."+obj+".style.visibility='hidden'");
}

function showhide(obj)
{
	property = eval("window."+obj+".style.visibility");
	if(property == "hidden")
	{
		eval("window."+obj+".style.visibility='visible'");
	}
	else
	{
		eval("window."+obj+".style.visibility='hidden'");
	}
}
// ==================================================================================================


// Á¦Ç°¸Þ´º ¼Ò¸Þ´º º¸¿©ÁÖ´Â ÇÔ¼ö =======================================================================
function ProdMenuShow(what)
{
	rg.style.display = 'none';
	wlan.style.display = 'none';
	bg.style.display = 'none';
	usb.style.display = 'none';
	multimedia.style.display = 'none'

	what.style.display = '';
}
// ==================================================================================================


// iframe ³ôÀÌ ÀÚµ¿ Á¶Á¤ =======================================================================
function resizeHeight(obj)
{
	alert(obj.name);
	objHeight = eval(obj.name + ".document.body.scrollHeight");
//	alert(objHeight);
	obj.setExpression('height', objHeight);
}


// ÆÄÀÏ ¾÷·Îµå ½Ã ÆÄÀÏ Æ÷¸Ë Ã¼Å©
 function FormatChk(object, file, format)
 {
	 chk_result = false;

	 file = file.split('\\');
	 file_cnt = file.length;
	 file = file[file_cnt-1];
	 file = file.split('.');
	 file_cnt = file.length;
	 file_format = file[file_cnt-1];
	 file_format = file_format.toLowerCase();
//	 alert(file_format);

	 format = format.split('|');
	 cnt = format.length;

	 for(i=0;i<cnt;i++)
	 {
		 if(format[i] == file_format) chk_result = true;
	 }

	 if (chk_result == false)
	 {
		 message = "ÆÄÀÏÇü½ÄÀº ";
		 for(i=0;i<cnt;i++)
		 {
			 message = message + "'" + format[i] + "'";
			 if(i != (cnt-1)) message = message + " È¤Àº ";
		 }
		 message = message + "¸¸ ¼±ÅÃÇÒ ¼ö ÀÖ½À´Ï´Ù.";
		 alert(message);
		 eval(object).focus();
	 }
	 return chk_result;

 }


// 5. ?? ============================================================================================
function new_window(val)
{
	if (val == 2)
	{
		window.open("event_agency.htm","event_agency","width=572, height=760, location=no, menubar=no, toolbars=no, scrollbars=yes, resizable=yes");
	}
	else if (val == 3)
	{
		window.open("event_agency.htm#online","event_agency","width=572, height=760, location=no, menubar=no, toolbars=no, scrollbars=yes, resizable=yes");
	}
	else if (val == 4)
	{
		location.href("atboard.php?param=0212event");
		window.close();
	}
	else if (val == "find_id_pw")
	{
		window.open("find_idpw.php", "find_idpw", "width=400, height=300, location=no, menubar=no, toolbars=no, scrollbars=auto, resizable=no");
	}
}
// ==================================================================================================


function WindowOpen(url, name, width)
{
	window.open(url+"?width="+width, name, "width="+width+", location=no, menubar=no, toolbars=no, scrollbars=yes, resizable=no");
}


function window_seminar()
{
		window.open("pre_seminar.php","pre_seminar","width=640, height=350, location=no, menubar=no, toolbars=no, scrollbars=no, resizable=yes");
}


// 7. ¼ýÀÚ¸¸ ±âÀÔ¹Þ°Ô ÇÏ´Â ÇÔ¼ö (ÀüÈ­¹øÈ£ Ã¼Å© ½Ã »ç¿ë. '-'´Â Çã¿ë) =======================================
function NumericChk(obj)
{
	Chk_Length = eval(obj).value.length;
	Compare_Val = "0123456789-";	// ¼ýÀÚ¿Í '-'´Â Çã¿ë
	Numeric_Ok = "true";

	for(i=0;i<Chk_Length;i++)
	{
		Temp_Val = eval(obj).value.substring(i,i+1);
		if(Compare_Val.indexOf(Temp_Val) == "-1") Numeric_Ok = "false";
	}

	if(Numeric_Ok == "false")
	{
		alert("¼ýÀÚ¸¸ ±âÀÔÇÒ ¼ö ÀÖ½À´Ï´Ù.");
		eval(obj).value = "";
		eval(obj).focus();
		return;
	}

}
// ==================================================================================================


function setBtn(obj, btnId)
{
	len = document.btn.length;
	tmp_index = "";

	for(i=1; i<len+1; i++)
	{
		tmp_src = document.btn[i-1].id;
		if(tmp_src == btnId) tmp_index = i-1;
		tmp_src = tmp_src + "Off.gif";
		document.btn[i-1].src = "img/"+tmp_src;
		tmp_contents = "contents_0" + i;
		eval(tmp_contents).style.display = "none";		
	}
	tmp_src = "img/"+btnId+"On.gif";
	document.btn[tmp_index].src = tmp_src;
	eval(obj).style.display = "";	
}


function setBtn2(obj, btnName)
{
	contents_01.style.display = "none";
	contents_02.style.display = "none";

	btn01.src = "img/contents_menu_v02_01off.gif";
	btn02.src = "img/contents_menu_v02_02off.gif";

	eval(obj).style.display = "";
	eval(btnName).src = "img/contents_menu_v02_" + btnName.substring(3, 5) + "on.gif";
	
}

function setBtn3(obj, btnName)
{
	contents_01.style.display = "none";
	contents_02.style.display = "none";
	contents_04.style.display = "none";
	contents_05.style.display = "none";

	btn01.src = "img/contents_menu_v02_01off.gif";
	btn02.src = "img/contents_menu_v02_02off.gif";
	btn04.src = "img/contents_menu_v02_04off.gif";
	btn05.src = "img/contents_menu_v02_05off.gif";

	eval(obj).style.display = "";
	eval(btnName).src = "img/contents_menu_v02_" + btnName.substring(3, 5) + "on.gif";
	
}

function setBtn4(obj, btnName)
{
	CMPcenter_01.style.display = "none";
	CMPcenter_02.style.display = "none";
	CMPcenter_03.style.display = "none";

	btnCMP1.src = "img/CMPcenter_btn_01Off.gif";
	btnCMP2.src = "img/CMPcenter_btn_02Off.gif";
	btnCMP3.src = "img/CMPcenter_btn_03Off.gif";

	eval(obj).style.display = "";
	eval(btnName).src = "img/CMPcenter_btn_0" + btnName.substring(6, 7) + "On.gif";
	
}

function fixlayer()
{
	var a = document.body.scrollTop + 20;
	layer1.style.top = a;
}