function createCookie(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=/";
	}
	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 switchStylestyle(styleName) {
		$('link[@rel*=style][title]').each(function(i)
		{
			this.disabled = true;
			if (this.getAttribute('title') == styleName) this.disabled = false;
		});
	}
	var off=true;
	function cambia(tip){
		if(tip==true){
			off=false;
			createCookie("style", "ok", 365);
			$(".apost").html("No tan claro");
			$('.post-info > a').addClass("readcolor3");
			//setActiveStyleSheet('verde');
			switchStylestyle('alternate'); return false;
		}
		else{
			eraseCookie('style');
			off=true;
			$(".apost").html("No lo ves claro");
			$('.post-info > a').removeClass("readcolor3");
			switchStylestyle('default'); return false;
		}
	}
	$(document).ready(function(){
		var c = readCookie('style');
		if (c){cambia(true);}else{cambia(false)}
			$("a.apost").click(function (){
				// quito la clase activa
				if(off==true){cambia(true);}else{cambia(false)}
				});
			});
	
	
	