
var windowWidth = 0, windowHeight = 0;

// fix main menu for Macs
function fixMacMenu() {
	var menu_links = $$('#menu a');
	var r = /Firefox\/2\.0\.0\./i;
	if ( r.test(navigator.userAgent) && navigator.platform.toLowerCase() == "macintel"  ) {
		for ( var i = 0; i < menu_links.length; i++ ) {
			menu_links[i].style.textIndent = '-10000px';
		}
	}
}

// simple document mouse click bind
function document_click(event) {
	click_element = Event.element(event);
}
mouse_click_bind = document_click.bindAsEventListener();

function document_click_search(event) {
	doc_elm = Event.element(event);
	if (!(doc_elm.descendantOf('searchBox'))) {
		$('searchFooter').hide();
		Event.stopObserving(document, 'click', document_click_bind);
		Event.observe('searchBox', 'mouseout', hide_footer_bind);
	}
}
document_click_bind = document_click_search.bindAsEventListener();

// Nová okna se scrollbarem a bez
function newWindow(src,x,y) { return window.open(src,'_blank','width='+x+',height='+y+',resizable=yes,scrollbars=yes'); }
function newPopup(src,x,y) { return window.open(src,'_blank','width='+x+',height='+y+',top=100,left=100,resizable=yes,scrollbars=no'); }

// Obrazek a flash do popupu
function imagePopup(title,src,x,y) {
	var image=window.open('','popup','width='+x+',height='+y+',top=100,left=100,resizable=yes,scrollbars=no');
	image.document.write('<html>\n<head>\n<title>'+title+'</title>\n</head>');
	image.document.write('<body style="margin:0; padding:0;">\n');
	image.document.write('<a href="#" onclick="window.close()">');
	image.document.write('<img src="'+src+'" width="'+x+'" height="'+y+'" border="0">');
	image.document.write('</a>\n');
	image.document.write('</body>\n</html>\n');
	image.document.close();
	return true;
}
function flashPopup(title,src,x,y) {
	var image=window.open('','_blank','width='+x+',height='+y+',top=100,left=100,resizable=yes,scrollbars=no');
	image.document.write("<html>\n<head>\n<title>"+title+"</title>\n</head>");
	image.document.write("<body style=\"margin:0;padding:0;\">\n");
	image.document.write("<object type=\"application/x-shockwave-flash\" data=\""+src+"\" width=\""+x+"\" height=\""+y+"\">");
	image.document.write("<param name=\"movie\" value=\""+src+"\">");
	image.document.write("</object>");
	image.document.write("</body>\n</html>\n");
	image.document.close();
	return true;
}

function findPosX(obj){var curleft = 0;if (obj.offsetParent){while (obj.offsetParent){curleft += obj.offsetLeft;obj = obj.offsetParent;}}else if (obj.x)curleft += obj.x;return curleft;}
function findPosY(obj){var curtop = 0;if (obj.offsetParent){while (obj.offsetParent){curtop += obj.offsetTop;obj = obj.offsetParent;}}else if (obj.y)curtop += obj.y;return curtop;}

function hideInputs () {
	var inputs = $$('input');
	for (var i = 0 ; i < inputs.length ; i++) {
		if (Element.hasClassName(inputs[i],'jsHide')) inputs[i].hide();
	}
}

function newWindowLinks() {
	var linksArray = document.getElementsByTagName('a');
	for (var i = 0; i < linksArray.length; i++) {
		if (Element.hasClassName(linksArray[i], 'blank')) {
			linksArray[i].setAttribute('target', 'blank');
		}
	}
}

var hits;
var boards;

function hitRotatorInit() {
	hits = $$('div.hit');
	boards = $$('a.board');

	if(typeof(boardPhotos)!="undefined") {
		photos = boardPhotos.slice();
	}
	for(var i = 0; i < boards.length; i++) {
		if(typeof(timeLimits)=="undefined"){
			boards[i].timeLimit = 4000;
		} else {
			boards[i].timeLimit = timeLimits[i];
		}
	}
}

function setBoardImage(nr) {
	var lnk = 'lnkHit_' + nr;
	for (var i = 0; i < boards.length; i++) {
		Element.removeClassName(boards[i], 'active');
	}
	Element.addClassName($(lnk), 'active');
	$('hitPhoto_1').src = boardPhotos[nr-1];
	if (hr) { clearTimeout(hr); }
	return true;
}

function setActiveBoard(nr) {
	if (hits.length > 0 && boards.length > 0 && hits.length == boards.length) {
		var lnk = 'lnkHit_' + nr;
		var board = 'hit_' + nr;
		for (var i = 0; i < boards.length; i++) {
			Element.removeClassName(hits[i], 'active');
			Element.removeClassName(boards[i], 'active');
		}
		Element.addClassName($(lnk), 'active');
		Element.addClassName($(board), 'active');
		if (hr) { clearTimeout(hr); }
		return true;
	}
}

