﻿function disableEnterKey(e) {
    var key;
    if (window.event)
        key = window.event.keyCode; //IE
    else
        key = e.which; //firefox     

    return (key != 13);
}

//MENU
function aprimenu(sottomenu) {
    if (document.getElementById(sottomenu).style.display == "none") {
        document.getElementById(sottomenu).style.display = "block";
    }
    else {
        document.getElementById(sottomenu).style.display = "none";
    }
}

//STAMPA
function printSelection(node) {
    var content = document.getElementById(node).innerHTML
    //RIMUOVO SCRIPT GOOGLE
    var content2 = content.replace(/<script\b[^>]*>(.*?)<\/script>/ig, '');
    //var content2 = content.replace(/<div class='news_boxannunci'>(.*?)<\/div>/ig, '');
    var pwin = window.open('', 'print_content', 'width=600,height=500');

    pwin.document.open();
    pwin.document.write('<html><head><title>' + document.domain + '</title></head><body onload="window.print();" style="padding:0 0 0 0;background-color:white;"><div style="width:650px;"><h1 style="color:black;">' + document.domain + '</h1><hr />' + content2 + '</div><hr />' + document.domain + '</body></html>');
    //NASCONDO DIV PERHE' ALTRIMENTI SPAZIO VUOTO IN ALTO
    pwin.document.getElementById('news_boxannunci').style.display = 'none';
    pwin.document.close();

    setTimeout(function() { pwin.close(); }, 1000);
}

//REDIRECT CERCA
function redirCerca() {
//    var cx = document.getElementById("cx").value
//    var cof = document.getElementById("cof").value
//    var ie = document.getElementById("ie").value
    var q = document.getElementById("q").value
    var action = document.getElementById("action").value
    location = action + '?q=' + q;
    //location = action + '?cx=' + cx + '&cof=' + cof + '&ie=' + ie + '&q=' + q;
     //location = 'http://www.closetonews.it/ricercago.aspx?cx=' + cx + '&cof=' + cof + '&ie=' + ie + '&q=' + q;
}
