var problemsOnPages = new Array(
		[1,"opakovani.html"],
		[69,"limity.html"],
		[149,"derivace.html"],
		[217,"lhospitalovo-pravidlo.html"],
		[247,"prubeh-funkce.html"],
		[284,"aplikace-dif-poctu.html"],
		[295,"diferencial.html"],
		[314,"zakladni-integracni-metody.html"],
		[347,"integrace.html"],
		[363,"specialni-integracni-metody.html"],
		[405,"integral.html"],
		[436,"aplikace-int-poctu.html"]);
/* Problem searching is based on this array. Sorting on problem's number is necessary */


function showProblem(id,headdiv) {
  if (document.getElementById(id).style.display == 'block') {
    document.getElementById(id).style.display = 'none';
    headdiv.getElementsByTagName('span')[0].innerHTML = '» Zobrazit zadání «';  
  } else {
    document.getElementById(id).style.display = 'block';
    headdiv.getElementsByTagName('span')[0].innerHTML = '» Skrýt zadání «';
  }
}

function showSolution(id,headdiv) {
  if (document.getElementById(id).style.display == 'block') {
    document.getElementById(id).style.display = 'none';
    headdiv.getElementsByTagName('span')[0].innerHTML = '» Zobrazit řešení «';  
  } else {
    document.getElementById(id).style.display = 'block';
    headdiv.getElementsByTagName('span')[0].innerHTML = '» Skrýt řešení «';
  }
}



function showAllProblems(zfrom,zto,rfrom,rto) {
	var headProblems = getElementsByClassName('priklad-hlavicka');
	
  for (i=zfrom;i<=zto;i++) {
		showProblem('zadani'+i,headProblems[i-zfrom]);
	}    
  
  // changes texts and classes
  elementVse = document.getElementById('odkaz-vse');   
  elementZadani = document.getElementById('odkaz-zadani');  
  elementReseni = document.getElementById('odkaz-reseni');
  if(elementZadani.className == "switchoff") {   

  	   buttonSwitching(elementZadani,"switchon","Sbalit zadání");
         
     if(elementReseni.className == "switchon") {
     
       elementVse.onclick=function(){hideAll(zfrom,zto,rfrom,rto);};  
       buttonSwitching(elementVse,"switchon","Sbalit vše");
     }    
          
  } else {         

  	   buttonSwitching(elementZadani,"switchoff","Rozbalit zadání");
  	 
     elementVse.onclick=function(){showAll(zfrom,zto,rfrom,rto);}; 
     buttonSwitching(elementVse,"switchoff","Rozbalit vše");
     
  }       
  
}




function showAllSolutions(zfrom,zto,rfrom,rto) {
	var headSolutions = getElementsByClassName('reseni-hlavicka');
	for (i=rfrom;i<=rto;i++) {
		showSolution('vypocet'+i,headSolutions[i-rfrom]);
	}      
   
  // changes texts and classes
  elementVse = document.getElementById('odkaz-vse');   
  elementZadani = document.getElementById('odkaz-zadani');  
  elementReseni = document.getElementById('odkaz-reseni');
	
	if(elementReseni.className == "switchoff") {   
	   
  	   buttonSwitching(elementReseni,"switchon","Sbalit řešení");
         
     if(elementZadani.className == "switchon") {

  	   elementVse.onclick=function(){hideAll(zfrom,zto,rfrom,rto);}; 
  	   buttonSwitching(elementVse,"switchon","Sbalit vše");
 
     }  
     
         
  } else {         
	     
  	   buttonSwitching(elementReseni,"switchoff","Rozbalit řešení");

  	 elementVse.onclick=function(){showAll(zfrom,zto,rfrom,rto);};
	 buttonSwitching(elementVse,"switchoff","Rozbalit vše");
  }     
}

