
function avaaMyymala(id, page) {
document.location.href=page + '&id=' + id;
}

function subGroups(){
var p=document.haku.country;
var ar="";
var ind=p.selectedIndex;
var id=document.haku.doc.value;
if (p.selectedIndex > 0 ) {

ar = unescape(p.options[p.selectedIndex].value);
}

var url='sp?open&cid='+id+'&ar='+ ar+'&ind='+ind;
this.document.location.replace(url);

}


function setResultCount(c)
{
	if ( document.getElementById("tulos") ) {
		var x = document.getElementById("tulos")
		if ( x ) x.innerHTML = "" + c;
	}
	else if ( document.all["tulos"] ) {
		var x = document.all["tulos"];
		if ( x ) x.innerHTML = "" + c;
	}
	else if ( document.layers && document.layers["tulos"] ) {
		var x = document.layers["tulos"];
		x.document.open();
		x.document.write(c);
		x.document.close();
	}
}


function paivitaHakulause(){  
var q = document.tendo.finalquery;
var t = document.tendo.tyyppi;
var a = document.tendo.alusta; 
var l = document.tendo.leveys;
var k = document.tendo.korkeus;
var s = document.tendo.syvyys;


q.value="";

if ( t.selectedIndex > 0 ) q.value += 'FIELD sailytintyyppi contains ' + unescape(t.options[t.selectedIndex].value);  
if (q.value!="" && a.value!="")  q.value += ' AND ';
if ( a.selectedIndex > 0 ) q.value += 'FIELD jalustatyyppi contains ' + unescape(a.options[a.selectedIndex].value);  
if (q.value!="" && l.value!="")  q.value += ' AND ';
if ( l.selectedIndex > 0 ) q.value += 'FIELD QueryLeveys contains ' + unescape(l.options[l.selectedIndex].value);  
if (q.value!="" && k.value!="")  q.value += ' AND ';
if ( k.selectedIndex > 0 ) q.value += 'FIELD QueryKorkeus contains ' + unescape(k.options[k.selectedIndex].value);  
if (q.value!="" && s.value!="")  q.value += ' AND ';
if ( s.selectedIndex > 0 ) q.value += 'FIELD QuerySyvyys contains ' + unescape(s.options[s.selectedIndex].value);  
if (q.value!="") q.value += ' AND FIELD Form contains variaatio AND FIELD tuotenimi_fin contains Tendo';

if (q.value==""){
alert('Vähintään yksi hakukriteeri on annettava!');
}
else{

document.tendo.submit();
}
}





function mailTo(name,domain,country){
document.location.href='mailto:'+name+'@'+domain+'.'+country;


}






function tark()
{
if (document.forms[0].Nimi.value=='')
	{alert('Nimi on pakollinen tieto!');
	document.forms[0].Nimi.focus();
	return false;
	}
if (document.forms[0].Postiosoite.value=='')
	{alert('Postiosoite on pakollinen tieto !');
	document.forms[0].Postiosoite.focus();
	return false;
	}
	if (document.forms[0].Postinumero.value=='')
	{alert('Postinumero on pakollinen tieto !');
	document.forms[0].Postinumero.focus();
	return false;
	}
	if (document.forms[0].Postitoimipaikka.value=='')
	{alert('Postitoimipaikka on pakollinen tieto !');
	document.forms[0].Postitoimipaikka.focus();
	return false;
	}
	if (document.forms[0].Haettava_tehtava.value=='')
	{alert('Haettava tehtävä on pakollinen tieto !');
	document.forms[0].Haettava_tehtava.focus();
	return false;
	}
return true;
}


function tarkesite()
{
if (document.forms[0].Nimi.value=='')
	{alert('Nimi on pakollinen tieto!');
	document.forms[0].Nimi.focus();
	return false;
	}

	if (document.forms[0].Yritys_tai_organisaatio.value=='')
	{alert('Yritys tai organisaatio on pakollinen tieto!');
	document.forms[0].Yritys_tai_organisaatio.focus();
	return false;
	}

	if (document.forms[0].Tyotehtava.value=='')
	{alert('Tyotehtava on pakollinen tieto !');
	document.forms[0].Tyotehtava.focus();
	return false;
	}

	if (document.forms[0].Osoite.value=='')
	{alert('Osoite on pakollinen tieto !');
	document.forms[0].Osoite.focus();
	return false;
	}

return true;
}



