/*
	°øÅë ½ºÅ©¸³Æ®
*/
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
	if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
	document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function bluring(){
	if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") 
	document.body.focus();
}

function iFrmReSize(ifnm, limitwidth, limitheight)
{
	var ParentFrame = eval(ifnm+".document.body");
	var ContentFrame = eval("document.all."+ifnm);

	var newHeight = ParentFrame.scrollHeight + (ParentFrame.offsetHeight - ParentFrame.clientHeight);
	var newWidth = ParentFrame.scrollWidth + (ParentFrame.offsetWidth - ParentFrame.clientWidth);

	if (newWidth>limitwidth && limitwidth>0)
	{
		newWidth = limitwidth;
	}

	if (newHeight>limitheight && limitheight>0)
	{
		newHeight = limitheight;
	}

	ContentFrame.style.height = newHeight;
	ContentFrame.style.width = newWidth;
}

function iFrmReSize_Width(ifnm, limitwidth)
{
	var ParentFrame = eval(ifnm+".document.body");
	var ContentFrame = eval("document.all."+ifnm);

	var newWidth = ParentFrame.scrollWidth + (ParentFrame.offsetWidth - ParentFrame.clientWidth);

	if (newWidth>limitwidth && limitwidth>0)
	{
		newWidth = limitwidth;
	}

	ContentFrame.style.width = newWidth;
}

function iFrmReSize_Height(ifnm, limitheight)
{
	var ParentFrame = eval(ifnm+".document.body");
	var ContentFrame = eval("document.all."+ifnm);

	var newHeight = ParentFrame.scrollHeight + (ParentFrame.offsetHeight - ParentFrame.clientHeight);

	if (newHeight>limitheight && limitheight>0)
	{
		newHeight = limitheight;
	}

	ContentFrame.style.height = newHeight;
}

function iFrmInit(ifnm, q, limitwidth, limitheight)
{
	if (q=="")
	{
		parent.iFrmReSize(ifnm, eval(limitwidth), eval(limitheight));
	}
	else if (q=="height")
	{		
		parent.iFrmReSize_Height(ifnm, eval(limitheight));		
	}
	else if (q=="width")
	{
		parent.iFrmReSize_Width(ifnm, eval(limitwidth));
	}
}

//ÆË¾÷ À©µµ¿ì
function openPop(theURL,winName,features) { 
  window.open(theURL,winName,features);
}

//ÆË¾÷ À©µµ¿ì Center
function openPopCenter(url, w, h, winName)
{
	if (!winName)
	{
		winName = "openPop";
	}
    var winl = (screen.availWidth - w) / 2;
	var wint = (screen.availHeight - h) / 2;
    window.open(url,winName,'width='+w+', height='+h+',top='+wint+',left='+winl);//+", scrollbars=yes"
}

/*
'M'   -> ÆÐÅÏ ÆÐÄ¡
'C'   -> »ç¿ëÀÚ Á¤ÀÇ ÇÔ¼ö
'Z'   -> °ªÀÇ Á¸Àç À¯¹«
[0-9] -> ¼ýÀÚ
\D    -> ¼ýÀÚ°¡ ¾Æ´Ñ ¹®ÀÚ(¿µ¹®ÀÚ,ÇÑ±Ûµî)
\d+   -> ¼ýÀÚ·Î¸¸ ±¸¼º
\w+   -> ¿µ¹®ÀÚ¿Í ¼ýÀÚ·Î¸¸ ±¸¼º('_'Æ÷ÇÔ)
\W+   -> ¿µ¹®ÀÚ¿Í ¼ýÀÚ¸¦ Á¦¿ÜÇÑ ¹®ÀÚ(ÇÑ±Û, Æ¯¼ö¹®ÀÚµî)
\w{1,30} -> ±æÀÌ°¡ 30ÀÚ ÀÌ³»ÀÌ°í ¿µ¹®ÀÚ¿Í ¼ýÀÚ·Î¸¸ ±¸¼º('_'Æ÷ÇÔ)
[a-zA-Z]\w+ -> Ã¹ ±ÛÀÚ´Â ¿µ¹®À¸·Î
*/

function validation(f) 
{

    var j = f.elements.length
    var i;
    var re;
    var args;
    var result;
    for (i=0; i<j; i++)
    {
		if (f.elements[i].style.display == "none") continue;
        if (typeof(f.elements[i].tag) == "undefined") continue;

        args = f.elements[i].tag.split("||", 3);
        if (args[0]=='C') 
        {
//            result = eval(args[1]+";");
            result = eval(args[1]+"(f.elements[i], f.elements[i].value);");
        }
        else if ((args[0]=='M') || 
            ((args[0]=='O') && (f.elements[i].value.length>0)))
        {
            re = new RegExp(args[1], "gi");
            result = re.test(f.elements[i].value);                                   
        }
        else if (args[0]=='Z')
        {
			if (!f.elements[i].disabled || f.elements[i].style.display == "none")		// obj°¡ disabled »óÅÂÀÏ¶§´Â pass
			{
				if (f.elements[i].value.length == 0)
				{
					result = false;
				}
			}
        }

        if (result == false)
        {
			if (args[0] != 'C') 
			{			
				f.elements[i].focus();
				alert(args[2]);
			}
			return false;
        }
    }
	return true;
}

//´ë±¸»çÀÌ¹ö ´ëÇÐ Àü¿ë
function FindPassword() {
  top.window.open("http://www.dcu.ac.kr/Member/password.htm", "_password", 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=0,resizable=0,top=1,left=1,width=700,height=260');
}
