var Cookie = {
  set: function(name, value, daysToExpire) {
    var expire = '';
    if (daysToExpire != undefined) {
      var d = new Date();
      d.setTime(d.getTime() + (86400000 * parseFloat(daysToExpire)));
      expire = '; expires=' + d.toGMTString();
    }
    return (document.cookie = escape(name) + '=' + escape(value || '') + expire);
  },
  get: function(name) {
    var cookie = document.cookie.match(new RegExp('(^|;)\\s*' + escape(name) + '=([^;\\s]*)'));
    return (cookie ? unescape(cookie[2]) : null);
  },
  erase: function(name) {
    var cookie = Cookie.get(name) || true;
    Cookie.set(name, '', -1);
    return cookie;
  },
  accept: function() {
    if (typeof navigator.cookieEnabled == 'boolean') {
      return navigator.cookieEnabled;
    }
    Cookie.set('_test', '1');
    return (Cookie.erase('_test') === '1');
  }
};


function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

        function textileReference() {
            window.open( 
                "/admin/textile.html",
                "textile",
                "height=600,width=550,channelmode=0,dependent=0," +
                "directories=0,fullscreen=0,location=0,menubar=0," +
                "resizable=0,scrollbars=1,status=1,toolbar=0"
            );
        }

		
				
				function popupWin(link, width, height) {
					var scrX;
					var scrY;
					var scrW = screen.availWidth;
				    var scrH = screen.availHeight;				
          scrX = (scrW - width - 10) * .5;
          scrY = (scrH - height - 30) * .5;
          var windowAttributes = "width=" + width + ",height=" + height + ",left=" + scrX + ",top=" + scrY + ",screenX=" + scrX + ",screenY=" + scrY;
          windowAttributes += ",location=" + link ;
  

				    var popupWin = null;
				    popupWin = window.open(link,'winPopup',windowAttributes);  
				}