function Is() {
  var agent = navigator.userAgent.toLowerCase();
  this.major = parseInt(navigator.appVersion);
  this.minor = parseFloat(navigator.appVersion);
  this.ie = (agent.indexOf("msie") != -1);
  this.ns = ((agent.indexOf('mozilla')!=-1) &&
((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible')
== -1)));
  this.ie4 = (this.ie && (this.major >= 4));
}

var is = new Is();

var myWin = null    // use this when referring to pop-up window
var winCount = 0
var xOffset = 0;
var yOffset = 0;
var CenterWindow=0;

function GoPopWin(cURL, wd, ht, sc, re, lc) {

   var Width = wd;
   var Height = ht;
   var wLeft = 20;
   var wTop = 20;
   var Scrollbars=sc; // Yes/No
   var Menubar='No'; // Yes/No
   var Toolbar='No'; // Yes/No
   var Directories='No'; // Yes/No
   var Resizable=re;
   var Status='No';
   var Location=lc;

   windowName = "popUpWindow";
   
   if (sc) {
		Scrollbars = sc;
	}
	
   if (re) {
		Resizable = re;
	}
	
   if (lc) {
		Location = lc;
	}

  
   

   if (is.ie4 || is.ns) {
       if (myWin != null) {
         if (!myWin.closed) { myWin.close(); }
       }

       if (CenterWindow) {
          PositionCenter(Width, Height);
       }
       else {
          PositionWindow(wLeft, wTop);
       }
   }


   var features =  'width='        + Width +
                   ',height='      + Height +
                   ',screenX='     + xOffset +
                   ',left='        + xOffset +
                   ',screenY='     + yOffset +
                   ',top='         + yOffset +
                   ',directories=' + Directories +
                   ',menubar='     + Menubar +
                   ',scrollbars='  + Scrollbars +
                   ',status='      + Status +
                   ',location='    + Location +
                   ',toolbar='     + Toolbar +
                   ',Resizable='  + Resizable;


   //alert(features);

   myWin = window.open(cURL, windowName, features);

}


function PositionWindow(wLft, wTp) {

    if (wLft > 0) {
       xOffset = wLft;
    }
    else {
       xOffset = 0;
    }
    if (wTp > 0) {
       yOffset = wTp;
    }
    else {
       yOffset = 0;
    }
}

function PositionCenter(wWd, wHt) {
   if (is.ie4) {
       var xMax = screen.width, yMax = screen.height;
   }
   else {
       if (is.ns) {
           var xMax = window.outerWidth, yMax = window.outerHeight;
       }
       else {
           var xMax = 640, yMax=480;
       }
   }

   xOffset = (xMax - wWd)/2;
   yOffset = (yMax - wHt)/2;

}



function Show_Stuff(input) {
	// Function that will swap the display/no display for 
	var Click_Menu = document.getElementById(input);
	
	// all content within span tags
	if (Click_Menu.style.display == "none")
	{
		Click_Menu.style.display = "";
	}
	else
	{
		Click_Menu.style.display = "none";
	}
}
