maxp_somewin = 1500; show_somewin = 1; ison_somewin = 0; /* jQuery(document).ready(function(){ thewin = jQuery("#somewin"); theshadow = jQuery(".somewin-shadow"); if(!getCookie('social')) { setTimeout(function() { thewin.fadeIn("slow", function(){}); theshadow.fadeIn("slow", function(){}); ison_somewin = 1; setTimeout(function() { thewin.find('.popup-close').css('display', 'block'); thewin.find('.button-close-popup').css('display', 'block'); }, 3000); },5000); } */ jQuery(window).scroll(function(){ var h_doc = jQuery(document).height(); var h_scr = jQuery(window).height(); var horiz_pos = jQuery(this).scrollTop(); if(show_somewin==1){ if( (h_doc - (h_scr+horiz_pos) )<=maxp_somewin){ if(ison_somewin==0){ thewin.fadeIn("slow", function(){}); ison_somewin = 1; } } else { if(ison_somewin==1){ hide_somew(0); } } } }); function hide_somew(perm){ if(perm==1){show_somewin = 0;} thewin.fadeOut("slow", function(){}); theshadow.fadeOut("slow", function(){}); setCookie('social','true', {'path': '/'}); ison_somewin = 0; } function getCookie(name) { var matches = document.cookie.match(new RegExp( "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)" )); return matches ? decodeURIComponent(matches[1]) : undefined; } function setCookie(name, value, options) { options = options || {}; var expires = options.expires; if (typeof expires == "number" && expires) { var d = new Date(); d.setTime(d.getTime() + expires * 1000); expires = options.expires = d; } if (expires && expires.toUTCString) { options.expires = expires.toUTCString(); } value = encodeURIComponent(value); var updatedCookie = name + "=" + value; for (var propName in options) { updatedCookie += "; " + propName; var propValue = options[propName]; if (propValue !== true) { updatedCookie += "=" + propValue; } } document.cookie = updatedCookie; } thewin.css("width","490px"); thewin.css("height","370px"); thewin.css("box-shadow",""); thewin.css("right","1px"); thewin.css("bottom","1px"); thewin.css("background",""); jQuery('.button-close-popup').click(function() { hide_somew(1); }); });