// FG Forrest, a.s. (c) 1996-2003

window.defaultStatus="www.eon.cz";

var onBeforePrint_EventHandler = null;
var onAfterPrint_EventHandler = null;
function onBeforePrint(win)
{
	if ( onBeforePrint_EventHandler != null ) return onBeforePrint_EventHandler(win);
	return true;
}
function onAfterPrint()
{
	if ( onAfterPrint_EventHandler != null ) return onAfterPrint_EventHandler();
	return true;
}

function printPage(url)
{
	//if ( onBeforePrint() == false ) return false;
openHardWin('_print',url,700,460,'yes');
	//onAfterPrint();
	return false;
}

// window status function
/*function ws(txt) {
	window.status = txt;
	return true;
}*/
function stripHTML(str) {
	return str.replace(/<[^>]*>/g," ");
}
function ws(txt) {
	txt = stripHTML(txt);
	window.status = txt;
	return true;
}

function getCenterW(width) {
	return parseInt( eval( (screen.width-parseInt(width))/2 ) );
}

function getCenterH(height) {
	return parseInt( eval( (screen.height-parseInt(height))/2 ) );
}


// open new win func
function openWin( path, width, height ) {
		var zcewin = window.open(path,'_eon','scrollbars=yes,resizable=yes,resize=no,width='+width+',height='+height+',screenX='+getCenterW(width)+',screenY='+getCenterH(height)+',top='+getCenterH(height)+',left='+getCenterW(width) );
		zcewin.focus();
}
function openHardWin( name, path, width, height, scroll ) {
		if (!scroll || scroll != 'yes') { scroll = 'no' };
		var eonwin = window.open(path,name,'scrollbars=' + scroll + ',resizable=no,resize=no,width='+width+',height='+height+',screenX='+getCenterW(width)+',screenY='+getCenterH(height)+',top='+getCenterH(height)+',left='+getCenterW(width)+',locationbar=no,directories=no,dependent=yes' );
		eonwin.focus();
		return eonwin;
}
function openHardWinNoButton( name, path, width, height, scroll ) {
		if (!scroll || scroll != 'yes') { scroll = 'no' };
		var eonwin = window.open(path,name,'scrollbars=' + scroll + ',resizable=no,resize=no,width='+width+',height='+height+',screenX='+getCenterW(width)+',screenY='+getCenterH(height)+',top='+getCenterH(height)+',left='+getCenterW(width)+',locationbar=no,directories=no,dependent=yes,toolbar=no,menubar=no' );
		eonwin.focus();
		return eonwin;
}
function openSiteMap(path) {
	openHardWin('_sitemap',path,780,580);
}

function printFrame(id) {
	var oW = window.parent.top.frames[id].window;
	oW.focus();
	oW.print();
}

function wClose() {
	parent.window.close();
}

// rollover object
function rollOver ( path, name, first, last )	{
	// properties
	this.path = path;
	this.name = name;
	this.extension = "gif";
	this.first = first;
	this.last = last;
	this.active = first-1;
	// methods
	this.preloadImages = preloadImages;
	this.preload = preload;
	this.roll = roll;
	this.set = set;
	this.dis = dis;
}
// rollover public method
function preloadImages( ext ) {
	var nameOver = (null!=ext)?'_'+ext:'';
	for (num=this.first; num<=this.last; num++) {
		this.preload( this.name + '_' + num + nameOver );
	}
}

function preload(imgSrc) {
	if (document.images) {
		eval(imgSrc+' = new Image()');
		eval(imgSrc+'.src = "' +this.path + '/' + imgSrc + '.' + this.extension + '"');
	}
}
// rollover public method - set active item
function set(num,over,pic) {
	this.prev = this.active;
	this.active = num+1;
	this.roll(num,over,pic);
	this.active = num;
	if (this.prev != 0)
		this.roll(this.prev);
}
// rollover public method - disable item
function dis(num,over,pic) {
	this.active = num;
}
// rollover public method - roll item
function roll(num,over,pic) {
	pic = (null != pic)?pic:num;
	over = (null != over)?over:'';
	if (num == this.active)	{
		return false;
	}
	if (document.images) {
		var imgObj;
		if (over != '') {
			imgObj = this.name + '_' + num + '_' + over;
		}
		else {
			imgObj = this.name + '_' + num;
		}
		var imgName = this.name + '_' + pic;
		if (document.images[imgName])	{
			document.images[imgName].src = eval(imgObj+".src");
		}
	}
}

