var ua = navigator.userAgent.toLowerCase();
var divw=0;
var divh=0;
 
if (document.getElementById || document.all)
	document.write('<div id="imgtrailer" style="position:absolute;visibility:hidden;"></div>')
 
function gettrailobject()
	{
	if (document.getElementById)
		return document.getElementById("imgtrailer")
	else if (document.all)
		return document.all.trailimagid
	}
 
function gettrailobj()
	{
	if (document.getElementById)
		return document.getElementById("imgtrailer").style
	else if (document.all)
		return document.all.trailimagid.style
	}
 
function truebody()
	{
	return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
	}
 
function hidetrail()
	{
	gettrailobject().innerHTML=" ";
	document.onmousemove='';
	gettrailobj().visibility="hidden";
	}
 
function trailOn(thumbimg,imgtitle,imgscription,thw,thh)
	{
		gettrailobj().left="-500px";
		divthw = parseInt(thw) + 2;
		
 
			gettrailobject().innerHTML = '<div style="padding:10px; width: 220px; background: url(pic/load.gif) 50% 50% #151515 no-repeat;"><img src="'+thumbimg+'" border="0" width="220px" height="220px"><p class="main_textover"><i>'+imgscription+'</i></p></div>';
		
		
		
		gettrailobj().visibility="visible";
		divw = parseInt(thw)+25;
		divh = parseInt(thh)+130;
		document.onmousemove=followmouse;
	}
 
function followmouse(e)
	{
	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(document.body.offsetHeight, window.innerHeight)
if(typeof e != "undefined")
	{
	if(docwidth < 15+e.pageX+divw)
		xcoord = e.pageX-divw-5;
	else
		xcoord = 15+e.pageX;
	if(docheight < 15+e.pageY+divh)
		ycoord = -280+e.pageY-Math.max(0,(divh + e.pageY - docheight - truebody().scrollTop - 30));
	else
		ycoord = -280+e.pageY;
	}
else if (typeof window.event != "undefined")
	{
	if(docwidth < 15+truebody().scrollLeft+event.clientX+divw)
		xcoord = truebody().scrollLeft-5+event.clientX-divw;
	else
		xcoord = truebody().scrollLeft+15+event.clientX;
 
	if(docheight < 15+truebody().scrollTop+event.clientY+divh)
		ycoord = -280+truebody().scrollTop+event.clientY-Math.max(0,(divh + event.clientY - docheight - 30));
	else
		ycoord = -280+truebody().scrollTop+15+event.clientY;
	}
	gettrailobj().left=xcoord+"px"
	gettrailobj().top=ycoord+"px"
	}
 
 
 
 $(function(){
 allw=$('#-footer').width()-72;
 onew=$('div.footer_main_konteiner:first').width();
 kol=Math.round(allw/onew);
 //alert('asd'+kol);
 $('div.footer_main_konteiner:lt('+kol+')').show();
 
 $(window).resize(function(){
 //alert('1');
 allw=$('#-footer').width()-72;
 onew=$('div.footer_main_konteiner:first').width();
 kol=Math.round(allw/onew);
 $('div.footer_main_konteiner:lt('+kol+')').show();
 $('div.footer_main_konteiner:gt('+kol+')').hide();
 });
 
 
 });
