<!--
var wsw = (window.screen.width);
var wsh = (window.screen.height);

var wwsw = rozmeryKlient('w');
var wwsh = rozmeryKlient('h');

/* ====================================================================== */


	function ReceiveServerData(arg, context) {

		var cb = arg.toString();
		var myArr = cb.split('|');


		if (myArr[0] == 'chyba') {

			// prozatim nic

		} else if (myArr[0] == 'clkHODed') { // hodnoceni clanku - uz hlasoval(a)

			gEBI('clkHodMsg').innerHTML = 'U&#x17e; jsi hlasoval(a)';
			gEBI('clkHodMsg').style.display = '';

		} else if (myArr[0] == 'clkHOD') { // hodnoceni clanku - uprava zobrazeni

			gEBI('hYesPocet').innerHTML = myArr[1] + 'x';
			gEBI('hNoPocet').innerHTML = myArr[2] + 'x';
			gEBI('clkHodMsg').style.display = '';


		} else if (myArr[0] == 'voted') { // palcovani na HP - uz hlasoval(a)

			gEBI('palceMsg').innerHTML = 'Znovu hlasovat nelze';
			gEBI('palceMsg').style.top = '100px';
			gEBI('palceMsg').style.display = '';

		} else if (myArr[0] == 'vote') { // palcovani na HP - uprava zobrazeni

			gEBI('percAno').innerHTML = myArr[1] + '%';
			gEBI('graphAno').style.height = myArr[2] + 'px';
			gEBI('percNe').innerHTML = myArr[3] + '%';
			gEBI('graphNe').style.height = myArr[4] + 'px';
			gEBI('palceMsg').style.display = '';

		}
	}


/* ====================================================================== */

function validateLength(sender, args) {
	var tb = gEBI(srchtb);
	if (tb.value.length < 3) {
		//show an error message
		args.IsValid = false;
	} else {
		args.IsValid = true;
	}
}

/* ====================================================================== */

function ensureChecked(source, args) {
	var cb = document.getElementById(cbREG);
	if ( cb.checked == true ) {
		args.IsValid = true;
	} else {
		args.IsValid = false;
	}
}

/* ====================================================================== */

function ensureCheckedPredplatne(source, args) {
	var cb = document.getElementById(cbPP);
	if ( cb.checked == true ) {
		args.IsValid = true;
	} else {
		args.IsValid = false;
	}
}

/* ====================================================================== */

function ShowHideAdresa2(el,akce) {
	if (el.checked) {
		for (i=1; i<=7; i++) {
			gEBI('tr'+i).style.display = akce;
		}
	}
}

/* ====================================================================== */
/*  predplatne adresa 2  */
/* ==================== */

function ppEnsureJmeno(source, args) {
	var cb = document.getElementById(p2Adresa);
	var el = document.getElementById(p2Jmeno);
	if (cb.checked == true) {
		if (el.value.length != 0) {
			args.IsValid = true;
		} else {
			args.IsValid = false;
		}
	} else {
		args.IsValid = true;
	}
}


function ppEnsurePrijmeni(source, args) {
	var cb = document.getElementById(p2Adresa);
	var el = document.getElementById(p2Prijmeni);
	if (cb.checked == true) {
		if (el.value.length != 0) {
			args.IsValid = true;
		} else {
			args.IsValid = false;
		}
	} else {
		args.IsValid = true;
	}
}


function ppEnsureUlice(source, args) {
	var cb = document.getElementById(p2Adresa);
	var el = document.getElementById(p2Ulice);
	if (cb.checked == true) {
		if (el.value.length != 0) {
			args.IsValid = true;
		} else {
			args.IsValid = false;
		}
	} else {
		args.IsValid = true;
	}
}


function ppEnsureMesto(source, args) {
	var cb = document.getElementById(p2Adresa);
	var el = document.getElementById(p2Mesto);
	if (cb.checked == true) {
		if (el.value.length != 0) {
			args.IsValid = true;
		} else {
			args.IsValid = false;
		}
	} else {
		args.IsValid = true;
	}
}


