 //¹®ÀÚ¸¦ ¹Þ¾Æ¼­ 3ÀÚ¸®¸¶´Ù ÄÞ¸¶¸¦ Âï¾î ¹ÝÈ¯ÇÑ´Ù.
String.prototype.comma=function(){
	
	
	//À½¼ö Ã³¸®ºÎºÐ		
	if ( this.indexOf("-") > -1 ) {
		var Flag = "-";
		var tmp = this.substr(1).split('.');
		
	}else{
		var Flag = "";
		var tmp = this.split('.');
	}
	
	

	var str=new Array();
	var v=tmp[0].replace(/,/gi,''); //ÄÞ¸¶¸¦ ºó¹®ÀÚ¿­·Î ´ëÃ¼
 
	for(var i=0;i<=v.length;i++){ //¹®ÀÚ¿­¸¸Å­ ·çÇÁ¸¦ µ·´Ù.
		str[str.length]=v.charAt(v.length-i); //½ºÆ®¸µ¿¡ °Å²Ù·Î ´ãÀ½
		
		if(i%3==0&&i!=0&&i!=v.length){ //Ã¹ºÎºÐÀÌ³ª, ³¡ºÎºÐ¿¡´Â ÄÞ¸¶°¡ ¾Èµé¾î°¨
			str[str.length]='.'; //¼¼ÀÚ¸®¸¶´Ù Á¡À» ÂïÀ½ - ¹è¿­À» ÇÚµé¸µÇÒ¶§ ½°Ç¥°¡ µé¾î°¡¸é Çê°¥¸®¹Ç·Î
		}
	}
	
	str=str.reverse().join('').replace(/\./gi,','); //¹è¿­À» °Å²Ù·ÎµÈ ½ºÆ®¸µÀ¸·Î ¹Ù²ÛÈÄ¿¡, Á¡À» ÄÞ¸¶·Î Ä¡È¯

	return Flag + ( (tmp.length==2)?str+'.'+tmp[1]:str );
}


//°´Ã¼ÀÇ À§Ä¡ Ã£±â
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
	
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}

	return [curleft,curtop];
}

//·Îµù ÀÌ¹ÌÁö °´Ã¼¸¦ µ¹·ÁÁØ´Ù.
function GetLoadingPop(divid){

	if (divid == null) {divid = "DIVLoadingPOP"}
	if (divid == "") {divid = "DIVLoadingPOP"}
									
	if ( typeof(document.all[divid]) == "undefined" ){
		//"<div ID="" align=center STYLE="position:absolute;top:0;left:0;visibility:visible;z-index:999;"><img src='/Common/LiblaryIMG/ICon/ToolAction/ani_loading.gif' align=center></div>
			
			var oDiv = document.createElement("DIV")
								
			with (oDiv) {
				id = divid;
				className = "Loading";
				innerHTML = "<img src='/Common/LiblaryIMG/ICon/ToolAction/ani_loading.gif'>"
			}
								
			document.body.appendChild(oDiv);
	}
	//alert("A :" + A.id)
								
	return document.all[divid];
									
}
function closeLoadingPop(divid){
	if (divid == null) {divid = "DIVLoadingPOP"}
	if (divid=="") {divid = "DIVLoadingPOP"}
	
	//alert(divid)
	
	layer_hid(divid);
}
function openLoadingPopSample(divid){
	var oDiv = GetLoadingPop(divid);
	
	oDiv.style.top = 100;
	oDiv.style.left = 100;
	
	layer_vis(divid);
}




//·¹ÀÌ¾îÀÇ À§Ä¡¸¦ °áÁ¤
function locateLayer(objName,X,Y){
	var obj = document.all[objName].style; obj.left = X;	obj.top = Y;
}
//TextBoxÀÇ Size¿Í Maxlength¸¦ º¯°æ
function ChangeSize(obj,pSize,pMaxLen){
	obj.size = pSize; obj.maxLength = pMaxLen;
}	
//Layer hidden,visible
function layer_vis(layerID){
	document.all[layerID].style.visibility = "visible";
} 
function layer_hid(layerID){
	document.all[layerID].style.visibility = "hidden";
}
//ÀÌ¹ÌÁö ¹Ù²Ù±â
function ImgOn(obj){
	obj.src = obj.src.toLowerCase().replace("_off","_on");
	obj.style.cursor = "hand";
}
function ImgOff(obj){
	obj.src = obj.src.toLowerCase().replace("_on","_off");
	obj.style.cursor = "hand";
}
//Style Class ¹Ù²Ù±â
function StyleOn(obj){
	obj.className = obj.className.toLowerCase().replace("_off","_on");
}
function StyleOff(obj){
	obj.className = obj.className.toLowerCase().replace("_on","_off");
}

