var ieMinVersion=5;

var netscapeMinVersion=5;



function needBrowserVersionUpdate (hostUrl) {

    var updateUrl = hostUrl+"/gc/common/browserVersionUpdate.html";

    var cf_is = new cf_sniffer();

    //alert(cf_is.ieVersion+", "+cf_is.navVersion);  

    if ((cf_is.ie && cf_is.ieVersion < ieMinVersion) || (cf_is.nav && cf_is.navVersion < netscapeMinVersion)) {

        popUpWindowWithSize(updateUrl, 350, 450, "BrowserVersion");

    }

}



function cf_sniffer () {

  var agt=navigator.userAgent.toLowerCase();

  this.major  = parseInt(navigator.appVersion);

  this.minor  = parseFloat(navigator.appVersion);

  this.nav    = ((agt.indexOf('mozilla')!=-1) && ((agt.indexOf('spoofer')==-1)

                  && (agt.indexOf('compatible') == -1)));

  this.ie     = (agt.indexOf("msie") != -1);

                  

  this.navVersion=0;

  this.ieVersion=0;

  

  if (this.nav && (this.major == 3)) {

    this.navVersion=3;

  }

  

  if (this.nav && (this.major == 4)) {

    this.navVersion=4;

  }

  

  if (this.nav && (this.major > 4)) {

    this.navVersion=5;

  }

  

  if (agt.indexOf('netscape6') > 1) {

    this.navVersion=6;

  }

  

  if (agt.indexOf('netscape/7') > 1) {

    this.navVersion=7;

  }

  

  if (this.ie && this.major < 4) {

    this.ieVersion = 3;

  }

  

  if (this.ie && this.major == 4 && agt.indexOf("msie 5.") == -1) {

       this.ieVersion = 4;

  }

  

  if (this.ie && this.major == 4 && agt.indexOf("msie 5.") > 1) {

       this.ieVersion = 5;

  }

  

  if (this.ie && this.major == 4 && agt.indexOf("msie 6.") > 1) {

       this.ieVersion = 6;

  }

  if (this.ie && this.major == 4 && agt.indexOf("msie 7.") > 1) {
       this.ieVersion = 7;
  }

  if (this.ie && this.major == 4 && agt.indexOf("msie 8.") > 1) {
       this.ieVersion = 8;
  }

  //for test

  //this.ieVersion=4;

  //this.navVersion=4;

 

 }

 

 function popUpWindowWithSize(URL, width, height, name) {

    var ScreenWidth=window.screen.width;

    var ScreenHeight=window.screen.height;

    var movefromedge=0;

    placementx=(ScreenWidth/2)-((250)/2);

    placementy=(ScreenHeight/2)-((250+50)/2);

    return window.open(URL,name,'width='+width+',height='+height+',toolbar=0,'+

                'location=0,directories=0,status=0,scrollbars=yes,'+

                'menubar=0,resizable=yes,left="+placementx+","'+

                'top="+placementy+",screenX="+placementx+",'+

                'screenY="+placementy+","');

 }

// print page
function openPrintPage() {
var win=window.open('','GCPrinterPage','scrollbars=1,toolbar=0,resizable=yes,width=650 height=720');
var init="<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"/gc/internet/css/styles_print.css\" /></head><BODY leftMargin=0 topMargin=0 marginheight=0 marginwidth=0 class=\"BODY\">";
init += "<table width=100% align=center><tr><td align=center class=\"bc\">";
init +="<font class=\"cellHeadingTtile\">";
init += document.getElementById('titlepage').innerHTML;
init += "</font></td><td align=right class=noprint><input type=button value=Print onClick=\"window.print()\"></td></tr><table>";
init += document.getElementById('printpage').innerHTML;
init += "<table width=100% align=center><tr><td align=center class=\"bc\"> Copyright 2009, Gwinnett County Board of Commissioners</td></tr><table>";
init += "</body></html>";
win.document.write(init);
win.document.close();
win.focus();
}