function hitImageRotator() {
	var activeBoard = boards.shift();
	var activePhoto = photos.shift();
	Element.removeClassName(activeBoard, 'active');
	Element.addClassName(boards[0], 'active');
	boards.push(activeBoard);
	photos.push(activePhoto);
	$('hitPhoto_1').src = photos[0];
	hr = setTimeout(hitImageRotator, boards[0].timeLimit);
}

function hitRotator() {
	if (hits.length > 0 && boards.length > 0 && hits.length == boards.length) {
		var activeBox = hits.shift();
		var activeBoard = boards.shift();
		Element.removeClassName(activeBox, 'active');
		Element.removeClassName(activeBoard, 'active');
		Element.addClassName(hits[0], 'active');
		Element.addClassName(boards[0], 'active');
		hits.push(activeBox);
		boards.push(activeBoard);
		hr = setTimeout(hitRotator, boards[0].timeLimit);
	}
}

function getServices(myURL,myId,close) {
	var s = new Array("closed","opened");
	var e = $(myId);
	var pars = 'myId=' + myId;
	if (close) {
		pars += '&close=true';
		s = s.reverse();
	}

	var myAjax = new Ajax.Updater(
		myId,
		myURL,
		{
			method: 'get',
			parameters: pars,
			onLoading: function() {
				if (!close) {
					Element.insert($(myId), { 'bottom' : '<p id=\"ajaxLoader\" class="center"><img src=\"/public_conver/96/a7/67/125175_196238_ajax_loader.gif\" /></p>'});
					
				}
				
			}
			
		});
	try {
		e.removeClassName(s[0]);
		e.addClassName(s[1]);
	} catch(e) {};
	if ($('ajaxLoader')) { $('ajaxLoader').remove(); }
	return false;
	
}

function getPricelists(myURL,myId,anchor) {
	var pars = 'myId=' + myId;
	var myAjax = new Ajax.Updater(
		myId,
		myURL,
		{
			method: 'get',
			parameters: pars,
			onLoading: function() {
				if (!close) {
					Element.insert($(myId), { 'bottom' : '<p id=\"ajaxLoader\" class="center"><img src=\"/public_conver/96/a7/67/125175_196238_ajax_loader.gif\" /></p>'});

				}

			}

		});
	if ($('ajaxLoader')) { $('ajaxLoader').remove(); }
	window.location.hash = anchor;
	return false;

}

function getDocuments(myURL,myId) {
	var s = new Array("closed","opened");
	var pars = 'myId=' + myId;
	var myAjax = new Ajax.Updater(
		myId,
		myURL,
		{
			method: 'get',
			parameters: pars,
			onLoading: function() {
				if (!close) {
					Element.insert($(myId), { 'bottom' : '<p id=\"ajaxLoader\" class="center"><img src=\"/public_conver/96/a7/67/125175_196238_ajax_loader.gif\" /></p>'});
				}
			}
		});
	if ($('ajaxLoader')) { $('ajaxLoader').remove(); }
	return false;
}

// BENEFIT TOOLTIPS
function viewTooltip(e, l) {

	var elm = Event.element(e);
	var elmParent = Position.offsetParent(elm);

	/* event element coords */
	var coords = Position.positionedOffset(elm);
	var xPos = coords[0] + 5;
	var yPos = coords[1] + 5;

	if ($(l)) {
		var layer = $(l);
		var layerDimensions = layer.getDimensions();

		Element.removeClassName(layer, "reverse");

			if (navigator.appVersion.indexOf('MSIE') > 0) {
				new Insertion.Bottom(layer, "<iframe></iframe>");
		}

		var testPosition = Position.page(elm)[1] - layerDimensions.height;

		if (testPosition > 0) {
			var layerTop = yPos - layerDimensions.height;
		} else {
			var layerTop = yPos + 2;
			Element.addClassName(layer, "reverse");
			}

			var layerLeft = xPos;

		if (layer.style.display == "block") {
			layer.style.display = "none";
		} else {
			layer.style.display = "block";
		}

		var layers = $$("div.layer");
		for (var i = 0; i < layers.length; i++) {
			if (layers[i] != layer) layers[i].style.display = "none";
		}

		layer.style.top = layerTop + "px";
		layer.style.left = layerLeft + "px";
	}
}

function hideTooltip(l) {
	if ($(l)) $(l).hide();
}

// TELEFONY
// Formulář pokyny a nastavení
function showModels(typ,url) {
	this.typ = typ;

	var mId = $F(typ+'Vendor');
	var url = url;
	var pars= 'vendor=' + mId + '&typ=' + typ;
	var myAjax = new Ajax.Request(
		url,
		{
			method: 'get',
			parameters: pars,
			onComplete: showModelsResponse.bind(this)
		});
}
function showModelsResponse(originalRequest){
	var output = "";
	var xmldoc = originalRequest.responseXML;
	var xmlchildren = xmldoc.getElementsByTagName('model');
	children = $(this.typ+'Id').immediateDescendants();
	for(i=1; i<children.length; i++) {
		children[i].remove();
	}
	for(i=0; i<xmlchildren.length; i++) {
		var o = document.createElement('option');
		var attr = xmlchildren[i].getAttribute('id');
		var txt = document.createTextNode(xmlchildren[i].firstChild.data);
		o.setAttribute('value',attr);
		o.appendChild(txt);
		$(this.typ+'Id').appendChild(o);
	}
}

