/** Returns the most probable height of inner window size. */
function winH() {
	if (window.innerHeight)
		/* NN4 a kompatibilni prohlizece */
		return window.innerHeight;
	else if (document.documentElement && document.documentElement.clientHeight)
		/* MSIE6 v std. rezimu - Opera a Mozilla jiz uspely s window.innerHeight */
		return document.documentElement.clientHeight;
	else if (document.body && document.body.clientHeight)
		/* starsi MSIE + MSIE6 v quirk rezimu */
		return document.body.clientHeight;
	else
		return null;
}

/** Returns the most probable width of inner window size. */
function winW() {
	if (window.innerWidth)
		/* NN4 a kompatibilni prohlizece */
		return window.innerWidth;
	else if (document.documentElement && document.documentElement.clientWidth)
		/* MSIE6 v std. rezimu - Opera a Mozilla jiz uspely s window.innerWidth */
		return document.documentElement.clientWidth;
	else if (document.body && document.body.clientWidth)
		/* starsi MSIE + MSIE6 v quirk rezimu */
		return document.body.clientWidth;
	else
		return null;
}





/*
 * Server and client time in moment of initialization. Difference of these two values is used for counting current server time
 */
var startServerTime = -1;
var startPageTime = -1;
/*
 * Initialization of time variables. Parses "serverTime" element for long value of server time and 
 * sets startPageTime to value of client side current time. 
 */
function initTime() {
	if(startServerTime==-1) {
		var text = document.getElementById("serverTime").innerHTML;
		startServerTime = parseInt(text, 10);
	}
	if(startPageTime==-1) {
		startPageTime = new Date().getTime();
	}
}


/*
 * Updates shown time; 
 */
function SetTime()
{
 /* gets current time on client side */
  var now = new Date();
  
  /* count difference between server and client time */
  var diff = startServerTime - startPageTime;
  
  /* add difference to current time */
  var date = new Date();
  date.setTime(now.getTime()+diff);
  
  /* write out counted time using locale formatting */
  document.getElementById("serverTime").innerHTML =date.toLocaleString();
}

/*
 *  Cycle method - ubdates shown time and sets new timeout
 */
function UpdateCycle() {
    SetTime();
    setTimeout("UpdateCycle()",250);
}

/* Makes time initialization and Starts time cycle*/
function initCycle() {
	initTime();
	UpdateCycle();
}






document.cookie = "screenHeight=" + screen.height;
document.cookie = "windowHeight=" + winH();
document.cookie = "screenWidth=" + screen.width;
document.cookie = "windowWidth=" + winW();