// Change ClassName and innerHTML to some element
function buttonSwitching(elementToChange,classNameToChange,textToChange) {
	elementToChange.innerHTML = textToChange;     
    elementToChange.className = classNameToChange; 
}


function showAll(zfrom,zto,rfrom,rto) {

     // changes texts and classes     
     elementVse = document.getElementById('odkaz-vse');   
     elementZadani = document.getElementById('odkaz-zadani');  
     elementReseni = document.getElementById('odkaz-reseni');
     if (elementVse.className == "switchoff")  {
  	   
  	   buttonSwitching(elementVse,"switchon","Sbalit vše");
  	   buttonSwitching(elementZadani,"switchon","Sbalit zadání");
  	   buttonSwitching(elementReseni,"switchon","Sbalit řešení");

     }                            
     
	var headProblems = getElementsByClassName('priklad-hlavicka');
	for (i=zfrom;i<=zto;i++) {
		//showProblem('zadani'+i,headProblems[i-zfrom]);
		
		document.getElementById('zadani'+i).style.display = 'block';
    	headProblems[i-zfrom].getElementsByTagName('span')[0].innerHTML = '» Skrýt zadání «';
	}
	
	var headSolutions = getElementsByClassName('reseni-hlavicka');
	for (i=rfrom;i<=rto;i++) {
		//showSolution('vypocet'+i,headSolutions[i-rfrom]);
		
		document.getElementById('vypocet'+i).style.display = 'block';
    	headSolutions[i-rfrom].getElementsByTagName('span')[0].innerHTML = '» Skrýt řešení «';
	}
	
	elementVse.onclick=function(){hideAll(zfrom,zto,rfrom,rto);};       

  
}


function hideAll(zfrom,zto,rfrom,rto) {

      // changes texts and classes           
     elementVse = document.getElementById('odkaz-vse');   
     elementZadani = document.getElementById('odkaz-zadani');  
     elementReseni = document.getElementById('odkaz-reseni');
     if (elementVse.className == "switchon")  { 

	   buttonSwitching(elementVse,"switchoff","Rozbalit vše");
  	   buttonSwitching(elementZadani,"switchoff","Rozbalit zadání");
  	   buttonSwitching(elementReseni,"switchoff","Rozbalit řešení");

     } 
     
	var headProblems = getElementsByClassName('priklad-hlavicka');
	for (i=zfrom;i<=zto;i++) {
		//showProblem('zadani'+i,headProblems[i-zfrom]);
		
		document.getElementById('zadani'+i).style.display = 'none';
    	headProblems[i-zfrom].getElementsByTagName('span')[0].innerHTML = '» Zobrazit zadání «';
	}
	
	var headSolutions = getElementsByClassName('reseni-hlavicka');
	for (i=rfrom;i<=rto;i++) {
		//showSolution('vypocet'+i,headSolutions[i-rfrom]);
		
		document.getElementById('vypocet'+i).style.display = 'none';
    	headSolutions[i-rfrom].getElementsByTagName('span')[0].innerHTML = '» Zobrazit řešení «';
	}
	
	elementVse.onclick=function(){showAll(zfrom,zto,rfrom,rto);};
	
}




function getElementsByClassName(classname, node) {
    if(!node) node = document.getElementsByTagName("body")[0];
    var a = [];
    var re = new RegExp('\\b' + classname + '\\b');
    var els = node.getElementsByTagName("*");
    for(var i=0,j=els.length; i "#zadani123") on load the page */
function initView() {
	if (location.href.indexOf("#") != -1) {
		var elementID = location.href.split("#"); // elementID[elementID.length-1]
		var allDivs = document.getElementsByTagName("div");
		for (i=0;i scrollingTrigger)) {
        document.getElementById("swmaster").className = "positionFixed";        
				fixed = true;  
			} else if (fixed && (getScrolled() <= scrollingTrigger)) {
        document.getElementById("swmaster").className = "positionNormal";              
				fixed = false;  
			}  
		
    }