﻿// JavaScript File

function pageLoad(sender, e)
{
  var mine = window.open('','','width=1,height=1,left=0,top=0,status=no,scrollbars=no,menubar=no,toolbar=no,resizable=no');
  
  if (mine)
  {
    mine.close();
    //window.open ("Default_Main.aspx", "Dummy", "status=no,menubar=yes,toolbar=yes,width=1015,height=595" );
    window.open ("Default_Main.aspx", "Dummy", "width=1014,height=616" );
    
    // This is the solution to automatically close  Parent window in IE7
    window.opener = 'Whocares';
    window.open('', '_parent', '');
    window.close();
  }
  else
  {
    // Updated 9/16/2008
    // Display the instructions to allow Popup
    
    // Instantiate a Stringbuilder object
    var sb = new Sys.StringBuilder();
    
    // Formulate the StringBuilder object, sb
    writeInstructions(sb);
 
    // Get the DOM element by ID (i.e. a <span>
    var theDivElement = $get("divInstructions");
    
    // Inject the sb to the <span> element.
    theDivElement.innerHTML = sb.toString();

    // Display alert
    alert('We have detected Pop-up blocking in your browser.\nPlease follow the instructions to allow Pop-ups from this site.');
  }
}

function writeInstructions(sb)
{
  // Use StringBuilder to formulate the instruction
  sb.append("<h1>_________________________________________<br />");
  sb.append("Glendale Neighborhood GIS Website<br />");
  sb.append("_________________________________________</h1>");
  sb.append("<h2>Popup Blocker has been detected. Please allow Pop-ups from this site<br />using any one of the following methods:</h2>");
  
  sb.append("<h3>Method 1</h3>");
  sb.append("<h4>&nbsp; &nbsp; &nbsp; - &nbsp; Right-click the yellow Information Bar.<br />");
  sb.append("&nbsp; &nbsp; &nbsp; - &nbsp; Select 'Always Allow Pop-ups from This Site...'.<br />");
  sb.append("&nbsp; &nbsp; &nbsp; - &nbsp; In the 'Allow Pop-ups from This Site' dialog, click the 'Yes' button.</h4>");
  
  sb.append("<h3>Method 2</h3>");
  sb.append("<h4>&nbsp; &nbsp; &nbsp; - &nbsp; From the Menu Bar select:<br />");
  sb.append("&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'Tools' - 'Pop-up Blocker' - 'Always Allow Pop-ups from This Site...'<br />");
  sb.append("&nbsp; &nbsp; &nbsp; - &nbsp; In the 'Allow Pop-ups from This Site' dialog, click the 'Yes' button.</h4>");

  sb.append("<h3>Method 3</h3>");
  sb.append("<h4>&nbsp; &nbsp; &nbsp; - &nbsp; From the Menu Bar select:<br />");
  sb.append("&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'Tools' - 'Pop-up Blocker' - 'Pop-up Blocker Settings...'.<br />");
  sb.append("&nbsp; &nbsp; &nbsp; - &nbsp; In the 'Pop-up Blocker Settings' dialog, type the following<br />");
  sb.append("&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; into the 'Address of website to allow' textbox:</h4>");
  sb.append("<h2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;");
  sb.append("gis.glendaleaz.com</h2>");
  sb.append("<h4>&nbsp; &nbsp; &nbsp; - &nbsp; Click the 'Add' button and the 'Close' button to exit the dialog.</h4>");
}