function check_submit() {
    $('#submit').click(function () { 
      if ($('#x1').val() == "") {
        alert('Please, select region')          
        return false;
      } else if ($('#x1').val() == $('#x2').val()) {
          alert('Please, select region');
          return false;
      }
    });
    
}

function selectionEnd(img, selection) { 
    //$('#example_info').attr('innerHTML', 'x1: ' + selection.x1 + '; height: ' + selection.y2);
    $('#x1').val(selection.x1);
    $('#x2').val(selection.x2);    
    $('#y1').val(selection.y1);
    $('#y2').val(selection.y2);    
}

function writeCookie() {
    var today = new Date();
    var the_date = new Date("December 31, 2023");
    var the_cookie_date = the_date.toGMTString();
    var the_cookie = "users_resolution="+ screen.width +"x"+ screen.height;
    var the_cookie = the_cookie + ";expires=" + the_cookie_date;
    document.cookie = the_cookie;
    //location = 'default.html';
}

$(window).load(function () { 
    /*
    $('#example').imgAreaSelect({ 
        selectionColor: 'green', 
        borderWidth: 2,
        aspectRatio: '4:3',
        x1: 0, y1: 0,
        x2: 200, y2: 150,        
        onSelectEnd: selectionEnd
    }); 
    */
});

$(document).ready(function(){
    //check_submit();
    writeCookie();
});