function showEq(e,c,cls,clh) {
	var s = new Array((clh?clh:"dummy"),(cls?cls:"all"));
	if (c) s.reverse();
	$(e).removeClassName(s[0]);
	$(e).addClassName(s[1]);
	return false;
}

function showGrid(e,cls) {
	var s = new Array("dummy",cls);
	if (Element.hasClassName(e,cls)) s.reverse();
	$(e).removeClassName(s[0]);
	$(e).addClassName(s[1]);
	return false;
}

function updatePrice() {
	switch($F('sb_Price')) {
		case '100001': priceFrom = 0; break;
		case '1500': priceFrom = 1; break;
		case '3000': priceFrom = 1500; break;
		case '5000': priceFrom = 3000; break;
		case '10000': priceFrom = 5000; break;
		case '100000': priceFrom = 10000; break;
	}
	$('price').value = priceFrom;
	return true;
}

// VYHLEDÁVÁNÍ
// Našeptávač
var wt;
function showWhispers(site, language) {
	if (wt) window.clearTimeout(wt);
	wt = window.setTimeout(function() { whisperRequest(site, language); }, 300);
}
function whisperRequest(site, language) {
	var str = $F('queryAndWords');
	var url = '/acomplete/';
	var pars= 'language=cz&prefix=' + str;
	var site_spec = 'O2_' + site + '_' + language;

	if (str.length > 0) {
		var myAjax = new Ajax.Request(
			url,
			{
				method: 'get',
				parameters: pars,
				onComplete: function(original) {
					showWhispersResponse(original, site_spec);
				}
			});
	}
}
var cookie = {
	create : function(name,value,days,domain) {
		if (days)
			{
				var date = new Date();
				date.setTime(date.getTime()+(days*24*60*60*1000));
				var expires = "; expires="+date.toGMTString();
			}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/; domain=."+domain;
		return true;
	},
	read : function(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	},
	erase : function(name,domain) {
		cookie.create(name,"",-1,domain);
	}
}

function setHomepage(site,domain,txtOn,txtOff)
{
	var c = cookie.read("sgmt");
	if (c == null || c != site) {
		cookie.create("sgmt",site,1000,domain);
		alert(txtOn);
	}
	else {
		cookie.erase("sgmt",domain);
		alert(txtOff);
	}
}
function searchFooterShow() {
	$('searchFooter').style.display = 'block';
	Element.addClassName('searchBox', 'over');		
}
function searchFooterHide() {
	$('searchFooter').style.display = 'none';
	Element.removeClassName('searchBox', 'over');		
}

//DATA NONSTOP formular
function validateDataNonstop(f) {
	emailRegExp = new RegExp("^[a-zA-Z0-9_.]{2,}@([a-zA-Z0-9]{1,}.){0,}[a-zA-Z0-9]{2,}.[a-zA-Z0-9]{2,4}$");
	msg = '';
	if (f.jmeno.value == '') msg += 'Vyplňte prosím vaše jméno\n';
	if (f.mesto.value == '') msg += 'Vyplňte prosím město\n';
	if (f.telefon.value == '') msg += 'Vyplňte prosím vaše telefonní číslo\n';
	if (!emailRegExp.test(f.muj_email.value)) msg += 'Zadejte prosím platnou e-mailovou adresu\n';
	if (msg != '') alert(msg);
	return (msg == '');
}

//PREDVYPLNENE LABELS U FORMULARU
function hideLabel (field_id, hide) {
	var field_for;
	var labels = document.getElementsByTagName('label');
	for (var i = 0; i < labels.length; i++) {
	field_for = labels[i].htmlFor || labels[i].getAttribute('for');
	if (field_for == field_id) {
		labels[i].style.textIndent = (hide) ? '-1000px' : '0px';
		return true;
	}
	}
}

function initOverLabels () {
	if (!document.getElementById) return;

	var labels, id, field;

	// Set focus and blur handlers to hide and show 
	// LABELs with 'overlabel' class names.
	labels = document.getElementsByTagName('label');
	for (var i = 0; i < labels.length; i++) {

	if (labels[i].className == 'overlabel') {
		// Skip labels that do not have a named association
		// with another field.
		id = labels[i].htmlFor || labels[i].getAttribute('for');

		if (!id || !(field = document.getElementById(id))) {
		continue;
		} 

		// Hide any fields having an initial value.
		if (field.value !== '') {
		hideLabel(field.getAttribute('id'), true);
		}

		// Set handlers to show and hide labels.
		field.onfocus = function () {
		hideLabel(this.getAttribute('id'), true);
		};
		field.onblur = function () {
		if (this.value === '') {
			hideLabel(this.getAttribute('id'), false);
		}
		};




		// Handle clicks to LABEL elements (for Safari).
		labels[i].onclick = function () {
		var id, field;
		id = this.getAttribute('for');
		if (id && (field = document.getElementById(id))) {
			field.focus();
		}
		};

	}
	}
};
Event.observe(window, "load", initOverLabels);

