function section(id)
{
	$(".hpsection").hide();
	$(".section-link").removeClass("active");
	
	$("#section-link-"+id).addClass("active");
	$("#section-"+id).fadeIn();


}


function addSmiley($i)
{
	var element = document.getElementById('text');
	//alert(element);
	element.value = element.value + '*' + $i + '*' + ' ';
}

function addSmileyForum($i)
{
	var element = document.getElementById('message');
	//alert(element);
	element.value = element.value + '*' + $i + '*' + ' ';
}

function zaklikni(elm)
{
  element = document.getElementById(elm);
  if (element != null)
  {
    obj = element;
    obj.checked == true ? obj.checked = false : obj.checked = true;
  }
}



function zvyraznit(elm, stav)
{
  if (stav)
  {
    elm.style.cursor = "pointer";
  }
 else
  {
  } 
}


function paste_strinL(strinL, user)
{ 

if(strinL=='') alert('Vyberte prosím nejprve text, který chcete citovat.');

else
{
  strinL = '[cite][b]' +user + '[/b]: ' + strinL + '[/cite]' + '\n';
  
  var input= document.gbook.vzkaz;
  input.value = input.value + strinL; 

}

}


function pasteSel() 
{

  if(document.getSelection) selection=document.getSelection();
  
  else if(document.selection) selection=document.selection.createRange().text;
  
  else if(window.getSelection) selection=window.getSelection;
  
  else selection='';

}




var zapasID;
function resultBox(zapas)
{
  
  element = document.getElementById("zapas" + zapas);
  if (zapasID)
  {
    displayElement("zapas" + zapasID, false);
  }
  if (element != null)
  {
    displayElement("zapas" + zapas, true);
    zapasID = zapas;
  }
  
}


function download(id, typ){
 
   var el=document.getElementById("IframeDownload");
   window.open('/dl.php?file=mirc.rar','IframeDownload');  
   //window.open('/download/detail/file-'+id+'/?id='+id+'&typ='+typ,'IframeDownload');  
   return false;
   
}



function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function ltrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
}



// zobrazit/schovat element
function displayElement(elementId, display)  {
	
	// zobrazit element
	if (display) {
		document.getElementById(elementId).style.display = '';
	}
	// schovat element
	else {
		document.getElementById(elementId).style.display = 'none';
	}
	
}

// zmenit zobrazeni elementu
function swapDisplayElement(elementId)  {
	
	// zobrazit element
	if (document.getElementById(elementId).style.display == 'none') {
		displayElement(elementId, true);
	}
	// schovat element
	else {
		displayElement(elementId, false);
	}
	
}

// zda je element zobrazen
function isDisplayedElement(elementId)  {
	
	// element neni zobrazen
	if (document.getElementById(elementId).style.display == 'none') {
		return false;
	}
	// element je zobrazen
	else {
		return true;
	}
	
}






function CheckScreen(screen) {


  if (screen.foto.value == "")
  { 
    window.alert("Chybí screen z utkání!");
    return false;
   }

return true;

}

function go(para)  {
	location.href = para;
}

function addtext(text) { if (document.gbook.vzkaz.createTextRange &&
	document.gbook.vzkaz.caretPos) { var caretPos = document.gbook.vzkaz.caretPos;
	caretPos.text = caretPos.vzkaz.charAt(caretPos.text.length - 1) == ' ' ?
	text + ' ' : text; } else document.gbook.vzkaz.value += text; document.gbook.vzkaz.focus(caretPos) }





function emo(smile) { 
     document.forms["gbook"].elements["vzkaz"].value=document.forms["gbook"].elements["vzkaz"].value+"*"+smile+"*"; 
     document.forms["gbook"].elements["vzkaz"].focus(); 
}

function otevri_okno(pg) {
     window.open(pg, "okynko", "width=450, height=344");
     return false;
}
function alert_zprava () {
     alert("Nevyplnil jste povinné položky! Zadejte je prosím!");
}

function countit() 
{ 
  napsanoznaku=document.gbook.vzkaz.value.length; 
  zbyvaznaku=1000-napsanoznaku; 
  document.gbook.napsano.value=napsanoznaku; 
  document.gbook.zbyva.value=zbyvaznaku; 
  if (napsanoznaku>=1000) document.gbook.vzkaz.value=document.gbook.vzkaz.value.substring(0,1000);
} 


function countitlong() 
{ 
  napsanoznaku=document.gbook.vzkaz.value.length; 
  zbyvaznaku=3000-napsanoznaku; 
  document.gbook.napsano.value=napsanoznaku; 
  document.gbook.zbyva.value=zbyvaznaku; 
  if (napsanoznaku>=3000) document.gbook.vzkaz.value=document.gbook.vzkaz.value.substring(0,3000);
} 



function navigatorxx(JTPullDown) {
location.href=(document.JTPullDown.JTList.options[document.JTPullDown.JTList.selectedIndex].value);
}

function navigatorx(JTPullDownx) {
location.href=(document.JTPullDownx.JTListx.options[document.JTPullDownx.JTListx.selectedIndex].value);
}



function detail(id)
{
	window.open('/pages/ostatni/ukaz-stadion.php?id='+id,'detail','menubar=no,status=no,width=260,height=180,scrollbars=yes');
}


function Popup(stranka)
{
	window.open('/popup/'+stranka,'popup_stranka','width=500,height=400,resizable=0,top=20,left=20');
}


function openWindow() {
sw = screen.width;
sh = screen.height;

varwidth = (sw - 500) / 2;
varheight = (sh - 400) / 2;

window.open("","JSL",'toolbar=0,location=0,scrollbars=0,width=500,height=400,resizable=0,top='+varheight+',left='+varwidth);
}
 


function tclWindow(id) {
sw = screen.width;
sh = screen.height;

varwidth = (sw - 580) / 2;
varheight = (sh - 400) / 2;

window.open("/pages/tip-credit-liga/tipuj.php?id="+id,"tcl",'toolbar=0,location=0,scrollbars=0,width=580,height=400,resizable=0,top='+varheight+',left='+varwidth);
}


function emo2(smile)                                
{   
 document.forms["gbook"].elements["vzkaz"].value=document.forms["gbook"].elements["vzkaz"].
 value+"["+smile+"] " + " [/"+smile+"]";  
 document.forms["gbook"].elements["vzkaz"].focus();   
}   


var submitted = false;
function SubmitTheForm() {                    
     if(submitted == true) { return; }    

    document.gbook.submit();                    
    document.gbook.Submit.value = 'Odesilá se ...';        
    document.gbook.Submit.disabled = true;                
    submitted = true;                                              
}

var submitcount=0;
function checkFields() {  
  
   if (submitcount == 0)
      {
      submitcount++;
      return true;
      }
   else 
      {
      alert("Formulář byl již poslán!");
      return false;
      }

}


function showLegend(stav)
{
  var elm = document.getElementById("thisLegend").style;
  if (elm.display == "block")
   elm.display = "none"; 
  else
   elm.display = "block";

}


function showScreen(screen)
{
  var obrazek = "/img/zapasy/public/" + screen + ".jpg";
  var elm = document.getElementById('screen').style;
  
  if (elm.visibility == "hidden")
     elm.visibility = "visible"; 
  else
     elm.visibility = "hidden"; 
    
}

function Match(id)
{
 window.location.href = '/match-redir.php?' + id;
}



function ShowForm (id)
{
if (document.getElementById("F" + id).style.display == 'none')
{
 document.getElementById("F" + id).style.display = "";
}
else
{
 document.getElementById("F" + id).style.display = "none";
}
}

