
function MM_changePreview(name) { //v3.0
  var x;
  if((x=MM_findObj('preview'))!=null) x.src="gallery_b/"+name+".jpg";
}

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]; } }
}

var txt_Sf_Alert   = "Your bookmark/favorites/PHP-session has expired. The Hentai 3D page will be reloaded now.";

var txt_CTS_Alert1 = "You have to accept the terms of service to continue.";
var txt_CTS_Alert2 = "Click 'OK' to accept the terms of service for this page.";


var txt_NL3D_Alert = "You have no Hentai3D software installed!";

var txt_CB_Alert = "The Hentai3D plugin works only with Microsoft Internet Explorer 4.01 " +
                   "or higher with ActiveX enabled!\nPlease try it again with a compatible " +
                   "browser."

var PLAY_WINDOW    = null;
var PHONE_WINDOW   = null;
var CVC_WINDOW     = null;
var TOS_WINDOW     = null;
var TROUBLE_WINDOW = null;
var HELP_WINDOW    = null;
var PROBLEM_WINDOW = null;


if (!homeLNK) var homeLNK = "http://www.hentai3d.com";
if (!hpcLNK)  var hpcLNK  = "http://www.hentaipark.com";


function openAudioPreview(homeLNK)
{
  var p = "dependent=0,directories=0,height=300,hotkeys=0,left=0,location=0,menubar=0,top=0,"+
          "personalbar=0,resizable=1,scrollbars=0,status=0,titlebar=0,toolbar=0,width=300";
  var u = homeLNK + "audio.html";
  var w = window.open(u, "AUDIOPREVIEW", p);
}

function openMoviePreview(homeLNK)
{
  var p = "dependent=0,directories=0,height=364,hotkeys=0,left=0,location=0,menubar=0,top=0,"+
          "personalbar=0,resizable=1,scrollbars=0,status=0,titlebar=0,toolbar=0,width=300";
  var u = homeLNK + "movie.html";
  var w = window.open(u, "MOVIEPREVIEW", p);
}

function ChangeMyPwdLength(index)
{
  if (document && document.forms['changepwd']) {
    var f = document.forms['changepwd'];

    f.elements['l' + index].value = f.elements['pwd' + index].value.length;
  }
}


function SessionFailed() //v1.0
{
  var nu = homeLNK+"/";

  alert(txt_Sf_Alert);

  if (parent) {
    if (parent.frames["masterFrm"]) {
      parent.frames["masterFrm"].location.href = nu;
    }
    else {
      if (parent.parent.frames["masterFrm"]) {
        parent.parent.frames["masterFrm"].location.href = nu;
      }
      else {
        parent.location.href = nu;
      }
    }
  }
} // ---------------------------------------------------------------------------- END SESSIONFAILED


function ClosePhoneWindow() //v1.0
{
  PHONE_WINDOW.opener = null;
  PHONE_WINDOW = null;
} // ------------------------------------------------------------------------- END CLOSEPHONEWINDOW


function ClosePlayWindow() //v1.0
{
  PLAY_WINDOW = null;

  if (PHONE_WINDOW) {
    PHONE_WINDOW.opener = null;
    PHONE_WINDOW.close();
  }
  PHONE_WINDOW = null;
} // -------------------------------------------------------------------------- END CLOSEPLAYWINDOW


function CheckNCCChoice(sid, lrl, oll) //v5.0
{
  var frm = 0;
  if (document && document.forms && document.forms["nccchoice"]) {
    frm = document.forms["nccchoice"];
  }
  else {
    return false;
  }
  var ok  = true;
  var par = 0;

  if (frm) {
    if (frm.elements["country"].value == "0") {
      ok = false;
    }

    // selection ok
    if (ok) {

      // set country in plugin (only reload marked)
      if (oll && lrl) {

        if (window.opener) {
          par = window.opener;

          var doc = 0;
          if (par.frames["lmainFrm"]) {
            doc = par.frames["lmainFrm"];
          }
          else if (par.parent.frames["lmainFrm"]) {
            doc = par.parent.frames["lmainFrm"];
          }

          if (doc && doc.Luder3D && doc.Luder3D.PageParameters) {
            var pps = doc.Luder3D.PageParameters.toString();
            var pos = pps.lastIndexOf("ctr=");
            if (pos != -1) {
              pps = pps.substr(0, pos - 1);
            }
            pps += "&ctr=" + frm.elements["country"].value;
            doc.Luder3D.SetPageParams(pps);
          }
        }
      }

      // submit form
      frm.submit();
    }
  }
} // --------------------------------------------------------------------------- END CHECKNCCCHOICE


