var xWindow=true;
var is_nis=false;
var PAGE="";
var agt=navigator.userAgent.toLowerCase();
var is_mac=(agt.indexOf("mac")!=-1);
/*
The following "is_nav" test is a weak test for Netscape.
There is a more thorough Netscape-detecting script here:
http://www.webreference.com/tools/browser/javascript.html
*/
var is_nav=(agt.indexOf("nav")!=-1);

function test_xWin(){
	// Get the type of "window.open".
	// On a PC, using Internet Explorer, "window.open" is an object.
	// With IE on a Macintosh, or with any Netscape, "window.open" is a function.
	// Norton Internet Security makes "window.open" into a function, so check to see if the type has been altered.
	PWOBJ=typeof(window.open);
	// Test to see if the BODY content can be scanned (good for IE 4+ and Netscape 6+).
	if (document.body&&typeof(document.body.innerHTML)!="undefined"){
		// Set the body contents as the PAGE variable
		PAGE=document.body.innerHTML.toLowerCase();
	}
	// DETECT NORTON INTERNET SECURITY (which acts as a virtual proxy server and disables pop-up windows
	// by writing its own scripts into the page. Norton Internet Security is serial-killer as described here:
	// http://www.popup-killer-review.com/serial-popup-killers.htm
	// Test to see if Norton Internet Security has written the "SymRealWinOpen" function into the BODY of the page.
	// Test to see if the "window.open" object has been altered in IE on a PC.
	// Test to see if the "SymWinOpen" or "SymRealWinOpen" functions exist.
	if ((PAGE.indexOf("symrealwinopen")!=-1) || ((PWOBJ.indexOf("function")!=-1) && (!is_mac&&!is_nav)) || (window.SymWinOpen) || (window.SymRealWinOpen)){
		xWindow=false;
		is_nis=true;
	// DETECT OTHER POP-UP KILLERS
	}else if ((xWin==null)||(typeof(xWin)=="undefined")){
		xWindow=false;
	}else{
		xWin.close();
	}
	
	if(xWindow==0||is_nis==1){
	alert("It appears you have a Popup Blocker installed with your browser.\n\n"+
	      "Some parts of AnalyzerPlus will not work with pop-ups disabled.\n\n" +
	      "Please add this site to the list of sites from which pop-ups are allowed.\n\n"+
	      "Microsoft Service Pack 2 (SP2) added a pop-up blocker to Windows Explorer.\n\n" +
	      "If this is the blocker being used, close this window, then click on the bar that states\n\n" +
	      "'Pop-up blocked. To see this pop-up or additional options click here...'\n\n" +
	      "It should appear at the top of this web page.  From the resulting menu select \n\n" +
	      "'Always Allow Pop-ups from This Site...' and then select 'Yes'.\n\n" +
	      "If you have additional questions, please contact info@lgan.com.");	
	}
	
	
}

function CookieTest(){
  OriginalCookie = document.cookie;
  //alert(document.cookie);
  document.cookie = "CookieTest=True";
  //alert(document.cookie);
  var curCookie = document.cookie.split("; ");
  var i = 0;
  var outValue = null;
  while((i < curCookie.length) && (outValue == null)) {
    var thisCookie = curCookie[i].split("=");
    if (thisCookie[0] == "CookieTest") {
      outValue = thisCookie[1]}
    ;
    i++;
  }
  //alert(outValue);
  if (outValue != "True") {alert("It appears you have cookies disabled in your browser.\n\n"+
	      "AnalyzerPlus will not work without cookies enabled.\n\n" +
	      "Please enable cookies, or add add this site to the list of sites\n"+
	      "from which first-party cookies are allowed.\n\n" +
	      "This can be done from the tools/internet options menu under the\n" +
	      "privacy tab.  The default setting of 'Medium High' or lower will \n" +
	      "allow this tool to function. \n\n" +
	      "You may wish to contact you system administrator.\n\n" +
	      "If you have additional questions, please contact info@lgan.com.");}	
  document.cookie = "CookieTest=";
  //alert(document.cookie);
}

function PopTest(){
	window.focus();
	// A small window will be tested off the screen in IE (or bottom right side for Netscape).
	// This eliminates manual window closing by the user using IE.
	// This also makes the pop-up window "more invisible" and less distracting.
	// If this is not desired, remove the phrase "top=5000,left=5000," from the next line.
	xWin=window.open("popup.html","xWin","top=5000,left=5000,width=100,height=100");
	setTimeout("test_xWin()",700);
	CookieTest();
}