(function(HomePage) {
    var hpd = document.getElementById('hpd');
    if(document.all && !window.opera) {    	if(!getCookie('hp') && !getCookie('nhp')) {
    		hpd.innerHTML = '<div>Часто здесь бываете? Сделайте Tululu стартовой страницей! &nbsp; &nbsp; <a id="hpl" href="#">Да, конечно!</a> &nbsp; &nbsp; <a id="nhp" href="#">Нет, спасибо</a></div>';

    		document.getElementById('hpl').onclick = function() {
    		   this.style.behavior = 'url(#default#homepage)';
    		   this.setHomePage(HomePage);
    		   setCookie('hp', 1, 999999999);
    		   hpd.innerHTML = '';
    		   var req = createRequestObject();
    		   req.open('GET', '/ajax/hp.php?t=l&url='+HomePage+'&'+Math.random(), false);
    		   req.send(null);
    		   return false;
    		}

    		document.getElementById('nhp').onclick = function() {    			setCookie('nhp', 1, 999999999);
    			hpd.innerHTML = '';
    			var req = createRequestObject();
    			req.open('GET', '/ajax/hp.php?t=n&url='+HomePage+'&'+Math.random(), false);
    			req.send(null);
    			return false;
    		}
    	}
    }

})('http://tululu.ru/');
function createRequestObject() {
  if (typeof XMLHttpRequest === 'undefined') {
    XMLHttpRequest = function() {
      try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }
        catch(e) {}
      try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); }
        catch(e) {}
      try { return new ActiveXObject("Msxml2.XMLHTTP"); }
        catch(e) {}
      try { return new ActiveXObject("Microsoft.XMLHTTP"); }
        catch(e) {}
      throw new Error("This browser does not support XMLHttpRequest.");
    };
  }
  return new XMLHttpRequest();
}
function setCookie( name, value, expires, path, domain, secure ) {
    var d = new Date();
    ed = (d.getTime() + expires * 1000);
	nd = new Date( ed );
    document.cookie = name+'='+escape( value ) + ( ( expires ) ? ';expires='+nd.toGMTString() : '' ) +
        ( ( path ) ? ';path=' + path : '' ) + ( ( domain ) ? ';domain=' + domain : '' ) + ( ( secure ) ? ';secure' : '' );
}
function getCookie( name ) {
    var start = document.cookie.indexOf( name + "=" );
    var len = start + name.length + 1;
    if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
        return false;
    }
    if ( start == -1 ) return false;
    var end = document.cookie.indexOf( ';', len );
    if ( end == -1 ) end = document.cookie.length;
    return unescape( document.cookie.substring( len, end ) );
}
function delCookie( name, path, domain ) {
    if ( getCookie( name ) ) document.cookie = name + '=' +
            ( ( path ) ? ';path=' + path : '') +
            ( ( domain ) ? ';domain=' + domain : '' ) +
            ';expires=Thu, 01-Jan-1970 00:00:01 GMT';
}
