$(document).ready(function(){
    $('#uusart').click(function(event){
	location.reload();
    });
    $('#paring').click(function(event){
	window.location.href = 'index.cgi';
    });
    $('#vastus').click(function(event){
	$('#spikker').toggle();
    });
    $('#teinepool').click(function(event){
	$('#spikker').toggle();
    });
//    $(document).bind("mouseup", tekstvalitud);
});

valitudtekst = function(){
    var vt = '';
    if (window.getSelection) {
	vt = window.getSelection();
    } else if (document.getSelection) {
	vt = document.getSelection();
    } else if (document.selection) {
	vt = document.selection.createRange().text;
    }
    return vt;
}

tekstvalitud = function(){
    var tx = valitudtekst();
    if (tx != '') {
	window.open("index.cgi?C07=1&C01=1&Q="+tx,"tyyp",'width=640,height=360,resizable=1,scrollbars=1');
    }
}

function tyyp(tp) {
  window.open("tyypsonad.html#tp"+tp,"tyyp",'width=640,height=360,resizable=1,scrollbars=1');
}

