

var version = 0;

if (navigator.userAgent.indexOf("Opera") != -1)	version = 3;
else if  (navigator.userAgent.indexOf("MSIE") != -1)	version = 2;
else version = 1;
//alert('selainversio on: ' + version);

var h = getHeight() - browser_type_height();
var w = getWidth() - browser_type_width();


//-------------------------------------------------
// adjust these return values as you wish!
//-------------------------------------------------

//säädä tämä palauttamaan sopiva arvo kullekin selaimelle:
//laske logobkg + navbar + footer korkeudet yhteensä
//ja merkitse paluuarvoksi
//joka vähennetään middlecolumn korkeudesta jolloin sivun alalaita asettuu sopivasti
function browser_type_height()
       {
	     //values for Opera here
        if (version == 3) return 180;
        //values for IE
        if (version == 2) return 163;
        //values for Mozilla
        if (version == 1) return 177;
        //default to something
        return 142;
        }

//esim. scrollbar leveys
function browser_type_width()
       {
	     //values for Opera here
        if (version == 3) return 20;
        //values for IE
        if (version == 2) return 3;
        //values for Mozilla
        if (version == 1) return 20;
         //default to something
         return 20;
        }

//-------------------------------------------------



//this is used in login.asp
function getAvailableArea() {

	var windowheight = getHeight();
	var windowwidth = getWidth();

	//siirretään tiedot login-lomakkeeseen
   var formDOMObj = document.form2;
   formDOMObj.screenheight.value = getHeight();
   formDOMObj.screenwidth.value = getWidth();
}


// these are double now...also in get_height_and_width.js
function getHeight() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;

  } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return myHeight;
}


function getWidth() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return myWidth;
}


