var yht_kohta=0;function lataa_pop(){if(yht_kohta==0){$(".yht_varjo").css({"opacity":"0.7"});$(".yht_varjo").fadeIn("slow");$(".yhteydenotto").fadeIn("slow");yht_kohta=1;}}
function sulje_pop(){if(yht_kohta==1){$(".yht_varjo").fadeOut("slow");$(".yhteydenotto").fadeOut("slow");yht_kohta=0;}}
function keskita(){var windowWidth=$(window).width();var windowHeight=$(window).height();var popupHeight=$(".yhteydenotto").height();var popupWidth=$(".yhteydenotto").width();$(".yhteydenotto").css({"position":"absolute","left":windowWidth/2-popupWidth/2});$(".yht_varjo").css({"height":windowHeight});}
$(document).ready(function(){$("#avaayht").click(function(){keskita();lataa_pop();});$(".yhteydenottoClose").click(function(){sulje_pop();});$(".yht_varjo").click(function(){sulje_pop();});$(document).keypress(function(e){if(e.keyCode==27&&yht_kohta==1){sulje_pop();}});});