function OpenPhoneNumbers(PS, delay) //v3.0
{
  if (delay) {
    window.setTimeout("OpenPhoneNumbers('" + PS + "', 0)", 1000);
  }
  else {
    var p = "top=0,left=0,width=500,height=400,toolbar=0,status=0,menubar=0,titlebar=0,hotkeys=0," +
            "dependent=0,directories=0,location=0,personalbar=0,resizable=1,scrollbars=1";
    PHONE_WINDOW = window.open("nocreditcard.php?PS=" + PS + "&oll=1", "PhoneNumbers", p);
    if (PHONE_WINDOW) {
      PHONE_WINDOW.focus();
    }
  }
} // ------------------------------------------------------------------------- END OPENPHONENUMBERS


function checkNewPassword(ll) //v1.0
{
  if (document.forms["changepwd"]) {
    var f = document.forms["changepwd"];

    if (ll) {
      if (f.elements["email"]) {
        if (f.elements["email"].value.length < 7) {
          alert("Email is missing.");
          return false;
        }
      }
      if (f.elements["subid"]) {
        if (f.elements["subid"].value.length < 7) {
          alert("Invalid Subscription Number.");
          return false;
        }
      }
    }

    if (!f.elements["pwd1"].value.length) {
      alert("Password is missing.");
      return false;
    }
    if (!f.elements["pwd2"].value.length) {
      alert("Re-type password is missing.");
      return false;
    }
    if (f.elements["pwd1"].value != f.elements["pwd2"].value) {
      alert("Password and re-type password doesn't match.");
      return false;
    }
  }
  else {
    return false;
  }

  return true;
} // ------------------------------------------------------------------------- END CHECKNEWPASSWORD


function checkTOS(newloc, prt) //v1.0
{
  var checked = true;
  if (document.forms["accepttos"]) {
    if (document.forms["accepttos"].elements["tos"].checked) {
      if (prt) {
        parent.document.location.href = newloc;
      }
      else {
        document.location.href = newloc;
      }
    }
    else {
      checked = false;
    }
  }
  else {
    checked = false;
  }

  if (!checked) {
    if (confirm(txt_CTS_Alert2)) {
      if (prt) {
        parent.document.location.href = newloc;
      }
      else {
        document.location.href = newloc;
      }
    }
  }
} // ------------------------------------------------------------------------------------- CHECKTOS


function openCVC(PS) //v1.0
{
  var p = "dependent=no,directories=no,height=250,hotkeys=no,left=0,location=no,menubar=no," +
          "personalbar=no,resizable=yes,scrollbars=yes,status=no,titlebar=no,toolbar=no,top=0," +
          "width=450";
  CVC_WINDOW = window.open("cvc.php?PS=" + PS, "CVC", p);
} // ---------------------------------------------------------------------------------- END OPENCVC


function AlertTOS() //v1.0
{
  alert(txt_CTS_Alert1);
} // --------------------------------------------------------------------------------- END ALERTTOS


function OpenTOS() //v1.0
{
  var p = "dependent=0,directories=0,height=450,hotkeys=0,left=0,location=0,menubar=0,toolbar=0,"+
          "resizable=1,scrollbars=1,status=0,titlebar=0,top=0,width=450,personalbar=0";
  TOS_WINDOW = window.open(homeLNK+"/termsofservice.php", "TERMSOFSERVICE", p);
} // ---------------------------------------------------------------------------------- END OPENTOS