function hiLiteMenuItem(index, tryNo) {
	if ( typeof(tryNo) == "undefined" ) tryNo = 1; if ( tryNo > 100 ) return;
	if ( top.frames[0].mn.set ) { top.frames[0].mn.set(index,'ovr'); 	return; }
	else { window.setTimeout("hiLiteMenuItem(" + index + ", " + tryNo + 1 + ")", 1000); return; }
}

function showSiteMap()
{
	openHardWin( "eonsitemap", "/cz/sitemap/sitemap.shtml", 780, 460 );
}

var cWindow = null;
function showDetail(cType, anch, lng, hTop) {
	this.hCode = "";
	this.writeHCode = writeHCode;

	var strTop, srcMain, srcFooter, heightTop;

	if ( typeof(lng) == "undefined" ) lng = "cz";
	heightTop =  ( !hTop ) ? heightTop = 50 : hTop;

	srcTop = "/" + lng + "/contact/summary_" + cType + "_top.shtml";
	srcMain = "/cms/" + lng + "/contact/summary_" + cType + "_main.shtml#" + anch;
	srcFooter = "/" + lng + "/footer_close_print.shtml";

	this.hCode += '<!--#include virtual="/cms/inc/u/_doctype_frame.shtml"-->\n';
	this.hCode += '<head>\n';
	this.	hCode += '	<title>E.ON</title>\n';
	this.	hCode += '</head>\n';
	this.	hCode += '<frameset rows="' + heightTop + ',*,25" border="0" frameborder="0" framespacing="0">\n';
	this.	hCode += '<frame name="cont_top" src="' + srcTop + '" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" noresize>\n';
	this.	hCode += '<frame name="cont_main" src="' + srcMain + '" marginwidth="0" marginheight="0" scrolling="auto" frameborder="0" noresize>\n';
	this.	hCode += '<frame name="cont_footer" src="' + srcFooter + '" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" noresize>\n';
	this.	hCode += '<noframes>\n';
	this.	hCode += '	Váš prohlížeč nepodporuje rámce.\n';
	this.	hCode += '</noframes>\n';
	this.	hCode += '</frameset>\n';
	this.	hCode += '</html>\n';

	if ( xIE && cWindow ) cWindow.close();
	cWindow = openHardWin("_contact", "/u/blank.html", 460, 460 );

	this.writeHCode();
	return;

	function writeHCode() {
		if ( cWindow.loaded ) {
			cWindow.document.write(hCode);
			cWindow.focus();
		}
		else {
			window.setTimeout(this.writeHCode, 200);
			return;
		}
	}
}

function SwitchMenu(obj) {
	var mi;
	if ( document.getElementById ) {
	var el = document.getElementById(obj);
	var ar;
	for ( mi=0;mi<3;mi++ ) {
		ar = document.getElementById("masterdiv" + mi).getElementsByTagName("span");
			if(el.style.display != "block"){
				for (var i=0; i<ar.length; i++){
					if (ar[i].className=="subm")
					ar[i].style.display = "none";
				}
				el.style.display = "block";
			}else{
				el.style.display = "none";
			}
		}
	}
}
// funkce vypise button BACK v dane lang verzi
function btnBack (lang)	{
	var lng	= lang ? lang : 'cs';
	if (lng == 'cs')	document.write('<a href="javascript:history.back()" onMouseOver="return ws(\'zpět\')"><img src="/img/u/back.gif" width="10" height="19" alt="Zpět" border="0">Zpět</a>');
	else	document.write('<a href="javascript:history.back()" onMouseOver="return ws(\'Back\')"><img src="/img/u/back.gif" width="10" height="19" alt="Back" border="0">Back</a>');
}

