/* thumb */

var thumb = new Object; 

thumb.thumbs = new Array(),
	
thumb.start = function (code,height,num,def)
{
	this.thumbs[code]=new Object();
	this.thumbs[code].height=height;
    this.thumbs[code].num=num;
    this.thumbs[code].def=def;
    this.thumbs[code].timeoutId=0;
    this.thumbs[code].current=1;

    this.end(code);
	this.changepic(code);
}
	
thumb.end = function (code)
{ 
    if(typeof this.thumbs[code].timeoutId == "number") {
		window.clearTimeout(this.thumbs[code].timeoutId);
		delete this.thumbs[code].timeoutId;
    }

	t=document.getElementById(code);
	t.style.backgroundPosition='0 -'+((this.thumbs[code].def-1)*this.thumbs[code].height)+'px';
}

thumb.changepic =  function (code)
{
	if (this.thumbs[code].current > 0)
	{
		if (this.thumbs[code].current > this.thumbs[code].num)
			this.thumbs[code].current = 1;
		
		t=document.getElementById(code);
		t.style.backgroundPosition='0 -'+((this.thumbs[code].current-1)*this.thumbs[code].height)+'px';
		this.thumbs[code].current++;
		this.thumbs[code].timeoutId=window.setTimeout("thumb.changepic('"+code+"')",500);
	}
}

mpnavighover = function() {
    if (!document.getElementsByTagName) return false;
	var menus=document.getElementsByTagName("UL");
	for (var m=0; m<menus.length; m++)
	{
		if (menus[m].className=="mpnavig")
		{
			var sfEls = menus[m].getElementsByTagName("LI");
			for (var i=0; i<sfEls.length; i++)
			{
		        sfEls[i].onmouseover=function(){this.className+=" sfhover";}
				sfEls[i].onmouseout=function(){this.className=this.className.replace(new RegExp(" sfhover\\b"), "");}
			}
		}
	}
}
//ie
if (window.attachEvent) window.attachEvent("onload",mpnavighover);


var dodo = {
	test: function(snippetId, r)
	{
		
		alert(nette.result.snippets);
//		var snippet = nette.result.snippets[snippetId];
		//delete nette.result.snippets[snippetId];
		//alert(snippet);
		//alert(snippetId + r);
		//nette.updateSnippet(snippetId, snippet);
/*
		var snippet = nette.result.snippets[snippetId];
		delete nette.result.snippets[snippetId];

		nette.processing += 1;

		var el = document.getElementById(snippetId);
		var img = $('table tr:eq(' + (3-y) + ') td:eq(' + (3-x) + ') img', el);
		img.parent().replaceWith(img);
		img.css('z-index', 1000);
		img.animate({
			'left': dx * img.attr('width') + 'px',
			'top': dy * img.attr('height') + 'px'
		});
		img.queue(function () {
			nette.updateSnippet(snippetId, snippet);
			nette.processing -= 1;
		});
*/
	}
}


