//¿ÞÂÊ ¸Þ´º ´Ù·ç±â
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
	menuOnOff(3);//¸ÞÀÎ¼­ºê¸Þ´º ²ô±â
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//div¸¦ ¿­¾ú´Ù ÆîÃÆ´Ù 
function showSub(obj){

	thisobj=document.getElementById(obj);

	if(thisobj.style.display=="none"){
		thisobj.style.display="block";
	}else{
		thisobj.style.display="none";
	}

	return;
}

//div¸¦ ¿­¾ú´Ù
function openSub(obj){

	thisobj=document.getElementById(obj);

	thisobj.style.display="block";

	return;
}


//div¸¦ ´Ý¾Òµû
function closeSub(obj){

	thisobj=document.getElementById(obj);

	thisobj.style.display="none";

	return;
}

// ·Î±×ÀÎ ¿äÃ»
function requestLogin(url){
	document.baseInfo.backURL.value=url;
	document.baseInfo.action="../member/login.php";
	document.baseInfo.submit();
}


//¼ýÀÚ¸¸ ÀÔ·ÂÇÏµµ·Ï Ã¼Å© ÇÏ´Â ÇÔ¼ö
function chkOnlynum(val){
	if(isNaN(val)){
		return true;
	}else return false;
}

//¹®ÀÚ¿­¿¡ ÇØ´ç ¹®ÀÚ°¡ Æ÷ÇÔµÇ¾î ÀÖ´ÂÁö Ã¼Å©
function containsCharsOnly(input,chars){
	for (var inx = 0; inx < input.length; inx++){
	   if (input.charAt(inx) == chars)
		   return false;
	}
	return true;
}

//¹®ÀÚ¿­¿¡ Æ¯Á¤ ¹®ÀÚ¿­ÀÇ Æ÷ÇÔµÇ¾î ÀÖ´ÂÁö Ã¼Å©
function check_string_in_string(standard,input){
	
	if(input.indexOf(standard)== 0 || input.indexOf(standard)>0)
		return true;
	else
		return false;
}

//¼ýÀÚ ¹®ÀÚ¿­À» ¼ýÀÚ·Î ¸¸µé±â
function string_to_number(myStr){

	var new_str="";

	for(i=0;i<myStr.length;i++){

		if(myStr.charAt(i)==0 && new_str=="")
			continue;
		else
			new_str+=myStr.charAt(i);
		
	}

	return parseInt(new_str);
}

//ÀÌ¸ÞÀÏÀÔ·ÂÃ¼Å©
function isVailEmail(emailValue){

	if(emailValue.indexOf("@")==-1 || emailValue.indexOf(".")==-1 || emailValue.length<9){
		return true;//À¯È¿ÇÏÁö ¾ÊÀ½
	}else return false;
}

//»õ·Î°íÄ§ ¹æÁö
function noEvent(){
	if(event.keyCode==116){
		event.keyCode=2;
		return false;
	}else if(event.ctrlKey && (event.keyCode==78 || event.keyCode==82)){
		return false;
	}
}

function menuOnOff(idx){
	obj01=document.getElementById("sub01");
	obj02=document.getElementById("sub02");
	
	if(idx==1){
		obj01.style.display="block";
		obj02.style.display="none";
	}else if(idx==3){
		if(obj01.style.display=="block")
			obj01.style.display="none";
		if(obj02.style.display=="block")
			obj02.style.display="none";		
	}else{
		obj01.style.display="none";
		obj02.style.display="block";		
	}
}

//ÀüÈ­¹øÈ£ µî Ã¼Å©, ¼ýÀÚ¿Í - ¸¸ Çã¿ë
function chkphonenumers(numbers){
	for(i=0;i<numbers.length;i++){
		if(!isNaN(numbers.charAt(i)) || numbers.charAt(i)=="-" || numbers.charAt(i)==".")
			continue;
		else{
			alert("ÀüÈ­¹øÈ£´Â ¼ýÀÚ¿Í '-','.' ¸¸ Çã¿ëµË´Ï´Ù.");
			return false;
		}
	}

	return true;
}

 //Ã¼Å©¹Ú½º ÀÔ·ÂÃ¼Å©
 function chkcheckbox(name){

	var obj=document.getElementsByName(name);

	for(i=0;i<obj.length;i++){
		if(obj[i].value == "") return false;
		else return true;
	}
 }

//Ã¼Å©¹Ú½º Ã¼Å©µÈ °³¼ö µ¹·Á ÁÜ
function count_checkbox(obj){

	var counter=0;
	for(var i=0;i<obj.length;i++){
		if(obj[i].checked==true)
			counter++;
		else
			continue;
	}

	return counter;
}

//¿ìÆí¹øÈ£ °Ë»ö Ã¢ ¿­±â
function callzipcode(){
		window.open("/www/member/searchzipcode.phtml","new","width=452,height=190,top=300,left=500,scrollbars=no,resizable=no");
}

