
//http://www.baroga.net/common/javascript.js ÇÔ¼ö ¸®½ºÆ®


// ÆäÀÌÁö ½ÃÀÛ½Ã°£
var Start = new Date();


// ¹Ù²Ù±â..
function MenuClick(url){
	document.f1.src = url;
}

/// ¸¶¿ì½º ¿À¹ö,¾Æ¿ô½Ã ÀÌ¹ÌÁö ¹Ù²Ù±â ///
function EventMouseOverOut(obj,isOver){
	ImgName = obj.id
	if(isOver=="Y") obj.src = "/image/" + ImgName + "_r.gif";
	else            obj.src = "/image/" + ImgName + ".gif";
}

////////// Null Ã¼Å© ÇÔ¼ö //////////
function isNull(str){
	if(str!=null && str.length!=0) return false;
	else                           return true;
}

////////// Alphabet, Number, AlphaNum, PhoneNum Ã¼Å© ÇÔ¼ö //////////
function isAlphaNum(str,div){
	                  //checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`~!@#$^*()_\+-=||{}[]:;<>?/\\";
	if(div=="Alphabet") checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
	if(div=="Number")   checkOK = "0123456789";
	if(div=="AlphaNum") checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
	if(div=="PhoneNum") checkOK = "0123456789-";
	for(i=0; i<str.length; i++){
		ch = str.charAt(i);
		for(j=0; j<checkOK.length; j++){
			if(ch==checkOK.charAt(j)) break;
		}
		if(j==checkOK.length){
			return false;
			break;
		}
	}
	return true;
}

////////// Æ¯Á¤¹®ÀÚ Á¸Àç Ã¼Å© ÇÔ¼ö //////////
function isExistChr(str,div){
	                    //checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`~!@#$^*()_\+-=||{}[]:;<>?/\\";
	if(div=="FolderName") checkOK = "`~!@#$^*()_\+-=||{}[]:;<>?/\\\"";
	for(i=0; i<str.length; i++){
		ch = str.charAt(i);
		for(j=0; j<checkOK.length; j++){
			if(ch==checkOK.charAt(j)){
				return true;
				break;
			}
		}
	}
	return false;
}

////////// ¹®ÀÚ±æÀÌ Ã¼Å© ÇÔ¼ö //////////
function isLengthOk(str,min,max){
	if(str.length<min || str.length>max) return false;
	else                                 return true;
}

////////// ÁÂ¿ì °ø¹éÁ¦°ÅÇÔ¼ö //////////
function trim(strSource){
	re = /^\s+|\s+$/g;
	return strSource.replace(re,'');
}
////////// ÁÂ °ø¹éÁ¦°ÅÇÔ¼ö //////////
function ltrim(strSource){
	re = /^\s+/g;
	return strSource.replace(re,'');
}
////////// ¿ì °ø¹éÁ¦°ÅÇÔ¼ö //////////
function rtrim(strSource){
	re = /\s+$/g;
	return strSource.replace(re,'');
}

// ·Î±×ÀÎ Ã¢
function openLogin(HostURL){
	var newWin = window.open('/Login.html?HostURL=' + HostURL,'BarogaLogIn','Top=100,Left=100,Width=400,Height=350,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');
	newWin.focus();
}

// ¾Æµðµð/ÆÐ½º¿öµå È®ÀÎÃ¢ Ã¢
function openFindID(HostURL){
	var newWin = window.open('/Login_Find_ID.html?HostURL=' + HostURL,'BarogaFindID','Top=100,Left=100,Width=400,Height=350,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');
	newWin.focus();
}

// È¸¿ø°¡ÀÔ Ã¢
function openRegMember(HostURL){
	var newWin = window.open('/member/member_m.html?HostURL=' + HostURL,'BarogaMemReg','Top=100,Left=100,Width=688,Height=600,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0');
	newWin.focus();
}

//ÆË¾÷ ·Î±×¾Æ¿ô Ã¢
function openLogout(HostURL){
	var newWin = window.open('http://www.baroga.net/Logout.html?HostURL=' + HostURL,'MyanywareLogOut','Top=100,Left=100,Width=100,Height=100,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');
	newWin.focus();
}

