//###°ø¿ë¸ðµâ###
//----------------------------------------------------------------------------------


//°ø¹éÃ¼Å©
function CheckSpaces(str,m) {
    var flag=true;
    var strValue = str.value;
 
    if (strValue!=" ") {
       for (var i=0; i < strValue.length; i++) {
          if (strValue.charAt(i) != " ") {
             flag=false;
             break;
          }
       }
    }
	if(flag == true) {
       alert( m + "À»(¸¦) ÀÔ·ÂÇÏ½Ê½Ã¿ä.");
       str.focus();
    }
   
    return flag;
}


function Digit(str) {
	var flag = false;

	if (str.value == "" ) {
		alert("±Ý¾×À» ÀÔ·ÂÇÏ¿©ÁÖ¼¼¿ä");
		str.focus();
		flag = true;

	}else {
		for(i=0; i < str.value.length; i++){
			var tmp_chr = str.value.charAt(i);

			if(/^[0-9]/.test(tmp_chr) == false) {
				alert("±Ý¾×¿¡´Â ¼ýÀÚ¸¸ ÀÔ·ÂÀÌ °¡´ÉÇÕ´Ï´Ù");
				str.value="";
				str.focus();
				flag = true;
				break;
			}
		}
	}
	return flag;
}

//¼ýÀÚ Ã¼Å©
function Number( str, m ) {
   var flag = false;
   var Digit= "1234567890";
  
   if ( CheckSpaces(str,m) == false) {
	   for(i=0; i<str.value.length;i++) {

		 if(Digit.indexOf(str.value.substring(i, i+1)) == -1){	
			alert(m + "Àº(´Â) ¼ýÀÚ¸¸ »ç¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.");
			str.value = "";
			str.focus();	
			flag = true;
			break;
		  }
		  
		}
   } else {
	 flag = true; 
   }
	return flag;
   
}   

function RateDigit(str) {
	var flag = false;

	for(i=0; i < str.value.length; i++){
			var tmp_chr = str.value.charAt(i);
			if(/^[0-9]/.test(tmp_chr) == false) {
				alert("¿Ï·áÀ² ÀÔ·ÂÀº ¼ýÀÚ¸¸ °¡´ÉÇÕ´Ï´Ù");
				str.value = "";
				str.focus();
				flag = true;
				break;
			}
	}
	return flag;
}

//¿µ¹®,¼ýÀÚ Ã¼Å©
function alphaDigit( str, m ) {
   var flag = false;
   var alphaDigit= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
  
   for(i=0; i<str.value.length;i++) {

	 if(alphaDigit.indexOf(str.value.substring(i, i+1)) == -1){	
		alert(m + "Àº(´Â) ¿µ¹®/¼ýÀÚ¸¸ »ç¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.");
		str.focus();	
		flag = true;
		break;
	  }
	  
    }
    return flag;
   
}  

//Flash (IE ÆÐÄ¡¿¡ µû¸¥script)
function setEmbed() 
{ 
  var obj = new String; 
  var parameter = new String; 
  var embed = new String; 
  var html = new String; 
  var allParameter = new String; 
  var clsid = new String; 
  var codebase = new String; 
  var pluginspace = new String; 
  var embedType = new String; 
  var src = new String; 
  var width = new String; 
  var height = new String; 

    
  this.init = function( getType , s ,w , h ) { 
      
      if ( getType == "flash") 
      { 

        clsid = "D27CDB6E-AE6D-11cf-96B8-444553540000";        
        codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"; 
        pluginspage = "http://www.macromedia.com/go/getflashplayer"; 
        embedType = "application/x-shockwave-flash"; 
      } 
      /* type Ãß°¡ 
      else if ( ) 
      { 
      } 
      */ 
            
      parameter += "<param name='movie' value='"+ s + "'>\n";  
      parameter += "<param name='quality' value='high'>\n";    
      
      src = s; 
      width = w; 
      height = h; 
  } 
  
  this.parameter = function( parm , value ) {      
      parameter += "<param name='"+parm +"' value='"+ value + "'>\n";        
      allParameter += " "+parm + "='"+ value+"'"; 
  }  
  
  this.show = function() { 
      if ( clsid ) 
      { 
        obj = "<object classid=\"clsid:"+ clsid +"\" codebase=\""+ codebase +"\" width='"+ width +"' height='"+ height +"'>\n"; 
      } 
      
      embed = "<embed src='" + src + "' pluginspage='"+ pluginspage + "' type='"+ embedType + "' width='"+ width + "' height='"+ height +"'"+ allParameter +" ></embed>\n"; 
      
      if ( obj ) 
      { 
        embed += "</object>\n"; 
      } 
      
      html = obj + parameter + embed; 
      
      document.write( html );  
  } 
  
} 