function RegetSID(t, p) //v2.0
{
  p += 1;

  if (parent.frames["lmainFrm"]) {
    var d = parent.frames["lmainFrm"].document;

    if (d.forms["SndFix"] && d.forms["SndFix"].elements["SidFX"]) {
      location.href = "ludertop_" + t + ".php?PS=" + d.forms["SndFix"].elements["SidFX"].value +
                      "&pass=" + p;
    }
  }
} // --------------------------------------------------------------------------------- END REGETSID


function NoLuder3D() //v2.0
{
  alert(txt_NL3D_Alert);
} // -------------------------------------------------------------------------------- END NOLUDER3D


function updateUserTime(PS, wmid, root) //v2.0
{
  if (parent) {
    var nu = root + "updateusertime.php?PS=" + PS;

    if (parent.frames["dummyFrm"]) {
      parent.frames["dummyFrm"].location.href = nu;
    }
    else if (parent.parent.frames["dummyFrm"]) {
      parent.parent.frames["dummyFrm"].location.href = nu;
    }
    else if (parent.frames["memDummyFrm"]) {
      parent.frames["memDummyFrm"].location.href = nu;
    }
    else if (parent.parent.frames["memDummyFrm"]) {
      parent.parent.frames["memDummyFrm"].location.href = nu;
    }
  }
} // --------------------------------------------------------------------------- END UPDATEUSERTIME


function SmallerNewURL(newurl, noparent) //v1.0
{
  var w = screen.availWidth;
  var h = screen.availHeight;

  if (w <= 800) w = 750; else w = 800;
  if (h <= 600) h = 530; else h = 600;

  self.resizeTo(w, h);
  parent.resizeTo(w, h);

  if (noparent) {
    document.location.href = newurl;
  }
  else {
    parent.location.href = newurl;
  }
} // -------------------------------------------------------------------------------- SmallerNewURL


function ResizeMe() //v1.0
{
  var w = screen.availWidth;
  var h = screen.availHeight;

  if (w > 850 || w < 0) w = 800; else w-= 50;
  if (h > 800 || h < 0) h = 750; else h-= 50;

  self.resizeTo(w, h);
  parent.resizeTo(w, h);
} // ------------------------------------------------------------------------------------- ResizeMe


function openInstantAccess(addLink, testing, altLink) //v2.0
{
  var nu = homeLNK;

  nu+= "/index.php?ofs=126&resize=1";
  if (altLink) nu+= "&altL="+ altLink;
  if (addLink && addLink.length) nu+= "&"+addLink;

  parent.location.href = nu; // anmelden
} // ------------------------------------------------------------------------ END OPENINSTANTACCESS


function openInstantAccessHPC(addLink, testing, altLink) //v2.0
{
  var nu = hpcLNK;

  nu+= "/index.php?ofs=126&resize=1";
  if (altLink) nu+= "&altL="+ altLink;
  if (addLink && addLink.length) nu+= "&"+addLink;

  parent.location.href = nu; // anmelden
} // --------------------------------------------------------------------- END OPENINSTANTACCESSHPC


function ChangeMaster(url) //v1.0
{
  if (parent) {
    if (parent.frames["memMasterFrm"]) {
      parent.location.href = url;
    }
    else if (parent.parent.frames["memMasterFrm"]) {
      parent.parent.location.href = url;
    }
    else if (parent.frames["masterFrm"]) {
      parent.location.href = url;
    }
    else if (parent.parent.frames["masterFrm"]) {
      parent.parent.location.href = url;
    }
  }
} // ----------------------------------------------------------------------------- END CHANGEMASTER


