var timerStarted = false;
jQuery(document).ready(function () {		
			var cookieval=getCookie('emailPrefByUser');
			
			if(isEmpty(cookieval) && !timerStarted){		
				var countVal=checkCount();
				var popupAtTime=getPopupTime();			
				var now = new Date();
				var timeDifference = popupAtTime - now.getTime();
				if((!isEmpty(popupAtTime)) && (!isEmpty(countVal)) && !timerStarted){  			
					callUserTagForm();
					if(timeDifference < 2500) timeDifference = 5000; //popup after 5 seconds if time has passed
					timerStarted=true;
					setTimeout(function () {jQuery( "#dialog-form" ).dialog( "open" );}, timeDifference);  				
				}  			
			} else {
				DeleteCookie('count');
				DeleteCookie('popup_time');
			}
		});		