//»õÃ¢¶ç¿ì±â
function winopen(URL,WinName,ScrollBar,top,left,width,height){
top=0;
left=0;	
 if (width == null) width=800;
 if (height == null) height=700;
 window.open(URL,WinName,"scrollbaRS=" + ScrollBar + ",toolbar=no,location=no,directories=no,status=no,width="+width+",height="+height+",resizable=yes,menubar=no,top=" + top + ",left=" + left);
}
//¹Ýº¹Replace
function LoopReplace(Expression,Find,Replaced){
	while (Expression.indexOf(Find) > -1){
		Expression = Expression.replace(Find,Replaced);
	}
	return Expression;
}
//EnterÄ¡¸é ¼­ºê¹ÔÇÏ°Ô
function FormSubmit(objForm){
	if(event.keyCode ==13){ 
     return FormCheck(objForm);     
  } 
}
//¼ýÀÚ¸¸ ÀÔ·Â¹Þ°Ô
function OnlyNumber(obj){
	var regS = /[^0-9]+/g;
	obj.value = obj.value.replace(regS,'');
}

function Left(str,Len){
	var Result = str;
	
	return Result.substring(0,Len);
	
}

function Right(str,Len){
	var Result = str;
	
	return Result.substring((str.length-Len),str.length);
	
}

//ÀÚ¸®¼ö º° ¹Ý¿Ã¸²ÇÔ¼ö
function aspround(Num,numdecimalplace){
	
	var returnVal;
	var E = 10;
	
	for (var i=1;i<numdecimalplace;i++){
		E *= 10  
	}
	
	returnVal = Math.round (eval(Num) * E) / E;
	
	return returnVal;
}



//ÆË¾÷Ã¢Å©±âÁ¶Àý
function resizePopUP(marginWidth,marginHeight,tableID){
	var maxWidth = 1024;
	var maxHeight = 700;
	
	var oTable = document.all[tableID]
	
	var x = oTable.offsetWidth+marginWidth;
	var y = oTable.offsetHeight+marginHeight+20;
	
	//var x = oTable.clientWidth+marginWidth;
	//var y = oTable.clientHeight+marginHeight;
	
	
	if (x > maxWidth) x = maxWidth;
	if (y > maxHeight) y = maxHeight;
	//alert( oTable.clientWidth + ' ' + oTable.clientHeight)
	window.resizeTo(x,y);
	window.focus();
	//alert( oTable.clientWidth + ' ' + oTable.clientHeight)
}

//Popup Left °Ë»öÃ¢ ¿ÀÇÂÇÏ±â
function OpenMiniSearchWindow(vURL,vWidth,vHeight){
	var oSearchTable = document.all["MINISEARCH"];
	var oLabel = document.all["SearchLabel"];
	var oFrame = document.all["SearchFrame"];
	
	if (vURL==null) vURL = "";
	if (vWidth==null) vWidth = "350px";
	if (vHeight==null) vHeight = "100%";
	
	oFrame.width=vWidth
	oFrame.height=vHeight
	
	if (vURL != "") oFrame.src=vURL;
	
	oSearchTable.style.display='';
		
	ResizeThis();
}
//Popup Left °Ë»öÃ¢ ´Ý±â
function CloseMiniSearchWindow(){
	var oSearchTable = document.all["MINISEARCH"];
	var oLabel = document.all["SearchLabel"];
	var oFrame = document.all["SearchFrame"];
	
	oSearchTable.style.display='none';

	ResizeThis();
}


//XMLRequest Ã³¸® ÄÄÆ÷³ÍÆ® /////////////////////////////////////////////
/*
url-loading object and a request queue built on top of it
*/