// È¸¿ø¼öÁ¤ Ã¢
function openInfoMember(HostURL){
	location.href = 'http://www.baroga.net/MyPage3/index.html?HostURL='+ HostURL + '&name=m_09';
	//var newWin = window.open('/member/membership.html?sel=mod&HostURL=' + HostURL,'BarogaMemInfo','Top=100,Left=100,Width=688,Height=600,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0');
	//newWin.focus();
}

//ÆË¾÷ MyPage Ã¢
function openMyPage(HostURL){
	var newWin = window.open('/MyPage/index.html?HostURL=' + HostURL,'MyPage','Top=100,Left=100,Width=600,Height=600,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');
	newWin.focus();
}

//ÆË¾÷ MyPage > SMS Ã¢
function openSMS(HostURL){
	var newWin = window.open('/MyPage/SMS_Send.html','MyPage','Top=100,Left=100,Width=600,Height=600,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');
	newWin.focus();
}


//ÆË¾÷ °øÁö»çÇ× Ã¢
function openNotice(){
	var newWin = window.open('/Pupup/index.html','Notice','Top=100,Left=100,Width=336,Height=370,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');
	newWin.focus();
}

////////// ÁÖ¹Îµî·Ï¹øÈ£ À¯È¿ Ã¼Å© ÇÔ¼ö //////////
function CheckJumin(obj_jumin1,obj_jumin2,val_jumin1,val_jumin2){
	if(!val_jumin1){ alert('ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä !!'); obj_jumin1.focus(); return false;}
	if(!val_jumin2){ alert('ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä !!'); obj_jumin2.focus(); return false;}
	ju = [0,0,0,0,0,0,0,0,0,0,0,0,0];   // ÁÖ¹Î¹øÈ£ Ã¼Å© ¹è¿­¼±¾ð
	for(i=0; i<6; i++) ju[i] = val_jumin1.substring(i,i+1);
	for(i=0; i<7; i++) ju[i+6] = val_jumin2.substring(i,i+1);
	for(sum=0,i=0; i<=11; i++) sum+= ju[i] * ((i>7)?(i-6):(i+2));
	mod = 11 - (sum % 11);
	if(mod>=10) mod-= 10;
	if(mod!=ju[12]){
		alert('ÁÖ¹Îµî·Ï¹øÈ£ ¿À·ùÀÔ´Ï´Ù !!\n\nÁÖ¹Îµî·Ï¹øÈ£ È®ÀÎ ÈÄ ´Ù½Ã ÀÔ·ÂÇØÁÖ¼¼¿ä.');
		obj_jumin1.select();
		obj_jumin2.value = '';
		return false;
	}

	//alert('Á¤È®ÇÑ ÁÖ¹Î¹øÈ£ ÀÔ´Ï´Ù.!!')
	return true;
}

////////// ÁÖ¹Îµî·Ï¹øÈ£ À¯È¿ Ã¼Å© ÇÔ¼ö //////////
function CheckJumin2(obj_jumin1,obj_jumin2,val_jumin1,val_jumin2){
	if(!val_jumin1){ alert('ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä !!'); obj_jumin1.focus(); return false;}
	if(!val_jumin2){ alert('ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä !!'); obj_jumin2.focus(); return false;}
	ju = [0,0,0,0,0,0,0,0,0,0,0,0,0];   // ÁÖ¹Î¹øÈ£ Ã¼Å© ¹è¿­¼±¾ð
	for(i=0; i<6; i++) ju[i] = val_jumin1.substring(i,i+1);
	for(i=0; i<7; i++) ju[i+6] = val_jumin2.substring(i,i+1);
	for(sum=0,i=0; i<=11; i++) sum+= ju[i] * ((i>7)?(i-6):(i+2));
	mod = 11 - (sum % 11);
	if(mod>=10) mod-= 10;
	if(mod==ju[12]){
		alert('Á¤È®ÇÑ ÁÖ¹Î¹øÈ£ ÀÔ´Ï´Ù.!!')
		return true;
	}
	alert('ÁÖ¹Îµî·Ï¹øÈ£ ¿À·ùÀÔ´Ï´Ù !!\n\nÁÖ¹Îµî·Ï¹øÈ£ È®ÀÎ ÈÄ ´Ù½Ã ÀÔ·ÂÇØÁÖ¼¼¿ä.');
	obj_jumin1.select();
	obj_jumin2.value = '';
	return false;

}