function show(anch)	{
	return popImage(anch.href,"E.ON - detail obrázku");
}
function popImage( imageURL,imageTitle ){
	var AutoClose = true;
	var PositionX = 100;
	var PositionY = 100;
	var defaultWidth  = 200;
	var defaultHeight = 200;
	var imgWin = window.open('','photoDetail','scrollbars=no,resizable=1,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY);
	if( !imgWin ) { return true; } //popup blockers should not cause errors
	imgWin.document.write('<html><head><title>'+imageTitle+'<\/title><script type="text\/javascript">\n'+
		'function resizeWinTo() {\n'+
		'if( !document.images.length ) { document.images[0] = document.layers[0].images[0]; }'+
		'var oH = document.images[0].height, oW = document.images[0].width;\n'+
		'if( !oH || window.doneAlready ) { return; }\n'+ //in case images are disabled
		'window.doneAlready = true;\n'+ //for Safari and Opera
		'var x = window; x.resizeTo( oW + 100, oH + 100 );\n'+
		'var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;\n'+
		'if( x.innerWidth ) { myW = x.innerWidth; myH = x.innerHeight; }\n'+
		'else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }\n'+
		'else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }\n'+
		'if( window.opera && !document.childNodes ) { myW += 16; }\n'+
		'x.resizeTo( oW = oW + ( ( oW + 100 ) - myW ), oH = oH + ( (oH + 100 ) - myH ) );\n'+
		'var scW = screen.availWidth ? screen.availWidth : screen.width;\n'+
		'var scH = screen.availHeight ? screen.availHeight : screen.height;\n'+
		'if( !window.opera && screen.width>800 ) { x.moveTo(Math.round((scW-oW)/2),Math.round((scH-oH)/2)); }\n'+
		'}\n'+
		'<\/script>'+
		'<\/head><body onload="resizeWinTo();"'+(AutoClose?' onblur="self.close();"':'')+'>'+
		(document.layers?('<layer left="0" top="0">'):('<div style="position:absolute;left:0px;top:0px;">'))+
		'<img src="'+imageURL+'" alt="Otevírám obrázek ..." title="" onload="resizeWinTo();" onclick="window.close();">'+
		(document.layers?'<\/layer>':'<\/div>')+'<\/body><\/html>');
	imgWin.document.close();
	if( imgWin.focus ) { imgWin.focus(); }
	return false;
}

/* kalkulator ceny plynu */
function resetGasCalcForm() {
	var oForm = document.forms['gasCalcForm'];

	var o = oForm.elements['obec'];
	if (o) { o.options[o.selectedIndex].selected = false; o.options[0].selected = true; }

	var o = oForm.elements['umisteni_plynomeru'];
	if (o) { o.options[o.selectedIndex].selected = false; o.options[0].selected = true; }

	var o = oForm.elements['status_zakaznika'];
	if (o) { o.options[o.selectedIndex].selected = false; o.options[0].selected = true; }

	var o = oForm.elements['obdobi_od'];
	if (o) { o.options[o.selectedIndex].selected = false; o.options[0].selected = true; }

	var o = oForm.elements['obdobi_do'];
	if (o) { o.options[o.selectedIndex].selected = false; o.options[0].selected = true; }

	var o = oForm.elements['spotreba'];
	if (o) o.value = '';
}
/* kalkulator ceny plynu */
/**/

function showDP(anch,title,subtitle)	{
	return popImageDP(anch.href,title,subtitle);
}

function popImageDP(imageURL,imageTitle,imageSubtitle){
	var AutoClose = true;
	var PositionX = 10;
	var PositionY = 10;
	var defaultWidth  = 640;
	var defaultHeight = 480;
	var imgWin = window.open('','photoDetail','scrollbars=no,resizable=1,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY);
	if( !imgWin ) { return true; } //popup blockers should not cause errors
	imgWin.document.write('<!DOCTYPE HTML PUBLIC "-\/\/W3C\/\/DTD HTML 4.01 Transitional\/\/EN" "http:\/\/www.w3.org\/TR\/html4\/loose.dtd">\n' +
		'<html>\n'+
		'<head><title>'+imageTitle+' - '+imageSubtitle+'<\/title>\n'+
		'<meta http-equiv="Content-Type" content="text\/html; charset=windows-1250">\n'+
		'<script type="text\/javascript">\n'+
		'function resizeWinTo() {\n'+
		'if( !document.images.length ) { document.images[0] = document.layers[0].images[0]; }'+
		'var oH = document.images[0].height, oW = document.images[0].width;\n'+
		'oW = oW + 690; oH = oH + 551\n' +
		'if( !oH || window.doneAlready ) { return; }\n'+ //in case images are disabled
		'window.doneAlready = true;\n'+ //for Safari and Opera
		'var x = window; x.resizeTo( oW + 300, oH + 300 );\n'+
		'var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;\n'+
		'if( x.innerWidth ) { myW = x.innerWidth+30; myH = x.innerHeight; }\n'+
		'else if( d && d.clientWidth ) { myW = d.clientWidth+30; myH = d.clientHeight; }\n'+
		'else if( b && b.clientWidth ) { myW = b.clientWidth+30; myH = b.clientHeight; }\n'+
		'if( window.opera && !document.childNodes ) { myW += 16; }\n'+
		'x.resizeTo( oW = oW + ( ( oW + 300 ) - myW ), oH = oH + ( (oH + 300 ) - myH ) );\n'+
		'var scW = screen.availWidth ? screen.availWidth : screen.width;\n'+
		'var scH = screen.availHeight ? screen.availHeight : screen.height;\n'+
		'if( !window.opera && screen.width>800 ) { x.moveTo(Math.round((scW-oW)/2),Math.round((scH-oH)/2)); }\n'+
		'}\n'+
		'<\/script>'+
		'<link rel="stylesheet" type="text\/css" href="\/css\/u\/popup.css">'+
		'<\/head><body id="photoDetail" onload="resizeWinTo();"'+(AutoClose?' onblur="self.close();"':'')+'>'+
		'<div id="content">'+'<div id="fr-top"><div class="top-popup"><div class="fLeft">'+'<img src="\/img\/u\/logo_pop_big.gif" alt="E.ON" width="121" height="37" border="0">'+'<\/div><div class="fRight">'+'<img src="\/img\/cs\/career\/technician\/title_mapa_pracovnich_mist.gif" alt="Mapa stránek" class="nomenu">'+'<\/div>'+'<br class="break">'+'<\/div>'+'<\/div>'+
		'<img src="'+imageURL+'" alt="Otevírám obrázek ..." title="" ><br>'+
		'<div class="bottom-popup">'+'<div class="fRight">'+'<a href="javascript:window.top.close()" title="Zavřít" class="close">Zavřít<\/a>'+'<\/div>'+'<\/div>\n' +
		(document.layers?'<\/layer>':'<\/div>')+'<\/body><\/html>');
	imgWin.document.close();
	if( imgWin.focus ) { imgWin.focus(); }
	return false;
}

//změna způsobu plateb

function changeInvoicePayment(invoiceObj,group)	{
	var valSel = invoiceObj.value;
	var straight = xGetElementById("straight");
	if (group=="citizen"){
		var sipo = xGetElementById("sipo");
	}
	var bank = xGetElementById("bank");
	var bankPerm = xGetElementById("bankPerm");
	var bill = xGetElementById("bill");
	var unselectedHide = xGetElementById("unselectedHide");
	var noticeSelect = xGetElementById("noticeSelect");
	if (valSel == 1 ) {
		unselectedHide.style.display = "block";
		straight.style.display = "list-item";
		bank.style.display = "none";
		bankPerm.style.display = "none";
		bill.style.display = "none";
		noticeSelect.style.display = "block";
		if (group=="citizen"){
			sipo.style.display = "list-item";
		}
	} else if (valSel == 3) {
		unselectedHide.style.display = "block";
		straight.style.display = "none";
		bank.style.display = "list-item";
		bankPerm.style.display = "list-item";
		bill.style.display = "none";
		noticeSelect.style.display = "block";
		if (group=="citizen"){
			sipo.style.display = "list-item";
		}
	} else if (valSel == 4) {
		bank.style.display = "none";
		bankPerm.style.display = "none";
		bill.style.display = "list-item";
		noticeSelect.style.display = "none";
		unselectedHide.style.display = "block";
		straight.style.display = "none";
		if (group=="citizen"){
			sipo.style.display = "list-item";
		}
	} else {
		unselectedHide.style.display = "none";
		straight.style.display = "none";
		bank.style.display = "none";
		bankPerm.style.display = "none";
		bill.style.display = "none";
		noticeSelect.style.display = "none";
		if (group=="citizen"){
			sipo.style.display = "none";
		}
	}
}

function initialize(){
	var invoiceObj = xGetElementById('invoicePayment');
	changeInvoicePayment(invoiceObj);
}

/* samoodecet napoveda*/

function initHelp() {
	if(document.getElementById('place-number')!=null) {
		document.getElementById('place-number').style.display = "none";
	}
	if(document.getElementById('electrometer-number')!=null) {
		document.getElementById('electrometer-number').style.display = "none";
	}
	if(document.getElementById('electrometer-state')!=null) {
		document.getElementById('electrometer-state').style.display = "none";
	}
	if(document.getElementById('electrometer-type')!=null) {
		document.getElementById('electrometer-type').style.display = "none";
	}
	if(document.getElementById('eancode-help')!=null) {
		document.getElementById('eancode-help').style.display = "none";
	}
}

function showHelp(objx) {
	objx = document.getElementById(objx);
	if (objx.style.display == "none"){
	objx.style.display = "block";
	}else{
		objx.style.display = "none";
	}
}
function hideHelp(objx) {
	objx = document.getElementById(objx);
	objx.style.display = "none";
}

function toggleHelp( objId ) {
	var elem = document.getElementById( objId );
	if ( elem.style.display == "none" || elem.style.display == "" )
		elem.style.display = "block";
	else
		elem.style.display = "none";
}

/*** PDU - JS nastaveni rozcestniku s plynem dle volby kraje ***/
$(document).ready(function() {
	var thisHref,
		gasRegion = getGasRegion();

	$("a").each(function() {
		thisHref = $(this).attr("href");
		if (thisHref == "/cs/citizen/natural_gas/products.shtml") {
			$(this).attr("href",thisHref + "?region=" + gasRegion);
		}
	});
});


// inicializace prvku v rozcestniku s plynem
function gasIndexInit() {
	setGasRegion(getGasRegion());
}

// provede vizualni nastaveni dle vybraneho kraje
function setGasRegion(gasRegion) {
	var selectedGroup = getGasGroup(gasRegion),
		group = [];

	//defaultni nastaveni subtitlu stranky
	if(gasRegion== undefined){
		gasRegion = "default";
	}
	$("div#cities").html(getCities(gasRegion));
	$("div#cities").css("display","block");

	// nastaveni prvku na strance v zavislosti na volbe skupiny (true = viditelny, false = skryty)
	// kazdy prvek, ktery potrebujeme nastavit musi mit prirazenou class zacinajici na "gas-"

	group[1] = [];
	group[2] = [];
	group[3] = [];

	//skupina 1
	group[1]["gas-1"] = false;
	group[1]["gas-2"] = false;
	group[1]["gas-3"] = false;
	group[1]["gas-4"] = true;
	group[1]["gas-5"] = true;
	group[1]["gas-6"] = true;
	group[1]["gas-7"] = true;
	group[1]["gas-8"] = true;
	group[1]["gas-9"] = false;
	group[1]["gas-10"] = false;
	group[1]["gas-11"] = true;
	group[1]["gas-12"] = false;
	group[1]["gas-13"] = false;
	group[1]["gas-14"] = true;

	//skupina 2
	group[2]["gas-1"] = true;
	group[2]["gas-2"] = true;
	group[2]["gas-3"] = true;
	group[2]["gas-4"] = true;
	group[2]["gas-5"] = false;
	group[2]["gas-6"] = true;
	group[2]["gas-7"] = true;
	group[2]["gas-8"] = true;
	group[2]["gas-9"] = true;
	group[2]["gas-10"] = true;
	group[2]["gas-11"] = true;
	group[2]["gas-12"] = true;
	group[2]["gas-13"] = false;
	group[2]["gas-14"] = true;

	//skupina 3
	group[3]["gas-1"] = false;
	group[3]["gas-2"] = false;
	group[3]["gas-3"] = false;
	group[3]["gas-4"] = true;
	group[3]["gas-5"] = true;
	group[3]["gas-6"] = true;
	group[3]["gas-7"] = true;
	group[3]["gas-8"] = true;
	group[3]["gas-9"] = false;
	group[3]["gas-10"] = false;
	group[3]["gas-11"] = true;
	group[3]["gas-12"] = false;
	group[3]["gas-13"] = true;
	group[3]["gas-14"] = true;


	for (i in group[selectedGroup]) {
		if (group[selectedGroup][i]) {
			$("." + i).show();
		}
		else {
			$("." + i).hide();
		}
	}
}

// funcke vrací číslo skupiny, do které patří daný region
function getGasGroup(gasRegion) {
	var gasGroup = [];

	gasGroup["place-sszc"] = 3;
	gasGroup["place-praha"] = 3;
	gasGroup["place-jc"] = 2;
	gasGroup["place-vc"] = 3;
	gasGroup["place-jm"] = 1;
	gasGroup["place-sm"] = 3;
	return gasGroup[gasRegion];
}

// funcke vypíše příslušné okresy
function getCities(gasRegion) {
	var cities = [];

	cities["place-sszc"] = 'Benešov,Beroun,Česká Lípa,Cheb,Chomutov,Domažlice,Děčín,Jablonec nad Nisou,Karlovy Vary,Kladno,Klatovy,Kolín,Kutná Hora,Liberec,Litoměřice,Louny,Mladá Boleslav,Most,Mělník,Nymburk,Plzeň-jih,Plzeň-město,Plzeň-sever,Příbram, Rakovník,Rokycany,Sokolov,Tachov,Teplice,Ústí nad Labem';
	cities["place-praha"] = 'Hlavní město Praha,Praha-východ,Praha-západ';
	cities["place-jc"] = 'České Budějovice,Český Krumlov,Jindřichův Hradec,Pelhřimov,Písek,Prachatice,Strakonice,Tábor';
	cities["place-vc"] = 'Hradec Králové,Havlíčkův Brod,Chrudim,Jičín,Náchod,Pardubice,Rychnov nad Kněžnou,Semily,Svitavy,Trutnov,Ústí nad Orlicí';
	cities["place-jm"] = 'Blansko,Brno-město,Brno-venkov,Břeclav,Hodonín,Jihlava,Kroměříž,Vyškov,Prostějov,Třebíč,Uherské Hradiště,Zlín,Znojmo,Žďár nad Sázavou';
	cities["place-sm"] = 'Bruntál,Frýdek Místek,Jeseník,Karviná,Nový Jičín,Olomouc,Opava,Ostrava-město,Přerov,Šumperk,Vsetín';
	cities["default"] = '';
	cities[gasRegion]='<p class="clr"><strong>Okresy: </strong>'+cities[gasRegion].replace(/,/g,", ")+'</li></ul>';

	return cities[gasRegion];
}


//vraci hodnotu z cookie gasRegion
function getGasRegion() {
	var	gasRegionCookie = $.cookie("gasRegion"),
		gasRegion;
		if (gasRegionCookie != null) {
			gasRegion = gasRegionCookie;
			$("h2#selected-place").html('Naše nabídka pro území: <span class="red">'+$("#" + gasRegion).attr("alt")+'</span>');

			var changeableUrl = $("a#place-changeable").attr("href");
			if(changeableUrl){
				changeableUrl = changeableUrl.split('?')[0]+"?"+gasRegion;
   }
			$("a#place-changeable").attr("href", changeableUrl);
			
			$("div#cities").css("display","block");
			if($("#" + gasRegion).length > 0){
				selectedAreaId = parseInt(($("#" + gasRegion).attr("class")).replace("offset-",""));
				$("#map-cr img.hover").css("top", -(selectedAreaId * $("#map-cr").find("img:first").height()));
			}
		} else {
			$("div#cities").css("display","none");
		}
	return gasRegion;
}

// Image mapa
$.fn.imageMap = function(o) {
	var defaults = {
		areaClassPrefix: "offset"
	};
	o = $.extend(defaults, o);

	return this.each(function() {
		var me = $(this),
		areas = $("area", me),
		mapOffset = parseInt($("img:first", me).height()),
		hoverImg = $("img.hover",me),
		spanImg = $("span",me),
		defaultAreaId = 6,
		defaultText = $("")/*,
		selectedRegion = getGasRegion();*/

		/* defaultni nastaveni */
		hoverImg.css("top", -(defaultAreaId * mapOffset));
		/*spanImg.text(defaultText);*/

		/* ovladani akci pohybu mysi */
		areas.mouseover( function() {
			var areaId = parseInt((this.className).replace(o.areaClassPrefix + "-",""));
			hoverImg.css("top", -(areaId * mapOffset));
			/*spanImg.text($(this).attr("alt"));*/
		});
		areas.mouseout( function() {
			defaultText = "";
			hoverImg.css("top", -(defaultAreaId * mapOffset));
			getGasRegion();
			/*spanImg.text(defaultText);*/
		});
		areas.click( function() {
			selectedRegion = ($(this).attr("id")).replace("region-","");
			$.cookie("gasRegion", selectedRegion, { expires: 9999, path: '/' });
			setGasRegion(selectedRegion);
			$("h2#selected-place").html('Naše nabídka pro území: <span class="red">'+$(this).attr("alt")+'</span>');
			
			var changeableUrl = $("a#place-changeable").attr("href");
			if(changeableUrl){
				changeableUrl = changeableUrl.split('?')[0]+"?"+selectedRegion;
			}
			$("a#place-changeable").attr("href", changeableUrl);
			YWATracker.setCF(9,$(this).attr("alt"));
			YWATracker.submit();
			return false;
		});
	});
};

// Cookie plugin
jQuery.cookie = function(name, value, options) {
	if (typeof value != 'undefined') { // name and value given, set cookie
		options = options || {};
		if (value === null) {
			value = '';
			options.expires = -1;
		}
		var expires = '';
		if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
			var date;
			if (typeof options.expires == 'number') {
				date = new Date();
				date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
			} else {
				date = options.expires;
			}
			expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
		}
		// CAUTION: Needed to parenthesize options.path and options.domain
		// in the following expressions, otherwise they evaluate to undefined
		// in the packed version for some reason...
		var path = options.path ? '; path=' + (options.path) : '';
		var domain = options.domain ? '; domain=' + (options.domain) : '';
		var secure = options.secure ? '; secure' : '';
		document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
	} else { // only name given, get cookie
		var cookieValue = null;
		if (document.cookie && document.cookie != '') {
			var cookies = document.cookie.split(';');
			for (var i = 0; i < cookies.length; i++) {
				var cookie = jQuery.trim(cookies[i]);
				// Does this cookie string begin with the name we want?
				if (cookie.substring(0, name.length + 1) == (name + '=')) {
					cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
					break;
				}
			}
		}
		return cookieValue;
	}
};

// belated png fix
if ($.browser.msie && ($.browser.version.substr(0, 3) == "6.0" || $.browser.version.substr(0, 2) == "5.")) {
	DD_belatedPNG.fix('.png-fix');
}
$(document).ready(function() {
  $(".js-show-note").hover(
    function () {
      $(".js-show-note-box").removeClass("hidden");
    },
    function () {
      $(".js-show-note-box").addClass("hidden");
    }
  );
});// document.ready