//±æÀÌ Ã¼Å©
function CheckLen( str, start, end ) {
	var flag = false;

	if ( str.value.length < start && str.value.length < end ) {
			alert(start + "~" + end + "ÀÚ ÀÌ³»·Î ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿À");
			str.focus();	
			flag = true;
   }

   return flag;
}




function jumin_chk(jumin1,jumin2){

		var jstr=(jumin1.value) + (jumin2.value)+"";
		var dummy = new Array("2","3","4","5","6","7","8","9","2","3","4","5");
		var tot;
		var tmp, chksum;


		tmp = jstr.charAt(2);
		tmp = tmp + jstr.charAt(3);
		if(tmp > 12){
				alert("Àß¸øµÈ ÁÖ¹Îµî·Ï¹øÈ£ÀÔ´Ï´Ù.");  
				return true;
		}

		tmp = jstr.charAt(4);
		tmp = tmp + jstr.charAt(5);
		if(tmp > 31){
				alert("Àß¸øµÈ ÁÖ¹Îµî·Ï¹øÈ£ÀÔ´Ï´Ù.");
				return true;
		}

		  tmp = jstr.charAt(6);
		if(tmp > 4){
				alert("Àß¸øµÈ ÁÖ¹Îµî·Ï¹øÈ£ÀÔ´Ï´Ù.");
				return true;
		}

	   if(jstr.length != 13){
				alert("ÁÖ¹Îµî·Ï¹øÈ£ ÀÚ¸´¼ö°¡ ¸ÂÁö ¾Ê½À´Ï´Ù.");
		jumin1.focus();
				return true;
		}

		tot = 0;
		tmp = 0;
		chksum = 0;

		for(var i=0; i<12; i++){
				tot = tot + (jstr.charAt(i) * dummy[i]);
		}

		tmp = tot%11;
		chksum = 11 - tmp;
		tmp = chksum%10;

		if( jstr.charAt(12) != tmp ){
				alert("Àß¸øµÈ ÁÖ¹Îµî·Ï¹øÈ£ÀÔ´Ï´Ù.");
				return true;
		}

		 return false;

} 




function CheckEqual( str1, str2, m ) {
	var flag = false;

	if ( str1.value !=  str2.value ) {
		alert(m + "°¡ °°Áö ¾Ê½À´Ï´Ù");
		str2.value="";
		str2.focus();
		flag = true;
	}
	 return flag;
}


//----------------------------------------------------------------------------------

function go_url(url){
	top.location.href=url;
}


function number_chk1(){

	var sMoney = event.srcElement.value.replace(/,/g,"");	
		if(isNaN(sMoney)){
		alert("¼ýÀÚ·Î ÀÔ·ÂÇÏ¼¼¿ä");        
		event.srcElement.value = "";
		event.srcElement.focus();
		return;
	}

}









/*-------------------------------------------------------------------------------------------------------------
	DDDDD    EEEEEE  SSSSSS   IIIIII   GGGGG   NN   NN
	DD   D   EE      SS         II    GG       N N  NN
	DD    D  EEEEEE   SSSSS     II    GG  GGG  NN N NN
	DD   D   EE           SS    II    GG   GG  NN  N N
	DDDDD    EEEEEE  SSSSSS   IIIIII   GGGGG   NN   NN
-------------------------------------------------------------------------------------------------------------*/


