var AttBox = null;
var searchTileInAspPage = null;
$(window).load(function() {
  CheckReferrer();
});
function CheckReferrer() {
  try {
    AttBox = document.getElementById("attBox");
    searchTileInAspPage = document.getElementById("ifrmSearch");
    var Ref = null;
    Ref = document.referrer;
    Ref = Ref.toLowerCase();
    if (Ref.length > 0) {
      if (Ref.indexOf('lanzaroteholidays24.com') != -1 || Ref.indexOf('grancanariaholidays24.com') != -1) {
        if (searchTileInAspPage == null) {
          DisableParent();
        }
        else {
          var cWindow = searchTileInAspPage.contentWindow;
          cWindow.DisableParent();
        }
        PositionAttBox();
        ShowHideAttBox(true);
      }
    }
  }
  catch (e) {
    //alert(e);
  }
}

function ShowHideAttBox(ToShow) {
  try {
    if (ToShow) {
      with (AttBox) {
        style.display = "";
        style.visibility = "visible";
      }
    }
    else {
      with (AttBox) {
        style.display = "none";
        style.visibility = "hidden";
      }
    }
  }
  catch (e) {
  }
}

function PositionAttBox() {
  var anchorObject = getAnchorPosition("SiteLogo");
  with (AttBox) {
    var leftPos = anchorObject.x + 300;
    style.top = 200 + "px";
    style.left = leftPos + "px";
  }
}

//Start:5477_Disable the search result page  While loading the  search details
addEvent(window, 'load', EnablePage);
function OnLoadDisableEnablePage(flag) {
  try {
    if (document.getElementById("divFadedBg") != null) {
      document.getElementById("divFadedBg").style.height = screen.height + "px";
      document.getElementById("divFadedBg").style.width = screen.width + "px";
    }
  }
  catch (ex)
    { }
}

function EnablePage() {
  try {
    if (document.getElementById("divFancyLoadingIcon") != null) {
      document.getElementById("divFancyLoadingIcon").style.visibility = "hidden";
      document.getElementById("divFancyLoadingIcon").style.display = "none";
      document.getElementById("divFadedBg").style.visibility = "hidden";
      document.getElementById("divFadedBg").style.display = "none";
    }
  }
  catch (ex) {
    if (document.getElementById("divFancyLoadingIcon") != null) {
      document.getElementById("divFancyLoadingIcon").style.visibility = "hidden";
      document.getElementById("divFancyLoadingIcon").style.display = "none";
      document.getElementById("divFadedBg").style.visibility = "hidden";
      document.getElementById("divFadedBg").style.display = "none";
    }
  }
}
//Attach event
function addEvent(obj, evType, fn) {
  try {
    if (obj.addEventListener) {
      obj.addEventListener(evType, fn, false);
      return true;
    }
    else if (obj.attachEvent) {
      var r = obj.attachEvent("on" + evType, fn);
      return r;
    }
    else {
      return false;
    }
  }
  catch (ex) { }
}

