var contentWidth = "500";
function WowFixTopWidth(pobj){
	//alert(pobj.offsetParent.tagName + "/" + pobj.offsetParent.width + "/" +pobj.width );
	if(pobj.offsetParent.width && pobj.width >= pobj.offsetParent.width){
		pobj.width = pobj.offsetParent.width;	
	}
	else {
	//	pobj.width = contentWidth;		
	}
}

var wowConstHideSource = false;
//Æ÷Ä¿½ºÀ§Ä¡ 
function formfocus(form) { 
	var len = form.elements.length; 
	for(i=0;i < len;i++){
		if ((form.elements[i].type == "text" || form.elements[i].type == "password")) { 		
			form.elements[i].focus(); 
			form.elements[i].value = form.elements[i].name;
			
			break; 
		} 
	} 
} 

function wowMouseOver(obj, colorvalue)
{
  if(document.all) {
    obj.style.backgroundColor=colorvalue;
  }
}
function wowMouseOut(obj)
{
  if(document.all) {
    obj.style.backgroundColor="transparent";
  }
}
function wowHideSource()
{
	//wowConstHideSource°¡ Æ®·çÀÌ¸é.... ¼Ò½ºº¸È£°¡ µ¿ÀÛ
}

//¸®½ºÆ®¿¡¼­ ·Ñ¿À¹ö½Ã ¹è°æ½ºÅ¸ÀÏÀ» ¹Ù²Û´Ù...
var tempClassName;
function ClassShiftOn(obj, className){
	if(document.all) {
		tempClassName = obj.className 
		obj.className = className;
	}
}
function ClassShiftOff(obj, className){
	if(document.all) {
		obj.className = tempClassName;
		if(className == '')
			obj.className = tempClassName;
		else
			obj.className = className;				
	}
}


var tempColor;
function BgcolorChangeOn(obj, onColor){
	if(document.all) {
		tempColor = obj.style.backgroundColor;	
		obj.style.backgroundColor = onColor;
	}
}

function BgcolorChangeOff(obj, offColor){
	//obj.style.backgroundColor = "transparent";
	if(document.all) {
		if(offColor == '')
			obj.style.backgroundColor = tempColor; 
		else
			obj.style.backgroundColor = offColor;		
	}
}


/*	
dialogHeight:sHeight 
dialogLeft:sXPos 
dialogTop:sYPos 
dialogWidth:sWidth 
center:{ yes | no | 1 | 0 | on | off } 
dialogHide:{ yes | no | 1 | 0 | on | off } 
edge:{ sunken | raised } 
help:{ yes | no | 1 | 0 | on | off } 
resizable:{ yes | no | 1 | 0 | on | off } 
scroll:{ yes | no | 1 | 0 | on | off } 
state:{ yes | no | 1 | 0 | on | off } 
unadorned:{ yes | no | 1 | 0 | on | off } 	
*/
function openModal(purl, pwidth, pheight)
{
	var width, height;
//	var width = window.document.body.clientWidth +"px";   //¾Æ¹«°Íµµ ÁÖÁö ¾ÊÀ¸¸é Ç®È­¸éÀ¸·Î ³ª¿È
//	var height = window.document.body.clientHeight +"px";	
	if((pwidth != null) && (pheight != null))
	{
		width = pwidth+"px";
		height = pheight+"px";
	}
	else 
	{
		width = "800";   //´ÜÀ§¸¦ ¾Æ¹«°Íµµ ÁÖÁö ¾ÊÀ¸¸é Ç®È­¸éÀ¸·Î ³ª¿È
		height = "600";		
	}
	var arr = showModalDialog(purl,"",
	"dialogWidth:"+width+";dialogHeight:"+height+";center:yes;help:no;resizable:no;scroll:no;status:no;" );
	return arr;
}

