function getCookie(name) {var matches=document.cookie.match(new RegExp('(?:^|; )'+name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1')+'=([^;]*)')); return matches ? decodeURIComponent(matches[1]) : undefined} function setCookie(name,value) {document.cookie=name+'='+value+';path=/;';} second=parseInt(getCookie('second')); if(!second) second=0; setInterval("second++;setCookie('second',second)",1000); function openWarningBlock(){if(!getCookie('isShowed')) { document.getElementById('secondtime').innerHTML=(parseInt(second/60)+" мин и "+parseInt(second%60)+" сек"); document.getElementById('warningBlock').style.display="block"; setCookie('isShowed',1); }} function closeWarning(){document.getElementById('warningBlock').style.display="none";} function setNext(a){ document.getElementById('zeroWin').style.display="none"; if(a==1) document.getElementById('firstWin').style.display="block"; else if(a==2) document.getElementById('secondWin').style.display="block"; document.getElementById('callBlock').style.display="block"; } function sendPhone(a){ var phone=document.getElementById('phoneNumber').value; var callTime=document.getElementById('callTime').value; if(!phone) return; isNow=0; if(a) isNow=1; $.ajax({ url: 'http://navesprofi.ru/tmp/userCall.php', type: "POST", crossDomain: true, data: {phone:phone,callTime:callTime,isNow:isNow}, complete: function(){document.getElementById('warningBlock').style.display="none";}, }); } document.body.onblur=openWarningBlock