// Image rollover
var changedImg;
function EImgChg(flag)
{	
	source=event.srcElement;
	if (source.name == "")
	{ return false;	}

	if(changedImg == source.name)
	return;

	else if (document.images && source.tagName=="IMG")	{
			imgElement = source.name;
			imgPath = source.src;

			imgPathLen = imgPath.length;
			imgPathFlag = imgPath.lastIndexOf("/");
			imgName = imgPath.substring(0,imgPathFlag+1);

			document.images[imgElement].src = imgName + imgElement + "_" + flag + ".gif";
	}
}



//Window Open
function open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{
	toolbar_str = toolbar ? 'yes' : 'no';
	menubar_str = menubar ? 'yes' : 'no';
	statusbar_str = statusbar ? 'yes' : 'no';
	scrollbar_str = scrollbar ? 'yes' : 'no';
	resizable_str = resizable ? 'yes' : 'no';
	window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

//ºñ¹Ð¹øÈ£Ã£±â
function find(){
	window.open("/program/member/find.asp","find","scrollbars=yes,toolbar=no,directories=no,menubar=no,resizable=no,status=no,width=410,height=270'");
}

//À©µµ¿ì ¿ÀÇÂ2
function open_window2(name, url, left, top, width, height){
	window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',scrollbars=yes,toolbar=no,directories=no,menubar=no,resizable=no,status=no');
}


//Flash (IE ÆÐÄ¡¿¡ µû¸¥script)
function setEmbed() 
{ 
  var obj = new String; 
  var parameter = new String; 
  var embed = new String; 
  var html = new String; 
  var allParameter = new String; 
  var clsid = new String; 
  var codebase = new String; 
  var pluginspace = new String; 
  var embedType = new String; 
  var src = new String; 
  var width = new String; 
  var height = new String; 

    
  this.init = function( getType , s ,w , h ) { 
      
      if ( getType == "flash") 
      { 

        clsid = "D27CDB6E-AE6D-11cf-96B8-444553540000";        
        codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"; 
        pluginspage = "http://www.macromedia.com/go/getflashplayer"; 
        embedType = "application/x-shockwave-flash"; 
      } 
      /* type Ãß°¡ 
      else if ( ) 
      { 
      } 
      */ 
            
      parameter += "<param name='movie' value='"+ s + "'>\n";  
      parameter += "<param name='quality' value='high'>\n";    
      
      src = s; 
      width = w; 
      height = h; 
  } 
  
  this.parameter = function( parm , value ) {      
      parameter += "<param name='"+parm +"' value='"+ value + "'>\n";        
      allParameter += " "+parm + "='"+ value+"'"; 
  }  
  
  this.show = function() { 
      if ( clsid ) 
      { 
        obj = "<object classid=\"clsid:"+ clsid +"\" codebase=\""+ codebase +"\" width='"+ width +"' height='"+ height +"'>\n"; 
      } 
      
      embed = "<embed src='" + src + "' pluginspage='"+ pluginspage + "' type='"+ embedType + "' width='"+ width + "' height='"+ height +"'"+ allParameter +" ></embed>\n"; 
      
      if ( obj ) 
      { 
        embed += "</object>\n"; 
      } 
      
      html = obj + parameter + embed; 
      
      document.write( html );  
  } 
  
} 

var old_sublayer = '';
var p_maximum = '1';


function setLayer(sublayer){

	if( old_sublayer != sublayer ) { 
			if( old_sublayer !='' ) { 
				old_sublayer.style.display = 'block'; 
			} 

			sublayer.style.display = 'block'; 
			old_sublayer = sublayer; 

	} else { 
			sublayer.style.display = 'none'; 
			old_sublayer = ''; 
	} 
}