function ReloadLuder(i, t) //v2.0
{
  var a, f;

  switch (t) {
  case "dialcode":    a = 2; f = 0; break;
  case "freecode":    a = 2; f = 1; break;
  case "entercode":   a = 2; f = 0; break;
  case "consumecode": a = 2; f = 0; break;
  case "phonecode":   a = 2; f = 0; break;
  default:            a = 2; f = 0; break;
  }

  if (parent.frames["lmainFrm"]) {
    if (parent.frames["lmainFrm"].document) {
      var d = parent.frames["lmainFrm"].document;

      if (d.Luder3D) {
        d.Luder3D.ID = i;

        d.Luder3D.SetFSK16(f, a, t);
      }
    }
  }
} // ------------------------------------------------------------------------------ END RELOADLUDER


function CheckDialerForm(n, p) //v2.0
{
  if (document.forms[n]) {
    var frm = document.forms[n];

    if (frm) {
      var ok = true;

      if (frm.elements[p].value == 0) {
        ok = false;
      }

      if (ok) {
        frm.submit();
      }
    }
  }
} // -------------------------------------------------------------------------- END CHECKDIALERFORM


function CheckKitChoice(cl) //v2.0
{
  var ok = true;
  var frm = document.forms["kitchoice"];

  if (frm.elements["lg"].value == "00") {
    ok = false;
  }
  if (frm.elements["country"].value == 0) {
    ok = false;
  }

  if (ok) {
    frm.submit();
  }

  if (cl) {
    window.close();
  }
} // --------------------------------------------------------------------------- END CHECKKITCHOICE


function OpenProblem(PS) // v1.0
{
  var p = "dependent=yes,directories=no,height=570,left=" + (screen.width / 3) + ",location=no," +
          "menubar=no,personalbar=no,resizable=yes,scrollbars=yes,status=no,titlebar=no," +
          "toolbar=no,top=0,width=700";
  PROBLEM_WINDOW = window.open("frameset.php?PS=" + PS + "&trg=hi&strg=trb&plw=1&mbm=1", "ProblemForm", p);

  if (PROBLEM_WINDOW) {
    PROBLEM_WINDOW.focus();
  }
} // ------------------------------------------------------------------------------ END OPENPROBLEM


function OpenTroubleHelp(PS, t, w, h) //v3.0
{
  var p = "dependent=yes,directories=no,height=" + h + ",left=" + (screen.width / 3) +
          ",location=no,menubar=no,personalbar=no,resizable=yes,scrollbars=yes,status=no," +
          "titlebar=no,toolbar=no,top=0,width=" + w;
  TROUBLE_WINDOW = window.open("troublehelp_" + t + ".php?PS=" + PS, "HentaiTroubleHelp", p);

  if (TROUBLE_WINDOW) {
    TROUBLE_WINDOW.focus();
  }
} // -------------------------------------------------------------------------- END OPENTROUBLEHELP


function openLuderHilfe(PS, tp) //v1.0
{
  OpenLuderHelp(PS, tp);
} // --------------------------------------------------------------------------- END OPENLUDERHILFE


function OpenLuderHelp(PS, tp) //v3.0
{
  var p = "dependent=yes,directories=no,width=700,height=570,locationbar=no,menubar=no," +
          "personalbar=no,resizable=yes,screenX=" + (screen.availWidth - 710) + ",screenY=" +
          (screen.availHeight - 600) + ",scrollbars=yes,status=no,titlebar=no,toolbar=no";
  LUDER_WINDOW = window.open("frameset.php?PS=" + PS + "&trg=hi&strg=hlp&mbm=1&tp=" + tp, "Hentai3DHelp", p);

  if (LUDER_WINDOW) {
    LUDER_WINDOW.focus();
  }
} // ---------------------------------------------------------------------------- END OPENLUDERHELP


function SetPinString(pc) //v3.0
{
  if (parent.frames["lmainFrm"]) {
    var d = parent.frames["lmainFrm"].document;

    if (d.Luder3D && pc && pc.length) {
      if (pc.indexOf("FRE") != -1) {
        d.Luder3D.FSK16 = 1;
      }

      d.Luder3D.ChangePinString(pc);
    }
  }
} // ----------------------------------------------------------------------------- END SETPINSTRING