function openModalWindowFull(purl, pwidth, pheight)
{
	var width, height;
//	var width = window.document.body.clientWidth +"px";   //¾Æ¹«°Íµµ ÁÖÁö ¾ÊÀ¸¸é Ç®È­¸éÀ¸·Î ³ª¿È
//	var height = window.document.body.clientHeight +"px";	
	if((pwidth != null) && (pheight != null))
	{
		width = pwidth+"px";
		height = pheight+"px";
	}
	else 
	{
		width = "800";   //´ÜÀ§¸¦ ¾Æ¹«°Íµµ ÁÖÁö ¾ÊÀ¸¸é Ç®È­¸éÀ¸·Î ³ª¿È
		height = "600";		
	}
	var arr = showModalDialog("/_Common/FullModalWindowFrame.aspx?purl=" + purl,"",
	"dialogWidth:"+width+";dialogHeight:"+height+";center:yes;help:no;resizable:no;scroll:no;status:no;" );
	return arr;
}
function openWindow(purl, pwindowname)
{
	var option, windowName;
	if (pwindowname) 
		windowName = pwindowname;
	else
		windowName = "noname";
		
	var winMain = window.open(purl, windowName);	
	winMain.focus();
}

function openWindowFull(purl, pwindowname)
{
	var option, windowName;
	if (pwindowname) 
		windowName = pwindowname;
	else
		windowName = "noname";
		
	var winMain = window.open(purl, windowName, "fullscreen=yes ");	
	winMain.focus();
}
function openWindowFrame(prows, ptopsrc, ptitle ,pwindowname )
{
	var option, windowName, frameurl;
	frameurl = "/_common/Frame2Row.aspx?";
	if (pwindowname) 
		windowName = pwindowname;
	else
		windowName = "noname";
	if (prows) 
		frameurl += "rows=" + prows + "&topsrc=" + ptopsrc;
	else
		frameurl += "rows=100%,0&topsrc=" + ptopsrc;
	if (ptitle) 
		frameurl += "&title=" + ptitle ;
	else
		frameurl += "&title=";
		
	var winMain = window.open(frameurl, windowName, "fullscreen=yes ");	
	winMain.focus();
}
function openWindowSize(purl, pwindowname, pwidth, pheight, poption)
{
	var option="", windowName="", winMain;
	if (pwindowname) 
		windowName = pwindowname;
	else
		windowName = "noname";
	if (pwidth) option += "width=" + pwidth+ ",";
	if (pheight) option += "height=" + pheight+ ",";	
	if (poption) 
		option += poption;
	else
		option = "directories=no,location=no,menubar=no,resizable=no,scrollbars=no,titlebar=no,toolbar=no";
	winMain = window.open(purl, windowName, option);	
	winMain.focus();
}
function openWindowPosition(purl, pwindowname, pheight, pwidth, ptopX, ptopY)
{
	var option="", windowName="",winMain;
	if (pwindowname) 
		windowName = pwindowname;
	else
		windowName = "noname";
	if (pwidth) option += "width=" + pwidth+ ",";
	if (pheight) option += "height=" + pheight+ ",";	
	if (poption) 
		option += poption;
	else
		option = "directories=no,location=no,menubar=no,resizable=no,scrollbars=no,titlebar=no,toolbar=no";
	winMain = window.open(purl, windowName, option);	
	winMain.moveTo(ptopX,ptopY);
	winMain.focus();
}


