function setCookie(c_name,value,expires)
{
	var today = new Date();
	today.setTime( today.getTime() );
	
	expires = expires * 1000 * 60 * 60 *24;
	var expires_date = new Date( today.getTime() + (expires) );
	
	document.cookie = c_name + "=" + escape(value) +
	((expires_date == null) ? "" : ";expires=" + expires_date.toGMTString() + "; path=/");
}

function deleteCookie(c_name){
	setCookie(c_name, null, -1);
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return null;
}

function killCookie(){
	deleteCookie('popup');
}

$(document).ready(function(){
	
	$('#killCookie').click(function(){
		killCookie();
	});
	
	if(getCookie('popup') == null){
		if($('#popupDiv').attr('data-trigger') == 'yes' ){
			if( $('#popupDiv').attr('data-size') != null ){
				$('#popupDiv').css('width', $('#popupDiv').attr('data-size') + 'px');
			}
			
			$(function() { // Run modal popup
				$.nyroModalManual({
					url: '#popupDiv',
				});
			});
			setCookie('popup', 'noShow', 1);
		}
	}

});