function ppEnsurePSC(source, args) {
	var cb = document.getElementById(p2Adresa);
	var el = document.getElementById(p2PSC);
	if (cb.checked == true) {
		if (el.value.length != 0) {
			args.IsValid = true;
		} else {
			args.IsValid = false;
		}
	} else {
		args.IsValid = true;
	}
}


/* ====================================================================== */

function usePngFix() {
	$(document).ready(function(){$(document).pngFix();});
}


/* ====================================================================== */
/* MSGS  */
/* ==== */

function MsgShow(idecko,sec) {
	if (document.getElementById) document.getElementById(idecko).style.display = '';
	if (parseInt(sec) > 0) setTimeout("MsgClose('"+idecko+"',false)", parseInt(sec) * 1000);
}

function MsgClose(idecko,zpet) {
	if (document.getElementById) document.getElementById(idecko).style.display = 'none';
	if (zpet) history.go(-1);
}

/* ====================================================================== */
/* SearchForm */
/* ==========*/

function popUpSrchForm() {
	$('div#sfClose').hide(); $('div#sfOpen').show(); $('div#srchForm').animate({ top: '-37px' }, 1);
}

function hideSF() {
	$('div#srchForm').animate({ top: '-37px' }, 500, 'easein'); $('div#sfClose').hide(); $('div#sfOpen').show();
}

function showSF() {
	$('div#srchForm').animate({ top: '0px' }, 500, 'backin'); $('div#sfClose').show(); $('div#sfOpen').hide();
}

/* ====================================================================== */
/* LoginForm */
/* =========*/

function popUpLoginForm() {
	$('div#lfClose').hide(); $('div#lfOpen').show(); $('div#LoginForm').animate({ top: '-37px' }, 1);
}

function hideLF() {
	$('div#LoginForm').animate({ top: '-37px' }, 500, 'easein'); $('div#lfClose').hide(); $('div#lfOpen').show();
}

function showLF() {
	$('div#LoginForm').animate({ top: '0px' }, 500, 'backin'); $('div#lfClose').show(); $('div#lfOpen').hide();
}


/* ====================================================================== */


function showClona() {

	var cL = gEBI('clona');

	cL.style.display = '';
	cL.style.height = wwsh + 'px';

	if(detectBrowser() == 'Microsoft Internet Explorer') {
		cL.style.filter = 'alpha(opacity=40)';
	} else {
		cL.style.opacity = 0.4;
	}

}


/* ====================================================================== */


function ShowForumForm(p) {

	gEBI(prnt).value = p;
	gEBI(rldd).value = '0';
	showClona();
	var ff = gEBI('forumFormular');
	ff.style.left = (wwsw - 500) / 2 + 'px';
	ff.style.top = (wwsh - 300) / 2 + 'px';
	ff.style.display = '';

}

function CloseForumForm() {

	gEBI('clona').style.display = 'none';
	var ff = gEBI('forumFormular');
	ff.style.display = 'none';

}


/* ====================================================================== */


function ShowTemaForm(p) {

	gEBI(ruum).value = p;
	showClona();
	var ff = gEBI('temaFormular');
	ff.style.left = (wwsw - 500) / 2 + 'px';
	ff.style.top = (wwsh - 400) / 2 + 'px';
	ff.style.display = '';

}

function CloseTemaForm() {

	gEBI('clona').style.display = 'none';
	var ff = gEBI('temaFormular');
	ff.style.display = 'none';

}




/* ====================================================================== */


function chngTemplejt(bgr, logo, titl) {

	var b = gEBI('bodyID');
	b.className = bgr + ' ' + logo + ' ' + titl;
}


function skinThisPage(skin) {

	var b = gEBI('bodyID');

	b.className = skin;

}

