function closeLayer(obj){
	obj.style.visibility='hidden';
}
function closetoLayer(obj){
	setCookie( obj, "done" , 1 );
	document.all[obj].style.visibility = "hidden";
}
function setCookie( name, value, expiredays ) { 
	var todayDate = new Date(); 
	todayDate.setDate( todayDate.getDate() + expiredays ); 
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" 
}
function getCookie( name ){ 
 var nameOfCookie = name + "=";
 var x = 0; 
 while ( x <= document.cookie.length ) { 
  var y = (x+nameOfCookie.length);
  if ( document.cookie.substring( x, y ) == nameOfCookie ) {
   if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 ) endOfCookie = document.cookie.length; 
   return unescape( document.cookie.substring( y, endOfCookie ) );
  } 
  x = document.cookie.indexOf( " ", x ) + 1;
  if ( x == 0 ) break; 
 } 
 return "";
}

function getFileExtension( filePath ){
	var extension = "";
	var lastIndex = -1;
		lastIndex = filePath.lastIndexOf('.');

	if ( lastIndex != -1 ){
		extension = filePath.substring( lastIndex+1, filePath.len );
	} else{
		extension = "";
	}
		return extension;
}

function uploadImg_check( value,msg,sort ){
	var src = getFileExtension(value);

	if(sort==1 && value==""){return true;}
	if ( src == ""){
		alert(msg);
		return false;
	} else if ( !((src.toLowerCase() == "gif") || (src.toLowerCase() == "jpg") || (src.toLowerCase() == "jpeg")) ) {
		alert('gif ¿Í jpg ÆÄÀÏ¸¸ ¾÷·Îµå ÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.');
		return false;
	}else{return true;}
}

function popOpen(Width,Height,idx,sTop,sLeft) {
	if( getCookie( "pop"+idx ) != "done" ){ 
		var Option="left="+sLeft+",top="+sTop+",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+Width+", height="+parseInt(Height+21);
		window.open("/popup.asp?idx="+idx,"pop"+idx,Option);
	}
}