/* namespacing object */
var net=new Object();

net.READY_STATE_UNINITIALIZED=0;
net.READY_STATE_LOADING=1;
net.READY_STATE_LOADED=2;
net.READY_STATE_INTERACTIVE=3;
net.READY_STATE_COMPLETE=4;


/*--- content loader object for cross-browser requests ---*/
net.ContentLoader=function(url,onload,onerror,method,params,contentType){
  this.req=null;
  net.currentLoader=this;
  this.onload=onload;
  this.onerror=(onerror) ? onerror : this.defaultError;
  this.loadXMLDoc(url,method,params,contentType);
}

net.ContentLoader.prototype.loadXMLDoc=function(url,method,params,contentType){
  if (!method){
    method="GET";
  }
  if (!contentType && method=="POST"){
    contentType='application/x-www-form-urlencoded';
  }
  if (window.XMLHttpRequest){
    this.req=new XMLHttpRequest();
  } else if (window.ActiveXObject){
    this.req=new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (this.req){
    try{
      var loader=this;
      this.req.onreadystatechange=function(){
        net.ContentLoader.onReadyState.call(loader);
      }
      this.req.open(method,url,true);
      if (contentType){
        this.req.setRequestHeader('Content-Type', contentType);
      }
      this.req.send(params);
    }catch (err){
      this.onerror.call(this);
    }
  }
}


net.ContentLoader.onReadyState=function(){
  var req=this.req;
  var ready=req.readyState;
  try{var httpStatus=req.status;
  if (ready==net.READY_STATE_COMPLETE){
    if (httpStatus==200 || httpStatus==0){
      this.onload.call(this);
    }else{
      this.onerror.call(this);
    }
  }
  }
  catch(e){}
}

net.ContentLoader.prototype.defaultError=function(){
  alert("error fetching data!"
    +"\n\nreadyState:"+this.req.readyState
    +"\nstatus: "+this.req.status
    +"\nheaders: "+this.req.getAllResponseHeaders());
}
//////////////////////////////////////////////////////////////




///////////////////»ç¿ëÀÚ¿µ¿ª////////////////////////

function OpenAboutUs(){
	BOX_ABOUTUS.style.display='';
}


function SetCategory(CatName){
	
	oCategory = document.all["M_"+CatName];
	//ImgOn(oCategory);

}

function MainImgOff(obj){
	if (oCategory != obj){
		ImgOff(obj);
	}
}


var oCategory = null; //Market Place ÀÌ¹ÌÁö ÀúÀå°´Ã¼ 


function GoAsk(RegSite,MailType,KeyID){
	winopen("/TM/FrmMail_"+RegSite+".asp?MailType="+MailType+"&KeyID="+KeyID,"ask","yes",50,50);
	//return false;
}

function GoDownZip(KeyID){
	winopen("/MarketPlace/FrmDownload_ENG.asp?KeyID="+KeyID,"DOWN","yes",50,50);
	//return false;
}


function GetSpreadSheet(Object_ID,width,height){
//clsid:0002E510-0000-0000-C000-000000000046 //9.0
//clsid:0002E551-0000-0000-C000-000000000046 //10.0
	var Object = "<object ID=\""+Object_ID+"\" style=\"LEFT: 0px; TOP: 0px;width:"+width+";height:"+height+"\" classid=\"clsid:0002E551-0000-0000-C000-000000000046\" VIEWASTEXT></object>";
	document.write (Object)
}

function GoMainWin(){
	
	
	
	try{
		opener.top.focus();
	}
	catch(e)
	{
		//alert(NEWWIN)
		if ( confirm("¸ÞÀÎÃ¢ÀÌ ´ÝÇû½À´Ï´Ù.\n\n¸ÞÀÎÃ¢À» ´Ù½Ã ¿©½Ã°Ú½À´Ï±î?") ){
			var T = window.open("/Framework/FrameSet.asp?GO=NEW","NEWWIN","width=1024,height=768,left=0,top=0,toolbar=yes, location=yes, directories=yes, status=yes, menubar=yes, resizable=yes, scrollbars=auto, copyhistory=yes")
		}
		//}else{
		//	NEWWIN.focus();
		//}
	}
}









