
// if(window.some_function_name_here)

// alert('jest');
var mnuHoverTout = 60;

var fsMax = 32;
var fsMin = 26;
var mnuHoverTmr = false;
var mnuHoverOutTmr = false;

var canRunMM = true;

function od_mnu_hover(mnuId) {
	
			
	canRunMM = false;
			
	
	if( document.getElementById('od_mm' + mnuId ) ) {
		if( mnuHoverOutTmr[mnuId] ) clearTimeout( mnuHoverOutTmr[mnuId] );
		
		m = document.getElementById('od_mm' + mnuId ); // current
		if( m.style.fontSize ) {
			ms = parseInt(m.style.fontSize.replace('px', ''));
		} else {
			ms = fsMin;
		}
		ms = (1.04 * ms) + 1;
		m.style.fontSize = ms + 'px';
		//alert(ms);
		
		m.style.opacity = Math.max(0.82, (ms / fsMax));
		m.style.filter = 'alpha(opacity=' + Math.max(85, 95 * (ms / fsMax)) + ')';
		
		if( ms < fsMax ) {
			eval('mnuHoverTmr' + mnuId + '= setTimeout(\'od_mnu_hover(\' + mnuId + \')\', mnuHoverTout);');
		} else {
			m.style.fontSize = fsMax + 'px';
			eval( 'clearTimeout(mnuHoverTmr' + mnuId + ');' );
			
			//canRunMM = true;
			
		}
	}
}

function od_mnu_hover_out(mnuId) {
			
	canRunMM = false;
			
	if( document.getElementById('od_mm' + mnuId ) ) {
		eval('if( mnuHoverTmr' + mnuId + ' ) clearTimeout( mnuHoverTmr' + mnuId + ' );');
		m = document.getElementById('od_mm' + mnuId ); // current
		if( m.style.fontSize ) {
			ms = parseInt(m.style.fontSize.replace('px', ''));
		} else {
			ms = fsMin;
		}
		ms = (0.95 * ms) - 1;
		m.style.fontSize = ms + 'px';
		//alert(ms);
		
		m.style.opacity = Math.max(0.82, (ms / fsMax));
		m.style.filter = 'alpha(opacity=' + Math.max(85, 95 * (ms / fsMax)) + ')';
		
		if( ms > fsMin ) {
			mnuHoverOutTmr[mnuId] = setTimeout('od_mnu_hover_out(' + mnuId + ')', mnuHoverTout / 2);
		} else {
			m.style.fontSize = fsMin + 'px';
			
			canRunMM = true;
			
		}
	}
}



function doSomething(e) {
	if (!e) var e = window.event;
	var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body
	var dsoctop=document.all? iebody.scrollTop : pageYOffset
	$('#tekst').scrollTo(dsoctop); // , {duration:500}
}


function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		findPos(obj.offsetParent);
	} 
	curleft += obj.offsetLeft;
	curtop += obj.offsetTop;
	retArr = new Array(2);
	retArr[0] = curleft;
	retArr[1] = curtop;
	return retArr;
}

var mmTmr = 400;
function moveMe() {
	if( mmTmr > 400 ) mmTmr = 0;
	//if( Math.round(2 * Math.random() > 1) ) {
		//obj = document.getElementById('logopng');
	//} else {
		if( Math.round(2 * Math.random() > 1) ) {
			obj = document.getElementById('kartka_p2');
		} else {
			obj = document.getElementById('kartka_p3');
		}
	//}
	xy = findPos(obj);
	ox = Math.round(-1 + 2 * Math.random());
	oy = Math.round(-1 + 2 * Math.random());
	if( (ox != 0) || (oy != 0) ) {
		obj.style.left = xy[0] + ox + 'px';
		obj.style.top = xy[1] + Math.round(-1 + 2 * Math.random()) + 'px';
	}
	mmTmr += 100;
	if( canRunMM && (mmTmr < 400) ) setTimeout('moveMe()', 400 * Math.random() + mmTmr + 200 );
}


