﻿function AdultWarningResizer()
{
	var div = document.getElementById('warning');
    div.style.top = document.body.scrollTop;
    div.style.width = document.body.clientWidth;
    div.style.height = document.body.clientHeight;
}
function AdultWarning(sLng)
{
    window.onresize = AdultWarningResizer;
    window.onscroll = AdultWarningResizer;
    var txt = [];
    txt['pl'] = [];
    txt['pl']['for_adults'] = 'STRONA TYLKO DLA DOROSŁYCH';
    txt['pl']['warning'] = 'UWAGA! TA STRONA ZAWIERA TREŚCI EROTYCZNE!<br>Jeśli nie ukończyłes 18-go roku życia, nie chcesz oglądać tego typu treści lub jest to niezgodne z prawem twojego kraju, nie wolno Ci wchodzić dalej!';
    txt['pl']['mam18'] = 'Mam ukończone 18 lat. Nie pokazuj mi więcej tego ostrzeżenia.';
    txt['pl']['entry'] = '>> WEJDŹ NA STRONE <<';
    txt['pl']['please_confirm'] = 'Potwierdź swoja pełnoletniość! ( zaznacz kwadracik )';

    txt['en'] = [];
    txt['en']['for_adults'] = 'SEXUAL CONTENT WARNING';
    txt['en']['warning'] = 'This Website contains explicit sexual material which may be offensive to some viewers. You must be 18 years or older to enter this Website. By going beyond this point, you acknowledge that you are 18 years or older.';
    txt['en']['mam18'] = "I'am over 18. Don't show me this page again.";
    txt['en']['please_confirm'] = 'Please confirm your majority';
    txt['en']['entry'] = 'ENTRY';

    var waring = '<div id="warning" style="position:absolute;top:0px;left:0px;width:100%;height:width:100%;background-color:#ffffff;"><table width="100%" height="100%"><tr><td align="center" valign="middle">';
    waring += '<table style="width:780px; height:1614px; border:1px solid #cccccc; background-color:#f5f5f5;">';
    waring += '<tr><td valign="top" align="center" style="padding-top:120px;">';
    waring += '<span style="font-size:36px; color:#ace149; font-family:impact,arial;">'+txt[sLng]['for_adults']+'</span>';
    waring += '<div align="center" style="margin-top: 32px; margin-bottom: 32px; width:370px;border:1px dotted #f1f1f1;font-family:arial; font-size:14px; font-weight:bold; font-family:arial;">'+txt[sLng]['warning']+'</div>';
    waring += '<input type=checkbox id="warningBox"> <a href="#" onclick="document.getElementById(\'warningBox\').checked ^= 1; return false;" style="font-family:tahoma;font-size:12px; font-weight:bold;">'+txt[sLng]['mam18']+'</a>';
    waring += '<div style="margin-top:32px;"><a href="#" onclick="AdultWarningLetMeIn(\''+txt[sLng]['please_confirm']+'\'); return false;" style="text-decoration:underline; font-size:32px; font-family:impact, arial; font-weight:bold; color:#78a515;">'+txt[sLng]['entry']+'</a></div>';
    waring += '</td></tr>';
    waring += '</table>';
    waring += '</td></tr></table></div>';
      document.write(waring);
}
function AdultWarningLetMeIn(not_checked)
{
	if(document.getElementById('warningBox').checked)
    {
    	AdultWarningSetCookie('adultPerson', 1, 1);
      	document.getElementById('warning').style.visibility = 'hidden';
      	window.onresize = null;
      	window.onscroll = null;
    }
    else alert(not_checked);
}
function AdultWarningSetCookie(sCookieName,sCookieValue,nDays)
{
    var today = new Date();
    var expire = new Date();
    var d = document.location.href.split('/');
    d = d[2].split('.');
    d = d[d.length-2]+'.'+d[d.length-1];
    if (nDays==null || nDays==0) nDays=1;
    expire.setTime(today.getTime() + 3600000*24*nDays);
    document.cookie = sCookieName+"="+escape(sCookieValue)
                    + ";path=/;expires="+expire.toGMTString()+";domain="+d;
}
function AdultWarningGetCookie( sName )
{
    var dc = document.cookie;
    var prefix = sName + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

