    function FixCookieDate(date) {
    var base = new Date(0);
    var skew = base.getTime();
    if (skew > 0)date.setTime(date.getTime() - skew);
    }

    function getCookieVal (offset) {
    var endstr = document.cookie.indexOf(";", offset);
    if (endstr == -1) endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
    }

    /*function GetCookie(name) {
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while (i < clen) {
        var j = i + alen;
        if (document.cookie.substring( i , j ) == arg) return getCookieVal(j);
        i = document.cookie.indexOf(" ", 1 ) + 1;
        if (i==0) break;
    }
    return null;
    }*/
	
	function GetCookie(name) {
    var arg = name + "=";
	var cval = document.cookie;
	
	tmp_pos = cval.indexOf(arg);
  if (tmp_pos == -1)
    return "";

    tmp_str = cval.substr(tmp_pos);
	
	tmp_pos1 = tmp_str.indexOf("=")+1;
	tmp_pos2 = tmp_str.indexOf(";");
	
	ret_val = tmp_str.substring(tmp_pos1, tmp_pos2);
	return ret_val;
	}

    function SetCookie(name,value,expires,path,domain,secure) {
    document.cookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
    }
    
    function DelCookie(name,path,domain) {
    if(GetCookie(name)) {
        document.cookie = name + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "");
      }
    }

function topleft(url) 
{ 
  if(url.indexOf('album')>0) 
  {
    window.open(url, "", "width=814,height=604,status=no,toolbar=no,location=yes,menubar=no,scrollbars=yes, resizable=yes");
  }
  else 
  {
    location.href=url;
  }
}

	//bolotov grisha for ie6
       var  m = document.uniqueID /*IE*/
        && document.compatMode  /*>=IE6*/
        && !window.XMLHttpRequest /*<=IE6*/
        && document.execCommand ;

        try{
                if(!!m){
                        m("BackgroundImageCache", false, true) /* = IE6 only */
                }

        }catch(oh){};
