//tento soubor je chranen autorskymi pravy Ceske republiky
//pouziti tohoto native kodu bude stihano dle platnych zakonu CR
//**************************************************************
var INFO;var OUTFO;
var leader=window.parent
leader.frames.forMENU.SX_RAM=leader.frames.SX_RAM
var xinited=0;
leader.xWORKFRAME=leader.frames.PRAVY_RAM;
var loadW=parent.frames.forMENU.document.all.INF
loadW.innerHTML="Loading script....phase 1"

//--

var SxTime=0;
var SxAnimTime=0;
var SxMTime=0;
var xSxAnimTime; //pro funkci preruseni
var xSxTime;   //pro funkci preruseni
var xSxMTime;   // pro fci preruseni


var YSLOKA; //odkaz na TD pri zapisu radku na obrazovku
var YSLOKATABLE //odkaz na celou Tabulku TABLE
var YSLOKAAKORDS //odkaz na SPAN obsahijici akordy vzdy jedne sloky
var YLastTop=0;
var YLastLeft=0;
var YLastWidth=0; //sirka nejdelsi radky .. sloky
var YLastHeight=0;  //vyska odstavce ...sloky
var YStartTop=0; 
var YStartLeft=0;
var Ypocetslok=0;
var YANIMATIONS=new Array();
var SXANIMATOR;
var SXANIMATORnumber;

var YSLOKAwidth=0;
var YSLOKAheight=0;
var Ycisloakordu=0;
var YSXOBJEKT=-1;  //tag s kterym se ma hybat
var YPX=0; //pozice bloku pred pretahnutim
var YPY=0; //pozice bloku pred pretahnutim

var YMOUSEX=0;
var YMOUSEY=0;
var YMOUSEXlast=0;
var YMOUSEYlast=0;

var dilatace=1.0;
var akordyON=1;
var akordy1="C C# D D# E F F# G G# A Bb B C C# D D# E F F# G G# A Bb B C C# D D# E F F# G G# A Bb B C Db D Eb E F Gb G Ab A A# H C"
var APL="" //akordy1.split(" ");
var akordy2=" C Db D Eb E F Gb G Ab A A# H C Db D Eb E F Gb G Ab A A# H C Db D Eb E F Gb G Ab A A# H C "

var akords=" C C# Db D D# Eb E F F# Gb G G# Ab A A# B Bb Bb H ";
var akordsM="  m min mi maj dim sus mmaj type add + m+ mi+ "
var ZNPoleX="1. 2. 3. 4. 5. 6. R. R: Ref. Ref: REF. REF: *: *. + Ref.: R1. R2. R3. R4. R5. R6. R1: R2: R3: Rec. Rec: Chor. Chorus: Recitace: Mezihra: Mezihra Intro: Outro: Repeat-chorus: 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. **: **. *) *.) *:) on: ona: On: Ona: oba: Oba: Sólo: Solo: Break Break: 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30.";
var ZNPole=ZNPoleX.split(" ");
var RPole=new Array;
var RWPole=new Array;  //s dosazenymi hodnotami do RPole 
var SxRPolelength=0;
//var NAPole=""
var GNA=0;
 //nastaveni globalnich promennych
 //font textu;velikost textu;barva textu
var GPp="verdana;5;blue"
var pocetSlok=0; 
var L="";
var Aktivni=-1;var MX=0;var MY=0;var pMX=0;var pMX=0;
var ALFA=-1;
//var cas=window.setInterval("{casovac()}",1000);

var interniData="";
var PX=10;var PY=10;var LX=0;var LY=0;var GPY=0;
var maxDelkaSloky=0;
var D="";
var behInterCasu=0;
var posledniPozice=0;
var vyskytAkordu=0;  //v ramci radek
var ExistenceAkordu=0;
var MIDI="";
var TRANSMODE=1;
var TRANSPOSE=0;
var RadkovaniA=-1 ;var RadkovaniAt=-1;  var RadkovaniT=-1;
var VP=1;var CP=1;
var d1Y="";var d2Y="";var d3Y="";  // Y hodnoty velikosti radek
var ni=0; //pocitac akordu;

var GAcords = new Array;  //globalni pole jez obsahuje vsechny akordy (opravdove)
var iG=0;
var WM="";
var WMD="";
var ADV=""
var ATABLE="";
var A_String="";var T_String="";
var SXANIM1INNERTEXT=''; var SXANIM2INNERTEXT='';



//______________________________________________________________________
function Remake(radka)   //fce testuje radku, zda-li se jedna o akordovou, ci textovou; je-li akordova, tak ji rovnou transponuje
{  
 
 var Tpole=akords.split(" ");
 var T="";  //tonina --- napr G
 var TM="";  // typ akordu --- napr dim
 var TN="";  //cislo akordu --- napr 7
 var Rozdelovace="";
 var a=0;
 var OneAkord=""  ;
 var OneAkords=""  ;  //pole
 var poleSlov=radka.split(" ");
 var TR=new Array  //Hotovy akord
 var TRadka = "" // Hotova radka - pospojovane TR
 var PAcords = new Array;
 var iA=0;
 for (var nn=0;nn<poleSlov.length;nn++)  //projede vsechny slova z radky
   {if (poleSlov[nn]=="") {TRadka+=" ";continue} ; //******otevreni for nn
    OneAkord="";Rozdelovace="*";
    for (var m=0;m<poleSlov[nn].length;m++) //rozseka slozeny akord (slovo) na akordy napr: Gmi/Ami na Gmi a na Ami ; vytvori pole pole Rozdelovace
        {  if ( (poleSlov[nn].charAt(m) =="/" ) || (poleSlov[nn].charAt(m) =="(" ) || (poleSlov[nn].charAt(m) ==")" ) || (poleSlov[nn].charAt(m) =="," ) )
             {OneAkord+=";"; if (m==0) Rozdelovace="";
             Rozdelovace+=poleSlov[nn].charAt(m)} else OneAkord+=poleSlov[nn].charAt(m);
        }
    OneAkords=OneAkord.split(";")
    ZaklAkords=akords.split(" ");
    for (var nnnnnn=0;nnnnnn<13;nnnnnn++) TR[nnnnnn]="";
	a=0;
    for (var m=0;m<OneAkords.length;m++)
        {
         //alert(">"+OneAkords[m]+"<")
         T="";  T=OneAkords[m].charAt(0); if ((OneAkords[m].charAt(1)=='#') || (OneAkords[m].charAt(1)=='b')) {T+=OneAkords[m].charAt(1)}
         TM="";TM=OneAkords[m].substring(T.length,100);
         var TNcpolec=";1;2;3;4;9;8;7;6;5;0"; var Tmm=TNcpolec.split(";");  //odriznuti indexu - napr(7-5)
         TN="";for (mm=1;mm<10;mm++)
                 {  
                 	if (TM.indexOf(""+Tmm[mm]+"")!=-1) {TN=TM.substring( TM.indexOf(""+Tmm[mm]+"")-0,100 );
                                                  TM=TM.substring  ( 0,TM.indexOf(""+Tmm[mm]+"")-0   );
                                                  break }
                 }
         //alert (T+"/"+TM+"/"+TN+"///////"+akordsM.indexOf(" "+TM+" "));
         //alert (T+TM+TN+"/.........n"+Rozdelovace)
         if  ( (akords.indexOf(T)!=-1) && (akordsM.indexOf(" "+TM+" ")!=-1) && (TM+T+TN !="") ) //jinak receno: jestli slozky akordu (G+mi+7) jsou akord
              { var Q=">"+T+"< >"+TM+"<>"+TN+" je "+m+". akord ze " +OneAkords.length+"/Rozdelovace: "+Rozdelovace
                if (Rozdelovace.charAt(a)==")" ) 
                   {for (var at=0;at<13;at++) 
                          {    	TR[at]+=Rozdelovace.charAt(a)+Rozdelovace.charAt(a+1)+trans(T,at)+TM+TN};a++;a++ ;
                   	 }
                  else   {for (var at=0;at<13;at++)
				            {
				           	if (Rozdelovace.charAt(a)!="*") TR[at]+=Rozdelovace.charAt(a)+trans(T,at)+TM+TN
				           	else TR[at]+=trans(T,at)+TM+TN
				           	   //if (at==0) alert(OneAkords.length+" / "+OneAkords[m]+"\t"+T+TM+TN+"\n"+(a+1)+" of  "+Rozdelovace.length+"\n\n"+m);
				           	 				           	//if (at==0) alert(">"+OneAkords[m]+"<>"+OneAkords[m+1]+"<>"+OneAkords[m+2]+"\n"+(OneAkords.length-1));
				             if ((OneAkords[m+2]+" "=="undefined ")  && (OneAkords[m+1]==""))
				           	  {TR[at]+=Rozdelovace.charAt(a+1); }
				           	
				           	}
				           	a++
                         }

              } else { if ( (TM+T+TN) !="") {TR[0]="x"}};
        }
     if (TR[0]!="x") {             //provadi se pokud se jedna o akord. ale muze to byt i spojka A
	                  PAcords[iA]=new Array;
					  for (var at=0;at<13;at++) {PAcords[iA][at]=TR[at]}
					  iA++
                          TRadka+=TR[0]+" ";
					 }
     if (TR[0]=="x") return("TEXTLINE");
   } //*****uzavreni for nn
 if (TRadka=="  ") {return("TEXTLINE");}
 

 //nyni je vytvoreno pole akordu pro jeden radek....
 //je treba ho pripojit ke globalnimu poli akordu, protoze ted je jasne, ze jde o akor. radek

 for (nnnnmm=0;nnnnmm<PAcords.length;nnnnmm++)
  {GAcords[iG+nnnnmm]=PAcords[nnnnmm]}
 iG=iG+PAcords.length
 if (ExistenceAkordu==0)  //pri 1. nalezeni akordu
  {//et("FIRSTCHORD",window.leader.frames.Hpanel.document.all.F0tran2.selectedIndex=12;
   var od=GAcords[0][0].charAt(0);
   if ((GAcords[0][0].charAt(1)=="#") || (GAcords[0][0].charAt(1)=="b") ) od+=GAcords[0][0].charAt(1);
   
   //---spoluprace s HPANELem ----
   
    var lsbox=leader.frames.HORNI_RAM.document.all.F0tran1
    
   // VYBER AKORDUU
   for (var wiik=0;wiik<lsbox.length;wiik++)
    {
       if (od==lsbox[wiik].value)
         { lsbox.selectedIndex=wiik  }
    }
   ViewTran(1);
 
   //-------
   

  }
 ExistenceAkordu=1;
 //alert("-"+GAcords[8]+"-"+PAcords.length)


 return(TRadka);
}
//_____________________________________________________________________
loadW.innerHTML="Loading script....phase 2"
//--------------------------
function ViewTran(offon)  //oktree
{

var HPA=leader.frames.HORNI_RAM.document.all;
if (offon==0)
 {HPA.F0tran1.style.visibility="hidden";HPA.F0tran2.style.visibility="hidden";
  //HPA.SRCP1.style.visibility="hidden";HPA.SRCP2.style.visibility="hidden";
  //HPA.F0tranPopis.innerHTML=' ';
 }

if (offon==1)
 {HPA.F0tran1.style.visibility="";HPA.F0tran2.style.visibility="";
  //HPA.SRCP1.style.visibility="";HPA.SRCP2.style.visibility="";
  //HPA.F0tranPopis.innerHTML="Transponovat:";
  
 }
}