//¹®ÀÚ¼­ºñ½º ÁßÁö ·¹ÀÌ¾î
function view(v){
var fm=document.fm;
	if(v=="Y"){
	Layer1.style.display="block";
//	Layer1.style.left=event.x-400;
//	Layer1.style.top=event.y;
//	document.ph.src=""+img;

	}else{
	Layer1.style.display="none";
	}
}


/*-------------------------------------
ÀÚ¹Ù½ºÅ©¸³Æ® µ¿Àû ·Îµù
-------------------------------------*/
function exec_script(src)
{
	var scriptEl = document.createElement("script");
	scriptEl.src = src;
	_ID('dynamic').appendChild(scriptEl);
}

/*-------------------------------------
½ºÅ©·Ñ ¹è³Ê
-------------------------------------*/
var bodyHeight = scrollobjHeight = 0;

function scrollBanner()
{
	if ( document.all ) window.attachEvent("onload", initSlide); // IE °æ¿ì
	else window.addEventListener("load", initSlide, false); // FF(¸ðÁú¶ó) °æ¿ì
}

function initSlide()
{
	var scroll = document.getElementById('scroll');
	var scrollTop = get_objectTop(document.getElementById('pos_scroll'));
	scroll.style.top = document.body.scrollTop + scrollTop;
	bodyHeight = document.body.scrollHeight;
	scrollobjHeight = scroll.clientHeight;
	movingSlide();
}

function movingSlide()
{
	var yMenuFrom, yMenuTo, yOffset, timeoutNextCheck;
	var scroll = document.getElementById('scroll');
	var scrollTop = get_objectTop(document.getElementById('pos_scroll'));

	yMenuFrom  = parseInt (scroll.style.top, 10);
	yMenuTo    = document.body.scrollTop + 10;
	if(yMenuTo<scrollTop) yMenuTo = scrollTop;
	timeoutNextCheck = 500;
	if (yMenuFrom != yMenuTo) {
		yOffset = Math.ceil(Math.abs(yMenuTo - yMenuFrom) / 10);
		if (yMenuTo < yMenuFrom) yOffset = -yOffset;
		scroll.style.top = parseInt (scroll.style.top, 10) + yOffset;
		timeoutNextCheck = 10;
	}
	if (scroll.style.pixelTop > bodyHeight - scrollobjHeight) scroll.style.top = bodyHeight - scrollobjHeight;

	setTimeout ("movingSlide()", timeoutNextCheck);
}

function gdscroll(gap)
{
	var gdscroll = document.getElementById('gdscroll');
	gdscroll.scrollTop += gap;
}