function windowOpenFull(purl, pwindowname)
{
	var option, windowName;
	if (pwindowname) 
		windowName = pwindowname;
	else
		windowName = "noname";
		
	var winMain = window.open(purl, windowName, "fullscreen=yes ");	
	winMain.focus();
}
function windowOpenFrame(prows, ptopsrc, ptitle ,pwindowname )
{
	var option, windowName, frameurl;
	frameurl = "/_common/Frame2Row.aspx?";
	if (pwindowname) 
		windowName = pwindowname;
	else
		windowName = "noname";
	if (prows) 
		frameurl += "rows=" + prows + "&topsrc=" + ptopsrc;
	else
		frameurl += "rows=100%,0&topsrc=" + ptopsrc;
	if (ptitle) 
		frameurl += "&title=" + ptitle ;
	else
		frameurl += "&title=";
		
	var winMain = window.open(frameurl, windowName, "fullscreen=yes ");	
	winMain.focus();
}
function windowOpenSize(purl, pwindowname, pwidth, pheight, poption)
{
	var option="", windowName="", winMain;
	if (pwindowname) 
		windowName = pwindowname;
	else
		windowName = "noname";
		
	if (pwidth) option += "width=" + pwidth+ ",";
	if (pheight) option += "height=" + pheight+ ",";	
	if (poption.length > 0) 
		option += poption;
	else
		option = "";	
//		option = "directories=no,location=no,menubar=no,resizable=no,scrollbars=no,titlebar=no,toolbar=no";
	winMain = window.open(purl, windowName, option);	
	winMain.focus();
}
function windowOpenPosition(purl, pwindowname, pheight, pwidth, ptopX, ptopY)
{
	var option="", windowName="",winMain;
	if (pwindowname) 
		windowName = pwindowname;
	else
		windowName = "noname";
	if (pwidth) option += "width=" + pwidth+ ",";
	if (pheight) option += "height=" + pheight+ ",";	
	if (poption) 
		option += poption;
	else
		option = "directories=no,location=no,menubar=no,resizable=no,scrollbars=no,titlebar=no,toolbar=no";
	winMain = window.open(purl, windowName, option);	
	winMain.moveTo(ptopX,ptopY);
	winMain.focus();
}



function IsNull(value)
{
	var chkstr = value + "";
	var result = true;

	if((chkstr == "") || (chkstr == null)){
		return result;
	}
	for(j = 0; result && (j < value.length); j++){
		if(value.substring(j, j+1) != " "){
			result = false;
		}
	}
	return result;
}

function IsNumber(value)
{
	var result = true;

	for(j = 0; result && (j < value.length); j++)
	{	if((value.substring(j, j+1) < "0") || (value.substring(j, j+1) > "9"))
		{	result = false;
		}
	}
	if (IsNull(value)) result = false;
	return result;
}

function month_array(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11)
{
	this[0] = m0;
	this[1] = m1;
	this[2] = m2;
	this[3] = m3;
	this[4] = m4;
	this[5] = m5;
	this[6] = m6;
	this[7] = m7;
	this[8] = m8;
	this[9] = m9;
	this[10] = m10;
	this[11] = m11;
}

function IsDD(yyyy, mm, value) 
{ 
	var result = false; 
	var monthDD = new month_array(31,28,31,30,31,30,31,31,30,31,30,31); 
	var im = eval(mm) - 1; 
	if(value.length != 2)   return false; 
	if(!IsNumber(value))    return false; 
	if(((yyyy % 4 == 0) && (yyyy % 100 != 0)) || (yyyy % 400 == 0)) 
	{ 
		monthDD[1] = 29; 
	} 
	var dd = eval(value); 
	if((0 < dd) && (dd <= monthDD[im]))     result = true; 
	return result; 
} 
function IsMM(value){ 
	return((value.length > 0) && (IsNumber(value)) && (0 < eval(value)) && (eval(value) < 13)); 
} 
function IsHH(value){ 
	return((value.length > 0) && (IsNumber(value)) && (0 <= eval(value)) && (eval(value) < 24)); 
} 
function IsNN(value){ 
	return((value.length > 0) && (IsNumber(value)) && (0 <= eval(value)) && (eval(value) < 60)); 
}
function IsHHNN(value){ 
	var     hh   = value.substring(0,2); 
	var     nn   = value.substring(2,4);  
	return( IsHH(hh) && IsNN(nn) );  
}
function IsYYYY(value) { 
		return((value.length == 4) && (IsNumber(value)) && (value != "0000")); 
} 
function IsYYYYMMDD(value) { 
	if (value.length != 8) return false;
		var     year  = value.substring(0,4); 
		var     month = value.substring(4,6); 
		var     day   = value.substring(6,8); 
	return( IsYYYY(year) && IsMM(month) && IsDD(year,month,day) );  
} 
function IsYYYYMMDDHHNN(value){
	if (value.length != 12) return false;
		var     yyyy  = value.substring(0,4); 
		var     mm = value.substring(4,6); 
		var     dd   = value.substring(6,8);
		var     hh   = value.substring(8,10); 
		var     nn   = value.substring(10,12);  
	return( IsYYYY(yyyy) || IsMM(mm) || IsDD(yyyy,mm,dd) || IsHH(hh)|| IsNN(nn) );  
}
function StringReplace(pstr1, pstr2, pstr3){
//Ã¹¹øÂ° ¹®ÀÚ¿­¿¡¼­ pstr2¸¦ °Ë»öÇÏ¿© pstr3·Î ´ëÄ¡ÇÑ´Ù
	var psn = pstr1.indexOf(pstr2,0);
	var returnstr = "";
	while (psn >= 0) {
		if (psn >= 0) {
			returnstr = returnstr + pstr1.substring(0,psn) + pstr3;
			pstr1 = pstr1.substring(psn+1,pstr1.length+1);
		}
		psn = pstr1.indexOf(pstr2,0);
	}
	returnstr = returnstr + pstr1;
	return returnstr;
}

