nyan_cats= new Array();
function add_nyan(e){
var img=new Image();
img.src='http://upyachka.ru/images/11/nyan_up_only_20110830195938.gif';
var cat=document.createElement('div');
cat.setAttribute('class', 'nyan_cat');
cat.appendChild(img);
var nyan = {container:'',rainbow:'',width:0};
nyan.rainbow=document.createElement('div');
nyan.rainbow.setAttribute('class', 'nyan_rainbow');
nyan.container=document.createElement('div');
nyan.container.appendChild(nyan.rainbow);
nyan.container.appendChild(cat);
var main_container=document.createElement('div');
main_container.setAttribute('class', 'nyan_container');
main_container.appendChild(nyan.container);
//main_container.style.top=(window.pageYOffset+Math.floor(window.innerHeight/2)-63)+"px";
main_container.style.top=e.pageY-63+"px";
main_container.style.width=document.body.scrollWidth+200+"px";
document.body.appendChild(main_container);
nyan_cats.push(nyan);
}

function action()
{
for(var i=0;i<nyan_cats.length;i++)
	{
	nyan_cats[i].width+=5;
	nyan_cats[i].rainbow.style.width=nyan_cats[i].width+"px";
	nyan_cats[i].container.style.width=nyan_cats[i].width+500+"px";
	}
}

var nyan_interval;

function append_nyan(sender){
sender.style.display="none";
var style=document.createElement('style');
style.innerHTML=".nyan_container{position:absolute;top:100px;left:-200px;clear: both;height: 127px;width:100px;overflow:hidden;}.nyan_rainbow{background: url('http://upyachka.ru/images/11/raindow_20110830195926.gif') repeat-x scroll 0 10px transparent;float: left;height: 127px;    width: 1px;}.nyan_cat{	float: left; margin-left: -65px;}";
document.body.appendChild(style);
var music=document.createElement('object');
music.width=1;
music.height=1;
music.innerHTML='<param name="movie" value="http://www.youtube.com/v/GE8M5QM1sf8?version=3&amp;hl=ru_RU&amp;hd=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/GE8M5QM1sf8?version=3&amp;hl=ru_RU&amp;hd=1&amp;autoplay=1" type="application/x-shockwave-flash" width="1" height="1" allowscriptaccess="always" allowfullscreen="true"></embed>';
document.body.appendChild(music);
document.body.onclick=add_nyan;
nyan_interval=setInterval(action,30);
}

document.write('<input type="button" value="Nyan" onclick="append_nyan(this);">');