function showTerm(t) {

	tooltips = document.getElementsByClassName('tooltip');
	for (var i = 0; i < tooltips.length; i++) {
		tooltips[i].style.display = 'none';
	}

	$(t).style.display = 'block';
	$(t).style.left = '0px';
	var termHeight = $(t).getHeight();
	var coords = Position.page($(t));
	var vcoords = Position.positionedOffset($(t));

	windowSize();

	if ((coords[1] + termHeight) > windowHeight) {
		var offsetY = vcoords[1] - termHeight - 25;
  		$(t).style.top = offsetY + "px";
	} else {
		$(t).style.top = vcoords[1] + "px";
	}
	$(t).style.left = '0px';
}
function hideTerm(t) {
	$(t).style.display = 'none';
}

MoviePlayer = Class.create();
MoviePlayer.prototype = {

	initialize: function (m, p, t, l) {
		this.srcMovie = m;
		this.srcImage = p;
		this.targetElement = (t == '') ? document.body : t;
		this.closeText = (l == 'en') ? 'Close' : 'Zavřít';
		this.playerVersion = 'standard';
	},

	createPlayer: function(v) {
		if (v) { this.playerVersion = v; }
		out = '<div id="MP_overlay"></div>';
		out += '<div id="MP_window" class="' + this.playerVersion + '">';
		out += '<div id="MP_player">';
		switch (this.playerVersion) {
			case 'hit':
				out += '<object type="application/x-shockwave-flash" data="/public_conver/15/f/76/103719_84746_player420x336_v1.swf" width="420" height="356">';
				break;
			default:
				out += '<object type="application/x-shockwave-flash" data="/public_conver/e8/ac/76/42865_21576_playerv4_large_jtr.swf" width="430" height="290">';
				break;
		}
		out += '<param name="movie" value="/public_conver/e8/ac/76/42865_21576_playerv4_large_jtr.swf" />';
		out += '<param name="wmode" value="transparent" />';
		out += '<param name="flashvars" value="autoPlay=true&sourceVideo=' + this.srcMovie + '" />';
		out += '</object>';
		out += '</div>';
		out += '<div class="reset"></div>';
		out += '<div><a class="closePlayer" href="javascript:closePlayer()">' + this.closeText + '</a></div>';
		out += '<div class="reset"></div>';
		out += '</div>';

		new Insertion.Bottom(this.targetElement, out);
		var contentOffset = Position.page($('innerLeft'))[1] - Position.page($('rightColumn'))[1];
		var innerLeftDimensions = $('innerLeft').getDimensions();
		var rightColumnDimensions = $('rightColumn').getDimensions();

		var overlayWidth = rightColumnDimensions.width;
		var overlayHeight = rightColumnDimensions.height/* - contentOffset*/;

		$('MP_overlay').style.top = 0 + 'px';
		$('MP_overlay').style.width = overlayWidth + 'px';
		$('MP_overlay').style.height = overlayHeight + 'px';

		$('MP_overlay').style.display = 'block';
		$('MP_window').style.display = 'block';
		Event.observe($('MP_overlay'), 'click', this.removePlayer);
	},

	removePlayer: function() {
		$('MP_overlay').remove();
		$('MP_window').remove();
	}
}

function playMovie(movie, picture, lang, version) {
	var sm = $('smallVideo');
	if (sm) { sm.MYpauseMovie(); }
	mp = new MoviePlayer(movie, picture, 'innerLeft', lang);
	mp.createPlayer(version);
}
function closePlayer() {
	mp.removePlayer();
}
function getObj(objName) {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[objName] : document[objName]; 
}

function showCallMeBack() {
	if ($('link-module-objednavejte-na')) { $('link-module-objednavejte-na').style.display = 'none'; }
	if ($('callMeBackForm')) { $('callMeBackForm').style.display = 'block'; }
}

// objednavka reverzniho zaznamu ke stat. ip
function ipTest(ip,elm) {
	var elm=document.getElementById(elm);
	if (ip=='90'){		
		if(elm) {
			elm.style.display = 'inline';
		}		
	}
	else { elm.style.display = 'none'; }
}

