function DialogOverlay(content, container) {
	
	// Manage arguments and assign defaults, 
	if (typeof container == 'undefined' ) container = document.body;
	if (null == (this.container = $(container))) throw("container is not valid");
	
	// Assign instance variables
	this.content = content;
	this.overlay = new Element('div', { 'class': 'overlay' }).hide();
	this.dialog = new Element('div', { 'class': 'dialog' }).hide();
	
	// Hide the overlay when clicked. Ignore clicks on the dialog.
	//Event.observe(this.overlay, 'click', this.hide.bindAsEventListener(this));
	//Event.observe(this.dialog, 'click',  function(event) { Event.stop(event) });
	
	// Insert the elements into the DOM
	this.dialog.insert(this.content);
	this.container.insert(this.overlay);
	this.container.insert(this.dialog);
	
	// Content may have been hidden if it is embedded in the page
	content.show();
	this.dialog.hide();
}

DialogOverlay.prototype.show = function() {
	new Effect.Appear(this.overlay, { duration: 1,  to: 0.8 });
	var winH = document.viewport.getHeight();
	this.dialog.style.top = (winH/2-($(this.dialog).getHeight())/2)+'px';
	
	this.dialog.show();
	return this;
}

DialogOverlay.prototype.hide = function(event) {
	this.dialog.hide();
	this.overlay.hide();
	return this;
}

function closeAgree() {
	createCookie('alreadyVisited',true,1);
	this.dialog.hide();
	this.overlay.hide();

	$('sites').style.visibility = 'visible';
	$('dvds').style.visibility = 'visible';
	$('stars').style.visibility = 'visible';
	$('catagories').style.visibility = 'visible';
	$('magazine').style.visibility = 'visible';
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*60*60*24*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	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;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function roll_over(img_name, img_src)
{
	document[img_name].src = img_src;
}