function rozbalsystem(formular) {
	zmena = document.getElementById(formular).style;
  	if(zmena.display == 'block') {
  		zmena.display = 'none';
  	}
  	else {
  		zmena.display = 'block';
  	}
}

function zesedni(text) {
  zmena = document.getElementById(text).style;
    zmena.color = '#acacac';
}

function normaltext(text) {
  zmena = document.getElementById(text).style;
    zmena.color = '#3d3d3d';
}

function disable_enable_necham(){
if (document.all || document.getElementById){
if (document.form.infosys.disabled==true) {
document.form.infosys.disabled=false
}
if (document.form.system.disabled==true) {
document.form.system.disabled=false
}
if (document.form.multijazyk.disabled==true) {
document.form.multijazyk.disabled=false
}
if (document.form.multishop.disabled==true) {
document.form.multishop.disabled=false
}
if (document.form.pronajem.disabled==true) {
document.form.pronajem.disabled=false
}
}
}

function disable_enable_lite(){
if (document.all || document.getElementById){
if (document.form.infosys.disabled==false) {
document.form.infosys.disabled=true
}
if (document.form.system.disabled==false) {
document.form.system.disabled=true
}
if (document.form.multijazyk.disabled==false) {
document.form.multijazyk.disabled=true
}
if (document.form.multishop.disabled==false) {
document.form.multishop.disabled=true
}
if (document.form.pronajem.disabled==true) {
document.form.pronajem.disabled=false
}
}
}

function rozbalskupinaost(div) {
  zmena = document.getElementById(div).style;
  	if(zmena.display == 'none') {
  		zmena.display = 'block';
  	}
  if (document.form.infosys.disabled==false) {
  document.form.infosys.disabled=true
  }
}

function zavriskupinaost(div) {
  zmena = document.getElementById(div).style;
  	if(zmena.display == 'block') {
  		zmena.display = 'none';
  	}
  if (document.form.maloobchod.disabled==false) {
  document.form.maloobchod.disabled=true
  }
  if (document.form.velkoobchod.disabled==false) {
  document.form.velkoobchod.disabled=true
  }
  if (document.form.maloobchodlite.disabled==true) {
  document.form.maloobchodlite.disabled=false
  }
  if (document.form.velkoobchodlite.disabled==true) {
  document.form.velkoobchodlite.disabled=false
  }
}

function rozbalskupinalite(div) {
  zmena = document.getElementById(div).style;
  	if(zmena.display == 'none') {
  		zmena.display = 'block';
  	}
}

function zavriskupinalite(div) {
  zmena = document.getElementById(div).style;
  	if(zmena.display == 'block') {
  		zmena.display = 'none';
  	}
  if (document.form.maloobchodlite.disabled==false) {
  document.form.maloobchodlite.disabled=true
  }
  if (document.form.velkoobchodlite.disabled==false) {
  document.form.velkoobchodlite.disabled=true
  }
  if (document.form.maloobchod.disabled==true) {
  document.form.maloobchod.disabled=false
  }
  if (document.form.velkoobchod.disabled==true) {
  document.form.velkoobchod.disabled=false
  }
}

function disable_enable_profi(){
if (document.all || document.getElementById){
if (document.form.infosys.disabled==true) {
document.form.infosys.disabled=false
}
if (document.form.system.disabled==true) {
document.form.system.disabled=false
}
if (document.form.multijazyk.disabled==false) {
document.form.multijazyk.disabled=true
}
if (document.form.multishop.disabled==false) {
document.form.multishop.disabled=true
}
if (document.form.pronajem.disabled==false) {
document.form.pronajem.disabled=true
}
if (document.form.pronajem.checked==true) {
document.form.pronajem.checked=false
}
}
}

function disable_enable_enterprise(){
if (document.all || document.getElementById){
if (document.form.infosys.disabled==true) {
document.form.infosys.disabled=false
}
if (document.form.system.disabled==true) {
document.form.system.disabled=false
}
if (document.form.multijazyk.disabled==true) {
document.form.multijazyk.disabled=false
}
if (document.form.multishop.disabled==true) {
document.form.multishop.disabled=false
}
if (document.form.pronajem.disabled==false) {
document.form.pronajem.disabled=true
}
if (document.form.pronajem.checked==true) {
document.form.pronajem.checked=false
}
}
}

function rozbal(formular) {
	zmena = document.getElementById(formular).style;
  	if(zmena.display == 'none') {
  		zmena.display = 'block';
  	}
}

function createCookie(name,value,days) {
	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=/";
}

function readCookie(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;
}


