// cookies
function create_cookie(name, value, hours) {
	if (hours) {
		var date = new Date();
		date.setTime(date.getTime() + (hours * 60 * 60 * 1000));
		var expires = "; expires="+date.toGMTString();
	} else
		var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function read_cookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	var ca_lngth = ca.length;
	for (var i = 0; i < ca_lngth; 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;
} 
onload = function() {
	var m_div = document.createElement("div");	
	m_div.id = "bonus_informer";
	var w_div = document.createElement("div");
	w_div.className = "wrap";
	var t_div = document.createElement("div");
	t_div.className = "t";
	var a = document.createElement("a");
	a.href=bonus_url;
	a.appendChild(document.createTextNode(bonus_info));	
	t_div.appendChild(a);
	w_div.appendChild(t_div);	
	var c_img = document.createElement("img");
	c_img.src = "/static/files/bonus_informer_x.png";
	c_img.className = "c";
	w_div.appendChild(c_img);
	m_div.appendChild(w_div);
	document.body.appendChild(m_div);
	
	var bonus_cookie = read_cookie('bonus_inf');
	if (bonus_cookie != 'no') {
		$("#bonus_informer .wrap").animate({bottom: 0}, 500);
		$("#bonus_informer .c").bind("click", function(e) {
				$("#bonus_informer .wrap").animate({bottom: -41}, 400);
				create_cookie('bonus_inf', 'no', 2);
			}
		);
		$("#bonus_informer .t a").bind("click", function(e) {
				$("#bonus_informer .wrap").animate({bottom: -41}, 400);
				create_cookie('bonus_inf', 'no', 2);
			}
		);
	}
}

// #f8f8dc