function skinTitle(skin) {

	var b = gEBI('bodyIn');

	b.className = skin;

}


/* ====================================================================== */

function ShowHideKSinfo(el, cil) {

	var ksi = gEBI(cil);

	if (ksi.style.display == 'none') {

		ksi.style.display = '';
		el.className = 'subSekceInfoMinus';

	} else {

		ksi.style.display = 'none'
		el.className = 'subSekceInfoPlus';

	}

}


/* ====================================================================== */

function ZobrazitDatum(datum, divadlo, rUrl, sekce) {

	var dat = gEBI(datum).value;

	var arr = dat.split(".");

	var d = arr[0].toString(); if (d.length == 1) { d = '0' + d; }
	var m = arr[1].toString(); if (m.length == 1) { m = '0' + m; }
	var y = arr[2].toString();

	//alert(y + m + d);

	var dlo = gEBI(divadlo);

	var sel = dlo.options[dlo.selectedIndex];

	//alert(sel.text);


	if (sel.value == "0") {

		location = rUrl + '/'+ sekce + '/' + y + m + d;

	} else {

		location = rUrl + '/'  + y + m + d + '/' + sel.value + '.htm';

	}

}

/* ====================================================================== */

function ZobrazitKino(datum, kino, film, rUrl, sekce) {

	var dat = gEBI(datum).value;

	var arr = dat.split(".");

	var d = arr[0].toString(); if (d.length == 1) { d = '0' + d; }
	var m = arr[1].toString(); if (m.length == 1) { m = '0' + m; }
	var y = arr[2].toString();

	//alert(y + m + d);

	var kEL = gEBI(kino);
	var kSel = kEL.options[kEL.selectedIndex];

	//alert(kSel.text);


	var fEL = gEBI(film);
	var fSel = fEL.options[fEL.selectedIndex];

	//alert(fSel.text);

	
	if (kSel.value == "0" && fSel.value == "0") {	// nevybrane ani kino ani film

		location = rUrl + '/'+ sekce + '/' + y + m + d;

	} else if (kSel.value == "0" && fSel.value !== "0") {	// nevybrane kino, vybrany film

		location = rUrl + '/'+ sekce + '/' + y + m + d + '/' + fSel.value + '.htm';

	} else if (kSel.value !== "0" && fSel.value !== "0") {	// vybrane kino i film

		location = rUrl + '/' + y + m + d + '/' + kSel.value + '/' + fSel.value + '.htm';
	
	} else { // vybrane jen kino

		location = rUrl + '/'  + y + m + d + '/' + kSel.value + '.htm';

	}
	
}


/* ====================================================================== */


function CreateLink( domena, name, text ) {
zavinac = "@"

    if( CreateLink.arguments.length == 2 ) {

		document.write('<a href="mailto:'+ name + zavinac + domena +'">'+ name + zavinac + domena +'<\/a>');

	} else {

		document.write('<a href="mailto:'+ name + zavinac + domena +'">'+ text +'<\/a>');
  
	}

}	// CreateLink()


/* ====================================================================== */


function gEBI(eID) {
	var obj = document.getElementById(eID);
	return obj;
}	// gEBI()


/* ====================================================================== */


function detectBrowser() {
	return navigator.appName;
}


/* ====================================================================== */


function rozmeryKlient(typRozmeru) {

	var kW = 0;
	var kH = 0;

	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		kW = window.innerWidth;
		kH = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		kW = document.documentElement.clientWidth;
		kH = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		kW = document.body.clientWidth;
		kH = document.body.clientHeight;
	}

	if (typRozmeru == 'h') {
		return kH;
	} else if (typRozmeru == 'w') {
		return kW;
	}

}


/* ====================================================================== */