//Accordion pro odstavce v clanku
var Accordion =  {
	language : "cz", 
	showItem : function(e) {
		var elm = Event.element(e);
		if (elm.nodeName == 'SPAN') {
			elm = elm.parentNode;
		} 
		if(elm.active == 0) {
			elm.active = 1;

			elm.next('div.accordion').style.display = "block";
		} else {
			elm.active = 0;
			elm.next('div.accordion').style.display = "none";
		}
		Accordion.setAnchor(elm, elm.active);
		return false;
	}, 
	setAnchor : function(link, active) {
		var link = link;
		var active = active;
		if(active == 0) {
			link.anchor.innerHTML = (Accordion.language == "cz") ? "zobrazit" : "Show more";
			link.anchor.className = "open";
		} else {
			link.anchor.innerHTML = (Accordion.language == "cz") ? "skrýt" : "Close" ;
			link.anchor.className = "close";
		}
	}, 
	init : function(lang) {
		Accordion.language = lang;
		allAccordionParts = $$('div.accordion');
		for(var i = 0; i < allAccordionParts.length; i++){
			allAccordionParts[i].hide();
		}
		var allAccordionTitles = $$('h3.accordion');
		for(var i = 0; i < allAccordionTitles.length; i++) {
			AccordionTitle = allAccordionTitles[i];
			AccordionTitle.active = 0;
			var anchor = document.createElement('span');
			AccordionTitle.anchor = anchor;
			Accordion.setAnchor(AccordionTitle, AccordionTitle.active);
			AccordionTitle.appendChild(anchor);
			Event.observe(AccordionTitle, "click", Accordion.showItem);
		}
		var hash = window.location.hash.sub('#', '');
		if (($(hash))&&(hash.length > 0)) {
			var anchorActive = $(hash);
			if(!anchorActive.next('div.accordion')) {
				return(false);
			} else {
				anchorActive.next('div.accordion').style.display = "block";
				anchorActive.active = 1;
				Accordion.setAnchor(anchorActive, anchorActive.active);
			}
		}
	}
}

function iPhoneCheckForm(lang) {
	var mail_msg;
	var mail_error_msg;
	var terms_msg;
	var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;

	if (lang == 'cz') {
		mail_msg = 'Nevíme, kam vám zaslat informace.\nNapište prosím svůj e-mail.';
		mail_error_msg = 'Zadaná e-mailová adresa není platná.';
		terms_msg = 'Musíte souhlasit s podmínkami registrace.';
	} else {
		mail_msg = 'We don’t know where to send you information.\nPlease enter your email address.';
		mail_error_msg = 'E-mail not valid.';
		terms_msg = 'You must agree with the terms of registration.';
	}

	if ($('email').value == '' && $('terms').checked != 1) {
		alert(mail_msg.replace("\n", " ") + "\n" + terms_msg);
		return false;
	} else {
		if ($('email').value != '') {
			if (emailPattern.test($('email').value)) {
				if ($('terms').checked != 1) {
					alert(terms_msg);
					return false;
				} else {
					return true;
				}
			} else {
				alert(mail_error_msg);
				return false;
			}

		} else {

			alert(mail_msg);
			return false;
		}
	}
}

function iPhoneShowTerms(lang) {
	if (lang == 'cz') {
		alert('Podmínky registrace\n\nOdesláním údajů dává fyzická osoba souhlas ke zpracování poskytnutých osobních údajů. Osobní údaje budou zpracovávány za účelem nabízení obchodu nebo služeb podle zákona č. 101/2000 Sb. o ochraně osobních údajů, a to správcem nebo jím určeným zpracovatelem a dále potvrzuje, že jím poskytnuté osobní údaje jsou přesné a pravdivé. Správcem ve smyslu zákona o ochraně osobních údajů je společnost Telefónica O2 Czech Republic, a.s., IČ 60193336, sídlem Praha 4, Michle, Za Brumlovkou 266/2, PSČ 14022, zapsaná v obchodním rejstříku vedeném u rejstříkového soudu v Praze, oddíl B, vložka 2322. Poskytnutí osobních údajů je dobrovolné, na dobu neurčitou (tj. do odvolání). Subjekt údajů má právo k jejich přístupu, je oprávněn písemně požádat o poskytnutí informace o osobních údajích, které jsou o něm zpracovávány, a to jednou za kalendářní rok bezplatně, jinak za přiměřenou úhradu, a v případě porušení svých práv má právo obrátit se na Úřad pro ochranu osobních údajů. Uvedené osobní údaje nebudou předávány třetím osobám.');
	} else {
		alert('Registration terms and conditions\n\nThese terms and conditions are meant to help our non-Czech customers understand the terms of registration. Please refer to the Czech version of this page for the complete, legally binding terms and conditions.\n\nBy sending their data, the sender agrees to the processing of the personal data they are providing. Their personal data will be processed in such a way that they may be offered goods or services in accordance with Law no. 101/2000 Coll. about the Protection of Personal Data. The data will be processed either by an administrator or by a processor designated by the administrator. The sender furthermore confirms that the personal data provided is exact and true. In terms of the Law about the Protection of Personal Data, the administrator is Telefónica O2 Czech Republic, a.s., IČ (company identification number) 60193336, seated in Prague 4, Michle, Za Brumlovkou 266/2, PSČ 14022, registered in the commercial registry recorded at registration court in Prague, section B, entry 2322. The provision of personal data is voluntary, for an indefinite period of time (i.e. until it is recalled). The subject of the data is entitled to its access, and they have the right to make a written request for information that is processed about them once a year for free; a corresponding fee is charged for subsequent requests in the same year. If their rights are violated, they can contact the Office for Personal Data Protection. The above-mentioned personal data will not be transferred to third parties.');
	}

}

