var jsxRatio = (744)/640;
var jsxOpenTime = 500;
var jsxCloseTime = 1500;
var jsxUrl = 'http://wizytownik.net';// link do strony z reklama

$().ready(function(){
        $('#peel-cover').click(function(){window.open(jsxUrl)}).css('opacity',0.0).hover(jsxIn,jsxOut);
            if($.browser.msie)
            {
			 $('#peel').html("<div id='peel-image-ie'></div>");
		    }
		jsxAnimate(2000);
});
function jsxIn()
    {
        $('#peel, #peel-cover').stop();
		$('#bg').stop();
		$('#tiny').stop().hide();
		$('#peel, #peel-cover').animate({width:500*jsxRatio,height:500*jsxRatio},jsxOpenTime);
		$('#bg').animate({width:500,height:500},jsxOpenTime);
	}
function jsxOut()
    {
        $('#peel, #peel-cover').stop();
		$('#bg').stop();
		$('#peel, #peel-cover').animate({width:75*jsxRatio,height:75*jsxRatio},jsxCloseTime);
		$('#bg').animate({width:75,height:75},jsxCloseTime,function(){$('#tiny').show().width(75).height(75);});
	}
function jsxAnimate(nt)
	{
        var n = 79+Math.floor(Math.random()*3);
	    var t = 1500;
	    if(nt) t = nt;
	    var w = $('#bg').width();
	    if(w > 75)
	     n = 75;
	    var nw = Math.floor(n*jsxRatio);
	    var nh = Math.floor(n*jsxRatio);
	   $('#peel').stop().animate({opacity:1,width:nw,height:nh},t,'swing')
	   $('#peel-cover').stop().animate({opacity:0,width:nw,height:nh},t,'swing')
	   $('#bg').stop().animate({width:n,height:n},t,'swing',jsxAnimate);
	   $('#tiny').stop().animate({width:n,height:n},t,'swing');
	}

