/*
*/
	var COOKIE_NAME = 'ageVerified';
	$go = $.cookie(COOKIE_NAME);
	var url = window.location.href;
	//var filename = url.substring(url.lastIndexOf('/')+1);
	var verify = "http://" + window.location.hostname+"/altersabfrage/";

//	if ($go == null && filename != verify && filename != "doi.php") {
	if ($go == null && url != verify) {
		$.cookie('redir', url,{ path: '/', _domain: window.location.hostname});
		window.location.href = verify;
	}
	function grantAccess(w){
		var redir = $.cookie('redir');
		if(w == 'w' && redir == '/'){
			redir = '/cinzano/weinaperitif/cinzano-bianco/';
		}
		$.cookie('redir', null);
		$.cookie('ageVerified', 'yes',{ path: '/', _domain: window.location.hostname});
		window.location.href = redir;
	};



$(function(){
	$.fn.supersized.options = {  
		startwidth: 1255,  
		startheight: 876,
		minsize: .5
	};
	$('#supersize').supersized(); 
});

/*------------------------------------------------*/

function isValidDate(s) {
    // format D(D)/M(M)/(YY)YY

    var dateFormat = /^\d{1,4}[\.|\/|-]\d{1,2}[\.|\/|-]\d{1,4}$/;

    if (dateFormat.test(s)) {
        s = s.replace(/0*(\d*)/gi,"$1");
        var dateArray = s.split(/[\.|\/|-]/);

		if (dateArray[1] < 1 || dateArray[1] > 12) {
			return false;
		}
		if (dateArray[0] < 1 || dateArray[0] > 31) {
			return false;
		}

		if ((dateArray[1]==4 || dateArray[1]==6 || dateArray[1]==9 || dateArray[1]==11) && dateArray[0]==31) {
			return false
		}

        dateArray[1] = dateArray[1]-1;

        if (dateArray[2].length<4) {
            dateArray[2] = (parseInt(dateArray[2]) < 50) ? 2000 + parseInt(dateArray[2]) : 1900 + parseInt(dateArray[2]);
        }

        var testDate = new Date(dateArray[2], dateArray[1], dateArray[0]);
        if (testDate.getDate()!=dateArray[0] || testDate.getMonth()!=dateArray[1] || testDate.getFullYear()!=dateArray[2]) {
            return false;
        } else {
            return true;
        }
    } else {
        return false;
    }
}
/*------------------------------------------------*/