// *** Kontextova napoveda
function closeContextDef(div) {
	div.remove();
}
function viewContextDef(e) {
	var elm = Event.element(e);
	new Ajax.Request(elm.href, {
		method: 'post',
		parameters: 'ajaxon=1',
		encoding: 'UTF-8',
		onSuccess: function(transport) {
			var elmWidth = elm.getWidth();
			var prevDivContextDef = $('contextDefWrap');
			var docContent =  $('mainBox');
			var innerLeft = $('innerLeft');
			if(!innerLeft) {    
				innerLeft = $('rightColumn');   //clanek bez sidebaru
			}
			var coordsInnerLeft = Position.cumulativeOffset(innerLeft);
			if($(prevDivContextDef)) {
				closeContextDef(prevDivContextDef);
			}
			var coords = Position.cumulativeOffset(elm);
			var xPos = coords[0];
			var yPos = coords[1];
			var divContextDef = document.createElement('div');
			divContextDef.setAttribute('id', 'contextDefWrap');
			divContextDef.style.display = "none";
			docContent.appendChild(divContextDef);
			var aClose = document.createElement('a');
			$(aClose).appendChild(document.createTextNode('zavřít'));	
			$(aClose).addClassName("contextDefClose");			
			$(aClose).observe('click', function(){
				closeContextDef($('contextDefWrap'));
			});
			$('contextDefWrap').update(transport.responseText);
			divContextDef.appendChild(aClose);
			divContextDef.style.display = "";	

			var divContextDefHeight = $('contextDefWrap').getHeight();
			var divContextDefWidth = $('contextDefWrap').getWidth();
			var fromLeft = xPos + Math.round(elmWidth/2) - Math.round(divContextDefWidth/2);
/*
			var fromLeft = coordsInnerLeft[0] + Math.round(innerLeft.getWidth()/2) - Math.round(divContextDefWidth/2);
*/
			var fromTop = yPos - divContextDefHeight - 5;
			divContextDef.style.left = fromLeft + "px";
			divContextDef.style.top = fromTop + "px";
			divContextDef.style.display = "block";	
			var coordsDivContextDef = Position.page(divContextDef);
			if (coordsDivContextDef[1]<0) {
				$('contextDefWrap').scrollTo();
			}
		}, 
		onFailure: function() {
			alert('Nápověda k tomuto slovu není dostupná.');
		}
	});
}
function initContextDef() {
	var allCD = $$('a.cD');
	for(var i=0; i<allCD.length; i++) {
		Event.observe(allCD[i], "click", function(event) {
			viewContextDef(event);
			Event.stop(event);
		});
	}
}

var height = 175;
var layerTop = 175, layerLeft = 0, maxOffset = 0, tmpOffset = 0, scrollTop = 0;

