function insertComma(num)
{
    if (num < 0) { num *= -1; var minus = true} 
    else var minus = false 
        
    var dotPos = (num+"").split(".") 
    var dotU = dotPos[0] 
    var dotD = dotPos[1] 
    var commaFlag = dotU.length%3 

    if (commaFlag) { 
            var out = dotU.substring(0, commaFlag)  
            if (dotU.length > 3) out += "," 
    } 
    else var out = "" 

    for (var i=commaFlag; i < dotU.length; i+=3) { 
            out += dotU.substring(i, i+3)  
            if ( i < dotU.length-3) out += "," 
    } 

    if (minus) out = "-" + out 
    if (dotD) return out + "." + dotD 
    else return out  	
}

function  popup_login(type)
{
   var w = 370;
   var h = 220;
   var width = (screen.width - w) / 2;
   var height = (screen.height - h) / 2;
	
	if (type)
	{
		window.open('../member/member_login.html?type=' + type, 'login', 'width=' + w + ', height=' + h + ', top=' + height + ', left=' + width + ', scrollbars=yes');
	}
	else 
	{
		window.open('../member/member_login.html', 'login', 'width=' + w + ', height=' + h + ', top=' + height + ', left=' + width + ', scrollbars=yes');
	}
}

function flash_show(fl_name, width, height, tar_id)
{
	var src_str = "<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 + "\"> ";
	src_str += "<param name=\"movie\" value=\"" + fl_name + "\"> ";
	src_str += "<param name=\"quality\" value=\"high\"> ";
	src_str += "<embed src=\"" + fl_name + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + width + "\" height=\"" + height + "\"></embed> ";
	src_str += "</object> ";

	if (tar_id.length == 0) {
		document.write (src_str);
	} else {
		var obj = document.getElementById(tar_id);
		obj.innerHTML = "";
		obj.innerHTML = src_str;
	}
}

function center_open(url, name, width, height, option)
{
   var w = width;
   var h = height;
   var width = (screen.width - w) / 2;
   var height = (screen.height - h) / 2;

   return window.open(url, name, option + ', width=' + w + ', height=' + h + ', left=' + width + ', top=' + height);
}

function go_register(url)
{
   var w = 568;
   var h = 752;
   var width = (screen.width - w) / 2;
   var height = (screen.height - h) / 2;

	window.open(url,'join_pvc','width=' + w + ',height=' + h + ',left=' + width + ',top=' + height + ',scrollbars=yes');
}

function estimate (x)
{
   var w = 800;
   var h = 630;
   var width = (screen.width - w) / 2;
   var height = (screen.height - h) / 2;
	
    window.open(x,'estimate','height=' + h +',width=' + w +',top=' + height +', left=' + width +',menubar=0,scrollbars=0,toolbar=0');
}

function LogInChk(Form)
{
	Form.encoding = "application/x-www-form-urlencoded";

	//var Temp_Id = "<?=$id?>";
	//var Temp_Pwd = "<?=$pwd?>";

	var Temp_Id = "cholsan";
	var Temp_Pwd = "cholsan1234";

	var new_win = window.open("");

	new_win.document.write("<html>");
	new_win.document.write("<body>");
	new_win.document.write("<form name=\"fm\" method=\"post\" action=\"http://www.mydirect.co.kr/Body/Direct.aspx\">");
	new_win.document.write("<input type=\"hidden\" name=\"check_join\" value=\"1\">");
	new_win.document.write("<input type=\"hidden\" name=\"direct_ptn_id\" value=\"" + Temp_Id + "\">");
	new_win.document.write("<input type=\"hidden\" name=\"direct_ptn_pwd\" value=\"" + Temp_Pwd + "\">");
	new_win.document.write("</form>");
	new_win.document.write("<script language=\"javascript\">");
	new_win.document.write("document.fm.submit();");
	new_win.document.write("</script>");
	new_win.document.write("</body>");
	new_win.document.write("</html>");
}

function createFlashObj(file_name, width, height) 
{
	var obj_str = "<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 + "\"> ";
	obj_str += "<param name=\"movie\" value=\"../images/flash/" + file_name +"\"> ";
	obj_str += "<param name=\"quality\" value=\"high\"> ";
	obj_str += "<param name=\"wmode\" value=\"transparent\"> ";
   	obj_str += "<embed src=\"../images/flash/" + file_name +"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + width + "\" height=\"" + height + "\"></" + "embed></" + "object> ";
     
	document.write (obj_str);
}

