// This is the global js script, register subscripts here

$(document).ready(function() {
   	// comments.js
	if (self.checkRememberCookie)
		checkRememberCookie();
			
	// hide alert
	$('#alert').click(function(){$(this).slideUp()}).css('cursor','pointer');
		
	// edit.js
	if (self.initEdit)
		initEdit();
	
	// form.js
	if (self.initForm)
		initForm();
	
	// custom, site specific functions
	if (self.initCustom)
		initCustom();
		

});


/* COOKIES */
var Cookies = {
	init: function () {
		var allCookies = document.cookie.split('; ');
		for (var i=0;i<allCookies.length;i++) {
			var cookiePair = allCookies[i].split('=');
			this[cookiePair[0]] = cookiePair[1];
		}
	},
	create: function (name,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 = name+"="+value+expires+"; path=/";
		this[name] = value;
	},
	erase: function (name) {
		this.create(name,'',-1);
		this[name] = undefined;
	}
};
Cookies.init();


function openClose(which)
{
	if (which.className == 'open')
		which.className = 'close';
	else
		which.className = 'open';
}

