n = (navigator.appName == "Netscape");
v = parseInt(navigator.appVersion);

ie=document.all;
var brow=0;
if((n&&(v>3))||(ie&&(v>4))||document.getElementById){brow=1;}

function tisk(){
vsechnyPrvky = (document.all ? document.all : (document.getElementsByTagName ? document.getElementsByTagName("*") : null)); 
  if (!document.getElementById || !vsechnyPrvky) return false; 
  if (!(document.styleSheets || document.implementation.hasFeature("StyleSheets","") || document.implementation.hasFeature("CSS","") || document.implementation.hasFeature("CSS2",""))) return false; 

var links = new Array(); var i=0;
var styles=new Array();
links=document.getElementsByTagName("link"); 
var x =confirm("OK = tisknout pouze hlavní obsah stránky, STORNO (ZRUŠIT, CANCEL) = tisknout celý aktuálně viditelný obsah stránky")
if(x==false){

for (i=0; i<links.length; i++){ 
   if(links[i].getAttribute("media")=="print"){links[i].disabled=true;}
  
} 
styles=document.getElementsByTagName("style"); 
/*for (i=0; i<styles.length; i++){ 
 if(styles[i].getAttribute("media")=="screen"){styles[i].setAttribute("media","all");}
}*/
alert("Bude vytištěn celý aktuálně viditelný obsah stránky");

}
else{

for (i=0; i<links.length; i++){ 
   if(links[i].getAttribute("media")=="print"){links[i].disabled=false;}
}

alert("Bude vytištěn pouze hlavní obsah stránky")}
	if(brow==1){
		window.print();
	}
	else{alert("Váš prohlížeč tuto funkci nepodporuje, využijte příkaz Tisk (Print) z nabídky Soubor (File).")}
}