//_______________________________

function OVLtran2()
 {
  
  
  TRANSPOSE=parseFloat(leader.frames.HORNI_RAM.document.all.F0tran2.value);
  //AktivujTran(1);
  if (ExistenceAkordu==0) var od="C";
  if (ExistenceAkordu==1) {var od=GAcords[0][0].charAt(0);
           if ((GAcords[0][0].charAt(1)=="#") || (GAcords[0][0].charAt(1)=="b") ) od+=GAcords[0][0].charAt(1);
                          }



//***** nastaveni 1. ovladace
  var pomP=0; var pomS="";
  for (var iik=0;iik<APL.length;iik++)
    {if (APL[iik]==od) {pomP=iik;break}  //pomP udava index nalezeneho akordu v poli Akordy1
    }
 //"C C# D D# E F F# G G# A Bb H C Db D Eb E F Gb G Ab A A# B");
  
  var pomTRANSPOSE=TRANSPOSE; 
  if (pomTRANSPOSE<0) pomTRANSPOSE+=12;
  if (pomP>12) pomP+=-12;if (pomP>12) pomP+=-12;
  var pomresult=(pomP+pomTRANSPOSE)
  while (pomresult>12) pomresult+=-12;
   
  //alert(APL[pomresult])
  pomS=APL[pomresult]; //if (TRANSPOSE<-6) alert(pomS);

  for (var iik=0;iik<leader.frames.HORNI_RAM.document.all.F0tran1.length;iik++)
    {
      if (pomS==leader.frames.HORNI_RAM.document.all.F0tran1[iik].value)
        { leader.frames.HORNI_RAM.document.all.F0tran1.selectedIndex=iik
          //alert (document.all.F0tran1[iik].value);
        }
    }


//***************************
 
 //Yif (provedeno<2) return;
 //if (provedeno==2) provedeno=3;
 Transpose(TRANSPOSE);
 }


function OVLtran1(OVLtMODE)
 {
  
  TRANSPOSE="";
  TRANSPOSE=leader.frames.HORNI_RAM.document.all.F0tran2.value;

  //if (provedeno==2) alert(ExistenceAkordu);//alert(GAcords[0][1])

  if (ExistenceAkordu==0) var od="C";
  if (ExistenceAkordu==1) {var od=GAcords[0][0].charAt(0);
           if ((GAcords[0][0].charAt(1)=="#") || (GAcords[0][0].charAt(1)=="b") ) od+=GAcords[0][0].charAt(1);
                          }
  
  for (var iik=1;iik<APL.length;iik++)
    {if (APL[iik]==od) {TRANSPOSE=iik;break}
    }
  //alert(od+"\n"+APL[TRANSPOSE])
  //alert(TRANSPOSE+"\n"+APL)
  for (var iik=0;iik<APL.length;iik++)
    {if (APL[iik]==leader.frames.HORNI_RAM.document.all.F0tran1.value)
      {TRANSPOSE=iik-TRANSPOSE;
       if (TRANSPOSE>6) TRANSPOSE+=-12; //pro porovnani s pianem CASIO
       if (TRANSPOSE<-6) TRANSPOSE+=12;
       //alert(od+"/"+parent.frames.HORNI_RAM.document.all.F0tran1.value+"/ "+TRANSPOSE+"\n");
       break}
    };

  //AktivujTran(0);
  //TRANSTO=F0.document.all.F0tran1.value;

//****ovladani druheho ovladace
  for (var iik=0;iik<leader.frames.HORNI_RAM.document.all.F0tran2.length;iik++)
    {
      if (TRANSPOSE==leader.frames.HORNI_RAM.document.all.F0tran2[iik].value)
        {
          leader.frames.HORNI_RAM.document.all.F0tran2.selectedIndex=iik
          //alert (F0.document.all.F0tran2[iik].value);
        }
    }
//******************
//Y if (provedeno<2) return;
//Y if (provedeno==2) provedeno=3;   //tzn. byl pozadavek transponovat, nutno provest na konci.
 Transpose(TRANSPOSE);


}

//_____________________________

function trans(acco,j)            //transponuje akord. zaklad o hodnotu j (j je kladne 0-13)
 {
  var lvysl=""  
  for (var jjj=0;jjj<APL.length;jjj++)
   {if (acco==APL[jjj])
     {if (jjj>12) {jjj=jjj-12;}
      if (jjj>12) {jjj=jjj-12;}
      if ((jjj+j)>12) j-=12;
      lvysl=APL[jjj+j]
      if (lvysl.substring(0,1)=='x') lvysl=lvysl.substring(1,100)
      return(lvysl);
      break;
     }
   }
  return("?");
 


 }

//_____________________________________________________________________
function Transpose(oj)  //oj udava o kolik transponovat ( klidne i zapornej smer)
{

var JA = leader.xWORKFRAME.document.all;


if (oj<0) oj=oj+12  //prevedeni zaporneho smeru na kladne hodnoty transponovani
if (oj>11) oj=oj-12;
TRANSPOSE=oj;
var cji=0; var ee=0;
var JAlength=JA.length
for (var cj=19;cj<JAlength;cj++) //staci pocitat az od 19 (zacatek tabulky)
 {
 ee=0;
 //if ( (JA[cj].tagName=="SPAN") && (JA[cj].className.charAt(0)=="A") &&(JA[cj].children.length==0 ) ) 
 if (JA[cj].className=="AKORD")
  {
  JA[cj].innerHTML=GAcords[cji][oj];
  //alert(JA[cj].innerText+"...\n...."+GAcords[cji][oj]);
  cji++;
  }
 if (JA[cj].tagName=="S")
  {
   //alert(JA[cj].innerText+"...\n...."+GAcords[cji][oj]);
   JA[cj].innerHTML=GAcords[cji][oj];
   cji++;
  }



 }


//alert(TRANSPOSE)

};

//________________________

function Priprav(aline)
{
//return;

//if (aline.indexOf('>')>-1) if (aline.indexOf('>')<5) return(aline.substring(2,aline.length-3));
var na=0; //pocita akordy na radku	
var outline="";
var prmm=0;
var prm=0;  //mod akord/text .... 1/0

var Ysxchordstyle='X_X'//leader.get("sx_chordCStyle","font-weight:900;");
for (nnn=0;nnn<aline.length;nnn++)
 {
  if (aline.charAt(nnn)=="|" ) if(prmm==1) {outline+='</Span>';prmm=0}
  if (aline.charAt(nnn)=="|" ) if(prm==1) {outline+='</SPAN>';prm=0}
  if (aline.charAt(nnn)=="|" ) if (aline.charAt(nnn+1)=="B" ) {prm=0;nnn=nnn+2;continue}
  if (aline.charAt(nnn)=="|" ) if (aline.charAt(nnn+1)=="T" ) {prm=0;nnn=nnn+1;continue}
  if (aline.charAt(nnn)=="|" ) if (aline.charAt(nnn+1)=="S" ) {prm=1;prmm=0;nnn=nnn+2;outline+='<SPAN class=AO2 STYLE="'+Ysxchordstyle+'">'}//..nasel samostatnou akordovou oblast
  if (aline.charAt(nnn)=="|" ) if (aline.charAt(nnn+1)=="A" ) {prm=1;prmm=0;nnn=nnn+2;outline+='<SPAN class=AO1 STYLE="'+Ysxchordstyle+'"> '}  //...nasel akordovou oblast
  if (prm==1) if (aline.charAt(nnn)==" ") if(prmm==1) //prmm... predchozi znak=nemezera  ......prmm=0 , jinak receno nenalezen akord
     {outline+='</span>'+"&nbsp;"; prmm=0;continue
      
     }
  if (prm==1) if (aline.charAt(nnn)!=" ")  if (prmm==0)// jinak receno nalezen akord
      {outline+='<span class=A1>'+""; prmm=1;
      na++;continue
      
      }
  if (prm==1) if (aline.charAt(nnn)!=" ") continue;
  
  if (aline.charAt(nnn)==" ") {outline+="&nbsp;"}
  if (aline.charAt(nnn)=="_") {outline+=" "} 
  if ((aline.charAt(nnn)!=" ") && (aline.charAt(nnn)!="_") ) {  outline+=aline.charAt(nnn); } 	
 } 	

//outline="<SPAN class=R>"+outline+"</SPAN>"
//alert(aline+".......\n\n\n\n"+outline);
//  NAPole[NAPole.length]=na;

//----------pridani znacek slok--------
for (nnn=0;nnn<ZNPole.length;nnn++)
 { if (outline.indexOf(ZNPole[nnn])==0) {outline='<span class=ZNACKA STYLE="'+leader.get("sx_signStyle","font-weight:900;")+'">'+ZNPole[nnn]+'</span>'+outline.substring(ZNPole[nnn].length,1750);}  }
//-------------------------------------
return(outline);
  	
}	
	
//----------

function incSize(step,primohodnota)
{
var chyba=0;
if (leader.xWORKFRAME==-1) chyba=1
if (leader.xWORKFRAME.document.all.N1==null) chyba=1;
if (leader.gmemory["sxt_tableSize"]==null) chyba=1

if (chyba==1)  {leader.frames.HORNI_RAM.document.all.IDZK.value=1*leader.frames.HORNI_RAM.document.all.IDZK.value+step;return;}


if (primohodnota!=null) step=2
var ts=leader.get("sxt_tableSize","16")*1	
var ta=leader.get("sxt_chordSize","14")*1	
var tratio=ts/ta
if (ts<8) if (step<0) return;
if (ts>24) step=step*2

var str = leader.get("sx_tableCStyle")
var re= "font-size:"+ts  //retezec, ktery se ma nahradit
ts=ts+step
if (primohodnota!=null) ts=primohodnota
var rc="font-size:"+ts  //novy retezec
parent.set("sx_tableCStyle",str.replace(re,rc));

str = leader.get("sx_chordCStyle")
re= "font-size:"+ta  //retezec, ktery se ma nahradit
ta=ts / tratio
rc="font-size:"+ta  //novy retezec
parent.set("sx_chordCStyle",str.replace(re,rc));


leader.set("sxt_tableSize",ts)
leader.set("sxt_chordSize",ta)
leader.set("sx_lineHeight",1.1*ts*(leader.get("sxt_lineExp1")/100))
leader.frames.HORNI_RAM.document.all.IDZK.value=ts ;
reDraw()
}

//-------
function newSong() 
{ if (leader.xWORKFRAME==-1) return;
 leader.frames.HORNI_RAM.viewMenu(0)
 leader.xWORKFRAME.location.href='_new.htm';
  parent.gTimeNum=5997;
}