function IsTelNo(value){
	if (!((IsNumber(value)) && (value.substring(0,1) == "0"))) return false;
	if (value.substring(0,2) == "02") {
		if ((value.length > 10) || (value.length < 9)) return false;
	}else if ((value.length > 11) || (value.length < 10)) return false;
	return true;
}
function IsHpNo(value){
	var preno = value.substring(0,3);
	if (!((IsNumber(value)) && (value.substring(0,1) == "0"))) return false;
	if ((preno != "010") && (preno != "011") && (preno != "016") && (preno != "017") && (preno != "018") && (preno != "019")) 
		return false;
	if ((value.length > 11) || (value.length < 10)) return false;
		return true;
}

function popup(procedure, heightwidth)
{
	Win = window.open(procedure,"popup","toolbar=no,scrollbars=yes,resizable=yes,"+heightwidth);
	Win.focus();
}

function popup2(procedure, heightwidth)
{
	Win = window.open(procedure,"popup2","toolbar=no,scrollbars=yes,resizable=yes,"+heightwidth);
	Win.focus();
}

function ShowHelp(program_id)
{
	if(program_id == null || program_id.length == 0)
		program_id = "/help/nohelp.html";
	else	program_id = "/help/"+program_id;

	var Win = window.open(program_id,"help","toolbar=yes,scrollbars=yes,resizable=yes,height=400,width=600");
	Win.focus();
}

function mod(value, div)
{
	var portion = 0;
	var mod = 0;

	portion = Math.floor(parseInt(value,10) / parseInt(div,10));
	mod = (parseInt(value,10) - (portion * parseInt(div,10)));
	return mod;
}

function check_radiobox(rb ,index)
{	if(rb.length > 0)
	{	if(rb[index].type == "checkbox")
		{	if(rb[index].checked)
				rb[index].checked = false;
			else	rb[index].checked = true;
		}
		else	rb[index].checked = true;
	}
	else
	{	if(rb.type == "checkbox")
		{	if(rb.checked)
				rb.checked = false;
			else	rb.checked = true;
		}
		else	rb.checked = true;
	}
}
function bblur(pobj)
{	obj = pobj;
	setTimeout("obj.blur()",1);
}
function ontop()	
{	setTimeout("self.focus()",1);
}


function SetCookie(name, value, expire)
{
	document.cookie = name + "=" + escape(value)
		+ ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
}



function GetCookie(Name)
{	var	search = Name + "="
	if(document.cookie.length > 0)	// if there are any cookies
	{	offset = document.cookie.indexOf(search)
		if(offset != -1)	// if cookie exists 
		{	offset += search.length 
			// set index of beginning of value
			end = document.cookie.indexOf(";", offset) 
			// set index of end of cookie value
			if(end == -1) 
				end = document.cookie.length
			return unescape(document.cookie.substring(offset, end))
		} 
	}
}

