/*

http://www.phpschool.com/gnuboard4/bbs/board.php?bo_table=tipntech&wr_id=55385
¼Ò½º¸¦ ÀÎ¿ë ¼öÁ¤ ÇÑ °ÍÀÓ.

¿øÀÛÀÚ : °í´Ï
*/
function msgmove() { 
  msg.style.posLeft = event.x + 0 + document.body.scrollLeft; 
  msg.style.posTop = event.y + 20 + document.body.scrollTop; 
} 

function msgset(strmsg) { 
  if( strmsg == null ) 
      strmsg    = event.srcElement.getAttribute("help"); 
  if( strmsg == null ) 
      strmsg    = event.srcElement.parentElement.getAttribute("help"); 
  if( strmsg == null || strmsg == "" )   { 
      msghide(); 
      return; 
  } 
  text ='<table style="border:1 #CCC8BE solid;" bgcolor=#FFFAEA><tr><td class=tx_blue01>' + strmsg + '</td></tr></table>'; 
  msg.innerHTML=text; 
} 

function msghide() { 
  msg.innerHTML=''; 
} 

function checkControl() { 
    var input        = document.all.tags("INPUT"); 
    var textarea    = document.all.tags("TEXTAREA"); 
    var div; 
    if( document.getElementById("msg") != null ) 
        div    = document.getElementById("msg"); 
    else 
        div    = document.createElement("DIV"); 
    div.style.cssText    = "position:absolute;left:0;top:0;width:0;height:0;"; 
    div.id                = "msg"; 

    document.body.appendChild(div); 

    if( input.length != 0 )     { 
        for( var i = 0; i < input.length ; i++) { 
            if(input[i].getAttribute("help") != null ) { 
                input[i].onmouseover    =    msgset; 
                input[i].onmousemove    =    msgmove; 
                input[i].onmouseout    =    msghide; 
            } 
        } 
    } 

    if( textarea.length != 0 ) { 
        for( var i = 0; i < textarea.length ; i++) { 
            if(textarea[i].getAttribute("help") != null ) { 
                textarea[i].onmouseover    =    msgset; 
                textarea[i].onmousemove    =    msgmove; 
                textarea[i].onmouseout    =    msghide; 
            } 
        } 
    } 



    if( input.length != 0 ) { 
        for( var i = 0; i < input.length ; i++) { 
            if(input[i].getAttribute("check") != null ) { 
                if(input[i].style.cssText != null ) 
                    input[i].style.cssText += ";border:1 solid #C0D1E2;background-color:rgb(239,243,248)"; 
                else 
                    input[i].style.cssText = ";border:1 solid #C0D1E2;background-color:rgb(239,243,248)"; 
            } 
        } 
    } 

    if( textarea.length != 0 ) { 
        for( var i = 0; i < textarea.length ; i++) { 
            if(textarea[i].getAttribute("check") != null ) { 
                if(textarea[i].style.cssText != null ) 
					textarea[i].style.cssText += ";border-color:#C0D1E2;background-color:rgb(239,243,248)"; 
                else 
                    textarea[i].style.cssText = ";border-color:#C0D1E2;background-color:rgb(239,243,248)"; 
            } 
        } 
    } 
} 


function form_check() 
{ 
		String.prototype.trim = function(str) { 
		str = this != window ? this : str; 
		return str.replace(/^\s+/g,'').replace(/\s+$/g,''); 
	}	

    var input        = document.all.tags("INPUT"); 
    var textarea    = document.all.tags("TEXTAREA"); 

    if( input.length != 0 ) 
    { 
        for( var i = 0; i < input.length ; i++) 
        { 
            if(input[i].getAttribute("check") != null ) 
            { 
                if(input[i].value == null || !input[i].value.trim() ) 
                { 
                    input[i].focus(); 
                    //alert("ÇÊ¼ö Ç×¸ñÀ» ÀÔ·ÂÇÏ¼¼¿ä"); 
					alert(input[i].getAttribute("help"));
					input[i].focus();
                    return false; 
                } 
            } 
        } 
    } 

    if( textarea.length != 0 ) 
    { 
        for( var i = 0; i < textarea.length ; i++) 
        { 
            if(textarea[i].getAttribute("check") != null ) 
            { 
                if(textarea[i].value == null || !textarea[i].value.trim()) 
                { 
                    textarea[i].focus(); 
                    alert(textarea[i].getAttribute("help"));
					textarea[i].focus();
                    return false; 
                } 
            } 
        } 
    } 
    return true; 
} 

function length_check() 
{ 
    var input        = document.all.tags("INPUT"); 
    var textarea    = document.all.tags("TEXTAREA"); 
     
    for( var i = 0; i < input.length ; i++) 
    { 
        if(input[i].getAttribute("max") != null ) 
        { 
            if( input[i].value.length > parseInt(input[i].getAttribute("max")) ) 
            { 
                input[i].focus(); 
                alert(parseInt(input[i].getAttribute("max")) +"ÀÚ¸¦ ÃÊ°úÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.\n\\n\rÀÔ·Â°ª : "+ input[i].value.length + "ÀÚ"); 
                return false; 
            } 
        } 
    } 

    for( var i = 0; i < textarea.length ; i++) 
    { 
        if(textarea[i].getAttribute("max") != null ) 
        { 
            if( textarea[i].value.length > parseInt(textarea[i].getAttribute("max")) ) 
            { 
                textarea[i].focus(); 
                alert(parseInt(input[i].getAttribute("max")) +"ÀÚ¸¦ ÃÊ°úÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.\n\\n\rÀÔ·Â°ª : "+ textarea[i].value.length + "ÀÚ"); 
                return false; 
            } 
        } 
    } 
     
    return true; 
} 