window.addEvent('domready', function(){
		postaviCevi();
});



window.onresize = postaviCevi;
//window.onscroll = postaviCevi;
function postaviCevi(){ //return;
	//	alert( getWindowHeight() );
	//return;
	//	alert( f_clientHeight() + ';'+ f_scrollTop() );
	var _wHeight = f_clientHeight();
	var _docHeight = getWindowHeight();
	var left = ($('page').getFirst().getPosition().x+90 );
	//	alert( left );

	if( _docHeight > 600 ){
		$$('#strana #levo .modulecevi').setStyle('top',(_docHeight-710+550)+'px');
		$$('#strana #levo .modulecevi').setStyle('position','fixed');
		$$('#strana #levo .modulecevi').setStyle('left',left+'px');
		$$('#strana #levo .modulecevi').setStyle('padding','0px');
		$$('#strana #levo .modulecevi').setStyle('display','block');
	}
	else // if( _docHeight >= 550 ){

// 	}
// 	else if(_docHeight < 500)
		{
	var left = ($('page').getFirst().getPosition().x+90 );
		var _pageHeight=parseInt(( $$('#page').getStyle('height') ));
		var top = Math.max(550, ( _pageHeight - 250));
		//				alert( top+';'+_pageHeight );
		$$('#strana #levo .modulecevi').setStyle('left',left+'px');
		$$('#strana #levo .modulecevi').setStyle( 'top',top+'px');
		$$('#strana #levo .modulecevi').setStyle('position','absolute');
		$$('#strana #levo .modulecevi').setStyle('display','block');
	}
	//	alert( (_docHeight-710) );
	return;
	//	alert( _docHeight );return;
	var contentHeight=document.getElementById('strana').offsetHeight;
	var pT = Math.max(_docHeight,contentHeight) - 550;
	//	var pH = 250 - f_scrollTop();;
	$$('#strana #levo .modulecevi p').setStyle('height',pT+'px');
	//alert('height'+pT+'px');
	//	alert(('height'+pT+'px'));
	// 	$$('#levo .modulecevi p').setStyle('top',pT+'px');

// 	alert( $$('#page').getStyle('height'));
// 	var _top;
// 	if(scnHei<700){
// 		pH = 250;
// 		pT = 60;
// 	}
// 	else if( scnHei<740){
// 		pH = 250;
// 		pT = 60;
// 		pT = scnHei - 484 -60;
// 	}
// 	else if( scnHei<860){
// 		pH = 250;
// 		pT = scnHei - 484;
// 	}
// 	else{
// 		pH = 250;
// 		pT = scnHei - 484;
// 	}
// 	$$('#levo .modulecevi p').setStyle('height',pH+'px');
// 	$$('#levo .modulecevi p').setStyle('top',pT+'px');
}



function getWindowHeight() {
	var windowHeight=0;
	if (typeof(window.innerHeight)=='number') {
		windowHeight=window.innerHeight;
	}
	else {
		if (document.documentElement&&
			document.documentElement.clientHeight) {
			windowHeight=
				document.documentElement.clientHeight;
		}
		else {
			if (document.body&&document.body.clientHeight) {
				windowHeight=document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}