function SetPinUserID() //v2.0
{
  if (parent.frames["lmainFrm"]) {
    var dm = parent.frames["lmainFrm"].document;
    var dt = parent.frames["ltopFrm"].document;

    if (dm.Luder3D) {
      var pc = parseInt(dt.code.pincode.value);

      if (isNaN(pc)) {
        pc = 0;
      }

      if (pc != 69696969 && pc != 59595959) {
        dm.Luder3D.PinCode = pc;
      }
      else {
        dm.Luder3D.PinCode = -1;
      }
    }
    else {
      NoLuder3D();
    }
  }
} // ----------------------------------------------------------------------------- END SETPINUSERID


function SetFreeCode() //v2.0
{
  if (parent.frames["lmainFrm"]) {
    var d = parent.frames["lmainFrm"].document;

    if (d.Luder3D) {
      d.Luder3D.PinCode = 69696969;
    }
    else {
      NoLuder3D();
    }
  }
} // ------------------------------------------------------------------------------ END SETFREECODE


function ChangePinCode(pc) //v2.0
{
  if (parent.frames["lmainFrm"]) {
    var d = parent.frames["lmainFrm"].document;

    if (d.Luder3D) {
      d.Luder3D.PinString = pc;
    }
    else {
      NoLuder3D();
    }
  }
} // ------------------------------------------------------------------------------ END SETFREECODE


function OpenLuder(PS, t, nopu, mbm, fullscrn) //v4.0
{
  if (nopu) {
    var nu = "luderframes.php?PS=" + PS + "&tp=" + t;

    if (parent.frames["masterFrm"]) {
      parent.frames["masterFrm"].location.href = nu;
    }
    else if (parent.frames["memMainFrm"]) {
      parent.frames["memMainFrm"].location.href = nu;
    }
    else if (parent.parent.frames["masterFrm"]) {
      parent.parent.frames["masterFrm"].location.href = nu;
    }
    else if (parent.parent.frames["memMainFrm"]) {
      parent.parent.frames["memMainFrm"].location.href = nu;
    }
    else if (top.frames["masterFrm"]) {
      top.frames["masterFrm"].location.href = nu;
    }
    else if (top.frames["memMainFrm"]) {
      top.frames["memMainFrm"].location.href = nu;
    }
  }
  else {
    var f;

    switch (t) {
    case "codeaufladen2":
      document.location.href = "codeaufladen.php?PS=" + PS;
      break;

    case "codeaufladen":
    case "codetelefon":
    case "codeeingeben":
    case "freecode":
    case "consumecode":
    case "entercode":
    case "pingcode":
    case "dialcode":
    case "phonecode":
    default:
      var w  = 800;
      var h  = 600;
      var aw = 800;
      var ah = 600;
      if (screen) {
        w  = screen.availWidth;
        h  = screen.availHeight;
        aw = screen.availWidth;
        ah = screen.availHeight;

        if (isNaN(w))  w  = 750;
        if (isNaN(h))  h  = 530;
        if (isNaN(aw)) aw = 750;
        if (isNaN(ah)) ah = 530;
      }

      if (!fullscrn) {
        if (w <= 800) {
          w = 750;
        }
        else {
          w = 800;
        }
        if (h <= 600) {
          h = 530;
        }
        else {
          h = 600;
        }

        aw = aw / 2 - w / 2;
        ah = ah / 2 - h / 2;
      }
      else {
        if (screen) {
          w  = screen.availWidth  - 10;
          h  = screen.availHeight - 10;
          aw = screen.availLeft;
          ah = screen.availTop;
        }
        else {
          w  = 790;
          w  = 590;
          aw = 0;
          ah = 0;
        }
      }

      var nu  = "PS=" + PS + "&tp=" + t;
      var p   = "dependent=yes,directories=no,width=" + w + ",height=" + h + ",locationbar=no," +
                "menubar=no,personalbar=no,resizable=yes,screenX=" + aw + ",screenY=" + ah + "," +
                "status=no,titlebar=no,toolbar=no,left=" + aw + ",top=" + ah;
      PLAY_WINDOW = window.open("luderframes.php?PS=" + PS + "&tp=" + t, "Hentai3DPlay", p);

      nu += "&oll=1";

      if (mbm) {
        parent.document.location.href = "frameset.php?" + nu + "&trg=hi&oll=1";
      }
      else {
        document.location.href = "frameset.php?" + nu + "&trg=hi&oll=1";
      }

      if (PLAY_WINDOW) {
        PLAY_WINDOW.focus();
      }
      break;

    }
  }
} // -------------------------------------------------------------------------------- END OPENLUDER