//¿ìÆí¹øÈ£ ³»¿ë Àü´ÞÇÏ±â
function setzipcode(){

	address=document.zipcode.address.value;

	var tempcode=address.split("|"); 
	opener.document.requestInfo.address01.value=tempcode[1];

	var obj=opener.document.getElementsByName("address02");
	obj[0].style.color="#CCCCCC";
	obj[0].value="³ª¸ÓÁö »ó¼¼ ÁÖ¼Ò¸¦ ÀÔ·ÂÇÏ¼¼¿ä";	

	var tempcode2=tempcode[0].split("-");
	opener.document.requestInfo.zipcode01.value=tempcode2[0];
	opener.document.requestInfo.zipcode02.value=tempcode2[1];
	
	window.self.close();

}

//Ãß°¡ÀÔ·Â ÁÖ¼Ò¿¡ »ö»ó º¯°æ
function set_address2_color(){

	var obj=document.getElementsByName("address02");
	
	if(obj[0].value=="³ª¸ÓÁö »ó¼¼ ÁÖ¼Ò¸¦ ÀÔ·ÂÇÏ¼¼¿ä"){
		obj[0].value="";
		obj[0].style.color="#031A3D";
	}
	
	return true;
	
}

//¿ìÆí¹øÈ£ ÀÔ·ÂÃ¼Å©
function chkenter(){
	if(document.zipcode.keyword.value==""){
		alert("Ã£°íÀÚ ÇÏ´Â µ¿ÀÌ³ª À¾(¸é)À» ÀÔ·ÂÇØÁÖ¼¼¿ä.");
		return;
	}else document.zipcode.submit();
}

//¿øÇÏ´Â±æÀÌ°ªÀÎÁö Ã¼Å©
function chkLength(mystr,limitLength){

	var obj=document.getElementsByName(mystr);

	if(obj[0].value.length > limitLength)
		return true;
	else
		return false;
}

//Ã¼Å©¹Ú½º Ç×¸ñ °¹¼ö
function chkListchk(obj){
		chkValue=0;
		for (var i=0; i<obj.length; i++){
				if(obj[i].checked){chkValue++;}
				else{continue;}
			}
		//alert(chkValue);
		return chkValue;
}

//¿øÇÏ´Â ÆäÀÌÁö·Î ÀÌµ¿
function movePage(myURL){
	//alert(myURL);
	location.href=myURL;
}

//¿À¸¥ÂÊ ¸Þ´º
function initMoving(target, position, topLimit, btmLimit) {
	if (!target)
		return false;

	var obj = target;
	obj.initTop = position;
	obj.topLimit = topLimit;
	obj.bottomLimit = document.documentElement.scrollHeight - btmLimit;

	obj.style.position = "absolute";
	obj.top = obj.initTop;
	obj.left = obj.initLeft;

	if (typeof(window.pageYOffset) == "number") {
		obj.getTop = function() {
			return window.pageYOffset;
		}
	} else if (typeof(document.documentElement.scrollTop) == "number") {
		obj.getTop = function() {
			return document.documentElement.scrollTop;
		}
	} else {
		obj.getTop = function() {
			return 0;
		}
	}

	if (self.innerHeight) {
		obj.getHeight = function() {
			return self.innerHeight;
		}
	} else if(document.documentElement.clientHeight) {
		obj.getHeight = function() {
			return document.documentElement.clientHeight;
		}
	} else {
		obj.getHeight = function() {
			return 500;
		}
	}

	obj.move = setInterval(function() {
		if (obj.initTop > 0) {
			pos = obj.getTop() + obj.initTop;
		} else {
			pos = obj.getTop() + obj.getHeight() + obj.initTop;
			//pos = obj.getTop() + obj.getHeight() / 2 - 15;
		}

		if (pos > obj.bottomLimit)
			pos = obj.bottomLimit;
		if (pos < obj.topLimit)
			pos = obj.topLimit;

		interval = obj.top - pos;
		obj.top = obj.top - interval / 3;
		obj.style.top = obj.top + "px";
	}, 30)
}

//div ±æÀÌ Á¶Á¤
function divHeight(divName,height){
	var obj=document.getElementById(divName);
	obj.style.height=eval(650+height)+"px";

	return;
}

//¸ÞÀÎÀ¸·Î ÀÌµ¿
function gotoMain(){
	location.href="http://www.komabiotech.co.kr";
}

//¼ýÀÚ Æ÷¸Ë
function number_format(input){ 
	
    var input = String(input); 
	
	input=input.split(',').join("");//ÄÞ¸¶Á¦°ÅÇØ¼­ ´Ù½Ã °è»ê
	//input=input.replace(",","");
	//replace()´Â ÇØ´ç ¹®ÀÚÀÇ Ã³À½ ¸¸³ª´Â ¹®ÀÚ ÇÑ¹ø¸¸ ½ÇÇà

	if(input.length < 4) return input;//±æÀÌ°¡ 4ÀÌ»óÀÎ °æ¿ì¿¡¸¸ Ã³¸®

	//var reg = /(\-?\d+)(\d{3})($|\.\d+)/;
	var reg =/([0-9]*)([0-9]{3})$/;

    if(reg.test(input)){ 
		return input.replace(reg, function(str,p1,p2){
                return number_format(p1) + "," + p2; 
            }     
        );
    }else{ 
		alert("input");
        return input; 
    } 
}