//---------------
function dialog(cislo)
{
leader.frames.HORNI_RAM.viewMenu(0)
if (leader.xWORKFRAME==-1) return;
if (cislo==4) if (leader.xWORKFRAME.document.all.N1==null) {alert("Tato akce nyní nemá smysl, protože není otevřena žádná píseň. \n Chcete-li zadat novou píseň, použijte nabídku \"Nová píseň\"  ");return} ;
if (cislo==5) if (leader.xWORKFRAME.document.all.N1==null) {alert("Tato akce nyní nemá smysl, protože není otevřena žádná píseň. \n Otevřete nejprv nějakou píseň, nebo zadejte novou píseň pomocí menu \"Nová píseň\"  ");return} ;
if (leader.xWORKFRAME.document.all.FORM!=null) {alert("Nejprve ukončete vyplňování formuláře...");return}
var prop=new Array; 
prop[0]=parent.gmemory

//alert(prop[sx_lineHeight])
//alert(prop[0]["sx_jmenoPisne"])
//"sx_jmenoPisne"]=sx_jmenoPisne;prop["sx_popiska"]=sx_popiska;
var q;
if (cislo==1) q=window.showModalDialog("../dialogs/dialog01.htm",prop,"dialogHeight: 400px; dialogWidth: 435px; dialogTop: 160px; dialogLeft: 270px; center: Yes; help: no; resizable: no; status: Yes;")	
if (cislo==3) q=window.showModalDialog("../dialogs/dialog03.htm",prop,"dialogHeight: 400px; dialogWidth: 500px; dialogTop: 160px; dialogLeft: 200px; center: Yes; help: no; resizable: no; status: Yes;")	
if (cislo==4) q=window.showModalDialog("../dialogs/dialog04.htm",prop,"dialogHeight: 10px; dialogWidth: 10px; dialogTop: 160px; dialogLeft: 270px; center: Yes; help: no; resizable: yes; status: yes; ")	
if (cislo==5) q=window.showModalDialog("../dialogs/dialog05.htm",prop,"dialogHeight: 380px; dialogWidth: 600px; dialogTop: 160px; dialogLeft: 150px; center: Yes; help: no; resizable: no; status: Yes;")	
if (cislo==6) q=window.showModalDialog("../dialogs/dialog06.htm",prop,"dialogHeight: 300px; dialogWidth: 400px; dialogTop: 160px; dialogLeft: 270px; center: Yes; help: no; resizable: no; status: Yes;")	
if (cislo==7) q=window.showModalDialog("../dialogs/dialog07.htm",prop,"dialogHeight: 360px; dialogWidth: 400px; dialogTop: 160px; dialogLeft: 270px; center: Yes; help: no; resizable: no; status: Yes;")	
if (cislo==8) q=window.showModalDialog("../dialogs/dialog08.htm",prop,"dialogHeight: 400px; dialogWidth: 400px; dialogTop: 160px; dialogLeft: 270px; center: Yes; help: no; resizable: no; status: Yes;")	
if (cislo==9) {SxPredTiskem();return}
if (cislo==10) {SxSave();return}

// q=window.showModelessDialog("dialogs/dialog08.htm",prop,"dialogHeight: 400px; dialogWidth: 500px; dialogTop: 100px; dialogLeft: 100px; center: Yes; help: no; resizable: no; status: Yes;")	
if (q[1]==0) return;
gmemory=q
leader.frames.HORNI_RAM.document.all.IDZK.value=leader.get("sxt_tableSize")   

if (q[1]==6) {leader.xWORKFRAME.location=q[2];hideIcons()}
if (q[1]==7) {leader.xWORKFRAME.location=q[2];parent.gTimeNum=6000}
if (q[1]==9) {leader.XMLFile.value=q[2];leader.loadXML();leader.frames.forMENU.ZNACKA=-1;/*leader.hideFrames();*/}


if (leader.xWORKFRAME.document.all.N1==null) return ;
if (q[1]==1) reDraw();
if (q[1]==2) ONSTART();
if (q[1]==8) sxPapir()


}

//-------------------
function sxPapir()
{
   var styleText='background-color:'+leader.get("sx_papirColor","whitesmoke")+';border-width:1;border-color:'+leader.get("sx_papirBorderColor","silver")+';border-style:dotted;visibility:visible;z-index:-1;display:'+'block'+';'
       styleText+='position:absolute;left:-'+leader.get("sx_papirMarginLeft",10)+'mm;top:-'+leader.get("sx_papirMarginTop",10)+'mm;width:'+(1*leader.get("sx_papirWidth",210)-leader.get("sx_papirMarginRight",10))+'mm;height:'+(1*leader.get("sx_papirHeight",297)-leader.get("sx_papirMarginBottom",10))+'mm;'
   var pap='<DIV id="PAPIROBJECT" STYLE="'+styleText+'">'
    pap+='</DIV>'
  
    if (leader.xWORKFRAME.document.all.PAPIROBJECT==null) 
    {leader.xWORKFRAME.document.all.SxOUT.outerHTML+=pap} 
    else 
    {    var PAPIR=leader.xWORKFRAME.document.all.PAPIROBJECT.style
     PAPIR.backgroundColor=leader.get("sx_papirColor","whitesmoke")
     
     PAPIR.posLeft='-'+leader.get("sx_papirMarginLeft",10)
     PAPIR.posTop=' -'+leader.get("sx_papirMarginTop",10)
     PAPIR.height=(1*leader.get("sx_papirHeight",297)-leader.get("sx_papirMarginBottom",10))+'mm'
     PAPIR.width =(1*leader.get("sx_papirWidth",210)-leader.get("sx_papirMarginRight",10))+'mm'
     PAPIR.borderColor=leader.get("sx_papirBorderColor","silver")
     
     
     
     
    }
    
    
    //alert(leader.xWORKFRAME.document.readyState+"\n"+leader.xWORKFRAME.document.all.PAPIROBJECT.contains"\n")
    //{leader.xWORKFRAME.document.all.PAPIROBJECT.innerHTML='sjaskjalskjalk'} 
    
}

//--------
function sxDefaultStyle()
{
leader.ifnset ("sx_tableCStyle","font-family:verdana;font-size:16;color:black;")
leader.ifnset ("sx_chordCStyle","font-family:arial;font-size:14.4;color:navy;font-weight:900;")
leader.ifnset ("sx_titleCStyle","font-family:IMPACT;font-weight:900;text-decoration:underline;font-size:32;color:navy;background-Color:white;position:relative;left:20;top:0;")	
leader.ifnset ("sx_descCStyle" ,"font-family:arial;font-size:12;color:navy;background-Color:transparent;position:relative;left:20;top:0;")	


leader.ifnset ("sxt_descLeft","20")
leader.ifnset ("sxt_titleLeft","20")
leader.ifnset ("sxt_lineExp1","100")
leader.ifnset ("sx_lineKoef1","1.6")
leader.ifnset ("sx_deltaY","68")
leader.ifnset ("sx_left","45")
leader.ifnset ("sx_top","20")

leader.ifnset ("sxt_tableSize","16")
leader.ifnset ("sxt_chordSize","14.4")

leader.ifnset("sx_lineHeight",1.1*18);

}

sxDefaultStyle()


//---------------
function sxHLAVICKA() //oktree
{
 var units='mm;'
 var lanum1=(leader.get("sx_papirWidth",210)-leader.get("sx_papirMarginLeft",10)-leader.get("sx_papirMarginRight",10))    *(3/5);  
 var lanum2=(leader.get("sx_papirWidth",210)-leader.get("sx_papirMarginLeft",10)-leader.get("sx_papirMarginRight",10))    *(1/4);  
 //var lanum2=leader.get("sx_papirWidth",210)*(1/4);  
 var jmenoPISNE = leader.get("sx_jmenoPisne","[Název pisně]")
 var POPISKA = leader.get("sx_popiska","[popiska]")
 var re= / /gi  //retezec, ktery se ma nahradit .. nahrazeni mezer strinem <wbr>
 var rc='<wbr> '
 jmenoPISNE=jmenoPISNE.replace(re,rc);POPISKA=POPISKA.replace(re,rc);
  //nasleduje jeste nahrazeni podtrzitek mezerou
 var re= /_/gi  ; var rc='&nbsp;';   jmenoPISNE=jmenoPISNE.replace(re,rc);POPISKA=POPISKA.replace(re,rc);
 



 
 //var la='width:'+lanum+'mm;' 
 //alert(la)
 var lll=""
    lll+='<DIV ID=IDTABLE border=0 height=100 STYLE="'+leader.get("sx_headStyle","")+'">'
    lll+='<nobr><span id=N1 onclick="parent.frames.SX_RAM.dialog(1)" STYLE="'+leader.get("sx_titleCStyle","background-color:silver;")+';white-space:normal;width:'+lanum1+units+'">'+jmenoPISNE+'</span>'
 
    var lpomm=leader.get("sx_popiska","")
    if (lpomm.length>0)
     {lll+='&nbsp;&nbsp;<span id=N2 onclick="parent.frames.SX_RAM.dialog(1)"  STYLE="vertical-align:0;'+leader.get("sx_descCStyle","background-color:silver;")+';white-space:normal;width:'+lanum2+units+'">'+POPISKA+'</span>'}
    else
     {lll+='&nbsp;&nbsp;<span id=N2></span>'}
    
    lll+='</nobr>';
    lll+='</DIV>'
 window.top.document.title="Agama / "+leader.get("sx_jmenoPisne","NAZEV_PISNE")
 return (lll)	
}

//_______________________________________________________________________

