var historyName;
var cookieName = "page_history";
var cookieInfo;
var showPopup = false;
var arr = new Array();
var http_request;
var response_array;

function isDefined( t )
{
     return ( t != 'undefined' ) ? 1 : 0;
}

var base64list = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';

function base64encode(s)
{
  var t = '', p = -6, a = 0, i = 0, v = 0, c;

  while ( (i < s.length) || (p > -6) ) {
    if ( p < 0 ) {
      if ( i < s.length ) {
        c = s.charCodeAt(i++);
        v += 8;
      } else {
        c = 0;
      }
      a = ((a&255)<<8)|(c&255);
      p += 8;
    }
    t += base64list.charAt( ( v > 0 )? (a>>p)&63 : 64 )
    p -= 6;
    v -= 6;
  }
  return t;
}

function base64decode(s)
{
  var t = '', p = -8, a = 0, c, d;

  for( var i = 0; i < s.length; i++ ) {
    if ( ( c = base64list.indexOf(s.charAt(i)) ) < 0 )
      continue;
    a = (a<<6)|(c&63);
    if ( ( p += 6 ) >= 0 ) {
      d = (a>>p)&255;
      if ( c != 64 )
        t += String.fromCharCode(d);
      a &= 63;
      p -= 8;
    }
  }
  return t;
}

function setCookie (name, value){
  document.cookie = name + '=' + escape(value) + ";path=/;"
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function getCookie(cookieName){
        var search = cookieName + '=';
        if (document.cookie.length>0) {
                offset = document.cookie.indexOf(search);
                if (offset != -1){
                        offset += search.length;
                        end             = document.cookie.indexOf(';',offset);
                        if(end == -1)
                                end = document.cookie.length;
                        return unescape(document.cookie.substring(offset,end));
                }
        }
        return null;
}

var cookieInfo = getCookie("page_history")

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function showHistory(){
return;
        if(cookieInfo){
                document.write("<table width='100%' height=20 cellspacing=0 cellpadding=2 border=0><tr><td>");
                arr = cookieInfo .split("|")
                for(var i=0; i < arr.length; i++){
                        var temp = arr[i].split("::");
                        var title = temp[0];
                        if(title.length>11) title = title.substring(0, 10)+'...';
                        var url = temp[1];
                        if(i>0) document.write("&nbsp;>&nbsp;");
                        document.write("<a href=" + url + ">" + title + "</a>");
                }
                document.write("</td></tr></table>");
        }
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function checkHistory(arrLocal){
        for(i=0; i<arrLocal.length; i++){
                strHistory = arrLocal[i]
                strHistoryName = (strHistory.split("::"))[0]
                if(strHistoryName.indexOf(historyName) > -1 && strHistoryName.length == historyName.length)
                        return false
        }
        return true
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(!historyName)
        historyName = (document.title).replace(" パコパコママ", "")

if(cookieInfo){
        arr = cookieInfo .split("|")
        if(historyName != "" && checkHistory(arr)){
                if(arr.length >= 5)
                        arr = (arr.slice(1,5)).concat(new Array(historyName+"::"+document.URL))
                else
                        arr = arr.concat(new Array(historyName+"::"+document.URL))
                setCookie(cookieName,  (cookieInfo = arr.join("|")))
        }
} else {
        setCookie(cookieName, historyName+"::"+document.URL)
}

function showD2PToolbar() {
if( typeof d2ptoolbar_load == 'undefined' )
{
    netia = getCookie('NetiA');
    document.write('<script type="text/javascript" src="http://www.caribbeancom.com/d2ptoolbar/pacopacomama.com/util.js"></script>');
}
//document.write('<script language="javascript" src="/js/d2ptar.js"><\/script>');
/*
        netia = getCookie('NetiA');
        if(netia) {
                document.write('<center><div class="d2_toolbar"><TABLE cellSpacing=0 cellPadding=0 width=950 border=0 ><TBODY><TR><TD height=23><IFRAME src="/d2ptb" frameBorder=0 width="100%" scrolling=no height=23></IFRAME></TD></TR></TBODY></TABLE></div></center>');
        }

*/
d2ptoolbar_load = 1;
}

function footer()
{
    document.write('<script type="text/JavaScript" src="http://tar1.d2pass.com/js/paco.js"><\/script>');
}

