function setSkin(v, url){
	var expire = (v != null) ? null : 'yes';
	setCookie('skin', v, expire);
    history.go(0);
}

function setCookie (name, value, expire) {
	var expiration_date = new Date ();
	var days = 365;
	expiration_date.setTime(expiration_date.getTime()+(days*24*60*60*1000));
	if (expire != null){
		// expire now
		expiration_date.setTime(expiration_date.getTime());
	}
    expiration_date = expiration_date . toGMTString ();

	var path = "/";

	// Build the cookie string:
	var cookie_string = escape (name) + "=" + escape (value) + "; expires=" + expiration_date;
	cookie_string += "; path=" + path;
	// Create/update the cookie:
	document.cookie = cookie_string;

	return true;
}

function getCookie (key){

	var cookie_string = document.cookie;
	var cookie_array = cookie_string . split ("; ");

	for (var i = 0; i < cookie_array . length; ++ i){
		var single_cookie = cookie_array [i] . split ("=");
		if (single_cookie . length != 2){
			continue;
      	}
		var name  = unescape (single_cookie [0]);
		var value = unescape (single_cookie [1]);
		// Return cookie if found:
		if (key == name){
			return value;
      	}
	}
	return null; // Cookie was not found:
}