function ONSTART(lqstring) //je volana po nahrani prave stranky...
{   //lqmode: undefined..na zacatku , string ..pri opakovanem ONSTARTU
if (leader.xWORKFRAME.document.all.FORM!=null) {alert("Nejprve ukončete vyplňování formuláře...");return}
if (leader.xWORKFRAME.document.all.LARGE==null) return;

//alert(leader.xWORKFRAME.document.body.innerHTML)
//if (leader.xWORKFRAME.document.all.LARGE==null) alert('Spatny soubor - chyba 555')
//leader.ifnset("SXCHORDS1","C C# D D# E F F# G G# A Bb B C Db D Eb E F Gb G Ab A A# H")  //angl.
//leader.ifnset("SXCHORDS1","C C# D D# E F F# G G# A Bb H C Db D Eb E F Gb G Ab A A# B")   //cs logic


if (parent.get("sx_AF",true)==false) 
  {SongInfo();
  if (leader.xWORKFRAME.document.all.LARGE.style.display=="") //pri prvnim. vykresl.
        {parent.set("sx_jmenoPisne",leader.xWORKFRAME.document.all.N1.innerText);
         parent.set("sx_popiska",leader.xWORKFRAME.document.all.N2.innerText);
         parent.set("sx_text","Je vyplé AGAMA formátování (AF)  -  Text je nedostupný    a nedá se tedy ani měnit");
        	return;}
  else {leader.xWORKFRAME.location.replace(leader.xWORKFRAME.location)}
  
  }
  /*
  
  leader.xWORKFRAME.document.all.LARGE.style.display="";
  if (leader.xWORKFRAME.document.all.SxOUT!=null) leader.xWORKFRAME.document.all.SxOUT.outerHTML='';
  
  if (leader.get("sx_oldIDTABLE","")!="") {leader.xWORKFRAME.document.all.IDTABLE.outerHTML=leader.get("sx_oldIDTABLE") }
   //alert(leader.xWORKFRAME.document.all.LARGE.innerText)
  return;}
*/


akordy1=leader.get("sx_chordTable","C C# D D# E F F# G G# A Bb H C Db D Eb E F Gb G Ab A A# B");

APL=akordy1.split(" ");
var pom33=APL[11]; if (pom33=='xB') pom33='B';
leader.frames.HORNI_RAM.document.all.F0tran1[11].text=pom33;
leader.frames.HORNI_RAM.document.all.F0tran1[11].value=APL[11]
leader.frames.HORNI_RAM.document.all.F0tran1[10].text=APL[10];
leader.frames.HORNI_RAM.document.all.F0tran1[10].value=APL[10];




GAcords= new Array;ExistenceAkordu=0;TRANSPOSE=0;
iG=0;
var s="";
if (SongInfo()==-1) {
	if (lqstring==null) return; //opakovany pokus
	//status=lqstring
	
	leader.xWORKFRAME.location='../htmltext/'+lqstring;
	parent.gTimeNum=6000
	/*alert("Soubor neexistuje \nKontaktujte prosím Agamu");*/ return;} //soubor neexistuje

if (leader.xWORKFRAME.document.all.LARGE.style.display=="") 
 {leader.xWORKFRAME.document.all.LARGE.outerHTML+='<DIV id=SxOUT STYLE="position:absolute;left:0;top:0;z-índex:2"></DIV>'
  s=" \n"+leader.xWORKFRAME.document.all.LARGE.innerText+" \n ";
  parent.set("sx_text",leader.xWORKFRAME.document.all.LARGE.innerText)
  parent.set("sx_jmenoPisne",leader.xWORKFRAME.document.all.N1.innerText)
  parent.set("sx_popiska",leader.xWORKFRAME.document.all.N2.innerText)
  function leader.xWORKFRAME.document.body.onunload() {if (SxTime>0) {SxTime=-1;window.clearInterval(xSxTime);return}}
  
  leader.frames.HORNI_RAM.document.all.F0tran2.value=0
  function leader.xWORKFRAME.document.body.onclick() {leader.frames.HORNI_RAM.viewMenu(0)}
  function leader.xWORKFRAME.document.body.onmousedown() {SXZACNIPOSUN(leader.xWORKFRAME.event);return(false)	}
  function leader.xWORKFRAME.document.body.onmousemove() {SXPOSUNOVANI(leader.xWORKFRAME.event,leader.xWORKFRAME.name);return(false)	}
  function leader.xWORKFRAME.document.body.onmouseup() {SXKONECPOSUNOVANI(leader.xWORKFRAME.event);return(false)}
  function leader.xWORKFRAME.document.body.onunload() {if (SxTime>0) {SxTime=-1;window.clearInterval(xSxTime);return}}
  
 }
else
 {s=" \n"+leader.get("sx_text","nic")+" \n ";
  if (SxTime>0) {SxTime=-1;window.clearInterval(xSxTime);}
 }
//leader.xWORKFRAME.document.all.LARGE0;top:0;z-index:2"></DIV>'

var p=""; //pomocna prom.
var XPole=new Array;




 RPole.length=0;
//********************vytvoreni pole z radek ***************

var pole="";


{pole = s.split("\n");} //vyrvori pole - kazda polozka=jeden radek

for (n=0;n<pole.length;n++)
 {  //status=n+". řádka zpracována"  ;
    s=pole[n];
    for (nm=(s.length-2);nm>=0;nm=nm-1)  //smaze zbytecne mezery z koncu radek
      {    if (s.charAt(nm)!=" ") {pole[n]=pole[n].substring(0,nm+2);nm=-1;};
           if (nm==0) {pole[n]="";nm=-1;}
      };
    pole[n]=pole[n].substring(0,pole[n].length-1)+" "; //prida mezeru na konce radek a na zacatek
    p= Remake(pole[n]); 
    if (p=="TEXTLINE") {XPole[n]="T"+pole[n] } else {XPole[n]="A"+p};
 }
//alert(XPole[2])
//if (ExistenceAkordu==0) ViewTran(0); 
//**************** Propojeni akordovych a textovych radek ****************
//*******************Slinkovani ******************************************

p=XPole.length;XPole[0]="0-BEGIN"; XPole[p]="--END--";
p=0;var R="";var pom="";
var AR=""; var TR="";var pp="";
for (n=0;n<XPole.length;n++)
 { 

    if    (XPole[n].charAt(0) =="0"   ) { RPole[p]="    "; p++ };
    if (  (XPole[n].charAt(0) =="T"   ) && ((XPole[n-1].charAt(0) =="T"   )||(XPole[n-1].charAt(0) =="0" )) )  { RPole[p]="|T"+(XPole[n].substring(1,1750))+"|B";RPole[p]=Priprav(RPole[p]);;;  p++ ;} 
    if (  (XPole[n].charAt(0) =="A"   ) && (XPole[n+1].charAt(0) =="A"   ) )  {RPole[p]="|S"+(XPole[n].substring(1,1750))+"|B";RPole[p]=Priprav(RPole[p]);;p++} // celoakord.radek
    if (  (XPole[n].charAt(0) =="A"   ) && (XPole[n+1]=="T " ) )  {RPole[p]="|S"+(XPole[n].substring(1,1750))+"|B";RPole[p]=Priprav(RPole[p]);;p++} // celoakord.radek
      //{ RPole[p]="|S"+Ospanuj(XPole[n].substring(1,1750))+"|B";RPole[p]=AddNbsp(RPole[p]);  p++ ;}
    if (( XPole[n] =="T "   ) && (XPole[n-1].charAt(0) =="A"   ))  { RPole[p]="|T"+(XPole[n].substring(1,1750))+"|B";RPole[p]=Priprav(RPole[p]);;;  p++ ;} 
    if (  (XPole[n].charAt(0) =="A"   ) && (XPole[n+1].charAt(0) =="T"   ) &&(XPole[n+1]!="T " ))
      { AR=XPole[n].substring(1,1750)+" ";TR=XPole[n+1].substring(1,1750);
        //AR=AR+"                                ";
        R="";       var pmode="Text";     var Text="";
        if (AR.length>TR.length) {pp=AR.length} else {pp=TR.length;AR+="                                                                         "};
//        alert(">"+AR+"< >"+TR+"<");
        //alert(TR+">"+TR.length+">>>"+pp);
        TR=TR.substring(0,TR.length-1);  //smaze mezeru na konci TR     	
        for (m=0;m<pp;m++)
         {
           { if ( m>=TR.length ) if (pmode=="Akord")  
               { 
                R+=(AR.substring(m,1750))+"|T"+Text;;break} 
               }
           { if ( m>=TR.length ) if (pmode=="Text")    //... znamena akord na konci
              {
     
                if (m==pp-1) break;       	
              	pom=0;var mezera=""
                for (var mm=1;mm<7;mm++)   //akord bude pripojen k predchozimu (je prilis blizko)
                 {  //alert (R.charAt(R.length-mm));
                  
                  if (mm>4) mezera+=" ";
                  if (R.charAt(R.length-mm)=="|") {R=R.substring(0,R.length-mm)+mezera+" "+AR.substring(m,1750)+R.substring(R.length-mm,1750);pom=1;}
                 }
                
                if (pom==1) break; //akord uz byl pripojen -konec
                //alert(m+"/"+pp+" \n "+ ">>>>"+R+"<<<<");
       
                R+="|A"+AR.substring(m,1750);break  //nebude pripojen - konec
              	 
              }
            }
           { if ( AR.charAt(m) ==" ") if (pmode=="Text")  { R+=TR.charAt(m);pmode="Text";continue} }
           { if ( AR.charAt(m) !=" ") if (pmode=="Text")  { R+="|A"+AR.charAt(m);pmode="Akord";Text+=TR.charAt(m);continue } }
           { if ( AR.charAt(m) !=" ") if (pmode=="Akord") { R+=AR.charAt(m);pmode="Akord";Text+=TR.charAt(m);continue }}//****
           { if ( AR.charAt(m) ==" ") if (pmode=="Akord") { R+="|T"+Text+TR.charAt(m);pmode="Text";Text="";continue} }
         }
       

        R="|T"+R+"|B"; 
        RPole[p]=Priprav(R);;
         
          p++; 
     }

 }

SxRPolelength=RPole.length;

SxTime=0;
xSxTime=window.setInterval(Put,10)
Ycisloakordu=0;
}
//________________________________________________________________

function reDraw()
{

if (leader.xWORKFRAME.document.all.FORM!=null) {alert("Nejprve ukončete vyplňování formuláře...");return}
if (leader.xWORKFRAME.document.all.SxOUT==null) {alert("Agama formátování je vyplé,\n proto tato akce nemá smysl");return;}

if (SxTime>0) {SxTime=-1;window.clearInterval(xSxTime)}
leader.xWORKFRAME.document.all.SxOUT.innerHTML=""
SxTime=0;
xSxTime=window.setInterval(Put,10)
Ycisloakordu=0;
}

function dosadDoRPole(c)  //dosadi za "urcite stringy" konkretni hodnoty
{
var str = RPole[c]  
var re= /X_X/gi  //retezec, ktery se ma nahradit
//if (c<5) alert(leader.get("sx_chordCStyle","111"))
var rc=leader.get("sx_chordCStyle","font-weight:900;");
RWPole[c]=str.replace(re,rc);
//if (c<6)
//alert(">>"+RWPole[c]+"<<")


}

//------------------------------

