try {
    document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}

function dropgo() {  
    if (document.dropdown.select.options[document.dropdown.select.selectedIndex].value != '#') {
        location.href = (document.dropdown.select.options[document.dropdown.select.selectedIndex].value);
        return false;
    }
}
function dropgo2() {  
    if (document.dropdown2.select.options[document.dropdown2.select.selectedIndex].value != '#') {
        location.href = (document.dropdown2.select.options[document.dropdown2.select.selectedIndex].value);
        return false;
    }
}
function dropgo3() {  
    if (document.dropdown3.select.options[document.dropdown3.select.selectedIndex].value != '#') {
        location.href = (document.dropdown3.select.options[document.dropdown3.select.selectedIndex].value);
        return false;
    }
}

function complain() {
    if( document.forms.commentform.comment.value.indexOf("<") != -1 ) {
        document.getElementById("complain").innerHTML = "<small>&Auml;l&auml; k&auml;yt&auml; kommentissa HTML:aa, kiitos.</small><br />";		
    } else {
        if( document.forms.commentform.comment.value.indexOf("http://") != -1 ) {
            document.getElementById("complain").innerHTML = "<small>Osoitteesta tehd&auml;&auml;n linkki automaattisesti.</small><br />";
        } else {
            document.getElementById("complain").innerHTML = "";
        }
    }
}

function verifyForm() {
    obj = document.forms.commentform;

    var message = "";

    // nimi
    if( obj.nimi.value == "" ) {
        message += "Nimi puuttuu.\n";
    }

    // kommentti
    if( obj.comment.value == "" ) {
        message += "Kommentti puuttuu.\n";
    }

    if( message == "" ) {
        obj.submit();
    } else {
        alert(message);
    }
}

function saveCookie(name, value, days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime()+(days*24*60*60*1000))
        var expires = "; expires="+date.toGMTString()
    }
    else expires = ""
    document.cookie = name+"="+value+expires+"; path=/"
}

function userProfile(id) {
    win = window.open('/keskustelu/profile.php?id='+id, 'profile', 'width=200,height=300,location=no,menubar=no,resizable=no,scrollbars=no,toolbar=no');
}