//¼ýÀÚÆ÷¸Ë Á¦°ÅÇÏ°í ¼ýÀÚ·Î º¯È¯
function make_string_to_int(number_str){
	
	if(number_str=="") return 0;

	var number=parseInt(number_str.split(',').join(""));
	return number;
}

//input ±Û¾²±â ¸ðµå ¼öÁ¤
function changeMode(optName,point){
	
	var obj=document.getElementsByName(optName);
	
	if(obj){

		if(obj[0].readOnly==true)
			obj[0].readOnly=false;
		else{
			obj[0].readOnly=true;
			obj[0].value="";
		}
			
	}else return false;
}

//°´Ã¼ ºó°ª Á¦¿ÜÇÑ ±æÀÌ
function count_not_empty_value(obj){
	counter=0;

	for(i=0;i<obj.length;i++){
		if(obj[i].value =="")
			continue;
		else
			counter++;
	}
	
	return counter;
}

//¹è¿­ ºó°ª Á¦¿ÜÇÑ ±æÀÌ
function count_not_empty_array(obj){
	counter=0;

	for(i=0;i<obj.length;i++){
		if(obj[i] =="" || obj[i]==null)
			continue;
		else
			counter++;
	}

	return counter;
}

//¹è¿­¿¡ Æ¯Á¤ °ªÀÌ ÀÖ´ÂÁö °Ë»öÇØ¼­ ÀÖÀ¸¸é true
function check_is_have_value(checkArray,checkValue){
	
	for(var i=0;i<checkArray.length;i++){
		if(checkArray[i]==checkValue)
			return true;
		else
			continue;
	}

	return false;
}

//°´Ã¼ ºó°ªÀÌ ÀÖ´ÂÁö Ã¼Å©. ÀÖÀ¸¸é true
function check_empty_in_obj(obj){

	for(var j=0;j<obj.length;j++){
		if(obj[j].value=="" || obj[j].value==null)
			return true;
	}

	return false;
}

//ºó°ªÀÎÁö Ã¼Å©
function isEmptyValue(check_value){
	
	if(check_value=="" || check_value==null)
		return true;
	else
		return false;
}

//³¯Â¥ÀÔ·ÂÃ¼Å©
function date_format(input){
	
	var reg=/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/;

	if(reg.test(input))//Çü½Ä¿¡ ¸ÂÀ½
		return true;
	else
		return false;
}

//¹®ÀÚ¿­ Ä¡È¯
function str_replace(original_str,find_sub_str,new_sub_str){

	new_str=original_str.split(find_sub_str).join(new_sub_str);

	return new_str;
}

//ÀÓÀÇÀÇ Ã¼Å©¹Ú½º ¸ðµÎ ¼±ÅÃ/ÇØÁ¦
function check_all_not(this_check,obj_name){
	
	obj=document.getElementsByName(obj_name);

	if(obj){
		if(this_check){
			for(i=0;i<obj.length;i++)
				obj[i].checked=true;
		}else{
			for(i=0;i<obj.length;i++)
				obj[i].checked=false;
		}
	}else
		alert("none_obj");
}

//ÀÔ·ÂµÈ ³¯Â¥°¡ À¯È¿ÇÑÁö Ã¼Å©
function isVaildDate(chkDate){

	if(chkDate=="")
		return false;

	today = new Date();
	year = today.getYear();
	month = today.getMonth()+1;
	date = today.getDate();
	//alert(year+"-"+month+"-"+date);
	var chkResult="";
	var tempString=chkDate.split("-");

	if(year < changeToInt(tempString[0])) return true;
	else if(year==changeToInt(tempString[0])){
		if(month < changeToInt(tempString[1])) return true;
		else if(month == changeToInt(tempString[1])){
			if(date < changeToInt(tempString[2])) return true;
			else return false;
		}else return false;
	}else return false;

	return true;

}

//0À¸·Î ½ÃÀÛÇÏ´Â ¹®ÀÚ¿­À» ¼ýÀÚ·Î
function changeToInt(charString){
	var toIntString="";
	for(j=0;j<charString.length;j++){
		if(charString.charAt(j)=="0" && j==0) continue;
		else 
			toIntString=toIntString+charString.charAt(j);
	}
	
	return parseInt(toIntString);

}

//3ÃÊ ÈÄ ¹«ºù½ºÅ©¸³Æ® È£Ãâ
setTimeout("initMoving(document.getElementById('rightMenu'), 66, 75, 250)",2000);