function Put()
{


if (SxTime==SxRPolelength) {SxTime=0;window.clearInterval(xSxTime);
                           
                            if (leader.get("sx_print","0")=="1") {SxPredTiskem()}
                          
                            
                            return}
dosadDoRPole(SxTime)  //fce dosadi do RPole konkretni hodnoty aktualniho stylu, vznikne RWpole
var yl_deltay=leader.get("sx_lineHeight","14.4") *1* leader.get("sx_linePadding","1.0")
var yl_pomocnaaa=0;


if (SxTime==0)
 {
  if (leader.xWORKFRAME.document.all.SxOUT==null) 
     {SxTime=0;window.clearInterval(xSxTime);leader.gTimeNum=10;leader.gTimeNum=2000;return}  //chyba444
  YStartTop=leader.get("sx_top","60")*1;
  //alert(YStartTop)
  YStartLeft=leader.get("sx_left","20")*1
  
  sxPapir();
  //alert('www1')
  
  //zapamatovani si puvodni hlavicky
  //if (leader.get("sx_oldIDTABLE","")=="")  leader.set("sx_oldIDTABLE",leader.xWORKFRAME.document.all.IDTABLE.outerHTML)
  
  leader.xWORKFRAME.document.all.IDTABLE.outerHTML=sxHLAVICKA()  
  
  leader.xWORKFRAME.document.all.SxOUT.style.posTop=(leader.xWORKFRAME.document.all.IDTABLE.offsetHeight*1)
  
  leader.xWORKFRAME.document.all.SxOUT.innerHTML='<TABLE id="TB0" class="SLOKATABLE"  STYLE="position:absolute;width:200;top:'+YStartTop+';left:'+YStartLeft+';z-index:10;cursor:hand;"><TBODY><TR><TD class="TDSLOKA"> </TD></TR></TBODY></TABLE>'
  YSLOKA=leader.xWORKFRAME.document.all.SxOUT.lastChild.lastChild.lastChild.lastChild
  YSLOKATABLE=leader.xWORKFRAME.document.all.SxOUT.lastChild;
  YLastTop=0-yl_deltay;
  Ypocetslok=1;
  YSLOKAwidth=200;
  leader.xWORKFRAME.document.all.LARGE.style.display="none";
  
  
   //alert(YSLOKA.outerHTML)
 }
//if (SxTime==1) {sxPapir()}

if (RWPole[SxTime]=='&nbsp;') {YLastTop+=yl_deltay;}
yl_pomocnaaa=0;
//for (var zpomal=0;zpomal<1000;zpomal++) status=zpomal
if (SxTime>0) if (SxTime<RWPole.length-1) if (RWPole[SxTime-1]=='&nbsp;') {yl_pomocnaaa=1;}

if (((RWPole[SxTime].indexOf('ss=ZNACKA')!=-1) && (SxTime>1)) || (yl_pomocnaaa==1))
 {if (YSXOBJEKT!="undefined") if (YSXOBJEKT!="-1") return; //pockani na presunuti sloky
  YStartTop+=(YLastTop+yl_deltay)
  leader.xWORKFRAME.document.all.SxOUT.innerHTML+='<TABLE id="TB'+Ypocetslok+'" class="SLOKATABLE" STYLE="position:absolute;width:200;top:'+YStartTop+';left:'+YStartLeft+';cursor:hand;z-index:'+(10+Ypocetslok)+'"><TBODY><TR><TD class="TDSLOKA"> </TD></TR></TBODY></TABLE>'
  
  YSLOKATABLE=leader.xWORKFRAME.document.all.SxOUT.children[(Ypocetslok)]//[Ypocetslok-1])
  YSLOKA=YSLOKATABLE.children[0].children[0].children[0]
    //alert(YSLOKA.outerHTML)
    //Ypocetslok++;SxTime++;return;
  YLastTop=0-yl_deltay;
  YSLOKAwidth=200;
  Ypocetslok++;

 }

if (RWPole[SxTime]=="&nbsp;") {SxTime++;return;}
if (RWPole[SxTime]=="    ") {SxTime++;return;} //=nulty radek
if (RWPole[SxTime].indexOf('ss=AO1')!=-1) yl_deltay=(yl_deltay*leader.get("sx_lineKoef1","1.6"))+(leader.get("sx_lineKoef2","0")*1);
var yl_top=YLastTop+yl_deltay;
YLastTop=yl_top;
var tabulaturastyl=""
if (RWPole[SxTime].indexOf('|')>-1) {tabulaturastyl=' STYLE="font-family:monospace" '}
YSLOKA.innerHTML+='<SPAN class="YL_RADKA" STYLE="position:absolute;top:'+yl_top+';left:0;'+leader.get("sx_tableCStyle")+';cursor:hand;width:100;"><nobr class="NOBR" '+tabulaturastyl+' >'+RWPole[SxTime]+'</nobr></span>'
YSLOKATABLE.style.height=yl_top+yl_deltay;


var yl_radkaP =YSLOKA.lastChild.lastChild; //pozor! =ukazuje na vnitrek YL_RADKA - tedy outerHTML="<NOBR><...
if (yl_radkaP.offsetWidth>YSLOKAwidth) {YSLOKAwidth=yl_radkaP.offsetWidth;YSLOKATABLE.style.width=YSLOKAwidth+10;}
var yl_rl=yl_radkaP.children.length  //pocet vsech mist pro akordy
//var yl_xsouradnice=new Array;
var yl_prvek;
var ipom;  
var opom;
var jp=0;var lastjp=0;
var vsechnyakordytetoradky=""
var zleva="";var maxzleva="";
for (yli=0;yli<yl_rl;yli++)  //zjisteni pozic
 {
  yl_prvek=yl_radkaP.children[yli];
  //yl_prvek=YSLOKA.lastChild.lastChild.children[yli];
  opom="";
       	
       
  if ((yl_prvek.className=="AO1")||(yl_prvek.className=="AO2") )
      {//yl_xsouradnice[yli]=yl_prvek.offsetLeft;
       ipom=yl_prvek.outerHTML;
       //if (SxTime<4) alert(RPole[SxTime])
       //alert(ipom)
       var err=0;jp=0;lastjp=0;
       var hpom=ipom.substring(0,ipom.indexOf(">",10));
       ipom=ipom.toLowerCase();
       while (jp>-1)
        {
        err++;if (err>200) break;
        jp= (ipom.indexOf('<span class=a1>',jp) )  //misto pro vlozeni jednotliveho akordu
        
        if (jp==-1) break;
        //if (SxTime==8) alert(jp)
        if (lastjp==0) {opom+=ipom.substring(ipom.lastIndexOf(">",jp)+1,jp);}
        if (lastjp!=0) opom+=ipom.substring(lastjp+22,jp);
        lastjp=jp; //llllllllll
        opom+='<span class="AKORD">'+GAcords[Ycisloakordu][TRANSPOSE]+'</span>'
        Ycisloakordu++;
        jp+=20;
        }
       var yposunutiakordu=yl_top- ((leader.get("sx_deltaY","75")/100) * (leader.get("sx_lineHeight","14.4")*1));
       if (yl_prvek.className=="AO2") 
           {yposunutiakordu=yl_top;
           }
       zleva=yl_prvek.offsetLeft;
       if (zleva>maxzleva) maxzleva=zleva;
       
       vsechnyakordytetoradky+=hpom + ' STYLE="position:absolute;top:'+yposunutiakordu+';left:'+zleva+';z-index:9">'+opom+'</SPAN>'
       yl_prvek.innerHTML=""  //pro DEBUG ...="@"
      } 
      
 }
 //alert(YSLOKA.lastChild.outerHTML)
 YSLOKA.lastChild.outerHTML+='<DIV class=YAKORDYRADKY><NOBR>'+vsechnyakordytetoradky+'</NOBR></DIV>'
 var ymaxdelkaOBJ=YSLOKA.lastChild; // = ukazuje na posledni Akord nejvice vpravo
 var ymaxdelka=0;
 if (ymaxdelkaOBJ.innerHTML!="")
    {ymaxdelka=(((ymaxdelkaOBJ.lastChild.style.posLeft)*1)+((ymaxdelkaOBJ.lastChild.offsetWidth)*1))*1
     if (ymaxdelka>YSLOKAwidth) {YSLOKAwidth=ymaxdelka;YSLOKATABLE.style.width=YSLOKAwidth+10;}
    }

if (SxTime>1000) {SxTime=-1;window.clearInterval(xSxTime);return}
SxTime++;
}
//--------------
/*
function SxUrciVelikostzRadkovani()  
{
var la=leader.get("sx_lineHeight","14.4")
var lo=0;

lo="font-size:"+(la*0.25)+"mm;"
leader.set("sx_tableFontSize",lo)
}
*/



//_________

function SongInfo()
{

 { //*...*
 var myW=document.all
 var OWN="";var iDT=leader.xWORKFRAME.document.all.INFO
 if (iDT==null) {return(-1)}
 iDT=iDT.content
 
 var iDA=iDT.split(";"); var OWNi="";var OWNa="";var OWNb="";

if (parent.get("sx_AF",false)==false) {hideIcons()} else {myW.ICONS.style.display="block"}
myW.MIDI.src="../pics/midi2.gif" 
parent.set("sx_TEXTAUTHOR","")     
parent.set("sx_MELODYAUTHOR","")   
parent.set("sx_INTERPRET","")      
parent.set("sx_ORIGINTERPRET","")  
                                
parent.set("sx_ALBUM","")          
parent.set("sx_YEAR","")           
parent.set("sx_PUBLISHING","")     
parent.set("sx_SOURCE","")         
                                
parent.set("sx_SENDER","")         
parent.set("sx_FILEVER",leader.xWORKFRAME.fileModifiedDate)       //??? nefunguje
parent.set("sx_URL",leader.xWORKFRAME.location.href)       //??? nefunguje
parent.set("sx_ANOTHERDATA","")

parent.set("sx_MIDI","")         
parent.set("sx_MP3","")       
parent.set("sx_VIDEO","")

parent.set("sx_OA","")
parent.set("sx_OALBUM","")
parent.set("sx_ON","")
 
 for (var i=0;i<iDA.length;i++)
  {  //*2*
   
   OWNi=iDA[i]   	;
   if (OWNi=="OFF") {OWNi="AF:OFF"}
   if (OWNi=="") continue;
   if (OWNi.indexOf(':')>-1)
     { //*3*
       OWNa=OWNi.substring (0,OWNi.indexOf(':'))	;
       OWNb=OWNi.substring (OWNi.indexOf(':')+1,500)	;
       	
      OWNa=OWNa.toUpperCase(); 
      if (OWNa=="AF") {OWNa="AF této písně interně zakázáno"; OWNb=""};
      if (OWNa=="Z") {parent.set ("sx_INTERPRET",OWNb)}
      if (OWNa=="I") {parent.set ("sx_INTERPRET",OWNb)}
      if (OWNa=="T") {parent.set ("sx_TEXTAUTHOR",OWNb)}
      if (OWNa=="H") {parent.set ("sx_MELODYAUTHOR",OWNb)}
      if (OWNa=="H&T") {parent.set ("sx_MELODYAUTHOR",OWNb);parent.set ("sx_TEXTAUTHOR",OWNb)}
      if (OWNa=="T&H") {parent.set ("sx_MELODYAUTHOR",OWNb);parent.set ("sx_TEXTAUTHOR",OWNb)}
      if (OWNa=="CT") {OWNa="Česky otextoval" };
      if (OWNa=="OL") {OWNa="Originální jazyk textu"};
      if (OWNa=="L") {OWNa="Jazyk textu"};
      if (OWNa=="A") {parent.set ("sx_ALBUM",OWNb)}
      if (OWNa=="OAL") {parent.set ("sx_OALBUM",OWNb)}
      if (OWNa=="OALB") {parent.set ("sx_OALBUM",OWNb)}
      if (OWNa=="OALBUM") {parent.set ("sx_OALBUM",OWNb)}
      if (OWNa=="Y") {parent.set ("sx_YEAR",OWNb)}
      if (OWNa=="R") {parent.set ("sx_YEAR",OWNb)}
      if (OWNa=="PBL") {parent.set ("sx_PUBLISHING",OWNb)}
      if (OWNa=="MORE") {parent.set ("sx_ANOTHERDATA",OWNb)}
      if (OWNa=="FF") {OWNa="Z filmu";  parent.set ("sx_ANOTHERDATA",parent.get("sx_ANOTHERDATA")+OWNa+': '+OWNb+'\n')} ;
      if (OWNa=="ZF") {OWNa="Z filmu";  parent.set ("sx_ANOTHERDATA",parent.get("sx_ANOTHERDATA")+OWNa+': '+OWNb+'\n')} ;
      if (OWNa=="JZ") {OWNa="Jiný zdroj"};
      if (OWNa=="ZS") {OWNa="Ze seriálu" ;  parent.set ("sx_ANOTHERDATA",parent.get("sx_ANOTHERDATA")+OWNa+': '+OWNb+'\n')} ;
      if (OWNa=="ZM") {OWNa="Z muzikálu";  parent.set ("sx_ANOTHERDATA",parent.get("sx_ANOTHERDATA")+OWNa+': '+OWNb+'\n')} ;
      if (OWNa=="ZP") {OWNa="Z pohádky" ;;  parent.set ("sx_ANOTHERDATA",parent.get("sx_ANOTHERDATA")+OWNa+': '+OWNb+'\n')} ;
      if (OWNa=="S")  {parent.set ("sx_SENDER",OWNb)}  //zaslal
      if (OWNa=="UT") {OWNa="Úprava textu"};
      if (OWNa=="ON") {parent.set ("sx_ON",OWNb)}
      if (OWNa=="OA") {parent.set ("sx_OA",OWNb)}
      if (OWNa=="VO") {parent.set ("sx_OA",OWNb)}
      if (OWNa=="DN") {parent.set ("sx_ORIGINTERPRET",OWNb)}
      if (OWNa=="OI") {parent.set ("sx_ORIGINTERPRET",OWNb)}
      if (OWNa=="ZD") {parent.set ("sx_SOURCE",OWNb)}
      if (OWNa=="PR") {OWNa="Přejato z"};      
      if (OWNa=="HREFC") 
        {OWNa="<A href=javascript:window.leader.frames.Lpanel.ViewFile('"+OWNb+"') >Viz česká verze písně</A>";OWNb="";  };
      if (OWNa=="HREFA") 
        {OWNa="<A href=javascript:window.leader.frames.Lpanel.ViewFile('"+OWNb+"') >Viz anglická verze písně</A>";OWNb="";  };
      if (OWNa=="HREF") 
        {OWNa="<A href=javascript:window.leader.frames.Lpanel.ViewFile('"+OWNb+"') >Viz další</A>";OWNb="";  };
      if (OWNa=="MIDI")   {parent.set ("sx_MIDI",OWNb)
                           myW.MIDI.src="../pics/midi1.gif"
                          }
      if (OWNa=="MP3")   {parent.set ("sx_MP3",OWNb)}
      if (OWNa=="VIDEO")   {parent.set ("sx_VIDEO",OWNb)}
     	
     }    //*3*
   } //*2*
 
 
 }//*...*


}

