﻿var femaleAccount = GetQueryStringItem('toid');

function ViewProfileVideo(femaleAccount) {
  /*var videoPath = 'profilevideo.aspx?femaleaccount=' + femaleAccount;*/
  var videoPath = '../profilevideo/' + femaleAccount + '.htm';
  var features = 'height=380,width=400,menubar=0,personalbar=0,resizable=1,scrollbars=0,status=0,titlebar=0,toolbar=0';
  window.open(videoPath, "profilevideo" + femaleAccount, features);
}

function VideoUnavailable() {
alert('This feature is temporarily disabled. We apologize for any inconvenience');
}

function VideoUnavailableb() {
alert('This feature is temporarily disabled. We apologize for any inconvenience.\nIf you cannot access any videos you have purchased in the last 90 days, please contact customer service.');
}


function imtrial(femaleAccount) {
  //var chatPath = '../imtrial/' + femaleAccount + '.htm';
  var chatPath = '../chattrial/' + femaleAccount + '.htm';
  features = 'height=450,width=785,menubar=0,personalbar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0';
  window.open(chatPath, "", features);
}

function bblink(femaleAccount) {
  try {
    var bbLocal = new String(top.document.location);
    bbLocal = bbLocal.toLowerCase();
    if (bbLocal.indexOf("blackbook/default.asp") == -1) {
      top.document.location.href = "../blackbook/default.asp?func=photo&toid=" + femaleAccount;
    }
  }
  catch (e) { }
}

function Email(femaleAccount) {
  try {
    document.location.href = '../email/email_noframe.asp?toid=' + femaleAccount + '&func=send';
  }
  catch (e) { }
}

var bb = new String(top.document.location);
bb = bb.toLowerCase();
if (bb.indexOf('blackbook') > -1) {
  try {
    if (parent.NavDetail != null) {
      var bbToid = parent.NavDetail.document.getElementById('ToID');
      if (bbToid != null) {
        bbToid.value = femaleAccount;
        var obj = parent.NavDetail.document.getElementById('yw');
        parent.NavDetail.OptionOn(obj);
      }
    }
  }
  catch (e) { }
}

function FindCard() {
  if (!(isNaN(femaleAccount))) {
    var searchpage = null;
    if (top.NavContent)
      searchpage = top.NavContent;
    /*else if (top.MailMain)
      searchpage = top.MailMain;*/
    if (searchpage) {
      if (searchpage.document.getElementsByTagName) {
        var divs = searchpage.document.getElementsByTagName('DIV');
        for (var i = 0; i < divs.length; i++) {
          var divID = parseInt(divs[i].id);
          if (divID == femaleAccount) {
            var profileDiv = divs[i];
            var curClassName = new String(profileDiv.className);
            if (curClassName.indexOf('Over') == -1) {
              profileDiv.className = curClassName + 'Over';
              break;
            }
          }
        }
      }
    }
  }
}

function GoToHoroscope() {
  var path = '../horoscope/?id=' + femaleAccount;
  document.location = path;
}

function OpenVideo(accountnumber) {
  var userID = GetCookieValue('ASPSessionID'); //make sure they are logged in (in getdata.js)
  var chatPath = '';
  if (userID != null) {
    if (accountnumber != 0) {
      femaleAccount = accountnumber; //update globals			
      //var chatPath = '../im/' + femaleAccount + 'v1.htm';
      chatPath = '../chat/v' + femaleAccount + '.htm';
      features = 'height=500,width=600,menubar=0,personalbar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0';
      window.open(chatPath, "", features);

      var wheresChatChecker = new String(top.location);
      wheresChatChecker = wheresChatChecker.toLowerCase();
      if (wheresChatChecker.indexOf('searches') > -1 || wheresChatChecker.indexOf('blackbook') > -1) {
        try {
          top.NavContent.inChat = true;
          top.NavContent.closeRequests();
          return
        }
        catch (e) { }
      }
      else if (wheresChatChecker.indexOf('email') > -1) {
        try {
          top.MailMain.inChat = true;
          top.MailMain.closeRequests();
        }
        catch (e) { }
      }
    }
  }
  else {//not logged in, prompt to join or log in and open trial chat window
    chatPath = '../chattrial/' + femaleAccount + '.htm';
    features = 'height=450,width=785,menubar=0,personalbar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0';
    window.open(chatPath, "", features);
  }
}

function Manip() {
  FindCard();
  var aboutSpan = document.getElementById('uxAboutMe');
  if (aboutSpan) {
    var aboutTd = document.getElementById('Aboutme');
    if (aboutTd) {
      var aboutTxt = aboutSpan.innerHTML;
      if (aboutTxt.length == 0) { aboutTxt = '&nbsp;' }
      aboutTd.innerHTML = aboutTxt;
      aboutSpan.style.display = 'none';
    }
  }
  var lookingSpan = document.getElementById('uxLookingFor');
  if (lookingSpan) {
    var lookingTd = document.getElementById('LookingFor');
    if (lookingTd) {
      var lookingTxt = lookingSpan.innerHTML;
      if (lookingTxt.length == 0) { lookingTxt = '&nbsp;' }
      lookingTd.innerHTML = lookingTxt;
      lookingSpan.style.display = 'none';
    }
  }
}

if (top == self) {
  if (femaleAccount > 0) {
    self.location.href = "../myhome/default.asp?func=profile&picAcct=" + femaleAccount;
  } else {
    self.location.href = "../myhome/default.asp";
  }
}

var closeTimer;
function JoinPrompt() {
  clearTimeout(closeTimer);
  var newDiv = document.createElement('div');
  newDiv.id = 'join';
  newDiv.innerHTML = 'You must be a member to view this video.<br/><a href="https://secure.hotrussianbrides.com/membership/join.aspx" target="_top">Click here</a> to join.';
  with (newDiv.style) {
    backgroundColor = '#ffffff';
    zIndex = 99;
    padding = 5 + 'px';
    border = '1px solid black';
    position = 'absolute';
    top = 20 + 'px';
    left = 20 + 'px';
    fontFamily = 'Verdana, Arial, Sans-serif';
    fontSize = 12 + 'px';
  }
  document.body.appendChild(newDiv);
  closeTimer = setTimeout(function() { RemoveMsg() }, 10000);
}

function RemoveMsg() {
  var divID = 'join';
  var div = document.getElementById(divID);
  if (div)
    document.body.removeChild(div);
}
