function getCookie(c_name) { if (document.cookie.length > 0) { c_start = document.cookie.indexOf(c_name + "=") if (c_start != -1) { c_start=c_start + c_name.length + 1 c_end=document.cookie.indexOf(";",c_start) if (c_end == -1) c_end=document.cookie.length return unescape(document.cookie.substring(c_start,c_end)) } } return null } function SetCookie (name, value, expires) { var argv = SetCookie.arguments; var argc = SetCookie.arguments.length; var expires = (argc > 2) ? argv[2] : null; var path = (argc > 3) ? argv[3] : null; var domain = (argc > 4) ? argv[4] : null; var secure = (argc > 5) ? argv[5] : false; var exp = new Date(); exp.setTime(exp.getTime() + (expires*24*60*60*1000)); document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + exp.toGMTString())) + // ((path == null) ? "" : ("; path=" + path)) + "; path=/" + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); } function addselection(id) { selection = getCookie('selection') if (selection!=null) { if (selection.indexOf(id) == -1) { SetCookie('selection',selection+';'+id,500) alert("The announcement "+id+" has been added to your selection") } else { alert("The announcement "+id+" already exists in your selection") } } else { SetCookie('selection',';'+id,500) alert("The announcement "+id+" has been added to your selection") } } function rmselection(id) { selection = getCookie('selection') if ( (selection!=null) && (selection.indexOf(id) != -1) ) { var selection = selection.toString(); var reg1 = new RegExp(';'+id, "gi"); selection = selection.replace(reg1,""); //alert(selection); SetCookie('selection',selection,500); alert("The announcement "+id+" has been withdrawn from your selection"); document.location=document.location; } } // selection = getCookie('selection'); // alert(selection);