////////// FromFormControlÀÔ·Â¶õ¿¡ ±ÛÀÚ¼ö°¡ StringLength°³ÀÌ¸é ToFormControl·Î Æ÷Ä¿½º ÀÌµ¿ÇÔ¼ö //////////
////////// onkeyup='MoveFocus(6,this,this.form.jumin2)' //////////
function MoveFocus(StringLength,FromFormControl,ToFormControl){
	if(FromFormControl.value.length==StringLength) ToFormControl.focus();
}

////////// login submitÀÌÀüÀÇ ÇÔ¼ö //////////
function beforelogin(frm){
	if(!frm.id.value){ alert('ID(¾ÆÀÌµð)¸¦ ÀÔ·ÂÇÏ¼¼¿ä!');    frm.id.focus(); return false;}
	if(!frm.pw.value){ alert('P/W(ºñ¹Ð¹øÈ£)¸¦ ÀÔ·ÂÇÏ¼¼¿ä!'); frm.pw.focus(); return false;}
	//document.cookie = 'previous_url=' + escape('$REQUEST_URI') + '; path=/';   // ÀÌÀü ÁÖ¼Ò¸¦ ÄíÅ°·Î ±â¾ï
}

////////// JavaScript·Î ÄíÅ°»ý¼º ÇÔ¼ö name:ÄíÅ°ÀÌ¸§ value:ÄíÅ°°ª expiredays:ÄíÅ°À¯Áö½Ã°£(ÀÏ) //////////
function setCookie(name,value,expiredays){
	if(expiredays){   // ÄíÅ°À¯Áö½Ã°£(ÀÏ)ÀÌ ÀÖÀ¸¸é
		var todayDate = new Date();
		todayDate.setDate(todayDate.getDate() + expiredays);
		document.cookie = name + "=" + escape(value) + "; path=/; expires=" + todayDate.toGMTString() + ";";
		//document.write(todayDate.toGMTString());
	}else{            // ÄíÅ°À¯Áö½Ã°£(ÀÏ)ÀÌ ¾øÀ¸¸é À¯Áö½Ã°£ ¼³Á¤ÇÏÁö ¾ÊÀ½ (ÇöÀçºê¶ó¿ìÀú ³»¿¡¼­¸¸ À¯Áö)
		document.cookie = name + "=" + escape(value) + "; path=/;";
	}
}

////////// JavaScript·Î ÄíÅ°°ª ºÒ·¯¿À´Â ÇÔ¼ö name:ÄíÅ°ÀÌ¸§ //////////
function getCookie(name){
	var Found = false;
	var start, end, i;
	for(i=0; i<=document.cookie.length; i++){
		start = i;
		end = start + name.length;
		if(document.cookie.substring(start,end)==name){
			Found = true;
			break;
		}
	}
	if(Found==true){
		start = end + 1;
		end = document.cookie.indexOf(";",start);
		if(end<start) end = document.cookie.length;   // ¸¶Áö¸·¿¡´Â ";"°¡ ¾øÀ¸¹Ç·Î
		return unescape(document.cookie.substring(start,end));   // JavaScript°¡ ÀÐÀ»¶§´Â unescape°¡ ÇÊ¿ä, PHP³ª ASP°¡ ÀÐÀ»¶§´Â ±×³É ÀÐÀ¸¸é µÊ
	}else{
		return "";
	}
}

////////// ¹æ¹®ÀÚÄ«¿îÆ® Ã³¸® //////////
if(!getCookie("C_visit")){
	document.write("<iframe name=WebLog scrolling=no width=0 height=0 frameborder=0 style='position:absolute; left:0; top:0; visibility:hidden;' src='/common/count_visit.html'></iframe>");
	setCookie("C_visit",true);
}



////////// ¸¶ÀÌÆäÀÌÁö ·¹ÀÌ¾î //////////
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
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_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_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  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];}
}