function UrlDecode(str) 
{
	  src = new String("");
	  tar = new String("");
	  src = str;
	  for (i=0;   i < src.length;  i++) 
	  {
			if ( src.charAt(i) == "&") 
			tar += "%26";
			else if ( src.charAt(i) == "%") 
			tar += "%25";
			else if ( src.charAt(i) == "\"") 
			tar += "%22";
			else if ( src.charAt(i) == "\r") 
			tar += "%0D";
			else if ( src.charAt(i) == "\n") 
			tar += "%0A";
			else if ( src.charAt(i) == "+")
			tar += "%2B";
			else if ( src.charAt(i) == ":") 
					tar += "%3A";
			else if ( src.charAt(i) == "#") 
					tar += "%23";
			else if ( src.charAt(i) == " ") 
					tar += "%20";
			else 
					tar += src.charAt(i);
		  }

		 return tar;
}

/*
function number2han(pnumber)
{
	if(!IsNumber(pnumber)) return false;
	var hanunit = new Array("½Ê","¾ï","Ãµ","¹é","½Ê","¸¸","Ãµ","¹é","½Ê","");
	var hangul = "";
	var i = 0;
	var j = 0;
	var len = 0;

	len = pnumber.length;
	j = 10 - len;
	for(i = j ; i < 10 ; i++)
	{	if(pnumber.substring(i-j, i-j+1) == "1")
			hangul = hangul + "ÀÏ";
		else if(pnumber.substring(i-j, i-j+1) == "2")
			hangul = hangul + "ÀÌ";
		else if(pnumber.substring(i-j, i-j+1) == "3")
			hangul = hangul + "»ï";
		else if(pnumber.substring(i-j, i-j+1) == "4")
			hangul = hangul + "»ç";
		else if(pnumber.substring(i-j, i-j+1) == "5")
			hangul = hangul + "¿À";
		else if(pnumber.substring(i-j, i-j+1) == "6")
			hangul = hangul + "À°";
		else if(pnumber.substring(i-j, i-j+1) == "7")
			hangul = hangul + "Ä¥";
		else if(pnumber.substring(i-j, i-j+1) == "8")
			hangul = hangul + "ÆÈ";
		else if(pnumber.substring(i-j, i-j+1) == "9")
			hangul = hangul + "±¸";
		if(pnumber.substring(i-j, i-j+1) != "0" || i == 1 || i == 5)
		{
			if(i == 5)
				if(pnumber.substring(i-j-3, i-j-3+4)=="0000")
					continue;
			hangul = hangul + hanunit[i];
		}
	}
	return hangul;
}
*/
function Wowhompy_juminno(pjuminno1, pjuminno2){
	// Á¤È®ÇÑ ÁÖ¹Îµî·Ï¹øÈ£ÀÎÁö Ã¼Å©ÇÑ´Ù. - ÀÚ¸®¼ö·Î 1Â÷ °Ë»ç¸¦ ÇÑ´Ù.
	if (pjuminno1.length != 6 || pjuminno2.length != 7){
		return false;	
	}

	// ÁÖ¹Îµî·Ï ¹øÈ£ Ã¼Å© ¾Ë°í¸®ÁòÀ¸·Î °è»ê °Ë»çÇÑ´Ù.
	a = pjuminno1.substring(0,1) * 2;
	b = pjuminno1.substring(1,2) * 3;
	c = pjuminno1.substring(2,3) * 4;
	d = pjuminno1.substring(3,4) * 5;
	e = pjuminno1.substring(4,5) * 6;
	f = pjuminno1.substring(5,6) * 7;
 
	g = pjuminno2.substring(0,1) * 8;
	h = pjuminno2.substring(1,2) * 9;
	i = pjuminno2.substring(2,3) * 2;
	j = pjuminno2.substring(3,4) * 3;
	k = pjuminno2.substring(4,5) * 4;
	l = pjuminno2.substring(5,6) * 5;
	m = pjuminno2.substring(6,7);

	total = a + b + c + d + e + f + g + h + i + j + k + l;
	remain = (total % 11);
	result = 11 - remain;

	if ( m != result ){
		result1 = result - 10;
		if ( m != result1 ){
			return false;	
		}
	}
	return true;	
}