//-------------------------

function usadNaRastr()
{
if (leader.xWORKFRAME==-1) return;
if (leader.xWORKFRAME.document.all.N1==null) return ;
//alert("usazuji na rastr")
var sloky=leader.xWORKFRAME.document.all.SxOUT.children
var l=sloky.length
var pt;
var RX=leader.get("sx_rastrX",20)*1;
var RY=leader.get("sx_rastrY",20)*1
//alert(l.outerHTML)
for (var n=0;n<l;n++)
 {//alert(sloky[n].style.posTop)
  pt=(sloky[n].style.posTop)*1
  sloky[n].style.posTop= (Math.round (pt/RY)  )*RY
  
  pt=(sloky[n].style.posLeft)*1
  sloky[n].style.posLeft= (Math.round (pt/RX)  )*RX	
 }	
}
//---------------
function usadIQ()
{
if (leader.xWORKFRAME==-1) return;
if (leader.xWORKFRAME.document.all.N1==null) return ;
var sloky=leader.xWORKFRAME.document.all.SxOUT.children
var l=sloky.length
var pt;
var RX=1000
var tolerance=200;
//alert(l.outerHTML)
for (var n=0;n<l;n++)
 {
  
  pt=(sloky[n].style.posLeft)*1
  if (Math.abs(RX-pt)>tolerance) {RX=pt}
  else
  {sloky[n].style.posLeft=RX}
  
  
 }	
}


//---------------
function hideIcons()
{
document.all.ICONS.style.display="none"	
leader.frames.HORNI_RAM.document.all.F0tran1.style.visibility="hidden"
leader.frames.HORNI_RAM.document.all.F0tran2.style.visibility="hidden"

}



//-------------------------
function CreateSongInfoString()
{
var s="";
var st0='<nobr>'//<MARQUEE BEHAVIOR=Scroll STYLE="width:100%;color:white;background-color:transparent" DIRECTION=Left SCROLLDELAY=100 SCROLLAMOUNT=8 LOOP=infinite>';
var st00='</nobr>'//</MARQUEE>'
var st1='<span STYLE="color:yellow">'
var st11='</span>'
var sp=document.all
var p='';var m='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<wbr>'
s+=st0
p=sp.EDITINTERPRET.value;if (p!='') s+=st1+'Zpívá: '+st11+p+m
p=sp.EDITMELODYAUTHOR.value;if (p!='') s+=st1+'Hudba: '+st11+p+m
p=sp.EDITTEXTAUTHOR.value;if (p!='') s+=st1+'Text: '+st11+p+m
p=sp.EDITALBUM.value;if (p!='') s+=st1+'Vyšlo na albu: '+st11+p+m
p=sp.EDITYEAR.value;if (p!='') s+=st1+'v roce: '+st11+p+m
p=sp.EDITPUBLISHING.value;if (p!='') s+=st1+'Vydavatelství: '+st11+p+m
p=sp.EDITON.value;if (p!='') s+=st1+'Pův. název: '+st11+p+m
p=sp.EDITORIGINTERPRET.value;if (p!='') s+=st1+'Pův. názpíval: '+st11+p+m
p=sp.EDITOA.value;if (p!='') s+=st1+'Originál od akordu: '+st11+p+m
p=sp.EDITSOURCE.value;if (p!='') s+=st1+'Zdroj: '+st11+p+m
p=sp.EDITANOTHERDATA.value;if (p!='') s+=st1+' '+st11+p+m
s+=st00	
leader.xWORKFRAME.F0songinfo.innerHTML=s

	
}


//-------------------------
function playMidi()
 { alert('zadne midi zatim nebyly nahrany na server')
 	return;
 	if (MIDI=="") return;
   // alert('ok');
      navigate("Midi/"+MIDI);
   
 	
 }	


//-------------------------

function SXZACNIPOSUN(lla)
{
 //xWORKFRAME.event.returnValue=false;  //return(false)
 var lpuvodce=lla.srcElement;
 YSXOBJEKT=-1;
 //alert(lpuvodce.outerHTML);return;
 if (lpuvodce.className=="SLOKATABLE") YSXOBJEKT=lpuvodce;
 if (lpuvodce.className=="AKORD") YSXOBJEKT=lpuvodce.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement;
 if (lpuvodce.className=="NOBR") YSXOBJEKT=lpuvodce.parentElement.parentElement.parentElement.parentElement.parentElement;
 if (lpuvodce.className=="TDSLOKA") YSXOBJEKT=lpuvodce.parentElement.parentElement.parentElement;
 if(YSXOBJEKT.className=="SLOKATABLE") {YSXOBJEKT.xrel=lla.x; YSXOBJEKT.yrel=lla.y
                                        YSXOBJEKT.xabs=YSXOBJEKT.style.posLeft*1;
                                        YSXOBJEKT.yabs=YSXOBJEKT.style.posTop*1;
                                        YSXOBJEKT.border=1;
                                        YSXOBJEKT.lastbgcolor=YSXOBJEKT.style.backgroundColor;
                                        YSXOBJEKT.lastzindex=YSXOBJEKT.style.zIndex;
                                        YSXOBJEKT.style.zIndex=Ypocetslok+10;
                                        YSXOBJEKT.style.backgroundColor="beige"
                                        var nOBJEKT=YSXOBJEKT
                                        while (nOBJEKT.nextSibling!=null)
                                        {
                                           if (nOBJEKT.nextSibling.className=="SLOKATABLE")
                                            {nOBJEKT.nextSibling.border=1
                                             nOBJEKT.nextSibling.style.backgroundColor="whitesmoke"
                                            }
                                           nOBJEKT=nOBJEKT.nextSibling 
                                         }
                                        nOBJEKT=YSXOBJEKT
                                        while (nOBJEKT.previousSibling!=null)
                                        {
                                           if (nOBJEKT.previousSibling.className=="SLOKATABLE")
                                            {nOBJEKT.previousSibling.border=1
                                             nOBJEKT.previousSibling.style.backgroundColor="whitesmoke"
                                            }
                                           nOBJEKT=nOBJEKT.previousSibling
                                        }
                                        
                                        
                                        
                                       }
 return(false)	
}	



function SXPOSUNOVANI(lla,llaname)
{var lymode=0
if (YSXOBJEKT.className=="SLOKATABLE")
 {//status=YSXOBJEKT.id+"/"+lla.y
 	status="XY: "+lla.x+"/"+lla.y
  
  //if (YSXOBJEKT.children[0].children[0].children[0].innerHTML!="") {YSXOBJEKT.children[0].children[0].children[0].innerHTML="Moving"}
  //status=YSXOBJEKT.children[0].children[0].children[0].tagName
  YSXOBJEKT.style.posLeft=YSXOBJEKT.xabs-(((YSXOBJEKT.xrel)*1)-(lla.x))
  YSXOBJEKT.style.posTop =YSXOBJEKT.yabs-(((YSXOBJEKT.yrel)*1)-(lla.y))
  lymode=1;
 }


      
  // POSUNOVANI POMOCI MYSI VYPNUTO
  YMOUSEXlast=YMOUSEX; YMOUSEYlast=YMOUSEY; 
  YMOUSEX=lla.x; YMOUSEY=lla.y;
  var lGGX=document.body.offsetWidth;
  var lGGY=document.body.offsetHeight;
 
  //status=YMOUSEX+"/"+llaname
  var asdfghjkl=0;
  
  var labsmousex='leader.window.document.all.'+llaname+'.style.posLeft';
  labsmousex=eval(labsmousex) //x-souradnice framu nad jimz se pohybuje mys
  YMOUSEX=labsmousex+YMOUSEX-leader.window.document.body.scrollLeft  //celkova absolutni x-souradnice mysi

  var labsmousey='leader.window.document.all.'+llaname+'.style.posTop';
  labsmousey=eval(labsmousey) //y-souradnice framu nad jimz se pohybuje mys
  YMOUSEY=labsmousey+YMOUSEY-leader.window.document.body.scrollTop  //celkova absolutni y-souradnice mysi




  //status=lla.parentNode+"---"+lla.parentElement
  //status=(leader.get(""))
  /* //vypnute autoscrolloavnii
  if (YMOUSEX>( lGGX-leader.get("SXMAGNETICBORDERSIZE") )) {asdfghjkl=1;if (SxMTime==0) {xSxMTime=setInterval(SCROLLRIGHT,5);SxMTime=1}}
  if (YMOUSEX<leader.get("SXMAGNETICBORDERSIZE")) {asdfghjkl=1;if (SxMTime==0) {xSxMTime=setInterval(SCROLLLEFT,5); SxMTime=1}}
  if (YMOUSEY<leader.get("SXMAGNETICBORDERSIZE")) {asdfghjkl=1;if (SxMTime==0) {xSxMTime=setInterval(SCROLLUP,5); SxMTime=1}}
  if (YMOUSEY>( lGGY-leader.get("SXMAGNETICBORDERSIZE") )) {asdfghjkl=1;if (SxMTime==0) {xSxMTime=setInterval(SCROLLDOWN,5); SxMTime=1}}
  */
  if (asdfghjkl==0) {clearInterval(xSxMTime);SxMTime=0}
  

 if (llaname=="MAIN")
 if (lymode==0) //urcovani polohy mysi
  {
  YMOUSEX=lla.x;YMOUSEY=lla.y;  //opet predefinovani na lokalni souradnice MAINu
  var lyah=YANIMATIONS.length; //pocet kontrolovanych oblasti
  asdfghjkl=0;
  for (yah=0;yah<lyah;yah++) 
   {
    
    asdfghjkl=0;  
    if ( (YMOUSEX>eval(YANIMATIONS[yah][0])) && (YMOUSEX<eval(YANIMATIONS[yah][1])) &&
      (YMOUSEY>eval(YANIMATIONS[yah][2])) && (YMOUSEY<eval(YANIMATIONS[yah][3])) )
        {   
        asdfghjkl=1;
        if (YANIMATIONS[yah][5]==0)  //tj. jeste nezacala animace
               {YANIMATIONS[yah][5]=1  //tj. animace zapocala
                //status="OBLAST "+YANIMATIONS[yah][4]+"|"+YANIMATIONS[yah][5];
                //alert("OBLAST \n"+YANIMATIONS[yah][4]+"\n"+eval(YANIMATIONS[yah][0])+"\n"+eval(YANIMATIONS[yah][1])+"\n"+eval(YANIMATIONS[yah][2])+"\n"+eval(YANIMATIONS[yah][3])+"\n")
                           
                SXANIMATOR=eval("leader.xWORKFRAME.document.all."+YANIMATIONS[yah][4]); //odkaz na tag
                SXANIMATORnumber=yah //cislo v poli YANIMATIONS
                SxAnimTime=0;  //zacatek animace
                asdfghjkl=1; //=jses v oblasti
            	SXANIM1()
            	
            	
               }
   
   	}
    if (asdfghjkl==0)  if (YANIMATIONS[yah][5]==1) //=mimo oblast
       {        SXANIMATOR=eval("leader.xWORKFRAME.document.all."+YANIMATIONS[yah][4]); //odkaz na tag
                SXANIMATORnumber=yah //cislo v poli YANIMATIONS
                SxAnimTime=0;  //zacatek animace
                
                YANIMATIONS[yah][5]=0 
                SXANIM2()
       	
       }
    
    
   
   }  //for-konec
  }
   
}
//------------------
loadW.innerHTML="Loading script....phase 3"

