﻿function popup_setCookie(name, value, expiredays) 
{ 
	var todayDate = new Date(); 
	todayDate.setDate(todayDate.getDate() + expiredays); 
	todayDate.setHours(0, 0, -1);
	document.cookie = name + '=' + escape(value) + ';path=/;expires=' + todayDate.toGMTString() + ';';
}

function checkandclose(obj) {
	if (obj.checked) {
		popup_setCookie("EventPopBan", "1" , 1);
		self.close(); 
	}
}

function checkandclose2() {
	popup_setCookie("EventPopBan", "1" , 1);
	self.close(); 
}

function clickandclose(cookieName) {
	popup_setCookie(cookieName, "1" , 1);
	self.close();
}

function getCookie(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    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));
}

function EventPopup() {
	var url = '/Events/Attendance/Popup.aspx';
	var name = 'AttendanceEvent';
	var features = 'width=300,height=407,scrollbars=no,status=no,menubar=no,toolbar=no,resizable=no';
	if (getCookie('AttendanceEventPopBan') != '1') {
		window.open(url, name, features);
	}
}

function windowCloseAll()
{
    if (window.opener != null && typeof(window.opener) != "undefined" && !window.opener.closed)
    {
        if (opener.windowCloseAll != null && typeof(opener.windowCloseAll) != "undefined") {
            opener.windowCloseAll();
        }
    }
    window.close();
}
