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
  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 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 window_open(w, h, url, resize, scroll, name)
{ 
  if(!name) { name = 'popup'; }
  window.open(url, name,'height='+h+',width='+w+',left=0,top=0,toolbar=no,directories=no,copyhistory=no,status=no,menubar=no,location=no,scrollbars='+scroll+',resizable='+resize);
}

var reg = /s+/g; 
function trim(str) { 
  a_str = str.split('');
  return_str = "";
  for(i=0; i<a_str.length; i++)
  {
    if(i==a_str.length-1) {
      if(a_str[i] == " ") {
        return_str = return_str;
      } else {
        return_str = return_str+a_str[i];
      }
    } else {
      return_str = return_str+a_str[i];
    }
  }
  return return_str;
} 

function number_format(num) {
   var num_str = num.toString()
   var result = ''

   for(var i=0; i<num_str.length; i++) {
      var tmp = num_str.length-(i+1)
      if(i%3==0 && i!=0) result = ',' + result
      result = num_str.charAt(tmp) + result
   }
   return result;
}

function frameSize(frameid)
{
	if(!frameid) {
		frameid = "view_frame";
	}
	var currentfr=document.getElementById(frameid)
	if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) { //ns6 syntax
		currentfr.height = currentfr.contentDocument.body.offsetHeight; 
	} else if (currentfr.Document && currentfr.Document.body.scrollHeight) {//ie5+ syntax
		currentfr.height = currentfr.Document.body.scrollHeight;
	}
}

function check_height()
{
	frameid = "view_frame";
	var currentfr=document.getElementById(frameid)
	currentfr.height = currentfr.Document.body.scrollHeight;
	alert(currentfr.height);
}


function add_bookmark(title, url) {
	if(window.sidebar) { // firefox
		window.sidebar.addPanel(title, url, "");
	} else if(window.opera && window.print) { // opera
		var elem = document.createElement('a');
		elem.setAttiribute('href',url);
		elem.setAttiribute('title',title);
		elem.setAttiribute('rel','sidebar');
		elem.click();
	} else if(document.all) { // ie
		window.external.AddFavorite(url, title);
	}
}

function byteCheck(str)
{
  var code_byte = 0;
  for ( var i = 0; i < str.length; i++ )
  {
    var oneChar = escape(str.charAt(i));
    if ( oneChar.length == 1 )
    {
      code_byte++;
    } else if ( oneChar.indexOf("%u") != -1 )
    {
      code_byte += 2;
    } else if ( oneChar.indexOf('%') != -1 )
    {
      code_byte += oneChar.length/3;
    }
  }
  return code_byte;
}

var httpRequest = null;
function getXMLHttpRequest(){
	if(window.ActiveXObject){
		try{
			return new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				return new ActiveXObject("Microsoft.XMLHTTP");
			}catch(e1){
				return(null);
			}
		}
	} else if(window.XMLHttpRequest) {
	   return new XMLHttpRequest();
	} else {
	   return null;
	}
}

function inputCheckSpecial(str){
  re = /[^A-Z0-9a-z°¡-ÆR]/gi;
  if(re.test(str)){	
	  return true;
  } else {
	  return false;
  }
}
// ~!@#$%^&*(_

function inputCheckSpecial2(str){
  re = /[^A-Z0-9a-z.]/gi;
  if(re.test(str)){
	
	  return true;
  } else {
	  return false;
  }
}

function URLEncode(clearString){
  var output = '';
  var x = 0;
  clearString = clearString.toString();
  var regex = /(^[a-zA-Z0-9_.]*)/;
  while (x < clearString.length) {
    var match = regex.exec(clearString.substr(x));
    if (match != null && match.length > 1 && match[1] != '') {
    output += match[1];
      x += match[1].length;
    } else {
      if (clearString[x] == ' ')
        output += '+';
      else {
        var charCode = clearString.charCodeAt(x);
        var hexVal = charCode.toString(16);
        output += '%' + hexVal.toUpperCase();
      }
      x++;
    }
  }
  return output;
}

function check_all(frm, name)
{
  var set_name = document.getElementsByName(name);
  var frm_name = document.getElementsByName(frm);
  for(i=0; i<set_name.length; i++)
  {
    if(frm_name[0].checked == true)
    {
      set_name[i].checked = true;
    } else {
      set_name[i].checked = false;
    }
  }  
}

function quick_move(link)
{
	if(link == "filebox") {
		window_open(0, 0, '/07_mypage/?_mode=mybox','N','Yes');
	} else if(link) { 
        location.href=link;
    }
}

var leftValue = 0; // ÆË¾÷Ã¢ ¶ß´Â À§Ä¡ ¼³Á¤
var topValue = 0;
var w = 0;
var h = 0;

var leftValue2 = 0; // ÆË¾÷Ã¢ ¶ß´Â À§Ä¡ ¼³Á¤
var topValue2 = 0;
var w2 = 396;
var h2 = 544;

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 "";
}

var refreshinterval=10000; // ÃÊ
var hideinterval=4;
var starttime
var nowtime
var reloadseconds=0
var secondssinceloaded=0

function show_grb_mark()
{
    document.all.grb_mark.style.display = '';
    starttime=new Date();
    starttime=starttime.getTime();
    countdown();
}

function countdown() {
  nowtime= new Date()
  nowtime=nowtime.getTime()
  secondssinceloaded=(nowtime-starttime)/1000
  reloadseconds=Math.round(refreshinterval-secondssinceloaded)
  if (hideinterval>=secondssinceloaded) {
    document.all.grb_mark.style.display = '';
    var timer=setTimeout("countdown()",10000);
  } else {
    document.all.grb_mark.style.display = 'none';
    if(reloadseconds*1 <= 0) {
      show_grb_mark()
    }
    var timer=setTimeout("countdown()",10000);
  }
}
function setCookie( name, value, expiredays )
{
  var todayDate = new Date();
  todayDate.setDate( todayDate.getDate() + expiredays );
  document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
function closeWin()
{
   setCookie("popup_mini1", "done" , 1); // 1=ÇÏ·íµ¿¾È °øÁöÃ¢ ¿­Áö ¾ÊÀ½
   document.all.grb_mark.style.display = 'none';
   hideinterval = 0;
}

function closeWinBanner()
{
   setCookie("popup_mini_payevent", "done" , 1); // 1=ÇÏ·íµ¿¾È °øÁöÃ¢ ¿­Áö ¾ÊÀ½
   document.all.grb_mark.style.display = 'none';
   hideinterval = 0;
}