//color -> worst
var initColor = new Array(208,16);
//color -> best
var endColor = new Array(16,208);
//
var composante3 = 16;
//messages
var infoSecure = "heslo je: "
var secureMsg = new Array("", infoSecure+"velmi slabé", infoSecure+"slabé",infoSecure+"pĝijatelné",infoSecure+"silné",infoSecure+"velmi silné");
//maximum value
var coefColor = 13;

var valSecure = 0;

function Password_check(obj) {
  valSecure = 0;
  //one lower case letter
  if (obj.value.match(/[a-z]/)) {
    valSecure++;
  }                         

  //one upper case letter
  if (obj.value.match(/[A-Z]/)) {
    valSecure++;
  }  

  //one number
  if (obj.value.match(/\d+/)) {
    valSecure++;
  }

  //both upper and lower case
  if (obj.value.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)) {
    valSecure+=3;
  }

  //both letters and numbers, almost works because an additional character is required
  if (obj.value.match(/(\d.*\D)|(\D.*\d)/)) {
    valSecure+=3;
  }

  /*
  //three numbers
  if (obj.value.match(/(.*[0-9].*[0-9].*[0-9])/)) {
    valSecure++;
  }

  //one special character
  if (obj.value.match(/.[!,@,#,$,%,^,&,*,?,_,~]/)) {
    valSecure++;
  }

  //letters, numbers, and special characters
  if (obj.value.match(/([a-zA-Z0-9].*[!,@,#,$,%,^,&,*,?,_,~])|([!,@,#,$,%,^,&,*,?,_,~].*[a-zA-Z0-9])/)) {
    valSecure++;
  }
  */

  if (obj.value.length ==0) {
    valSecure = 0;
  } else if (obj.value.length <= 4) {
    valSecure=1;
  } else if (obj.value.length <= 7) {
    valSecure=2;
  } else {
    valSecure += 4;
  }

  getBar(valSecure);
}

function getBar(refColor) {

  var rgbColor = new Array();
  rgbColor = getColor(refColor);

  document.getElementById("passwd_lv").style.backgroundColor = "rgb("+ rgbColor[0] +"," + rgbColor[1] + "," + composante3 + ")";
  document.getElementById("passwd_lv").style.width = Math.round(100*refColor/coefColor) + "%";
  document.getElementById("passwd_lv_txt").innerHTML = secureMsg[Math.ceil(refColor/coefColor*(secureMsg.length-1))];
  document.getElementById("passwd_lv_txt").style.color = "rgb("+ rgbColor[0] +"," + rgbColor[1] + "," + composante3 + ")";
}

function getColor(coef) {

  var diffr = 0;
  var diffg = 0;
  var tabResult = new Array(0,0);
  var coefV1 = 1;
  var coefV2 = 1;

  if (endColor[0]>=initColor[0]) {
    diffr = endColor[0] - initColor[0];
    coefV1 = 1;
  } else {
    diffr = initColor[0] - endColor[0];
    coefV1 = -1;
  }

  if (endColor[1]>=initColor[1]) {
    diffg = endColor[1] - initColor[1];
    coefV2 = 1;
  } else {
    diffg = initColor[1] - endColor[1];
    coefV2 = -1;
  }

  var diffTotal = diffr + diffg;
  var v1 = diffTotal*coef/coefColor;


  if (initColor[0]>endColor[0]) {

    if (v1<=diffr) {
      tabResult[0] = Math.round(initColor[0]);
      tabResult[1] = Math.round(initColor[1]-(v1*coefV1));
    } else {
      tabResult[0] = Math.round(initColor[0]-(v1*coefV2)+(diffr*coefV2));
      tabResult[1] = Math.round(endColor[1]);
    }

  } else {

    if (v1<=diffr) {
      tabResult[0] = Math.round(initColor[0]+(v1*coefV1));
      tabResult[1] = Math.round(initColor[1]);
    } else {
      tabResult[0] = Math.round(endColor[0]);
      tabResult[1] = Math.round(initColor[1]+(v1*coefV2)-(diffr*coefV2));
    }

  }

  return tabResult;
}