function SXKONECPOSUNOVANI(lla)
{
if (YSXOBJEKT.className=="SLOKATABLE")
 {//status=""
 //YJ// YSXOBJEKT.style.posLeft=YSXOBJEKT.xabs-(((YSXOBJEKT.xrel)*1)-(lla.x))
 //YJ// YSXOBJEKT.style.posTop =YSXOBJEKT.yabs-(((YSXOBJEKT.yrel)*1)-(lla.y))
  
  //alert(YSXOBJEKT.style.zIndex+"\prev: "+YSXOBJEKT.lastzindex)//=((YSXOBJEKT.style.zIndex*1)-1)
  YSXOBJEKT.style.zIndex=Ypocetslok+10-1;
  YSXOBJEKT.border=0;
  YSXOBJEKT.style.backgroundColor=YSXOBJEKT.lastbgcolor;
  var nOBJEKT=YSXOBJEKT
  while (nOBJEKT.nextSibling!=null)
   {
     if (nOBJEKT.nextSibling.className=="SLOKATABLE")
      {nOBJEKT.nextSibling.border=0;
      nOBJEKT.nextSibling.style.backgroundColor=YSXOBJEKT.lastbgcolor;
       if (((nOBJEKT.nextSibling.style.zIndex)*1)>YSXOBJEKT.lastzindex) nOBJEKT.nextSibling.style.zIndex--;
      }
     nOBJEKT=nOBJEKT.nextSibling 
   }
  nOBJEKT=YSXOBJEKT
  while (nOBJEKT.previousSibling!=null)
  {
     if (nOBJEKT.previousSibling.className=="SLOKATABLE")
      {nOBJEKT.previousSibling.border=0
       nOBJEKT.previousSibling.style.backgroundColor=YSXOBJEKT.lastbgcolor;
       if (((nOBJEKT.previousSibling.style.zIndex)*1)>YSXOBJEKT.lastzindex) nOBJEKT.previousSibling.style.zIndex--;
      }
     nOBJEKT=nOBJEKT.previousSibling
  }
    
  
  
  
  
  YSXOBJEKT=-1;
 }
}


//-----------------------
function SxPredTiskem()
 {
 
 if (leader.xWORKFRAME==-1) return;
 if (leader.xWORKFRAME.document.all.LARGE==null) return ;
 if (SxTime>0) {SxBudeTisk();return;}
 
 var l=leader.xWORKFRAME.document.all
 if (l.DIALOG1!=null) {l.DIALOG1.style.display="none"}

 
 
 //l.N1.style.background="whitesmoke"
 if (leader.get("sx_cbTisk","true")==true) leader.set("sx_cbTisk","true")
 if (leader.get("sx_cbTisk",true)=="true")
 {
  
  var s=l.SxOUT; var lbackup=s.innerHTML
  var s2=l.IDTABLE;var lnbackup=s2.innerHTML
  var sn=s.all
  l.PAPIROBJECT.style.display="none"
 
  var ll=sn.length
  for (var n=0;n<ll;n++)
  {
   //alert(sn[n].outerHTML)	
   if (typeof(sn[n].style.color)!="undefined") sn[n].style.color="black"
   if (typeof(sn[n].style.background)!="undefined") sn[n].style.background="transparent"
  	
  }
  l.N1.style.color="black"; l.N2.style.color="black";
  if ((l.N1.style.backgroundColor==l.PAPIROBJECT.style.backgroundColor) || (l.N1.style.backgroundColor.toUpperCase()=='TRANSPARENT'))
   {l.N1.style.background="transparent"} else {l.N1.style.background="silver"}
 
  if ((l.N2.style.backgroundColor==l.PAPIROBJECT.style.backgroundColor) || (l.N2.style.backgroundColor.toUpperCase()=='TRANSPARENT'))
   {l.N2.style.background="transparent"} else {l.N2.style.background="silver"}
 }  
 
 leader.set("sx_print","0");
 leader.xWORKFRAME.focus();
 leader.xWORKFRAME.print();
 if (leader.get("sx_cbTisk","true")=="true")
  { s.innerHTML=lbackup    
   s2.innerHTML=lnbackup;    
   l.PAPIROBJECT.style.display="block"
  } 
 }

//--------------------------
function SxBudeTisk()
 {
 if (leader.xWORKFRAME==-1) return;
 if (leader.xWORKFRAME.document.all.LARGE==null) return ;
 
 var pom='<DIV id=DIALOG1 STYLE="width:60mm;height:40mm;position:absolute;left:0;top:0;z-index:21;background-color:blue;color:white;display:none;filter:alpha(opacity=70)"></DIV>'
 

 if (leader.xWORKFRAME.document.all.DIALOG1==null) 
  {leader.xWORKFRAME.document.all.LARGE.outerHTML+=pom } 
    
 
 
 var gx=leader.xWORKFRAME.document.body.offsetWidth;
 var gy=leader.xWORKFRAME.document.body.offsetHeight;
 var myx=360
 var myy=100
 var lx=(gx-myx) / 2
 var ly=(gy-myy) / 2
 leader.xWORKFRAME.document.all.DIALOG1.style.display="block"
 leader.xWORKFRAME.document.all.DIALOG1.style.width=myx+"px"	
 leader.xWORKFRAME.document.all.DIALOG1.style.height=myy+"px"	
 leader.xWORKFRAME.document.all.DIALOG1.style.left=lx
 leader.xWORKFRAME.document.all.DIALOG1.style.top=ly
 
 var lpom='';
 lpom+='<br STYLE="font-size:6mm">'
 lpom+='<center STYLE="font-family:verdana;">'
 lpom+='Printing in process'
 lpom+='<br STYLE="font-size:15mm">' 
 lpom+='<br STYLE="font-size:15mm">' 
 lpom+='<button title="Cancel printing in future" '
 lpom+=' onclick={parent.set("sx_print","0");document.all.DIALOG1.style.display="none"} '
 lpom+='>Storno</button>'
 lpom+='</center>'
 leader.xWORKFRAME.document.all.DIALOG1.innerHTML=lpom
 
//alert("nastavuji na 1") 
 leader.set("sx_print","1");
 
 }