//¹Ù·Î°¡±â
//¸µÅ© ÀÚ¹Ù½ºÅ©¸³Æ®
function GoLink(u)
{
	if(u =="home") 				url = "http://www.netimo.net/index.html";
	if(u =="cafe") 					url = "http://cafe.netimo.net";
	//if(u =="mypage") 	url = "http://www.baroga.net/MyPage3/index.html";
	if(u =="mypage") 		url = "http://my.baroga.net/";
	if(u =="shopping") 	url = "http://shop.netimo.net/";
	if(u =="community") url = "http://www.netimo.net/";
	if(u =="anyware") 		url = "http://anyware.netimo.net/";
	if(u =="baroga") 			url = "http://www.baroga.net/";

	if(u =="notice") 				url = "http://www.netimo.net/board/list.html?table=commu_board&div=notice";
	if(u =="privacy") 			url = "http://www.netimo.net/notice/index.html?mode=privacy";
	if(u =="boranet") 		url = "http://www.netimo.net/notice/index.html?mode=boranet";

	if(u =="site_idea") 	url = "http://www.netimo.net/board/list.html?table=pcbangnews&div=site_idea";
	location.href(url);
}

function GoBoard(table,div,section)
{

	var table;
	var div;
	var section;

	url = "http://www.netimo.net/board/list.html?table="+table+"&div="+div+"&section="+section;

	//url = "http://www.netimo.net/board/init_cookie.html?table="+table+"&div="+div+"&section="+section;

	document.go_board.location.href(url);
}



//»õ·Î¿î È¸¿ø°¡ÀÔÆäÀÌÁö
function GlobalMemberRegist(r)
{
	//r = refference
	location.href("http://my.netimo.net/regist/?PreURL="+r);
}
// »õ·Î¿î ¾Æµðµð/ÆÐ½º¿öµå È®ÀÎÃ¢ Ã¢
function GlobalMemberFindID()
{
	url 	= "http://www.netimo.net/login/find_user_idpw.html";
	var newWin = window.open(url,'GlobalFindID','Top=100,Left=100,Width=400,Height=350,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');
	newWin.focus();
}
//»õ·Î¿î È¸¿ø·Î±×¾Æ¿ô
function GlobalLogOut()
{
	location.href = "/login/process_logout.php";
}

//Mypage
function GlobalMyPage(r)
{
	if(r =="baroga.netimo.net")
	{
		url			= "http://my.netimo.net/modules/public205/index.php";
		var set = '';
		var newWin = window.open(url,'netimo',set);
	}
	else
	{
		url			= "http://my.baroga.net/modules/public205/index.php";
		var set = '';
		var newWin = window.open(url,'baroga',set);
	}
	newWin.focus();
//	url= "http://my.baroga.net/";
//	var set = '';
//	var newWin = window.open(url,'baroga',set);
//	newWin.focus();
}


function GlobalMemberModify(r)
{
	if(r =="baroga.netimo.net")
	{
		location.href ="http://my.netimo.net/modules/public205/index.php";
	}
	else
	{
		location.href ="http://my.baroga.net/modules/public205/index.php";
	}


}

function NetimoMemberModify(r)
{
	//r = refference
	location.href("http://my.netimo.net/regist/?name=m_03");
}


function GlobalSMS()
{
	url= "http://my.baroga.net/modules/public202/index.php";
	var set = '';
	var newWin = window.open(url,'baroga',set);
	newWin.focus();
}



/*
//http://www.baroga.net/common/javascript.js ÇÔ¼ö ¸®½ºÆ®

function MenuClick(url)
function EventMouseOverOut(obj,isOver)
function isNull(str)
function isAlphaNum(str,div)
function isExistChr(str,div)
function isLengthOk(str,min,max)
function trim(strSource)
function ltrim(strSource)
function rtrim(strSource)
function openLogin(HostURL)
function openFindID(HostURL)
function openRegMember(HostURL)
function openLogout(HostURL)
function openInfoMember(HostURL)
function openMyPage(HostURL)
function openSMS(HostURL)
function openNotice()
function CheckJumin(obj_jumin1,obj_jumin2,val_jumin1,val_jumin2)
function CheckJumin2(obj_jumin1,obj_jumin2,val_jumin1,val_jumin2)
function MoveFocus(StringLength,FromFormControl,ToFormControl)
function beforelogin(frm)
function setCookie(name,value,expiredays)
function getCookie(name)
if(!getCookie("C_visit"))
function MM_showHideLayers()
function MM_preloadImages()
function MM_swapImgRestore()
function MM_findObj(n, d)
function MM_swapImage()
function GoLink(u)
function GoBoard(table,div,section)
function GlobalMemberRegist(r)
function GlobalMemberFindID()
function GlobalLogOut()
function GlobalMyPage()
function GlobalMemberModify()
function GlobalSMS()
*/