function eScroll()
{
	var thisObj = this;
	this.timeObj = null;

	/*** ¼³Á¤º¯¼ö ***/
	this.mode = "left";				// ½ºÅ©·Ñ ¹æÇâ (top|left)
	this.width = "100%";			// ¶óÀÎ´ç °¡·Î°ª (pixel)
	this.height = 20;				// ¶óÀÎ´ç ³ôÀÌ°ª (pixel)
	this.line = 1;					// Ãâ·Â ¶óÀÎ¼ö
	this.delay = 100;				// ½ºÅ©·ÑÈÄ µô·¹ÀÌ ½Ã°£
	this.speed = 1;					// ½ºÅ©·Ñ ¼Óµµ (ÀÛÀ»¼ö·Ï ºü¸§)
	this.id = 'obj_eScroll';		// °´Ã¼ id (Å¬·¡½º ´ÙÁß »ç¿ë½Ã id ´Ù¸£°Ô ÁöÁ¤ ¿ä¸Á)
	this.contents = new Array();	// Ãâ·Â ³»¿ë (¹è¿­·Î ³»¿ë ÁöÁ¤ ¿ä¸Á)
	this.align = "left";			// ³»¿ë aligne
	this.valign = "middle";			// ³»¿ë valigne

	/*** ³»Àåº¯¼ö ***/
	this.gap = 0;
	this.direction = 1;

	this.add = add;
	this.exec = exec;
	this.start = start;
	this.stop = stop;
	this.scroll = scroll;
	this.direct = direct;
	this.go = go;

	function add(str)
	{
		this.contents[this.contents.length] = str;
	}

	function exec()
	{
		this.basis = (this.mode == "left") ? this.width : this.height;
		var outWidth = this.width * ((this.mode == "left") ? this.line : 1);
		var outHeight = this.height * ((this.mode == "top") ? this.line : 1);

		var outline = "<div id=" + this.id + " style='overflow:hidden;width:" + outWidth + ";height:" + outHeight + "'><table></table></div>";
		document.write(outline);
		this.obj = document.getElementById(this.id);

		var tb = this.obj.appendChild(document.createElement("table"));
		var tbody = tb.appendChild(document.createElement("tbody"));
		tb.cellPadding = 0 ;
		tb.cellSpacing = 0 ;
		tb.onmouseover = function(){thisObj.stop()};
		tb.onmouseout = function(){thisObj.start()};

		if (this.mode=="left") var tr = tbody.appendChild(document.createElement("tr"));
		for (k=0;k<this.contents.length;k++){
			if (this.mode=="top") var tr = tbody.appendChild(document.createElement("tr"));
			var td = tr.appendChild(document.createElement("td"));
			td.noWrap = true;
			td.style.width = this.width;
			td.style.height = this.height;
			td.style.textAlign = this.align;
			td.style.verticalAlign = this.valign;
			td.innerHTML = this.contents[k];
		}

		var len = (this.contents.length<this.line) ? this.contents.length : this.line;
		for (i=0;i<len;i++){
			if (this.mode=="top") var tr = tbody.appendChild(document.createElement("tr"));
			td = tr.appendChild(document.createElement("td"));
			td.noWrap = true;
			td.style.width = this.width;
			td.style.height = this.height;
			td.style.textAlign = this.align;
			td.style.verticalAlign = this.valign;
			td.innerHTML = this.contents[i];
		}

		this.obj.parent = this;
		this.tpoint = this.basis * this.contents.length;
		this.start();
	}

	function scroll()
	{
		var out = (this.mode=="left") ? this.obj.scrollLeft : this.obj.scrollTop;
		if (out%this.basis==0){
			this.gap++;
			if (this.gap>=this.delay) this.gap = 0;
		}
		if (!this.gap){
			var ret = (out==this.tpoint) ? this.direction : out + this.direction;
			if (ret<0) ret = this.tpoint + ret;
			if (this.mode=="left") this.obj.scrollLeft = ret;
			else this.obj.scrollTop = ret;
		}
	}

	function start()
	{
		this.timeObj = window.setInterval("(document.getElementById('" + this.id + "')).parent.scroll()",this.speed);
	}

	function stop()
	{
		clearTimeout(this.timeObj);
	}

	function direct(d)
	{
		this.direction = d;
	}

	function go()
	{
		this.stop();
		var out = (this.mode=="left") ? this.obj.scrollLeft : this.obj.scrollTop;
		var ret = (parseInt(out / this.basis) + this.direction) * this.basis;
		if (ret<0) ret = this.tpoint + ret;
		if (ret>this.tpoint) ret = this.basis;
		if (this.mode=="left") this.obj.scrollLeft = ret;
		else this.obj.scrollTop = ret;
	}

}
function doResize(iframeObj){
        var innerBody = iframeObj.contentWindow.document.body;
  
  var innerHeight = innerBody.scrollHeight + (innerBody.offsetHeight - innerBody.clientHeight);
  var innerWidth = innerBody.scrollWidth + (innerBody.offsetWidth - innerBody.clientWidth);
  
  iframeObj.style.height = innerHeight;
  iframeObj.style.width = innerWidth;
  
  this.scrollTo(1,1);
  height = document.body.scrollHeight + 25;
}

