var txt_Sf_Alert   = "Ihr Bookmark/Favoriten/PHP-Sitzung ist abgelaufen. Die Hentai 3D Seite wird nun neu geladen.";

var txt_CTS_Alert1 = "Du mußt die Nutzungsbedingungen akzeptieren, um fortfahren zu können.";
var txt_CTS_Alert2 = "Klicke 'OK', um zu bestätigen, dass du die Nutzungsbedingungen für diese "+
                     "Seite gelesen und akzepiert hast.";

var txt_NL3D_Alert = "Sie haben keine Hentai3D Software installiert!";

var txt_CB_Alert = "Die Hentai3D Software funktioniert nur mit dem Microsoft Internet Explorer "+
                   "4.0 oder höher mit aktiviertem ActiveX!\nBitte versuchen Sie es erneute mit "+
                   "einem kompatiblen 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 || !homeLNK.length) var homeLNK = "http://www.hentai3d.at";
if (!hpdLNK  || !hpdLNK.length ) var hpdLNK  = "http://www.hentaipark.de";


function submitForm(idx) //v2.0
{
  var sf = "submit_form";
  var rf = "reset_form";
  var as = "after_submit";

  if (idx) {
    sf += "_" + idx;
    rf += "_" + idx;
    as += "_" + idx;
  }

  if (document.getElementById(sf)) {
	  document.getElementById(sf).style.display = "none";
	}
	if (document.getElementById(rf)) {
	  document.getElementById(rf).style.display = "none";
	}

	if (document.getElementById(as)) {
	  document.getElementById(as).style.display = "inline";
	}

  return true;
} // ----------------------------------------------------------------------------------- submitForm


function openAfendisCancel(query) //v1.0
{
  var p = "dependent=0,directories=0,height=400,hotkeys=0,left=0,location=0,menubar=0,top=0,"+
          "personalbar=0,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0,width=800";
  var u = "http://www.thrixxx.at/customer-support/afendis/cancellation.php?"+query;
  var w = window.open(u, "AFENDISCANCEL", p);
} // ---------------------------------------------------------------------------- openAfendisCancel


function checkTOSForm() //v1.0
{
  if (document.forms["accepttos"]) {
    if (document.forms["accepttos"].elements["tos"].checked) {
      return true;
    }
  }

  if (confirm(txt_CTS_Alert2)) {
    return true;
  }

  return false;
}


function SessionFailed() //v1.0
{
  var nu = "http://www.hentai3d.at/";

  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;

  var tos = 0;
  if (document && document.forms && document.forms["accepttos"]) {
    tos = document.forms["accepttos"];
  }

  if (tos) {
    if (!tos.elements["tos"] || !tos.elements["tos"].checked) {
      if (!confirm(txt_CTS_Alert2)) {
        frm = 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=410,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 || !f.elements["email"].value.length) {
          alert("Email fehlt.");
          return false;
        }
      }
      if (f.elements["trefnum"]) {
        if (!f.elements["trefnum"].value || !f.elements["trefnum"].value.length) {
          alert("Transaktionsnummer fehlt.");
          return false;
        }
      }
    }

    if (!f.elements["pwd1"].value || !f.elements["pwd1"].value.length) {
      alert("Passwort fehlt.");
      return false;
    }
    if (!f.elements["pwd2"].value || !f.elements["pwd2"].value.length) {
      alert("Kontrolleingabe fehlt.");
      return false;
    }
    if (f.elements["pwd1"].value != f.elements["pwd2"].value) {
      alert("Passwort und Kontrolleingabe stimmen nicht überein.");
      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(PS, test) //v1.0
{
  OpenTOS(PS, test);
}

function OpenTOS(PS, test) //v2.0
{
  var p = "dependent=0,directories=0,height=450,hotkeys=0,left=0,location=0,menubar=0," +
          "personalbar=0,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0,top=0,width=450";
  var u = homeLNK+"/termsofservice.php?PS="+PS;
  TOS_WINDOW = window.open(u, "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(linkAdd, testing, altLink) //v1.0
{
  var nu = homeLNK;

  nu+= "/index.php?ofs=126&resize=1";
  if (altLink) nu+= "&altL="+ altLink;
  if (linkAdd && linkAdd.length) nu+= "&"+linkAdd;

  parent.location.href = nu; // anmelden
} // ------------------------------------------------------------------------ END OPENINSTANTACCESS


function openInstantAccessHPD(linkAdd, testing, altLink) //v1.0
{
  var nu = hpdLNK;

  nu+= "/index.php?ofs=126&resize=1";
  if (altLink) nu+= "&altL="+ altLink;
  if (linkAdd && linkAdd.length) nu+= "&"+linkAdd;

  parent.location.href = nu; // anmelden
} // --------------------------------------------------------------------- END OPENINSTANTACCESSHPD


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 = 1; f = 0; break;
  case "freecode":    a = 1; f = 1; break;
  case "entercode":   a = 1; f = 0; break;
  case "consumecode": a = 1; f = 0; break;
  case "phonecode":   a = 1; f = 0; break;
  default:            a = 1; 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) //v2.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) //v3.0
{
  switch (pass) {
  case 0:
    window.setTimeout("GetLuderParams('" + post + "', 1)", 1000);
    break;

  case 1:
    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

