var SSL_USE_YN		= true;

function layer_toggle(obj) {
	var objt = document.getElementById(obj);
	objt.style.display = objt.style.display == "none" ? "block" : "none";
}

/* ÆäÀÌÁö Áñ°Ü Ã£±â Ãß°¡ °ü·Ã ÇÔ¼öµé */
/* ¸µÅ©»ç¿ë¹ý : javascript:bookmarksite('title_of_site', 'url_of_site') */
function bookmarksite(title,url) {
	if (window.sidebar) // firefox
		window.sidebar.addPanel(title, url, "");
	else if(window.opera && window.print)
	{ // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	}
	else if(document.all)// ie
	window.external.AddFavorite(url, title);
}

// ½ÃÀÛ ÆäÀÌÁö·Î ÁöÁ¤ ÇÏ´Â ÇÔ¼ö
function setStartPage() {
	startpage.style.behavior='url(#default#homepage)';
	startpage.setHomePage('http://www.4science.net/');
}


// ¼ýÀÚ¸¸ ÀÔ·Â (INPUT) *********************************************************
function num_only()
{
	if((event.keyCode < 48) || (event.keyCode > 57))
	{
		event.returnValue=false;
	}
}


// ÁÖ¹Îµî·Ï¹øÈ£ Ã¼Å© ***********************************************************
function numbercheck(theform)
{
	var chk	= 0;
	var yy	= theform.ssn1.value.substring(0,2);
	var mm	= theform.ssn1.value.substring(2,4);
	var dd	= theform.ssn1.value.substring(4,6);
	var sex	= theform.ssn2.value.substring(0,1);

	// ÁÖ¹Îµî·Ï¹øÈ£ Ã¼Å©
	for (var i = 0; i <= 5 ; i++)
	{
		chk = chk + ((i % 8 + 2) * parseInt(theform.ssn1.value.substring(i, i + 1)));
	}
	for (var i = 6; i <= 11 ; i++)
	{
		chk = chk + ((i % 8 + 2) * parseInt(theform.ssn2.value.substring(i - 6, i - 5)));
	}
	chk = 11 - (chk % 11);
	chk = chk % 10;

	if (chk != theform.ssn2.value.substring(6, 7))
	{
		alert ("À¯È¿ÇÏÁö ¾ÊÀº ÁÖ¹Îµî·Ï¹øÈ£ÀÔ´Ï´Ù.");
		theform.ssn1.value = "";
		theform.ssn1.focus();
		return false;
	}

	else if ((theform.ssn1.value.length != 6) || (yy < 25 || mm < 1 || mm >12 || dd < 1))
	{
		alert ("ÁÖ¹Îµî·Ï¹øÈ£°¡ Àß¸øµÇ¾ú½À´Ï´Ù.");
		theform.ssn1.value = "";
		theform.ssn1.focus();
		return false;
	}

	else if ((sex != 1 && sex !=2 )||(theform.ssn2.value.length != 7 ))
	{
		alert ("ÁÖ¹Îµî·Ï¹øÈ£°¡ Àß¸øµÇ¾ú½À´Ï´Ù.");
		theform.ssn2.value = "";
		theform.ssn2.focus();
		return false;
	}

	else
		return true;
}


// ÀÌ¸ÞÀÏ Ã¼Å© *****************************************************************
function emailCheck(str_email)
{
	var pattern = /^(.+)@(.+)$/;
	var atom = "\[^\\s\\(\\)<>#@,;:!\\\\\\\"\\.\\[\\]\]+";
	var word = "(" + atom + "|(\"[^\"]*\"))";
	var user_pattern = new RegExp("^" + word + "(\\." + word + ")*$");
	var ip_pattern = /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var domain_pattern = new RegExp("^" + atom + "(\\." + atom +")*$");

	var arr = str_email.match(pattern);
	if (!arr)
		return false;			//"Email address seems incorrect (check @ and .'s)";
	if (!arr[1].match(user_pattern))
		return false;			//"The username doesn't seem to be valid.";

	var ip = arr[2].match(ip_pattern);
	if (ip)
	{
		for (var i=1; i<5; i++)
		{
			if (ip[i] > 255)
				return false;	//"Destination IP address is invalid!";
		}
	}
	else
	{
		if (!arr[2].match(domain_pattern))
			return false;		//"The domain name doesn't seem to be valid.";
		var domain = arr[2].match(new RegExp(atom,"g"));
		if (domain.length < 2)
			return false;		//"This address is missing a hostname!";
		if (domain[domain.length-1].length < 2 || domain[domain.length-1].length > 3)
			return false;		//"The address must end in a three-letter domain, or two letter country.";
	}

	return true;
}


// ¸ðµ¨ ¼ö·®º¯°æ ***************************************************************
function count_change(temp, no, cart_yn)
{
	// 2°³ ÀÌ»óÀÇ ¸ðµ¨À» °®°í ÀÖ´Ù¸é ¹è¿­·Î Ã³¸®
	if (document.frm.ea.length)
	{
		var ea = document.frm.ea[no].value;
		if(temp == 0){
			ea ++;
		}else if(temp == 1){
			if(ea > 1) ea --;
		}
		document.frm.ea[no].value = ea;
	}
	// ¸ðµ¨ÀÌ ÇÏ³ªÀÏ °æ¿ì
	else
	{
		var ea = document.frm.ea.value;
		if(temp == 0){
			ea ++;
		}else if(temp == 1){
			if(ea > 1) ea --;
		}
		document.frm.ea.value = ea;
	}

	// Àå¹Ù±¸´Ï¿¡¼­ »ç¿ëÇÒ °æ¿ì
	if (cart_yn == 1)
		price_change(ea, no);
}


// Àå¹Ù±¸´Ï °¡°Ýº¯°æ ***********************************************************
function price_change(ea, no)
{
	// 2°³ ÀÌ»óÀÇ ¸ðµ¨À» °®°í ÀÖ´Ù¸é ¹è¿­·Î Ã³¸®
	if (document.frm.ea.length)
	{
		var package_quantity		= document.frm.package_quantity[no].value;
		var package_price			= document.frm.package_price[no].value;
		var array_package_quantity	= package_quantity.split(",");
		var array_package_price		= package_price.split(",");

		if (array_package_quantity.length > 1)
		{
			for (i = array_package_quantity.length - 1; i >= 0; i--)
			{
				if (array_package_quantity[i] <= ea)
				{
					price			= array_package_price[i];
					price_times_ea	= price * ea;
					document.frm.price[no].value = number_format(price) + "¿ø";
					document.frm.price_times_ea[no].value = number_format(price_times_ea) + "¿ø";
					break;
				}
			}
		}
		else if (package_price != 0)
		{
			price_times_ea			= package_price * ea;
			document.frm.price_times_ea[no].value = number_format(price_times_ea) + "¿ø";
		}
	}
	// ¸ðµ¨ÀÌ ÇÏ³ªÀÏ °æ¿ì
	else
	{
		var package_quantity		= document.frm.package_quantity.value;
		var package_price			= document.frm.package_price.value;
		var array_package_quantity	= package_quantity.split(",");
		var array_package_price		= package_price.split(",");

		if (array_package_quantity.length > 1)
		{
			for (i = array_package_quantity.length - 1; i >= 0; i--)
			{
				if (array_package_quantity[i] <= ea)
				{
					price			= array_package_price[i];
					price_times_ea	= price * ea;
					document.frm.price.value = number_format(price) + "¿ø";
					document.frm.price_times_ea.value = number_format(price_times_ea) + "¿ø";
					break;
				}
			}
		}
		else if (package_price != 0)
		{
			price_times_ea			= package_price * ea;
			document.frm.price_times_ea.value = number_format(price_times_ea) + "¿ø";
		}
	}

	price_check();
}


// ÃÑÇÕ ±Ý¾× º¯°æ **************************************************************
function price_check()
{
	var frm = document.frm;
	var sum_price_times_ea = 0;

	// 2°³ ÀÌ»óÀÇ ¸ðµ¨À» °®°í ÀÖ´Ù¸é ¹è¿­·Î Ã³¸®
	if (frm.ea.length)
	{
		for (i = 0; i < frm.ea.length; i++)
		{
			sum_price_times_ea		= sum_price_times_ea + parseInt(frm.price_times_ea[i].value.replace(/,/g, ""));
		}

		if (sum_price_times_ea * 1.1 < 100000)
		{
			shipping_fees			= 3500
			document.all.table_VAT.style.display = "block";
		}
		else
		{
			shipping_fees			= 0
			document.all.table_VAT.style.display = "none";
		}

		frm.sum_price_times_ea.value= number_format(sum_price_times_ea) + "¿ø";
		frm.VAT.value				= number_format(sum_price_times_ea * 0.1) + "¿ø";
		frm.total_order_price.value	= number_format(parseInt(sum_price_times_ea * 1.1 + shipping_fees)) + "¿ø";
	}
	// ¸ðµ¨ÀÌ ÇÏ³ªÀÏ °æ¿ì
	else
	{
		sum_price_times_ea			= parseInt(frm.price_times_ea.value.replace(/,/g, ""));

		if (sum_price_times_ea * 1.1 < 100000)
		{
			shipping_fees			= 3500
			document.all.table_VAT.style.display = "block";
		}
		else
		{
			shipping_fees			= 0
			document.all.table_VAT.style.display = "none";
		}

		frm.sum_price_times_ea.value= number_format(sum_price_times_ea) + "¿ø";
		frm.VAT.value				= number_format(sum_price_times_ea * 0.1) + "¿ø";
		frm.total_order_price.value	= number_format(parseInt(sum_price_times_ea * 1.1 + shipping_fees)) + "¿ø";
	}
}


// ¼ýÀÚÆ÷¸Ë (,) ³Ö±â ***********************************************************
function number_format(number)
{
	unit		= 3;
	i			= 0;
	rst			= '';
	number		= number + '';
	len			= number.length;
	arr			= new Array(len);

	while(i <len){
		arr[i]	= number.charAt(len-i-1);
		rst		= arr[i] + rst;
		i++;
		if(i % unit == 0 && i != len)
			rst	= ',' + rst;
	}
	return rst;
}


// Àå¹Ù±¸´Ï ¼±ÅÃÁÖ¹®/°ßÀû ******************************************************
function get_cartParam(mode, cart_model_idx, no)
{
	var frm = document.frm;

	// 2°³ ÀÌ»óÀÇ ¸ðµ¨À» °®°í ÀÖ´Ù¸é ¹è¿­·Î Ã³¸®
	if (frm.ea.length)
		cart_ea = frm.ea[no].value;
	// ¸ðµ¨ÀÌ ÇÏ³ªÀÏ °æ¿ì
	else
		cart_ea = frm.ea.value;

	if (SSL_USE_YN)
		location.href = "https://" + document.domain + "/main.asp??=cart/main&mode=" + mode + "&cart_model_idx=" + cart_model_idx + "&cart_ea=" + cart_ea;
	else
		location.href = "/main.asp??=cart/main&mode=" + mode + "&cart_model_idx=" + cart_model_idx + "&cart_ea=" + cart_ea;

}


// ÁÖ¹®ÇÏ±â (¹Ù·ÎÁÖ¹®/ÀüÃ¼ÁÖ¹®) ************************************************
function cart_buy(cookie_type)
{
	if (SSL_USE_YN)
		document.frm.action = "https://" + document.domain + "/main.asp??=cart/buy/buy_step01&cookie_type="+ cookie_type;
	else
		document.frm.action = "/main.asp??=cart/buy/buy_step01&cookie_type="+ cookie_type;
	document.frm.submit();
}


// °ßÀû¿äÃ» (¹Ù·Î°ßÀû/ÀüÃ¼°ßÀû) ************************************************
function quotation_request(cookie_type)
{
	if (SSL_USE_YN)
		document.frm.action = "https://" + document.domain + "/main.asp??=cart/quotation/quotation_step01&cookie_type="+ cookie_type;
	else
		document.frm.action = "/main.asp??=cart/quotation/quotation_step01&cookie_type="+ cookie_type;

	document.frm.submit();
}


// À§½Ã¸®½ºÆ® ´ã±â *************************************************************
function wishlist()
{
	document.frm.action_mode.value = "wishlist";
	document.frm.submit();
}


// °ßÀû¼­ ÀÎ¼âÇÏ±â1 (Àå¹Ù±¸´Ï) *************************************************
function print_quotation(cookie_type)
{
	var win = "frameset.asp??=cart/quotation/quotation_print&cookie_type=" + cookie_type;

	document.frm.submit();
	window.open(win, "print", "left=20, top=25, width=667, height=800, scrollbars=yes");
	document.location.href = "main.asp??=cart/main";
}


// °ßÀû¼­ ÀÎ¼âÇÏ±â2 (Àå¹Ù±¸´Ï ±¸¸Å ¿Ï·á) ***************************************
function print_quotation2(cookie_type, buy_idx)
{
	var win = "frameset.asp??=cart/quotation/quotation_print&cookie_type=" + cookie_type + "&buy_idx=" + buy_idx;

	window.open(win, "print", "left=20, top=25, width=667, height=800, scrollbars=yes");
}


// ¸¶ÀÌÆäÀÌÁö ÀÎ¼âÇÏ±â *********************************************************
function print_mypage_quotation(buy_idx, quotation_admin_idx)
{
	win = "http://" + document.domain + "/frameset.asp??=mypage/shopping/print/print&buy_idx=" + buy_idx + "&quotation_admin_idx=" + quotation_admin_idx;
	window.open(win, "print", "left=20, top=25, width=667, height=800, scrollbars=yes");
}


// ÁÖ¼ÒÃ£±â ********************************************************************
function popup_addressCheck(formName, siName, dongName,moreName, zipCodeName)
{
	var win = "/Common/toolkit/NWS_address/address.asp?formName="+ formName +"&siName="+ siName +"&dongName="+ dongName +"&moreName="+ moreName +"&zipCodeName="+ zipCodeName;
	window.open(win, "address", "width=457, height=568, left=200, top=200, scrollbars=yes");
}

// Çö±Ý¿µ¼öÁõ ÆË¾÷ *************************************************************
function showreceipt(tid)
{
	var showreceiptUrl = "https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/Cash_mCmReceipt.jsp?noTid=" + tid + "&clpaymethod=22";
	window.open(showreceiptUrl,"showreceipt","width=380,height=540, scrollbars=no,resizable=no");
}


// File Upload Ã¢ ¶ç¿ì±â *******************************************************
function popup_upload(formName, inputName, uploadType)
{
	var win = '/Common/toolkit/NWS_upload/fileselect.asp?formName='+ formName +'&imageName='+ inputName +'&uploadType='+ uploadType;
	window.open(win, 'popup', 'width=440, height=320');
}

// ¾ÆÀÌµð Ã¼Å© *****************************************************************
function checkid(formName, member_id)
{
	if(document.frm.member_id.value==0)
		alert("ID¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä");
	else
	{
		var id = eval(formName +"."+ member_id +".value");
		var win ="none.asp??=join/popup/id_check&formName="+ formName +"&member_id="+ id;
		window.open(win, "id_check", "width=440, height=330, left=200, top=200");
	}
}

// »óÇ°ÀÌ¹ÌÁö Å©°Ôº¸±â *********************************************************
function popup_enlarge(item_idx)
{
	var url = 'none.asp??=item/popup_enlarge&item_idx=' + item_idx;
	window.open(url, "enlarge", "width=683, height=545");
}

// ·Î±×ÀÎ **********************************************************************
function login(quotation_admin_idx)
{
	var parentWebProtocol = "http";

	if(isSSL())
		parentWebProtocol  = "https";

	if (quotation_admin_idx != "")
		var win = "https://" + document.domain + "/none.asp??=passport/member_login&mode=login&parentWebProtocol="+parentWebProtocol + "&quotation_admin_idx=" + quotation_admin_idx;
	else
		var win = "https://" + document.domain + "/none.asp??=passport/member_login&mode=login&parentWebProtocol="+parentWebProtocol;
	window.open(win, "login", "left=20, top=25, width=440, height=320");
}

// ºñÈ¸¿ø·Î±×ÀÎ ****************************************************************
function nonmember_login(no)
{
	var win;
	if (no == 1)
		win = "none.asp??=passport/nonmember_login&mode=buy";					// ÁÖ¹®/¹è¼ÛÁ¶È¸
	else if (no == 2)
		win = "none.asp??=passport/nonmember_login&mode=quotation";				// ºñÈ¸¿ø°ßÀû¼­Á¶È¸

	window.open(win, "login", "left=20, top=25, width=440, height=372");
}

// ÀÌ¸ÞÀÏ·Î±×ÀÎ ****************************************************************
function email_quotation_login(quotation_admin_idx)
{
	win = "none.asp??=passport/nonmember_login&mode=quotation&quotation_admin_idx=" + quotation_admin_idx;
	window.open(win, "login", "left=20, top=25, width=440, height=372");
}

// ¸¶ÀÌÆäÀÌÁö Á¶È¸³¯Â¥ º¯°æ ****************************************************
function change_date(str_date)
{
	var date	= new Date();

	var today_year		= date.getFullYear();
	var today_month		= date.getMonth() + 1;
	var today_day		= date.getDate();

	if (("" + today_month).length == 1)
		today_month		= "0" + today_month;
	if (("" + today_day).length == 1)
		today_day		= "0" + today_day;

	document.frm.from_year.value	= str_date.substring(0, 4);
	document.frm.from_month.value	= str_date.substring(5, 7);
	document.frm.from_day.value		= str_date.substring(8, 10);
	document.frm.to_year.value		= today_year;
	document.frm.to_month.value		= today_month;
	document.frm.to_day.value		= today_day;
}


// ·¹ÀÌ¾î View or Hidden *******************************************************
function show_layer(lname)
{
//	var layer = (navigator.appName == 'Netscape') ? document.layers[lname] : document.all[lname];
	var layer = document.getElementById(lname);
	if (lname == '') return;
//	if (navigator.appName == 'Netscape') layer.visibility = 'show';
//	else
		layer.style.visibility = 'visible';
}

function hide_layer(lname)
{
	if (lname)
	{
//		var layer = (navigator.appName == 'Netscape') ? document.layers[lname] : document.all[lname];
		var layer = document.getElementById(lname);
//		if (navigator.appName == 'Netscape') layer.visibility = 'hide';
//		else
			layer.style.visibility = 'hidden';
	}
	else
	{
		for (i = 1 ; i <= 11 ; i ++)
		{
			var lname = 'layer'+i;
//			var layer = (navigator.appName == 'Netscape') ? document.layers[lname] : document.all[lname];
			var layer = document.getElementById(lname);
//			if (navigator.appName == 'Netscape') layer.visibility = 'hide';
//			else
				layer.style.visibility = 'hidden';
		}
	}
}


// TOPMENU »óÇ° °Ë»ö ***********************************************************
function checkform_top_search(theform)
{
	if (theform.search_value1.value == "")
	{
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		theform.search_value1.focus();
		return false;
	}
//	else if (theform.search_value1.value.length < 3)
//	{
//		alert("°Ë»ö¾î´Â 3ÀÚ ÀÌ»óÀÌ¾î¾ß ÇÕ´Ï´Ù.");
//		theform.search_value1.focus();
//		return false;
//	}
}


// ÀÌ¹ÌÁö Å©±â Á¶ÀýÇÏ¿© img ÅÂ±× Ãâ·Â ******************************************
function change_image_size(image_url, limit_width, limit_height)
{
	imgFile					= new Image();
	imgFile.src				= image_url;

	var real_width			= imgFile.width;
	var real_height			= imgFile.height;

	if (real_width >= real_height)
	{
		if (real_width <= limit_width)
		{
			result_width	= real_width;
			result_height	= real_height;
		}
		else
		{
			result_width	= limit_width;
			result_height	= parseInt((real_height * limit_width) / real_width);
		}
	}
	else
	{
		if (real_height <= limit_height)
		{
			result_width	= real_width;
			result_height	= real_height;
		}
		else
		{
			result_width	= parseInt((real_width * limit_height) / real_height);
			result_height	= limit_height;
		}
	}

	document.write ("<img src='"+ image_url +"' width='"+ result_width +"' height='"+ result_height +"' border='0' style='cursor:hand' onclick='popup_realsize(\""+ image_url +"\")'>");
}


// ÀÌ¹ÌÁö Á¦Å©±â·Î ÆË¾÷Ã¢ ¶ç¿ì±â ***********************************************
function popup_realsize(image_url)
{
	imgFile					= new Image();
	imgFile.src				= image_url;

	var real_width			= imgFile.width + 17;
	var real_height			= imgFile.height;

	var O					= "width="+ real_width +", height="+ real_height +", scrollbars=1, resizable=1";
	imgWin					= window.open("", "", O);
	imgWin.document.write("<html><head></head>");
	imgWin.document.write("<body topmargin=0 leftmargin=0 onload='resizeTo("+ real_width +", "+ real_height +")'>");
	imgWin.document.write("<img src='"+ image_url +"' style='cursor:hand' onclick='self.close()'>");
}

function imgResize(img)
{
	img1 = new Image();
	img1.src = (img);
	imgControll(img);
}

function imgControll(img)
{
	if((img1.width!=0)&&(img1.height!=0))
	{
		viewImage(img);
	}
	else
	{
		controller="imgControll('"+img+"')";
		intervalID=setTimeout(controller, 20);
	}
}

function viewImage(img)
{
	var scroll = "yes";
	var W = img1.width;
	var H = img1.height;
	var AW = screen.availWidth;
	var AH = screen.availHeight;

	if (H > AH && W <= AW)
		W += 17;
	if (W > AW && H <= AH)
		H += 17;

	if (W <= AW && H <= AH)
		scroll = "no";

	var O = "width=" + W + ",height=" + H + ",scrollbars=" + scroll + ",left=0,top=0";
	imgWin=window.open("","",O);
	imgWin.document.write("<html><head><title>Image View</title></head>");
	imgWin.document.write("<body style='margin:0'>");
	imgWin.document.write("<img src='"+img+"' onclick='self.close()' style='cursor:hand;'>");
	imgWin.document.write("</body></html>");
	imgWin.document.close();
}



// input or textarea OnFocus ³»¿ëÁö¿ì±â ****************************************
function delete_contents(input)
{
	if (input.value == input.defaultValue)
	{
		input.value = "";
	}
}


// IE6 ÀÌÇÏ ¹öÀüÀ» À§ÇÑ PNG Ã³¸® ***********************************************
function setPng24(obj)
{
	obj.width=obj.height=1;
	obj.className=obj.className.replace(/\bpng24\b/i,'');
	obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
	obj.src='';
	return '';
}

// ÀÔ·Â¾øÀ½ Ã¼Å© & ¾È³» ********************************************************
function emptyInputYN(input_obj, lable)
{
	var type = input_obj.type;
	var type_no = 0;

	if (type == undefined && input_obj.length != undefined)
		type = input_obj[0].type;
	else if (type == undefined)
		type_no = 1;

	type = type.toUpperCase();

	if (type == "TEXT" || type == "HIDDEN" || type == "TEXTAREA" || type == "PASSWORD")
		type_no = 1;
	else if (type == "SELECT-ONE" || type == "SELECT-MULTIPLE")
		type_no = 2;
	else if (type == "RADIO" || type == "CHECKBOX")
		type_no = 3;

	if(type_no == 1 && input_obj.value == '')
	{
		alert(lable + ' ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.');
		input_obj.focus();
		return true;
	}
	else if (type_no == 2 && input_obj.value == '')
	{
		alert(lable + '¼±ÅÃÇØ ÁÖ½Ê½Ã¿À.');
		input_obj.focus();
		return true;
	}
	else if (type_no == 3)
	{
		if (input_obj.length)
		{
			if (!radioCheckedYN(input_obj))
			{
				alert(lable + '¼±ÅÃÇØ ÁÖ½Ê½Ã¿À.');
				input_obj[0].focus();
				return true;
			}
		}
	}
	else
		return false;
}

// ¶óµð¿À ¹öÆ° Áß ¼±ÅÃµÈ À¯¹Â **************************************************
function radioCheckedYN(input_obj)
{
	for (i = 0; i < input_obj.length ; i++)
	{
		if (input_obj[i].checked)
			return true;
	}

	return false;
}

// ¶óµð¿À ÀÎÇ²ÀÇ ¼±ÅÃµÈ °ª °¡Á®¿À±â ********************************************
function radioCheckedValue(input_obj)
{
	for (i = 0; i < input_obj.length ; i++)
	{
		if (input_obj[i].checked)
			return input_obj[i].value;
	}

	return "";
}

// Ã¼Å©¹Ú½ºÀÇ ¼±ÅÃµÈ ¼ö °¡Á®¿À±â ***********************************************
function inputCheckCnt(input_obj)
{
	var cnt = 0;

	for (i = 0; i < input_obj.length ; i++)
	{
		if (input_obj[i].checked)
			cnt += 1;
	}

	return cnt;
}


// ¹è¿­ Áß °°Àº °ªÀÌ Á¸ÀçÇÏ´ÂÁö È®ÀÎ (Àç±ÍÇÔ¼ö)
function IsSameValue(arr_obj)
{
	if (arr_obj.length >= 2)
	{
		arr_sub = new Array(arr_obj.length - 1);

		for (i = 1; i < arr_obj.length ; i++)
		{
			arr_sub[i - 1] = arr_obj[i];
			if (arr_obj[0] == arr_obj[i])
			{
				return true;
				break;
			}
		}

		return IsSameValue(arr_sub);
	}

	return false;
}

// °°Àº °ªÀÎÁö Ã¼Å© & ¾È³» *****************************************************
function sameInputValYN(input_obj, lable, value)
{
	if(input_obj.value == value || input_obj.value == "")
	{
		alert(lable + ' ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.');
		input_obj.focus();
		return true;
	}
	else
		return false;
}

// ¹üÀ§ ³»ÀÇ °ªÀÎÁö Ã¼Å© & ¾È³» ************************************************
function betweenInputValYN(input_obj, lable, from_value, to_value)
{
	var compare_value = input_obj.value.replace(/,/gi, '');

	if(compare_value < from_value || compare_value > to_value)
	{
		alert(lable + ' ' + number_format(from_value) + ' ~ ' + number_format(to_value) + ' ¹üÀ§·Î ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.');
		input_obj.focus();
		return false;
	}
	else
		return true;
}


// SSL ¿©ºÎ(HTTPS)
function isSSL()
{
	// SSL ¿©ºÎ È®ÀÎ  -------------------
	var sslYn = false;
	var url = String(document.location);
	var protocol = url.split(":");
	if (protocol[0] == "https")			sslYn = true;
	//-----------------------------------
	return sslYn;
}


// ºñµ¿±âÅë½Å ±¸Çö *************************************************************
function createHttp(){

   //»ç¿ëÇÏ´Â ºê¶ó¿ìÀú¸¦ Ã¼Å©ÇÏ¿© ±×¿¡ ÇØ´çÇÏ´Â Åë½Å°´Ã¼¸¦ »ý¼ºÇÏ¿© ÁØ´Ù.
	if(window.ActiveXObject){
		xmlHttp = new ActiveXObject("Microsoft.XMLHttp");

	//IE7ºÎÅÍ´Â ¾Æ·¡¿Í °°Àº ¹æ¹ýÀ¸·Îµµ »ç¿ë°¡´É
	}else{
		xmlHttp = new XMLHttpRequest();
	}
}

function startRequest(url, param, charset, callFunc){

	createHttp();//Åë½ÅÀ» À§ÇÑ °´Ã¼ »ý¼º
	//¼­¹ö°¡ ÀÀ´äÇÏ¸é ¼öÇàÇÒ ÄÝ¹éÇÔ¼ö¸¦ µî·ÏÇÑ´Ù.
	//onreadystatechange´Â ¸Å »óÅÂ¸¶´Ù ÇØ´ç ÇÔ¼ö¸¦ È£ÃâÇÑ´Ù.
	xmlHttp.onreadystatechange = function(){

		/*
		0 : Uninitialized
		1 : Loading
		2 : Loaded
		3 : Interactive
		4 : Complete
		*/

		//readstate ¿äÃ» »óÅÂ -- 4 : complete
		if(xmlHttp.readyState==4){
			//¼­¹ö·ÎºÎÅÍÀÇ ÀÀ´ä»óÅÂ -- 200 : ok
			if(xmlHttp.status == 200){
				//¼­¹ö¿¡¼­ ÀÀ´äÇÑ µ¥ÀÌÅÍ°¡ ÀúÀå
				callFunc(xmlHttp.responseXml);
			}
		}
	};

	//false·Î ¼³Á¤ÇÏ¸é ¼­¹ö·ÎºÎÅÍ ÀÀ´ä µ¥ÀÌÅÍ°¡ ¿Ã ¶§±îÁö ºê¶ó¿ìÀú´Â ´Ù¸¥ ÀÛ¾÷À» ÇÒ ¼ö ¾ø´Â »óÅÂ°¡ µË´Ï´Ù.
	xmlHttp.open("POST", url, true);
	xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded;charset=" + charset);
	if (param != "")
		xmlHttp.send(param);
}


// Ä«µå ¿µ¼öÁõ ÆË¾÷ ************************************************************
function receipt(tid)
{
	var receiptUrl = "https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/mCmReceipt_head.jsp?noTid=" + tid + "&noMethod=1";
	window.open(receiptUrl,"receipt","width=420,height=700, scrollbars=yes,resizable=yes");
}

