﻿function _cookie(name, value, options) { if (typeof value != 'undefined') { options = options || {}; if (value === null) { value = ''; options.expires = -1; } var expires = ''; date = new Date(); date.setTime(date.getTime() + (1 * 24 * 60 * 60 * 1000)); expires = '; expires=' + date.toUTCString(); if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { var date; if (typeof options.expires == 'number') { date = new Date(); date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); } else { date = options.expires; } expires = '; expires=' + date.toUTCString(); } var path = options.path ? '; path=' + options.path : ''; var domain = options.domain ? '; domain=' + options.domain : ''; var secure = options.secure ? '; secure' : ''; document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); } else { var cookieValue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = cookies[i].replace(/(^\s*)|(\s*$)/g, ""); if (cookie.substring(0, name.length + 1) == (name + "=")) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; } } function _banner_cookie(divID, cookieName) { var _toolObj = document.getElementById(divID); if (document.body && _toolObj) { var t = 0; var account = _cookie(cookieName); var _itemsObj = _toolObj.getElementsByTagName("A"); var count = _itemsObj.length;  if (count == 0) { setTimeout("_banner_cookie('" + divID + "','" + cookieName + "')", 13);return; } function bannerShow(k) { for (var i = 0; i < count; i++) {  if (i + 1 == k) { _itemsObj.item(i).style.display = ''; } else { _itemsObj.item(i).style.display = 'none'; } } k = k >= count ? 1 : ++k; _cookie(cookieName, k);       } if (account == null) { var k = parseInt(1 + Math.random() * count); for (var i = 0; i < count; i++) { if (i + 1 == k) { _itemsObj.item(i).style.display = ''; } else {  _itemsObj.item(i).style.display = 'none'; } } ++k; _cookie(cookieName, k); } else { k = account; bannerShow(account); }} else { setTimeout("_banner_cookie('" + divID + "','" + cookieName + "')", 13);}}
