/* This file contains all the functions that handle the cookies */

//This function returns the value of the cookie
function valueOfCookie(name) {
	var values = document.cookie.split(";");
	for(var i = 0; i < values.length; i++) {
		//Retrieve that value
		if(values[i].search(name) != -1) {
			var position = values[i].indexOf("=");
			return values[i].charAt(position + 1);
		}
	}
	return 0;
}
//This function deletes a cookie
function deleteCookie(name) {
	createCookie(name, "", -1);
}
//This function creates a cookie with the specified name-value pair
function createCookie(name, value) {
	var date = new Date();
	date.setTime(date.getTime() + 24 * 60 * 60 * 1000);
	document.cookie = name + "=" + value + "; expires=" + date.toGMTString() + "; path=/";

}