function fallingLayer() {
	windowSize();
	tmpOffset = maxOffset = windowHeight - height - 5;
	if ($('ilayer')) {
		Event.observe(window, 'scroll', scrolled);
		var lt = window.setTimeout("fallingLayerMove()", 10);
	}
}
function fallingLayerMove() {
	layerTop = Math.ceil(layerTop + 1); //.05 * (tmpOffset - layerTop));
	if (layerTop > tmpOffset) {
		layerTop = tmpOffset;
		$('ilayer').style.top = layerTop + 'px';
	} else {
		$('ilayer').style.top = layerTop + 'px';
		var lt = window.setTimeout("fallingLayerMove()", 10);
	}
}
function scrolled() {
	if( typeof( window.pageYOffset ) == 'number' ) {
		scrollTop = window.pageYOffset;
	} else if (document.body && document.body.scrollTop) {
		scrollTop = document.body.scrollTop;
	} else if (document.documentElement && document.documentElement.scrollTop) {
		scrollTop = document.documentElement.scrollTop;
	}

	tmpOffset = maxOffset + scrollTop;
	var lt = window.setTimeout("fallingLayerMove()", 10);
}
function windowSize() {
	if (typeof(window.innerWidth) == 'number') {
		windowWidth = window.innerWidth;
		windowHeight = window.innerHeight;
	} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if(document.body && ( document.body.clientWidth || document.body.clientHeight)) {
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}
}
/* --- /ilayer --- */
var TableOver = {

	highliteCol : function(col, radek) {
		var col = col;		
		var rows = table.getElementsByTagName('tr');
		for (var i = 0; i < countRow; i++){
			var cols = rows[i].getElementsByTagName('td');		

			for(var j=0; j<countCols; j++ ){
				if(col==j){
				$(cols[col]).addClassName('blue');
					if(cols[j].id){					
						var holder = $("t-"+cols[j].id);
						if(holder){
							holder.show();
						}								
					}					
				}
				else{
					if($(cols[j]).hasClassName('blue')){
						$(cols[j]).removeClassName('blue');				
					}
					if(cols[j].id){								
						var holder = $("t-"+cols[j].id);
						if(holder){
							holder.hide();
						}								
					}							
				}			
			} 		
		} 
	},	

	highliteRow : function(e) {	
		elm = Event.element(e);						
		if (elm.match('td')){		
			elm.parentNode.addClassName('red');
			var radek = elm.parentNode;
			var what = elm;
		}	
		else {		
			var radek = elm.parentNode;
			if ($(radek).match('td')){		
				var radek = elm.parentNode.parentNode;
				var what = elm.parentNode;
				elm.parentNode.parentNode.addClassName('red');
			}
			else {
				var radek = elm.parentNode.parentNode.parentNode;
				var what = elm.parentNode.parentNode;
				elm.parentNode.parentNode.parentNode.addClassName('red');
			}			
		} 		

		if(radek){
		var pCols = radek.getElementsByTagName('td');
		for (var i=0; i<pCols.length; i++){
			if(pCols[i]==what){
				TableOver.highliteCol(i, radek);				
			}
		}		
		}
	}, 

	highliteRowChecked : function(e) {	
		elm = Event.element(e);		
		if(elm.checked){	
			elm.parentNode.parentNode.addClassName('checked');
		}
		else{
			elm.parentNode.parentNode.removeClassName('checked');
		}
	},		

	dishighlite : function(e) {
		elm = Event.element(e);	
		if(!elm.descendantOf('pTarify')){			

			TableOver.highliteCol(-1,-1);
		}
	},			

	noHighliteRow : function(e) {		
		elm = Event.element(e)	
		if (elm.match('td')){			
			elm.parentNode.removeClassName('red');								
		}
		else{
			elm.parentNode.parentNode.removeClassName('red');		
		}
	}, 

	selectedInput : function(e) {
		elm = Event.element(e);	
		var checked = 0;		
		$$("#pTarifyBody input").each(
			function(e) {
				if(e.checked){
					checked = checked+1;	
				}				
			}		
		);		
		if(checked < 2){ 
			if($$('body')[0].hasClassName('en')){ alert('You must choose at least two tariffs for comparison.'); }
			else { alert('Pro porovnání vyberte alespoň dva tarify.'); }
			Event.stop(e);		
		}	
	},	

	init : function() {
		countCols = 8;  // pocet sloupcu tabulky
		table = $("pTarifyBody");
		$("t-sort0").hide();
		$("t-sort1").hide();
		$("t-sort2").hide();
		$("t-sort3").hide();
		$("t-sort4").hide();
		$("t-sort5").hide();
		countRow = 0;

		var page = $("rightColumn");		
		Event.observe(page, "mouseout", TableOver.dishighlite);

		$$('#fCT .sTB').each( function(e){ Event.observe(e, "click", TableOver.selectedInput); });

		$$("#pTarify tbody tr").each(
			function(e){
				Event.observe(e, "mouseover", TableOver.highliteRow);
				Event.observe(e, "mouseout", TableOver.noHighliteRow);
				countRow++;	
				oldElm = "";	

				var check = e.getElementsByTagName('input');
				if(check[0]){				
					if(check[0].checked){
						if(check[0].parentNode.parentNode.match('tr')){
							check[0].parentNode.parentNode.addClassName('checked');
						}	
					}
					Event.observe(check[0], "click", TableOver.highliteRowChecked);	
				}			
			}	
		);	
	}
}

/* --- nahledy telefonu --- */

var originalUrl;
var selectedUrl;
var selectedBigUrl;
function mouseOverPhonePhoto(url) {
	originalUrl = $('biggerDetail').src;
	$('biggerDetail').src = url;
}
function mouseOutPhonePhoto() {
	if(selectedUrl){ 
		$('biggerDetail').src = selectedUrl; 
		if(selectedBigUrl) {
			$('biggerDetailLink').href = selectedBigUrl;	
		}
	} 
	else{ if (originalUrl != null) { $('biggerDetail').src = originalUrl; }}	
}
function mouseClickPhoto(link) {
	$$("#phone_colors a").each(
		function(e){ $(e).removeClassName('selected'); }	
	);	
	$(link).addClassName('selected');	
	selectedUrl = $(link);	
	selectedBigUrl = $(link).rel;
}


/*-----------------------stripped table rows -----------------------------*/

var stripedTableRows = {
	init : function() {
			$$('table.strips').each(
				function(e){
					var i = 0;
					var rows = e.getElementsByTagName('tr');
					for(i=0; i<rows.length; i++){
						if(i%2 == 1){
							rows[i].className='greyBg';
						}

					}
				}
			);
		}
}

