function showHide(id) {
   var disp=document.getElementById(id).style.display;
   if(disp=='none') document.getElementById(id).style.display='';
   else document.getElementById(id).style.display='none';
}

function PopupWindow(url,width,height,windowName) {
	_PopupWindow(url,width,height,150,windowName);
}

function popup(url,width,height,windowName) {
	_PopupWindow(url, 510, height,150,windowName);
}

function _PopupWindow(url,width,height,top,windowName) {
	var center_x = (screen.width - width)/2;
	var center_y = (screen.height - height)/2;	
//    var num = Math.round(Math.random()*10000000);
//    var str = new String(num);
    var win = window.open(url,windowName,"toolbar=no,location=no,directories=no,"+
      "status=no,menubar=no,scrollbars=yes,resizable=no,"+
      "copyhistory=no,left="+center_x+",top="+center_y+",width="+width+",height="+height);
}

function displayBanner() {
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="478" height="220" id="ban02g" align="middle">');
	document.write('<param name="allowScriptAccess" value="never">');
//	document.write('<param name="allowScriptAccess" value="sameDomain">');
	document.write('<param name="movie" value="/flash/ban01b.swf">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="bgcolor" value="#ffffff">');
	document.write('<param name="wmode" value="transparent">');
	document.write('<embed wmode="transparent" src="/flash/ban01b.swf" quality="high" bgcolor="#ffffff" width="478" height="220" name="ban02g" align="middle" allowScriptAccess="never" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">');
	document.write('</object>');
}

function checkSearchForm(form) {
	return checkInput(form["search-clause"], "Please enter the words you are looking for");
}


function getPageSize(){
   var xScroll, yScroll;
   if (window.innerHeight && window.scrollMaxY) {
      xScroll = document.body.scrollWidth;
      yScroll = window.innerHeight + window.scrollMaxY;
   } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
      xScroll = document.body.scrollWidth;
      yScroll = document.body.scrollHeight;
   } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
      xScroll = document.body.offsetWidth;
      yScroll = document.body.offsetHeight;
   }
   var windowWidth, windowHeight;
   if (self.innerHeight) { // all except Explorer
      windowWidth = self.innerWidth;
      windowHeight = self.innerHeight;
   } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
      windowWidth = document.documentElement.clientWidth;
      windowHeight = document.documentElement.clientHeight;
   } else if (document.body) { // other Explorers
      windowWidth = document.body.clientWidth;
      windowHeight = document.body.clientHeight;
   }
   if(yScroll < windowHeight){
      pageHeight = windowHeight;
   } else {
      pageHeight = yScroll;
   }

   if(xScroll < windowWidth){
      pageWidth = windowWidth;
   } else {
      pageWidth = xScroll;
   }


   arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
   return arrayPageSize;
}


var BrowserDetect = {
   init: function () {
      this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
      this.version = this.searchVersion(navigator.userAgent)
         || this.searchVersion(navigator.appVersion)
         || "an unknown version";
      this.OS = this.searchString(this.dataOS) || "an unknown OS";
   },
   searchString: function (data) {
      for (var i=0;i<data.length;i++)  {
         var dataString = data[i].string;
         var dataProp = data[i].prop;
         this.versionSearchString = data[i].versionSearch || data[i].identity;
         if (dataString) {
            if (dataString.indexOf(data[i].subString) != -1)
               return data[i].identity;
         }
         else if (dataProp)
            return data[i].identity;
      }
   },
   searchVersion: function (dataString) {
      var index = dataString.indexOf(this.versionSearchString);
      if (index == -1) return;
      return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
   },
   dataBrowser: [
      {  string: navigator.userAgent,
         subString: "OmniWeb",
         versionSearch: "OmniWeb/",
         identity: "OmniWeb"
      },
      {
         string: navigator.vendor,
         subString: "Apple",
         identity: "Safari"
      },
      {
         prop: window.opera,
         identity: "Opera"
      },
      {
         string: navigator.vendor,
         subString: "iCab",
         identity: "iCab"
      },
      {
         string: navigator.vendor,
         subString: "KDE",
         identity: "Konqueror"
      },
      {
         string: navigator.userAgent,
         subString: "Firefox",
         identity: "Firefox"
      },
      {
         string: navigator.vendor,
         subString: "Camino",
         identity: "Camino"
      },
      {     // for newer Netscapes (6+)
         string: navigator.userAgent,
         subString: "Netscape",
         identity: "Netscape"
      },
      {
         string: navigator.userAgent,
         subString: "MSIE",
         identity: "Explorer",
         versionSearch: "MSIE"
      },
      {
         string: navigator.userAgent,
         subString: "Gecko",
         identity: "Mozilla",
         versionSearch: "rv"
      },
      {     // for older Netscapes (4-)
         string: navigator.userAgent,
         subString: "Mozilla",
         identity: "Netscape",
         versionSearch: "Mozilla"
      }
   ],
   dataOS : [
      {
         string: navigator.platform,
         subString: "Win",
         identity: "Windows"
      },
      {
         string: navigator.platform,
         subString: "Mac",
         identity: "Mac"
      },
      {
         string: navigator.platform,
         subString: "Linux",
         identity: "Linux"
      }
   ]

};
BrowserDetect.init();

