function show_hide_icon(span_id) {
var divstyle = new String();
divstyle = document.getElementById(span_id).className;
if (divstyle.toLowerCase() == 'glyphicon glyphicon-minus' || divstyle == "") {
document.getElementById(span_id).className='glyphicon glyphicon-plus';
var date = new Date( new Date().getTime() + 1000*60*60*24*365); // ставим куку на 365 дней
_setCookie(span_id, escape('glyphicon glyphicon-plus'), date.toUTCString(), "/");
} else {
document.getElementById(span_id).className='glyphicon glyphicon-minus';
var date = new Date( new Date().getTime() + 1000*60*60*24*365); // ставим куку на 365 дней
_setCookie(span_id, escape('glyphicon glyphicon-minus'), date.toUTCString(), "/");
}
}
<span id="span_pm" class="<?=isset($_COOKIE['span_pm'])? $_COOKIE['span_pm'] : 'glyphicon glyphicon-minus'; ?>" ></span>
jQuery.extend({
stringify : function stringify(obj) {
var t = typeof (obj);
if (t != "object" || obj === null) {
// simple data type
if (t == "string") obj = '"' + obj + '"';
return String(obj);
} else {
// recurse array or object
var n, v, json = [], arr = (obj && obj.constructor == Array);
for (n in obj) {
v = obj[n];
t = typeof(v);
if (obj.hasOwnProperty(n)) {
if (t == "string") v = '"' + v + '"'; else if (t == "object" && v !== null) v = jQuery.stringify(v);
json.push((arr ? "" : '"' + n + '":') + String(v));
}
}
return (arr ? "[" : "{") + String(json) + (arr ? "]" : "}");
}
}
});