function mainLoginSend(form) {
	if(form.userid.value=="") {
		alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		form.userid.focus();
		return;
	}
	if(form.userid.value.length < 6 || form.userid.value.length > 15) {
		alert("È¸¿ø ¾ÆÀÌµð´Â 6~15ÀÚ·Î ÀÔ·Â ÁÖ¼¼¿ä.");
		form.userid.focus();
		return;
	}
	if(form.passwd.value=="") {
		alert("ÆÐ½º¿öµå¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		form.passwd.focus();
		return;
	}
	if(form.passwd.value.length < 6 || form.passwd.value.length > 15) {
		alert("ÆÐ½º¿öµå´Â 6~15ÀÚ·Î ÀÔ·Â ÁÖ¼¼¿ä.");
		form.passwd.focus();
		return;
	}form.submit();
}

function mainLoginInputSendit(form) {
	if(event.keyCode==13) { 
		mainLoginSend(form);
	}
}

function zipcodeck(myname,w,h,scroll,frm,zip,addr1,addr2){
	var urlstr="/common/zipsearch.asp?frm="+frm+"&fzip="+zip+"&faddr1="+addr1+"&faddr2="+addr2;
	var winl=(screen.width - w)/2;
	var wint=(screen.height - h)/2;
	winprops='height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll
	window.open(urlstr,myname,winprops)
}

function itemsearch(){
	if(document.itemshform.searchstr.value==""){
		alert("°Ë»öÇÏ½Ç Á¦Ç° ´Ü¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		document.itemshform.searchstr.focus();
		return;
	}document.itemshform.submit();
}

function openModal(width,height,fileUrl,scroll){
	var OpenFile=fileUrl;
	var ReturnValue=window.showModalDialog(OpenFile,'','scroll:'+scroll+'; help:no; center:yes; status:no; dialogWidth:'+width+'px; dialogHeight:'+height+'px');
	if(ReturnValue==1){
		return true;
	}
}

function MainItemSearchGo(){
	if ( document.mainSearch.textfield.value.length==0 || document.mainSearch.textfield.value.length<1 ){
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.\n°Ë»ö¾î´Â 1ÀÚÀÌ»ó ÀÔ·ÂÇØÁÖ¼¼¿ä."); 
		document.mainSearch.textfield.focus();
		return ;		
	}   		
	document.mainSearch.submit();	
}

function openWindow(Width,Height,Url,winname,scroll) {
	var winPosLeft = (screen.width - Width) / 2; // »õÃ¢ Y ÁÂÇ¥
	var winPosTop = (screen.height - Height) / 2; // »õÃ¢ X ÁÂÇ¥

	var Option="top="+winPosTop+",left="+winPosLeft+", toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars="+scroll+", resizable=no,width="+Width+", height="+Height;
	obj = window.open(Url,winname,Option);
	obj.focus();
}

function login(){
	alert("·Î±×ÀÎÀÌ ÇÊ¿äÇÑ ÆäÀÌÁöÀÔ´Ï´Ù.\n·Î±×ÀÎ Ã³¸®¸¦ ÇØÁÖ¼¼¿ä.");
	return;
}

function downChk(){
	alert("´Ù¿î·Îµå ±ÇÇÑÀÌ ¾ø½À´Ï´Ù.\nÈ®ÀÎÈÄ ´Ù½Ã½ÃµµÇØÁÖ¼¼¿ä.");
	return;
}

function inputSendit(thisform) {
	if(event.keyCode==13) {
		thisform.submit();
	}
}

function formatNumber(v1,v2){
	var str=new Array(); //ÄÞ¸¶½ºÆ®¸µÀ» Á¶ÇÕÇÒ ¹è¿­
	v1=String(v1); //¼ýÀÚ¸¦ ½ºÆ®¸µÀ¸·Î º¯È¯
	for(var i=1;i<=v1.length;i++){ //¼ýÀÚÀÇ ±æÀÌ¸¸Å­ ¹Ýº¹
		if(i%v2) str[v1.length-i]=v1.charAt(v1.length-i); //ÀÚ¸®¼ö°¡ ¾Æ´Ï¸é ¼ýÀÚ¸¸»ðÀÔ
		else  str[v1.length-i]=','+v1.charAt(v1.length-i); //ÀÚ¸®¼ö ÀÌ¸é ÄÞ¸¶±îÁö »ðÀÔ
	}
	return str.join('').replace(/^,/,''); //½ºÆ®¸µÀ» Á¶ÇÕÇÏ¿© ¹ÝÈ¯
}



function regularExp(Str,Patten){
	var chk
	if(Patten=="hangle"){chk=/[^ ¤¡-ÆR]/;}		// ÇÑ±Û,°ø¹é Çã¿ë
	else if(Patten=="charcode"){chk=/[^ \w¤¡-ÆR]/}	// ÇÑ¿µ¹®ÀÚ,¼ýÀÚ,°ø¹é,_ Çã¿ë
	else if(Patten=="intcode"){chk=/[^\d-]/;}	// ¼ýÀÚ,- Çã¿ë
	else{chk=Patten}
	return chk.test(Str);
}


function onlyNumber(){
	if((event.keyCode==190) || (event.keyCode>=96 && event.keyCode<=105) || (event.keyCode==110) || (event.keyCode>47 && event.keyCode<58) || event.keyCode==8 || event.keyCode==16 || event.keyCode==116 || event.keyCode==18 || event.keyCode==9 ||(event.keyCode>=37 && event.keyCode<=40) || event.keyCode==46 );
	else event.returnValue=false;
}

function OpenWin_Upload() {
	window.open("../TextEditor/fileupload.asp","FileUpload","scrollbars=yes,height=470,width=720,top=20,left=50");
}

function setCookie( name, value, expiredays ){
  var endDate = new Date();
  endDate.setDate( endDate.getDate()+ expiredays );
  document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + endDate.toGMTString() + ";"
}

function get_Cookie( name ){
    var nameOfCookie = name + "=";
    var x = 0;
    while ( x <= document.cookie.length ){
        var y = (x+nameOfCookie.length);
        if ( document.cookie.substring( x, y ) == nameOfCookie ){
            if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
                endOfCookie = document.cookie.length;
            return unescape( document.cookie.substring( y, endOfCookie ) );
        }
        x = document.cookie.indexOf( " ", x ) + 1;
        if ( x == 0 ) break;
    }
    return "";
}

function changeMenu(index){
	if(index==0){
		document.all.MenuTable1.style.display='block';
		document.all.MenuTable2.style.display='none';
		setCookie( "menuSort", 0 , 1);
	}else{
		document.all.MenuTable1.style.display='none';
		document.all.MenuTable2.style.display='block';
		setCookie( "menuSort", 1 , 1);
	}
}

function vodView(title,url){
	var Option="top=0, left=0, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars="+scroll+", resizable=no,width=400, height=300";
	window.open('/player/player.asp?title='+title+'&ViewFileUrl='+url,'player',Option);
}

function transView(transCompany,transCode){
	
	if(transCompany=="»ï¼ºÅÃ¹è"){
		openWindow(555,450,"http://www.cjgls.co.kr/nels/tracking/tracking_voice_hth2.asp?slipno="+transCode,'expView','yes')
	}else if(transCompany=="·ÎÁ¨ÅÃ¹è"){
		openWindow(800,600,"http://d2d.ilogen.com/d2d/delivery/invoice_search_popup.jsp?invoiceNum="+transCode+"&viewType=type1","expView","yes")
	}else if(transCompany=="¿ìÃ¼±¹ÅÃ¹è"){
		openWindow(500,600,"http://service.epost.go.kr/trace.RetrieveRegiPrclDeliv.postal?sid1="+transCode,"expView","yes")
	}else{
		openWindow(900,600,"http://hanjin.co.kr/Delivery_html/inquiry/result_waybill.jsp?wbl_num="+transCode,"expView","yes")
	}
}



//¿¡µðÅÍ °ü·Ã ½ºÅ©¸³Æ®======================================================================================
function alditor_PlayNow(obj, w, h, url){
	try	{
		if (url){
			var el = obj;
			var sURL = url;
			var sID = url;
		} else {
			var el = obj.previousSibling;
			while (el.tagName!="A")
			el = el.previousSibling;
			var sURL = el.href;
			var sID = el.href;
		}
		var sExt = sID.substring(sID.lastIndexOf("."));
		var sComp = sExt.toUpperCase();

		if (document.getElementById(sID)==null){
			var embedHolder = document.createElement("div");
			var embed = document.createElement("EMBED");
			if (w) { embed.width = w;	}
			if (h) 	{ embed.height = h;	}
			if (sComp==".SWF"){
				embed.quality = "high";
				embed.wmode = "transparent";
			} else {
				embed.autostart = true;
			}
			embed.id = sID;
			embed.src = sURL;
			embedHolder.appendChild(embed);
			el.parentNode.insertBefore(embedHolder,el);
		} else {
			document.getElementById(sID).parentNode.parentNode.removeChild(document.getElementById(sID).parentNode);
		}
	}
	catch(e){}
}

function alditor_ShowHide(obj){
	try{
		var targetDiv = document.getElementById(obj.id + 'sh');
		if (targetDiv.className == 'showhideDiv') {
			obj.title = obj.innerHTML;
		}
		obj.innerHTML = (targetDiv.className == 'showhideDiv')? '°¡¸®±â' : obj.title ;
		targetDiv.className = (targetDiv.className == 'showhideDiv')? 'showhideDivShow' : 'showhideDiv' ;
	}
	catch(e) {}
}
//==========================================================================================================