function createFlashObj2(file_name, width, height) 
{
	var obj2_str = "<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 + "\"> ";
	obj2_str += "<param name=\"movie\" value=\"../images/flash/" + file_name +"\"> ";
	obj2_str += "<param name=\"quality\" value=\"high\"> ";
	obj2_str += "<param name=\"wmode\" value=\"transparent\"> ";
   	obj2_str += "<embed src=\"images/flash/" + file_name +"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + width + "\" height=\"" + height + "\"></" + "embed></" + "object> ";
     
	document.write (obj2_str);
}




function createFlashObj3(file_name, width, height) 

{
	
	var obj3_str = "<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 + "\"> ";
	
	
	obj3_str += "<param name=\"movie\" value=\"" + file_name +"\"> ";
	
	obj3_str += "<param name=\"quality\" value=\"high\"> ";
    
	obj3_str += "<param name=\"wmode\" value=\"transparent\"> ";
   	
	obj3_str += "<embed src=\"" + file_name +"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + width + "\" height=\"" + height + "\"></" + "embed></" + "object> ";
     
	
		
	document.write (obj3_str);

}
	


function createFlashObj4(file_name, width, height) 

{
	
	var obj4_str = "<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 + "\"> ";
		
	obj4_str += "<param name=\"movie\" value=\"../images/mv/" + file_name +"\"> ";
	
	obj4_str += "<param name=\"quality\" value=\"high\"> ";
    
	obj4_str += "<param name=\"wmode\" value=\"transparent\"> ";
   	
	obj4_str += "<embed src=\"../images/mv/" + file_name +"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + width + "\" height=\"" + height + "\"></" + "embed></" + "object> ";
     
	
		
	document.write (obj4_str);

}
	


/*
function createFlashObj3(file_name, width, height) 
{
	var obj3_str = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"" + width + "\" height=\"" + height + "\" align=\"middle\"> ";
	obj3_str += "<param name=\"movie\" value=\"images/" + file_name +"\" /> ";
	obj3_str += "<param name=\"quality\" value=\"high\" /> ";
// 	obj3_str += "<param name=\"wmode\" value=\"transparent\"> ";
	obj3_str += "<param name=\"allowScriptAccess\" value=\"sameDomain\" />";
	// images/mv/"
	obj3_str += "<param name=\"bgcolor\" value=\"#000000\" />";
   	obj3_str += "<embed src=\"images/" + file_name +"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + width + "\" height=\"" + height + "\"></" + "embed></" + "object> ";

	document.write (obj3_str);
}

*/

/*
function OptionChg(oSel, svc)
{
	var fm = document.forms[0].elements;

	obj = document.getElementById(svc);

	if (oSel == "0,0,0")
	{
		obj.innerText = "";
		return;
	}

	var oSelValue = oSel.split(',');

	for(i = 0; i < fm.length; i++)
	{
		if (fm[i].type == "radio" && fm[i].name == "PayType")
		{
			if (fm[i].checked == true && fm[i].id == "Month_1")
			{
				obj.innerText = insertComma(oSelValue[2]) + " ¿ø/¿ù";
			}
			else
			{
				obj.innerText = insertComma(oSelValue[2]) + " ¿ø";
			}

			break;
		}
	}

	
	/*
	if (oSel != "")
	{
		var oSelValue = oSel.split(',');
		
		if (oSelValue[2] != "0")
		{
			for(i = 0; i < fm.length; i++)
			{
				if (fm[i].type == "select-one" && fm[i].name == "ddlFeeType")
				{
					if (fm[i][1].selected == true)
					{
						obj.innerText = insertComma(oSelValue[2]) + " ¿ø/¿ù";
					}
					else
					{
						obj.innerText = insertComma(oSelValue[2]) + " ¿ø";
					}
				}
			}	
		}
		else
		{
			// ¹«·á °Ô½ÃÆÇ
			if (oSelValue[0] == "01501")
				obj.innerText = "¹«·á";
			else
				obj.innerText = "";
		}
	}
	else
	{
		obj.innerText = "";
	}
	*/
/* } */

function CheckBoxChg(name, svc1, svc2)
{
	obj1 = document.getElementById(name);
	
	obj2 = document.getElementById(svc1);
	
	obj3 = document.getElementById(svc2);

	
	if (obj1.checked == true)
	{
		obj2.disabled = false;
	}
	else
	{
		obj2.disabled = true;
		obj2[0].selected = true;
		obj3.innerText = "";		
	}
}

