function checkPassword (){
	kayttajatunnus = document.forms['lomakearvonta']['kayttajatunnus'].value;
	salasana = document.forms['lomakearvonta']['salasana'].value;
	doWork(2, 0);
	
	
}

var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;
if (checkIt('konqueror'))
{
	browser = "Konqueror";
	OS = "Linux";
}
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) browser = "Internet Explorer"
else if (!checkIt('compatible'))
{
	browser = "Netscape Navigator"
	version = detect.charAt(8);
}
else browser = "An unknown browser";

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}


function windowOpener(url,width,height,name, sb) {
     browserName = navigator.appName;
     browserVer = navigator.appVersion.substring(0,1);
     if (width==null) {width=600;}
     if (height==null) {height=400;}
     if (name==null) {name="blanko"}
     if (sb==null) {sb="yes"}
     if (browserName != "Netscape" || browserVer != 2) { 
      controlWindow=window.open(url,name,"toolbar=no,height="+height+",width="+width+",location=no,directories=no,status=no,menubar=no,scrollbars="+sb+",resizable=yes");
     }
}

function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}

function getWindowWidth(){
	var myWidth = 0, myHeight = 0;
  	if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    	myWidth = window.innerWidth;
  	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    	//IE 6+ in 'standards compliant mode'
    	myWidth = document.documentElement.clientWidth;
  	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
   	 //IE 4 compatible
   		myWidth = document.body.clientWidth;
  	}
	return myWidth;
}

function getWindowHeight(){
	var myHeight = 0;
  	if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    	myHeight = window.innerHeight;
  	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    	//IE 6+ in 'standards compliant mode'
    	myHeight = document.documentElement.clientHeight;
  	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
   	 //IE 4 compatible
    	myHeight = document.body.clientHeight;
  	}
	return myHeight;
}

function Viewport(){ 
	this.windowX = (document.documentElement && document.documentElement.clientWidth) || window.innerWidth || self.innerWidth || document.body.clientWidth; 
	this.windowY = (document.documentElement && document.documentElement.clientHeight) || window.innerHeight || self.innerHeight || document.body.clientHeight; 
	this.scrollX = (document.documentElement && document.documentElement.scrollLeft) || window.pageXOffset || self.pageXOffset || document.body.scrollLeft; 
	this.scrollY = (document.documentElement && document.documentElement.scrollTop) || window.pageYOffset || self.pageYOffset || document.body.scrollTop; 
	this.pageX = (document.documentElement && document.documentElement.scrollWidth) ? document.documentElement.scrollWidth : (document.body.scrollWidth > document.body.offsetWidth) ? document.body.scrollWidth : document.body.offsetWidth; 
	this.pageY = (document.documentElement && document.documentElement.scrollHeight) ? document.documentElement.scrollHeight : (document.body.scrollHeight > document.body.offsetHeight) ? document.body.scrollHeight : document.body.offsetHeight;
	return [pageX,pageY];
}

function getRealLeft(el) 
{
	if (arguments.length==0) el = this;
   	xPos = el.offsetLeft;
   	tempEl = el.offsetParent;
   	while (tempEl != null) 
	{
   	    xPos += tempEl.offsetLeft;
   	    tempEl = tempEl.offsetParent;
   	} 
	return xPos;
}
function getRealTop(el) 
{

	if (arguments.length==0) el = this;
    yPos = el.offsetTop;
   	tempEl = el.offsetParent;
    while (tempEl != null) 
	{
       	yPos += tempEl.offsetTop;
       	tempEl = tempEl.offsetParent;
    }
	return yPos;
}
function findPosX(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}
//-->

	
function getBodyHeight()
{
    var x,y;
	if (self.innerHeight) // all except Explorer
	{
		x = self.innerWidth;
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
    return y;
	
}

function getScrollPoint()
{
    var scrollY;
	
    if (document.documentElement.scrollTop) scrollY = document.documentElement.scrollTop;
	if (document.body.scrollTop) scrollY = document.body.scrollTop;
	if (window.pageYOffset) scrollY = window.pageYOffset;
	return scrollY;
}

function getOff(elementId)
{
	
	x = document.getElementById(elementId).offsetWidth;
	y = document.getElementById(elementId).offsetHeight;
	return [x,y];
}

