﻿// File JScript

function popup(nomeCartella,ID_foto,ide,fotoStart){
    URL_res ='popup.aspx?nomeCartella='+nomeCartella+'&ID_foto='+ID_foto+'&fotoStart='+fotoStart+"&ide="+escape(ide);
    var w = 860;
    var h = 660;
    var l = Math.floor((screen.width-w)/2);
    var t = Math.floor((screen.height - h) / 2);
    var url;
    if (location.host.toString().indexOf('localhost') > -1) {
        //alert(location.protocol + "//" + location.host + "/" + "sexyguidaitalia/");
        url = location.protocol + "//" + location.host + "/" + "sexyguidaitalia/"
    }
    else {
        //alert(location.protocol + "//" + location.host);
        url = location.protocol + "//" + location.host + "/";
    }
    window.open(url + URL_res, "", "height=" + h + ",width=" + w + ",menubar=0,resizable=1,scrollbars=yes,status=0,titlebar=0,toolbar=0,left=" + l + ",top=" + t + "+");
    return;
}
function popupRiviste(nomeCartella,ID_foto,ide){
    URL_res ='popupRiviste.aspx?nomeCartella='+nomeCartella+'&ID_foto='+ID_foto+"&ide="+escape(ide);
    var w = 860;
    var h = 660;
    var l = Math.floor((screen.width-w)/2);
    var t = Math.floor((screen.height-h)/2);
    window.open(URL_res,"","height="+h+",width="+w+",menubar=0,resizable=1,scrollbars=yes,status=0,titlebar=0,toolbar=0,left="+l+",top="+t+"+");
    return;
}
function popupUtenti(){
    URL_res ='../reserved/popupUtenti.aspx';
    var w = 860;
    var h = 660;
    var l = Math.floor((screen.width-w)/2);
    var t = Math.floor((screen.height-h)/2);
    window.open(URL_res,"","height="+h+",width="+w+",menubar=0,resizable=1,scrollbars=yes,status=0,channelmode=1,titlebar=0,toolbar=0,left="+l+",top="+t+"+");
    return;
}

function clickButton(e,buttonid)
{ 
    var bt=document.getElementById(buttonid);
    if(typeof bt=='object')
    {
    if(navigator.appName.indexOf("Netscape")>(-1))
    {
    if(e.keyCode == 13)
    {
    if (bt && typeof(bt.click) == 'undefined')
    {
    bt.click = addClickFunction1(bt)
    }
    }
    }
    if(navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
    {
    if(event.keyCode == 13)
    {
    bt.click();
    return false;
    }
    }
    }   
}
function addClickFunction1(bt)
{
    var result = true;
    if (bt.onclick) result = bt.onclick();
    if (typeof(result) == 'undefined' || result)
    {
    eval(bt.href);
    }
}

function check(txt) {

    var date = txt.value.split("/");
    var selectedDate = new Date(date[2] + "/" + date[1] + "/" + date[0]);
    var today = new Date();
    today.setHours(0, 0, 0, 0);
    
    //alert(txt)

    if (selectedDate < today) {
        alert('Attenzione!! non è possibile inserire una data anteriore a quella odierna');
        txt.value = '';
        return false;
    }
}