function CheckBrowser(PS, t) //v2.0
{
  if (navigator.appName.indexOf("Internet Explorer") != -1) {
    var u = "checkplugin1.php?PS=" + PS;

    if (t) {
      u += "&tp=" + t;
    }
    location.href = u;
  }
  else {
    alert(txt_CB_Alert);
  }
} // ----------------------------------------------------------------------------- END CHECKBROWSER


function CheckLuderVersion(PS, cpurl, t, p) //v2.0
{
  switch (p) {
  case 0:
    window.setTimeout("CheckLuderVersion('" + PS + "','" + cpurl + "','" + t + "',1)", 1000);
    break;

  case 1:
    var x;

    cpurl += "?PS=" + PS;
    if (t && t.length) {
      cpurl += "&tp=" + t;
    }

    if (document.Luder3D) {
      x = document.Luder3D;
    }
    else {
      x = MM_findObj('Luder3D', document);
    }
    if (x) {
      if (x.Version) {
        var v1 = x.Version;
        var v2 = x.Version.toString();

        if (v1.length) {
          cpurl += "&plgV=" + v1;
        }
        else if (v2.length) {
          cpurl += "&plgV=" + v2;
        }
      }
    }

    document.location.href = cpurl;
    break;

  }
} // ------------------------------------------------------------------------ END CHECKLUDERVERSION


function GetLuderParams(post, pass, crack) //v3.0
{
  timeout = 1000;
  if (crack) timeout = 250;

  switch (pass) {
  case 0:
    window.setTimeout("GetLuderParams('" + post + "', 1, " + crack + ")", timeout);
    break;

  case 1:
    if (crack) {
      var u = homeLNK + "/Offline/start2.html?chs=" + crack + post;
    }
    else {
      var u = "index2.php?" + post;
    }
    var f = document.forms["PPRMSFix"];

    if (document.Luder3D) {
      if (typeof(document.Luder3D.LoadInfoImages) != "undefined") {
        if (document.Luder3D.UID && document.Luder3D.UID.length) {
          u += "&usrid=" + document.Luder3D.UID.toString();
          f.elements["usrid"].value = document.Luder3D.UID.toString();
        }
        if (document.Luder3D.Page && document.Luder3D.Page.length) {
          u += "&page=" + document.Luder3D.Page.toString();
          f.elements["page"].value = document.Luder3D.Page.toString();
        }
        if (document.Luder3D.PageParameters && document.Luder3D.PageParameters.length) {
          u += "&pprms=" + document.Luder3D.PageParameters.toString();
          f.elements["pprms"].value = document.Luder3D.PageParameters.toString();
        }
        if (document.Luder3D.Version && document.Luder3D.Version.length) {
          u += "&plgV=" + document.Luder3D.Version.toString();
          f.elements["plgV"].value = document.Luder3D.Version.toString();
        }
      }
    }

    location.href = u;
    break;

  }
} // --------------------------------------------------------------------------- END GETLUDERPARAMS


function BackToMain(PS, wmid, ofs) //v2.0
{
  var u = "index2.php?PS=" + PS + "&uid=" + wmid + "&ofs=" + ofs;

  if (parent.frames["masterFrm"]) {
    parent.frames["masterFrm"].location.href = u;
  }
  else {
    if (parent.parent.frames["masterFrm"]) {
      parent.parent.frames["masterFrm"].location.href = u;
    }
  }
} // ------------------------------------------------------------------------------- END BACKTOMAIN