function velikostPisma(velikost) {
	var styl = document.getElementById('content').style;

	switch(velikost) 
	{
		case 'saved':
			size = readCookie('font_size');
			if (!((size > 6) && (size < 30))) {
				size = 11;
			}
			styl.fontSize = size + 'px';
		break;
	  case 'large':
			styl.fontSize = '14px';
			createCookie('font_size', 14, 7);
	  break;
	  case 'small':
		default:
			styl.fontSize = '11px';
			createCookie('font_size', 11, 7);
	  break;
	}
}


function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
window.onload = externalLinks;


function confirmDelete(dotaz) {
	if (!confirm(dotaz)) {
		return false;
	} else {
		return true;
	}
}

function open_popup(dokument,sirka,vyska,centrovat,pozice_l,pozice_h) {
  if (centrovat == 1) {
	  so = screen.width;
		vo = screen.height;
		zleva = ((so - sirka) / 2) - 13;
//		shora = (vo - vyska) / 2;
		shora = 100;
	} else {
	  zleva = pozice_l;
		shora = pozice_h;
	}
  popup_win = window.open(dokument,"popup_okno","width="+sirka+",height="+vyska+",left="+zleva+",top="+shora+",location=0,menubar=0,resizable=0,scrollbars=1,status=0,titlebar=0,toolbar=0");
  popup_win.focus();
}

function pl(url){
	window.opener.location.href=url;
	window.close();
	window.opener.focus();
}

function nove_okno(adresa) {
	window.open(adresa,"","");
}

function pl(url){
	window.opener.location.href=url;
}

function switchNote(noteId,a) {
    if(a == 1) {
    		document.getElementById(noteId+"-show").style.display = "none";
        document.getElementById(noteId+"-unshow").style.display = "inline";
        document.getElementById(noteId+"-note").style.display = "block";
    }
    if(a == 0) {
    		document.getElementById(noteId+"-show").style.display = "inline";
        document.getElementById(noteId+"-unshow").style.display = "none";
        document.getElementById(noteId+"-note").style.display = "none";
    }
    if(a == 2) {
    		document.getElementById(noteId+"-show").style.display = "none";
        document.getElementById(noteId+"-unshow").style.display = "none";
        document.getElementById(noteId+"-note").style.display = "none";
    }
  return;
}

function getQuerystring(key, default_)
{
  if (default_==null) default_=""; 
  key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
  var qs = regex.exec(window.location.href);
  if(qs == null)
    return default_;
  else
    return qs[1];
}
function vypisForm() {
  var query = getQuerystring('verze')
  if(query == 'lite') {
    document.getElementById(query).checked = true;
    rozbal('form2');
    rozbalskupinalite('skupinalite');
    zavriskupinaost('skupinaost');
    disable_enable_lite();
    zesedni('tvorbatext');
    zesedni('infosystext');
    zesedni('multijazyktext');
    zesedni('multishoptext');
    zesedni('systemtext');
    normaltext('pronajemtext');
  } else if (query == 'profi') {
    document.getElementById(query).checked = true;
    rozbal('form2'); rozbalskupinaost('skupinaost'); zavriskupinalite('skupinalite'); disable_enable_profi(); normaltext('tvorbatext'); normaltext('infosystext'); zesedni('multijazyktext'); zesedni('multishoptext'); normaltext('systemtext'); zesedni('pronajemtext');
  } else if (query == 'enterprise') {
    document.getElementById(query).checked = true;
    rozbal('form2'); rozbalskupinaost('skupinaost'); zavriskupinalite('skupinalite'); disable_enable_enterprise(); normaltext('tvorbatext'); normaltext('infosystext'); normaltext('multijazyktext'); normaltext('multishoptext'); normaltext('systemtext'); zesedni('pronajemtext');
  } else {
    return true;
  }
}

// funkce pro udrzeni fixniho reklamniho bannerku na stale stejnem miste i pri zmene sirky prohlizece 
function GetWidth()
{
        var x = 0;
        if (self.innerHeight)
        {
                x = self.innerWidth;
        }
        else if (document.documentElement && document.documentElement.clientHeight)
        {
                x = document.documentElement.clientWidth;
        }
        else if (document.body)
        {
                x = document.body.clientWidth;
        }
        return x;
}

function upravPozici() { 
  var currWidth = GetWidth();  
  var newPos = ((currWidth-632)/2)+632;
  document.getElementById('fixni').style.left = newPos;
}
// spousteni funkce 10x do vteriny aby zjistila zda se neco zmenilo a prepsala hodnotu atributu left u position:fixed
//setInterval("upravPozici()",100);
