function jumpMenu(targ,selObj,restore,url){ //v3.0
  eval(targ+".location='"+url+""+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function jumpMenu_koriin(targ,selObj,restore){ 
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function jumpMenuUrl(url,targ,selObj,restore){ 
  eval(targ+".location='"+url+""+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

/*
 * This script is written by Geert Van Aken
 * Please read the official documentation for more information
 * about the functions of this file.
 *
 * http://altum.be/products/emailobfuscator
 *
 * Please do not remove this information from the file and
 * report improvements that you make to this sourcecode
 *
 * Version 1.1.0
 * Date    2006/04/11
 */

var monkeyCode = 4 << 4;
var oldStatusText = "";

function EOa() {
  return String.fromCharCode(monkeyCode);
}

function EOd(pText) {
  var splitted = pText.split(",");
  var result = "";

  for (i = 0 ; i < splitted.length ; i++) {
    result += String.fromCharCode(splitted[i]);
  }
  return result;
}

function EOp() {
  var prefix = EOd('109,97,105');
  prefix += EOd('108,116');
  return prefix + EOd('111,58');
}

function EOad(pName, pdomain) {
  EOad(pName, pDomain, null);
}

function EOinitStatus(pName, pDomain) {
  oldStatusText = window.status;
  window.status = Loc(pName, pDomain);
}

function EOrestoreStatus() {
  window.status = oldStatusText;
}

function EOae(pName, pDomain, pSubj, pHover, pText, pClass) {

//  alert("pName = " + pName + "\npDomain = " + pDomain + "\npSubj = " + pSubj + "\npHover = " + pHover + "\npText = " + pText + "\npClass = " + pClass);

  var result = "<a href=\"JavaScript:EOad('" + pName + "','" + pDomain + "'";
  if (pSubj != null && pSubj.length > 2) {
    result += ",'" + pSubj + "'";
  }
  result += ");\"";

  if (pHover != null && pHover.length > 0) {
    result += " title=\"" + EOd(pHover) + "\"";
  }

  if (pClass != null && pClass.length > 0) {
    result += " class=\"" + pClass + "\"";
  }

  result += " onMouseOver=\"EOinitStatus('" + pName + "','" + pDomain + "');return true;\" onMouseOut=\"EOrestoreStatus();\"";

  result += ">" + EOd(pText) + "</a>";

//  alert(result);

  document.write(result);

}

function EOad(pName, pDomain, pSubj) {
  var loc = Loc(pName, pDomain);
  if (pSubj != null && pSubj.length > 0) {
    loc += "?" + EOd('115,117,98,106,101,99,116') + "=" + encodeURIComponent(EOd(pSubj));
  }

  document.location = loc;
}

function Loc(pName, pDomain) {
  var first = EOd(pName);
  var second = EOd(pDomain);
  var loc = EOp() + first + EOa() + second; 
  
  return loc;
}

// @name      The Fade Anything Technique
// @namespace http://www.axentric.com/aside/fat/
// @version   1.0-RC1
// @author    Adam Michela

var Fat = {
	make_hex : function (r,g,b) 
	{
		r = r.toString(16); if (r.length == 1) r = '0' + r;
		g = g.toString(16); if (g.length == 1) g = '0' + g;
		b = b.toString(16); if (b.length == 1) b = '0' + b;
		return "#" + r + g + b;
	},
	fade_all : function ()
	{
		var a = document.getElementsByTagName("*");
		for (var i = 0; i < a.length; i++) 
		{
			var o = a[i];
			var r = /fade-?(\w{3,6})?/.exec(o.className);
			if (r)
			{
				if (!r[1]) r[1] = "";
				if (o.id) Fat.fade_element(o.id,null,null,"#"+r[1]);
			}
		}
	},
	fade_element : function (id, fps, duration, from, to)
	{
		if (!fps) fps = 30;
		if (!duration) duration = 3000;
		if (!from || from=="#") from = "#FFFF33";
		if (!to) to = this.get_bgcolor(id);
		
		var frames = Math.round(fps * (duration / 1000));
		var interval = duration / frames;
		var delay = interval;
		var frame = 0;
		
		if (from.length < 7) from += from.substr(1,3);
		if (to.length < 7) to += to.substr(1,3);
		
		var rf = parseInt(from.substr(1,2),16);
		var gf = parseInt(from.substr(3,2),16);
		var bf = parseInt(from.substr(5,2),16);
		var rt = parseInt(to.substr(1,2),16);
		var gt = parseInt(to.substr(3,2),16);
		var bt = parseInt(to.substr(5,2),16);
		
		var r,g,b,h;
		while (frame < frames)
		{
			r = Math.floor(rf * ((frames-frame)/frames) + rt * (frame/frames));
			g = Math.floor(gf * ((frames-frame)/frames) + gt * (frame/frames));
			b = Math.floor(bf * ((frames-frame)/frames) + bt * (frame/frames));
			h = this.make_hex(r,g,b);
		
			setTimeout("Fat.set_bgcolor('"+id+"','"+h+"')", delay);

			frame++;
			delay = interval * frame; 
		}
		setTimeout("Fat.set_bgcolor('"+id+"','"+to+"')", delay);
	},
	set_bgcolor : function (id, c)
	{
		var o = document.getElementById(id);
		o.style.backgroundColor = c;
	},
	get_bgcolor : function (id)
	{
		var o = document.getElementById(id);
		while(o)
		{
			var c;
			if (window.getComputedStyle) c = window.getComputedStyle(o,null).getPropertyValue("background-color");
			if (o.currentStyle) c = o.currentStyle.backgroundColor;
			if ((c != "" && c != "transparent") || o.tagName == "BODY") { break; }
			o = o.parentNode;
		}
		if (c == undefined || c == "" || c == "transparent") c = "#FFFFFF";
		var rgb = c.match(/rgb\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/);
		if (rgb) c = this.make_hex(parseInt(rgb[1]),parseInt(rgb[2]),parseInt(rgb[3]));
		return c;
	}
}




function unblur() {
	
	this.blur();
}

function getLinksToBlur() {
	
	if (!document.getElementById) return
	links = document.getElementsByTagName("a");
	for(i=0; i<links.length; i++) {
		links[i].onfocus = unblur;
	}
}

function test_submit() {
	
	alert("Form submit OK!");
}

function validate_kassalomake() {
	
	if ((!document.kassa.tilaaja_sukunimi.value || !document.kassa.tilaaja_etunimi.value || !document.kassa.tilaaja_osoite.value || !document.kassa.tilaaja_postinumero.value || !document.kassa.tilaaja_postitoimipaikka.value || !document.kassa.tilaaja_sahkoposti.value || !document.kassa.tilaaja_puhelin.value)) {
		
		document.getElementById("form_error").className = 'show';
		
		if ((!document.kassa.tilaaja_sukunimi.value)) {
			Fat.fade_element("tilaaja_sukunimi", "30", "1800", "#ff0000", "#ffff99");
		} else {
			Fat.fade_element("tilaaja_sukunimi", "30", "1800", "#ffffff", "#ffffff");
		}
		
		if ((!document.kassa.tilaaja_etunimi.value)) {
			Fat.fade_element("tilaaja_etunimi", "30", "1800", "#ff0000", "#ffff99");
		} else {
			Fat.fade_element("tilaaja_etunimi", "30", "1800", "#ffffff", "#ffffff");
		}
		
		if ((!document.kassa.tilaaja_osoite.value)) 
		{
			Fat.fade_element("tilaaja_osoite", "30", "1800", "#ff0000", "#ffff99");
		} else {
			Fat.fade_element("tilaaja_osoite", "30", "1800", "#ffffff", "#ffffff");
		}
		
		if ((!document.kassa.tilaaja_postinumero.value)) {
			Fat.fade_element("tilaaja_postinumero", "30", "1800", "#ff0000", "#ffff99");
		} else {
			Fat.fade_element("tilaaja_postinumero", "30", "1800", "#ffffff", "#ffffff");
		}
		
		if ((!document.kassa.tilaaja_postitoimipaikka.value)) {
			Fat.fade_element("tilaaja_postitoimipaikka", "30", "1800", "#ff0000", "#ffff99");
		} else {
			Fat.fade_element("tilaaja_postitoimipaikka", "30", "1800", "#ffffff", "#ffffff");
		}
		
		if ((!document.kassa.tilaaja_sahkoposti.value)) 
		{
			Fat.fade_element("tilaaja_sahkoposti", "30", "1800", "#ff0000", "#ffff99");
		} else {
			Fat.fade_element("tilaaja_sahkoposti", "30", "1800", "#ffffff", "#ffffff");
		}
		
		if ((!document.kassa.tilaaja_puhelin.value)) 
		{
			Fat.fade_element("tilaaja_puhelin", "30", "1800", "#ff0000", "#ffff99");
		} else {
			Fat.fade_element("tilaaja_puhelin", "30", "1800", "#ffffff", "#ffffff");
		}
		
		return false;
	}
	else {
		//test_submit();	
		return true;
	}
}

function toggle(id) { 
	var el = document.getElementById(id).style; 
	if(el.display == "none" || !el.display) { 
		el.display = "block"; 
	} 
	else if(el.display == "block") { 
		el.display = "none"; 
	} 
}
function show(id) { 
	var el = document.getElementById(id).style; 
	el.display = "block"; 
}
function hide(id) { 
	var el = document.getElementById(id).style; 
	el.display = "none"; 
}


window.onload = function () {
	//Fat.fade_all();
	getLinksToBlur();
}