/*----------------------------------------------------------------*/

/* -- fce pro zjisteni param. stranky pro lightbox -- */

function getPageScroll(){
	var xScroll, yScroll;
	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
		xScroll = self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
		xScroll = document.documentElement.scrollLeft;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
		xScroll = document.body.scrollLeft;	
	}
	arrayPageScroll = new Array(xScroll,yScroll) 
	return arrayPageScroll;
}

function getPageSize(){
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;

	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	

	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}


var Useq = {
	positive : function(e) {
		var myId = $("useq");
	//	var myURL = "";
		var myURL = myURLF;	
		var myAjax = new Ajax.Updater(
		myId,
		myURL,
		{
			method: 'post',
			parameters: $('fU').serialize(),
			onSuccess: Useq.trackFeedback ('positive')
		});			
	},
	
	negative : function(e) {	
		var myId = $("uq_content");			
		var arrayPageSize = getPageSize();
		var arrayPageScroll = getPageScroll();
		var overlayTop = arrayPageScroll[1] + (arrayPageSize[3] / 10);
		var overlayLeft = arrayPageScroll[0] + (arrayPageSize[2]/2) - 220;		
		var h = $$('body')[0].getDimensions();	
		var overlayWidth = arrayPageSize[0];
		var overlayHeight = arrayPageSize[1]; //h.height;	
		
		$('uq_overlay').style.top = 0 + 'px';
		$('uq_overlay').style.width = overlayWidth + 'px';
		$('uq_overlay').style.height = overlayHeight + 'px';
		$('uq_overlay').style.display = 'block';	
		$('uq_window').style.top = overlayTop + 'px';	
		$('uq_window').style.left = overlayLeft + 'px';
		$('uq_window').style.display = 'block';
		Event.observe($('uq_window'), 'click',  function(){ Event.stop(e) });
		Event.observe($('uq_overlay'), 'click', Useq.removeOverlay);	
	
	//	var pars = "?negative=1&sendUri=/static_conver/1741-1-PUBLIC/none/resources/js_functions.js";
		var pars = "?negative=1&sendUri="+myNowURL;

		var myURL = myURLS;	
		var myAjax = new Ajax.Updater(
		"uq_content",		
		myURL,		
		{
			method: 'get',	
			parameters: pars
		});		
	},
	
	sendQResponse : function() {	
		$('browser2').value=navigator.userAgent;
		Event.observe($('closeLayer'), "click", Useq.removeOverlay);
		var myId = $("tHolder");
	//	var myURL = "";
		var myURL = myURLF;	
		var myAjax = new Ajax.Updater(
		myId,
		myURL,
		{
			method: 'get',
			parameters: $('fUF').serialize(),
			onSuccess: Useq.trackFeedback ('negative')			
		});
	},
	
	createOverlay : function() {
		var myId = $('useq');	
		var d_o = document.createElement('div');
		d_o.id = "uq_overlay";		
		var d_w = document.createElement('div');
		d_w.id = "uq_window";	
		var d_c = document.createElement('div');
		d_c.id = "uq_content";	
		var a_close = document.createElement('a');
		a_close.id = "closeLayer";
		a_close.update="{%%zavrit}";
					
		myId.appendChild(d_o);
		d_c.appendChild(a_close);
		d_w.appendChild(d_c);
		myId.appendChild(d_w);
	},


	removeOverlay: function() {
		if ($('fUF')) {
			Useq.sendQResponse(); 
		}
		$('uq_overlay').hide();
		$('uq_window').hide();

		$('uq_content').update('<a href="#" id="closeLayer"><\/a>');
		Event.observe($('closeLayer'), "click", Useq.removeOverlay);
	},

	trackFeedback : function(type) {
		if (typeof pT != "undefined") {
			pT._trackPageview('/VP_feedback/' + type + '.html');
		}
	},

	init : function() {
		Useq.createOverlay();
		Event.observe($('uqano'), "click", Useq.positive);
		Event.observe($('uqne'), "click", Useq.negative);		
		Event.observe($('closeLayer'), "click", Useq.removeOverlay);
		$('browser').value=navigator.userAgent;
		$('useq').show();
	}
}

function getOfferInfo(myId) {
	var myId = $(myId);
	closeOffer();
	myId.addClassName('opened');
}
function closeOffer() {
	var closeTags = $$('#offers li');
	for (i=0; i<closeTags.length; i++) {
		closeTags[i].removeClassName('opened');
		closeTags[i].removeClassName('openedOffer');
	}
}

function addToBookMarks()
{
	if(document.all)
		window.external.AddFavorite(location.href,document.title);
	else if(window.sidebar)
		window.sidebar.addPanel(document.title,location.href,'');
}




/*
<!-- monitoring
__ETN_.O.K.__
// monitoring -->
*/

