function popup() {
	lightCore.registerInit(this);
}

popup.prototype = {
	cookieName: 'popupShown',
	ready: false,

	initialize: function() {
		if (!this.readCookie()) {
			this.showPopup();
			this.createCookie('1', 60);
		}
	},

	createCookie: function(value,days) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = this.cookieName+"="+value+expires+"; path=/";
	},

	readCookie: function() {
		var nameEQ = this.cookieName + "=";
		var ca = document.cookie.split(';');
		for (var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ')
				c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0)
				return c.substring(nameEQ.length,c.length);
		}
		return null;
	},

	showPopup: function() {
		var a = document.getElementsByTagName('a');
		var found = null;
		for (var i = 0; i < a.length && !found; i++) {
			if (a[i].className == 'thickbox')
				found = a[i];
		}
		if (found) {
			jQuery(found).click();
			this.ready = true;
		}
	}

}

function playerReady(obj) {
	if (pop.ready) {
		var id = obj['id'];
		var elm = document.getElementById(id);
		if (elm.parentNode.id = 'TB_ajaxContent') {
			setTimeout("document.getElementById('"+id+"').sendEvent('PLAY', true)", 2000);
		}
	}
}

var pop = new popup();