Fishker = {};
Fishker.LINK = "http://www.fishker.ru/net/registration?wmid=133";
Fishker.wsize = function(){
	var wwidth = (window.innerWidth) ? window.innerWidth :
		((document.all) ? document.body.offsetWidth : null); 
	var wheight = (window.innerHeight) ? window.innerHeight: 
    	((document.all) ? document.body.offsetHeight : null);
    return {x: wwidth, y: wheight};
};

Fishker.closePopup = function(){
	var d = document.getElementById("fishker-popup");
	d.parentNode.removeChild(d);
};

Fishker.popup = function(text, footnote){
	var div = document.createElement("DIV");
	var w = Fishker.wsize();
	var y = Math.round(w.y/2-100);
	var x = Math.round(w.x/2-175);
	if (y < 0) y = 0;
	if (x < 0) x = 0;
	div.innerHTML = '<table border="0" style="' +
		'z-index: 10000; border-collapse: separate; font: message-box; border: ActiveBorder ridge; background: Window; padding: 15px; width: 350px; position: absolute; top:' + y + 'px; left:' + x + 'px;"' +
		'><tbody><tr><td colspan="2" style="padding-bottom:10px; color: WindowText;">' +
		text +
		'</td></tr>' +
		'<tr><td style="text-align:center"><a href="' + Fishker.LINK + '" target="blank" onclick="Fishker.onRegister(); Fishker.closePopup(); return true;" style="font: caption; text-decoration:none;color: WindowText;"><button>Зарегистрироваться</button></a></td>'+
		'<td style="text-align:center"><a href="#" onclick="Fishker.closePopup(); return false; " style="font: caption; text-decoration:none;color: WindowText;"><button>Нет, спасибо</button></a></td></tr>' +
		'<tr><td colspan="2" style="font-size: 85%; color: WindowText;">*' + footnote + '</td></tr>' +
		'</tbody></table>';
	div.style.height = div.style.width = "100%";
	div.style.top = div.style.left = "0";
	div.style.position = "absolute";
	div.id = "fishker-popup";
	document.body.appendChild(div);
};

Fishker.onRegister = function(){
	if (!false){
		var div = document.createElement("DIV");
		div.innerHTML = '<img src="http://partners.fishker.com/reg_btn"/>';
		div.style.display = "none";
		document.body.appendChild(div);
	}
}

Fishker.popupOnload = function(){
    var ie  = !!(window.attachEvent && !window.opera);
    var wk  = /webkit\/(\d+)/i.test(navigator.userAgent) && (RegExp.$$1 < 525);
    var fn  = [];
    var run = function () { for (var i = 0; i < fn.length; i++) fn[i](); };
    var d   = document;
    d.fishkerready = function (f) {
    	if (false)
    		f();
    	else{
    		if (!ie && !wk && d.addEventListener)
	            return d.addEventListener('DOMContentLoaded', f, false);
	        if (fn.push(f) > 1) return;
	        if (ie)
	            (function () {
	                var ok = false;
	                try { d.documentElement.doScroll('left'); ok = true;}
	                catch (err) { setTimeout(arguments.callee, 0); }
	                if(ok) run();
	            })();
	        else if (wk)
	            var t = setInterval(function () {
	                if (/^(loaded|complete)$$/.test(d.readyState))
	                    clearInterval(t), run();
	            }, 0);
    	}
    };
};

Fishker.popupOnload();

document.fishkerready(function() {
	Fishker.popup('Приглашаем Вас зарегистрироваться в социальной сети Фишкер. Вы получите доступ к миллионам видео, аудио и фото файлов, а так же сможете найти старых и новых друзей.', 'Ссылка открывается в новом окне');
	Fishker.countLiveinternet();
});

Fishker.countLiveinternet = function(){
	var div = document.createElement("div");
	div.innerHTML = "<img src='http://counter.yadro.ru/hit;fishkerpartner?t52.6;" +
	"r"+escape(document.referrer)+
	//"r"+escape(document.URL)+
	((typeof(screen)=="undefined")?"":
	";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?
	screen.colorDepth:screen.pixelDepth))+
	";u"+escape(document.URL)+
	//";u"+escape("http://partners.fishker.com")+
	";"+Math.random()+
	"' alt='' title='LiveInternet: показано число просмотров и"+
	" посетителей за 24 часа' "+
	"border='0' width='88' height='31'>";
	div.style.position = 'absolute';
	div.style.overflow = 'hidden';
	div.style.width = '0px';
	div.style.height = '0px';
	document.body.appendChild(div);
}