function sxSend()
{
 //if (document.all.ZPA.value=="@") {alert('Vyplňte zpáteční adresu! \n Pokud si nepřejete její uvedení musí být políčko prázdné ');return;}
 if (leader.xWORKFRAME==-1) return;
 
 

 
 var d=leader.xWORKFRAME.document.all;var st='';
 if (d.N1==null) {alert('Lze aplikovat jen na písně');return;}
 if (d.SxOUT==null) {alert('Písěň musí být zformátovaná (AF)');return;}
 if (d.FORM==null) 
  {
   //leader.xWORKFRAME.document.body.style.backgroundColor=""
   var pSTYL='STYLE="width:200px;font-size:10px"'
   d.SxOUT.style.display="none";
   d.IDTABLE.style.display="none"	
   d.PAPIROBJECT.style.display="none"	
   //st+='<FORM id=FORM METHOD="post" ACTION=http://www.vol.cz/cgi-bin/pl/mailer.new.cgi>'
   st+='<DIV id=FORM STYLE="font-size:12px;font-family:verdana,arial">'
   st+='<DIV style="position:absolute;left:400px;top:440px;text-align:justify;border-color:gold;border-style:solid;">'
   st+='<nobr>Tyto informace budou <wbr>zaslány do AGAMY,<wbr> píseň se objevi <wbr>v AGAMĚ na internetu<wbr> obvykle do 14 dnů,<wbr> nejdéle do 1 měsíce</nobr>' 
   st+='</DIV>'
   st+='<INPUT '+pSTYL+' id=A1 NAME="JMENO_PISNE" type=text value="'+leader.get("sx_jmenoPisne")+'" /> Název písně<br>'
   st+='<INPUT '+pSTYL+' id=A2 NAME="POPISKA" type=text value="'+leader.get("sx_popiska")+'" /> Popiska<br>'
   st+='<TEXTAREA wrap=off id=AA NAME="TEXT" STYLE="font-size:13px;width:80%;height:200px;"type=text>'+leader.get("sx_text")+'</TEXTAREA><br>'
   st+='<hr width=300px color=gold align=left>'
   st+='<INPUT '+pSTYL+' id=TEXTAUTHOR type=text value="'+leader.get("sx_TEXTAUTHOR")+'" /> Autor textu<br>'
   st+='<INPUT '+pSTYL+' id=MELODYAUTHOR type=text value="'+leader.get("sx_MELODYAUTHOR")+'" /> Autor hudby<br>'
   st+='<INPUT '+pSTYL+' id=INTERPRET type=text value="'+leader.get("sx_INTERPRET")+'" /> Zpívá<br>'
   st+='<INPUT '+pSTYL+' id=ALBUM type=text value="'+leader.get("sx_ALBUM")+'" /> Z alba<br>'
   st+='<INPUT '+pSTYL+' id=YEAR type=text value="'+leader.get("sx_YEAR")+'" /> Z roku<br>'
   st+='<INPUT '+pSTYL+' id=PUBLISHING type=text value="'+leader.get("sx_PUBLISHING")+'" /> Hud. vydavatelství<br>'
   st+='<INPUT '+pSTYL+' id=OA type=text value="'+leader.get("sx_OA")+'" /> Orig. od akordu<br>'
   
   st+='<INPUT '+pSTYL+' id=ORIGINTERPRET type=text value="'+leader.get("sx_ORIGINTERPRET")+'" /> Pův. nazpíval(a)<br>'
   st+='<INPUT '+pSTYL+' id=ORN type=text value="'+leader.get("sx_ON")+'" /> Pův. název<br>'
   st+='<INPUT '+pSTYL+' id=OALBUM type=text value="'+leader.get("sx_OALBUM")+'" /> Pův. album<br>'
   
   st+='<INPUT '+pSTYL+' id=SOURCE type=text value="'+leader.get("sx_SOURCE")+'" /> Zroj těchto dat<br>'
   st+='<INPUT '+pSTYL+' id=ZASLAL type=text value="'+'@'+'" /><b> Zaslal (email)</b><br>'
   st+='<INPUT '+pSTYL+' id=ZASLALP type=text value="'+''+'" /><b title="Bude uvedeno u písně, jako jméno toho, kdo ji zaslal"> Zaslal (jméno/přezdívka)</b><br>'
   st+='<TEXTAREA id=ANOTHERDATA STYLE="font-family:arial;width:200px;height:50px;font-size:12px" type=text>'+leader.get("sx_ANOTHERDATA")+'</TEXTAREA>Jiná data<br>'
   
   st+='<INPUT TYPE="hidden" NAME="TO" VALUE="x2000@volny.cz" ></INPUT>'
   st+='<INPUT TYPE="hidden"  NAME="SUBJECT" VALUE="Agama MAIL 3"></INPUT>'
   st+='<INPUT TYPE="hidden" NAME="OK_PAGE" VALUE="http://www.volny.cz/x2000/Odeslano.htm"></INPUT>' 
   //<!--úplné URL stránky, která se má zobrazit po odeslání formuláře, včetně http://jméno_serveru.cz/. Pokud tuto položku neuvedete, bude zobrazena krátká zpráva o odeslání. -->

   st+='<INPUT TYPE="hidden" NAME="OK_MESSAGE" VALUE="Váš příspěvek byl odeslán"></INPUT>'
   //<!--text, který se má zobrazit po odeslání formuláře. Pokud tuto položku neuvedete, bude zobrazena krátká zpráva o odeslání. -->
   st+='<BUTTON onclick="parent.frames.SX_RAM.sxZabal()" STYLE="position:absolute;left:390px;top:390px;width:120px;font-size:18px;">Odeslat</BUTTON>'
   st+='<BUTTON onclick="{var d=document.all;d.FORM.outerHTML=\'\';d.SxOUT.style.display=\'\';d.IDTABLE.style.display=\'\';d.PAPIROBJECT.style.display=\'\' }" STYLE="position:absolute;left:390px;top:350px;width:120px;font-size:18px;">Storno</BUTTON>'
   
   
   
   
   st+='</DIV>'
   
   
   
   d.LARGE.outerHTML+=st
  	
  	
  }
 
 
 //document.all.WHATTOSEND.value=SxSave(2)
 //alert(SxSave(2))
 //document.all.FORM1.submit();
 
	
}
//--------------
var sxOBALKA;
//--------------
function sxZabal()
{
var d=leader.xWORKFRAME.document.all;var st='';

if (d.TEXTAUTHOR.value!='') st+='T:'+d.TEXTAUTHOR.value+';'
if (d.MELODYAUTHOR.value!='') st+='H:'+d.MELODYAUTHOR.value+';'
if (d.INTERPRET.value!='') st+='Z:'+d.INTERPRET.value+';'
if (d.ORIGINTERPRET.value!='') st+='DN:'+d.ORIGINTERPRET.value+';'
if (d.ALBUM.value!='') st+='A:'+d.ALBUM.value+';'
if (d.OALBUM.value!='') st+='OALB:'+d.OALBUM.value+';'
if (d.YEAR.value!='') st+='Y:'+d.YEAR.value+';'
if (d.PUBLISHING.value!='') st+='PBL:'+d.PUBLISHING.value+';'
if (d.OA.value!='') st+='OA:'+d.OALBUM.value+';'
if (d.SOURCE.value!='') st+='ZD:'+d.SOURCE.value+';'
if (d.ORN.value!='') st+='ON:'+d.ORN.value+';'
if (d.ZASLAL.value!='') st+='S:'+d.ZASLALP.value+';'
if (d.ANOTHERDATA.value!='') st+='MORE:'+d.ANOTHERDATA.value+';'
if (d.ZASLAL.value=='@') {alert('Vyplňte vaši adresu (políčko "Zaslal")\nPokud ji nechcete uvést, musí být políčko prázdné. ');return;}

sxOBALKA=new Array(d.A1.value,d.A2.value,st,d.AA.value,d.ZASLAL.value)
//var q=window.showModalDialog("../dialogs/dialog09.htm",prop,"dialogHeight: 400px; dialogWidth: 435px; dialogTop: 160px; dialogLeft: 270px; center: Yes; help: no; resizable: no; status: Yes;")		
var qw=open("../dialogs/dialog09.htm","","width=230,height=220,left=200,top=50,resizable=no,scrollbars=yes")
/*
   
*/   
	
	
}


//--------------------
function ondestroyAF() //vlastni zpracovani
 {
 return;
 leader.window.document.all.SX2PANEL.style.display="none"
 if (SxTime==0) {SxTime=-1;window.clearInterval(xSxTime);return}
 
 
 }


//--------------------
function SxSave(mode)	//puziva se
{

if (leader.xWORKFRAME==-1) {alert("Zatím není co ukládat...");return;}
if (leader.xWORKFRAME.document.all.N1==null) {alert("Zatím není co ukládat...");return;}
if (leader.xWORKFRAME.document.all.SxOUT==null) {alert("Píseň nelze uložit pokud je vyplé AGAMA formátování (AF)\nNejprve jej zapněte a překreslete píseň. (Menu ENGINE) ");return} 
var o="" ;var oo=""

var l=document.all
var st='';

if (leader.get("sx_TEXTAUTHOR","")!="") st+='T:'+leader.get("sx_TEXTAUTHOR","")+';'
if (leader.get("sx_MELODYAUTHOR","")!="") st+='H:'+leader.get("sx_MELODYAUTHOR","")+';'
if (leader.get("sx_INTERPRET","")!="") st+='Z:'+leader.get("sx_INTERPRET","")+';'
if (leader.get("sx_ALBUM","")!="") st+='A:'+leader.get("sx_ALBUM","")+';'
if (leader.get("sx_YEAR","")!="") st+='Y:'+leader.get("sx_YEAR","")+';'
if (leader.get("sx_PUBLISHING","")!="") st+='PBL:'+leader.get("sx_PUBLISHING","")+';'
if (leader.get("sx_OA","")!="") st+='OA:'+leader.get("sx_OA","")+';'
if (leader.get("sx_ORIGINTERPRET","")!="") st+='DN:'+leader.get("sx_ORIGINTERPRET","")+';'
if (leader.get("sx_ON","")!="") st+='ON:'+leader.get("sx_ON","")+';'
if (leader.get("sx_OALBUM","")!="") st+='OAL:'+leader.get("sx_OALBUM","")+';'

if (leader.get("sx_SOURCE","")!="") st+='ZD:'+leader.get("sx_SOURCE","")+';'
if (leader.get("sx_SENDER","")!="") st+='S:'+leader.get("sx_SENDER","")+';'
if (leader.get("sx_ANOTHERDATA","")!="") st+='MORE:'+leader.get("sx_ANOTHERDATA","")+';'


o=parent.get("sx_text",leader.xWORKFRAME.document.all.LARGE.innerText)

var ar=o.split("\n");var arl=ar.length;
var s=""
for (var n=0;n<arl;n++)
   {s=ar[n]
    for (var nm=(s.length-2);nm>=0;nm=nm-1)  //smaze zbytecne mezery z koncu radek
      {    if (s.charAt(nm)!=" ") {ar[n]=ar[n].substring(0,nm+2);nm=-1;};
           if (nm==0) {ar[n]="";nm=-1;}
      };

    }
var num=0;
var a=ar.length-1;

while (a>0)
 {
   if (ar[a].length<3) {ar[a]="x";ar.length+=-1;}
   else {a=0}
   a+=-1;	
 }

//alert(">"+ar[ar.length-1]+"<"+num)

var areaedit=ar.join("\n")


o=''; oo='';
o+='<HTML><HEAD>\n'
o+='<META HTTP-EQUIV="Content-Type"   Content-Type: text/html; charset=windows-1250>\n'
o+='<META NAME="keywords" CONTENT="'+leader.get("sx_jmenoPisne","")+'">\n'
o+='<META NAME="GENERATOR" CONTENT="Mozilla/4.0 IAC-DesignStudio2001">\n'
o+='<META ID=INFO NAME=IACinfo CONTENT="'+st+'">\n\n'
o+='<TITLE>'+leader.get("sx_jmenoPisne")+'</TITLE>'
oo+=leader.get("sx_jmenoPisne")+'\n'
oo+=leader.get("sx_popiska")+'\n'

oo+=st+'\n';
o+='</HEAD>\n'

o+='<BODY class=G bgcolor=white>\n'

o+='<TABLE border=0 width=100% class=TNADPIS ID=IDTABLE><TBODY><TR>\n'
o+='<TD width=30 ID=N0>&nbsp;</TD>\n'
o+='<TD bgcolor=#EEEEEE width=300 ID=N1><FONT size=5 face=verdana class=SONGNAME>'+leader.get("sx_jmenoPisne","")+'</FONT></TD>\n'
o+='<TD bgcolor=#EEEEEE           ID=N2><FONT size=2 face=verdana class=AUTHOR  >'+leader.get("sx_popiska","")+'</FONT></TD>\n'
o+='</TD></TR></TBODY></TABLE>\n'
o+='<UL>\n'
o+='<pre id=LARGE Style="font-family:monospace;">\n'
oo+=areaedit;
o+=areaedit
o+='\n</pre>\n'
o+='</UL>\n'
o+='</BODY>\n\n'
o+='</HTML>'

if (mode==1) return(o)   //vrati retezec vcetne tagu
if (mode==2) return(oo)   //vrati retezec vcetne tagu
//OUTFO.document.body.innerHTML='<NOBR STYLE="font-family:monospace" id="TAG"></NOBR>'
if (typeof(mode)=="undefined") 
{
OUTFO=open("","","width=600,height=400,left=100,top=50,resizable=yes,scrollbars=yes")
OUTFO.document.body.innerHTML+='<span STYLE="font-family:verdana;font-size:5mm">Zkopírujte do clipboardu a uložte jako soubor</span>'
OUTFO.document.body.innerHTML+='<TEXTAREA id=TTEXT wrap=off STYLE="width:100%;height:300" value="..moment.."></TEXTAREA>'
OUTFO.document.body.style.backgroundColor='silver'
OUTFO.document.title="Saving ..."
OUTFO.document.all.TTEXT.value=o;
OUTFO.document.body.innerHTML+='<br><center><INPUT TYPE="Button" Value="Zavřít toto okno" STYLE="width:60%" onclick="window.close()"></center>'
//OUTFO.document.writeln("")
}
	
}	




//----------------------
loadW.innerHTML="Loading complete....OK"

setTimeout ("{loadW.outerHTML='';leader.document.all.forMENUp.style.visibility='hidden'}",350)