function OW(theURL,winName,features) {
  window.open(theURL,winName,features);
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}


// let's set some cookie properties
var timeToKeep = 1288000; 
var expires = new Date();
expires.setTime(expires.getTime() + timeToKeep);
var cookieName = 'IskuFontSize';

// write style according to cookie value
function writeStyle(){
	var cookieName = 'IskuFontSize';
	fontCookie = get_cookie(cookieName);
	if (fontCookie == "large") {
		document.write('<link rel="stylesheet" type="text/css" href="sivut/large.css">');
	} else if (fontCookie == "normal") {
		document.write('<link rel="stylesheet" type="text/css" href="sivut/global.css">');
	} else {
		document.write('<link rel="stylesheet" type="text/css" href="sivut/global.css">');
	}	
}

// update Style cookie
function updateStyle(size){
	var cookieName = 'IskuFontSize';
	set_cookie(cookieName, size, expires);
	window.location.reload();
}

// fontsizer icon preloads, etc.

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}




// Cookie Toolbox Javascript
// copyright 4th September 2002, by Stephen Chapman, Felgall Pty Ltd

// You have permission to copy and use this javascript provided that
// the content of the script is not changed in any way.
// For instructions on how to use these functions see "A Cookie Toolbox"
// in the Javascript section of our site at http://www.felgall.com/

var dbug = 0; function d_a(ary) {var beg = next_entry(ary) - 1; for (var i = beg ; i > -1; i--) {ary[i] = null;}} function init_array() {if (dbug) alert('init_cookie');  var ary = new Array(null); return ary;} function set_cookie(name,value,expires) {if (dbug) alert('set_cookie'); if (!expires) expires = new Date();
document.cookie = name + '=' + escape(value) + '; expires=' + expires.toGMTString() + '; path=/';} function get_cookie(name) {if (dbug) alert('get_cookie'); var dcookie = document.cookie; var cname = name + "="; var clen = dcookie.length; var cbegin = 0; while (cbegin < clen) {var vbegin = cbegin + cname.length;
if (dcookie.substring(cbegin, vbegin) == cname) {var vend = dcookie.indexOf (";", vbegin); if (vend == -1) vend = clen; return unescape(dcookie.substring(vbegin, vend));} cbegin = dcookie.indexOf(" ", cbegin) + 1; if (cbegin == 0) break;} return null;} function del_cookie(name) {if (dbug) alert('del_cookie');
document.cookie = name + '=' + '; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/';} function get_array(name, ary) {if (dbug) alert('get_array'); d_a(ary); var ent = get_cookie(name); if (ent) {i = 1; while (ent.indexOf('^') != '-1') {ary[i] = ent.substring(0,ent.indexOf('^')); i++;
ent = ent.substring(ent.indexOf('^')+1, ent.length);}}} function set_array(name, ary, expires) {if (dbug) alert('set_array'); var value = ''; for (var i = 1; ary[i]; i++) {value += ary[i] + '^';} set_cookie(name, value, expires);} function del_entry(name, ary, pos, expires) {if (dbug) alert('del_entry');
var value = ''; get_array(name, ary); for (var i = 1; i < pos; i++) {value += ary[i] + '^';} for (var j = pos + 1; ary[j]; j++) {value += ary[j] + '^';} set_cookie(name, value, expires);} function next_entry(ary) {if (dbug) alert('next_entry'); var j = 0; for (var i = 1; ary[i]; i++) {j = i} return j + 1;}
function debug_on() {dbug = 1;} function debug_off() {dbug = 0;} function dump_cookies() {if (document.cookie == '') document.write('No Cookies Found'); else {thisCookie = document.cookie.split('; '); for (i=0; i<thisCookie.length; i++) {document.write(thisCookie[i] + '<br \/>');}}}
