//--------------------------------------------------------------
var run_ok=0, time_restart=0, www_info="www.4weld.sk", info=www_info, loading="<BR><CENTER><IMG src='../DATA/IMG/00c.gif' ></CENTER>", act_menu=0, actp_menu=0, act_id="", sel_id=["","","",""] ;	//sel_id="", .... bolo za act_id
var win_pop1=0;
var img0 = new Image();img0.src = "../DATA/IMG/00c.gif";
var ld_pg4 = new Array (0,1,1,1,1,2,1,1,1,1);
var undefined;
//--------------------------------------------------------------
function url_code(tx){
chh=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");ret="";
for(i=0;i<tx.length;i++){
ch=tx.charCodeAt(i);if(ch==124)ch=35;
nr1=Math.floor(ch/16);nr2=Math.floor(ch-16*nr1);
ret+=chh[nr1]+chh[nr2];}return ret;
}
//--------------------------------------------------------------
//alert("---start---");
document.onclick = click;
document.onmouseover = MouseOver;
dhtml=0;nr1=0;nr2=0;nr3=0;nr4=0;
if(document.layers){dhtml=0;nr3=1;}
if(document.all){dhtml=2;dc=document.all;nr2=1;}
if(document.getElementById){dhtml=1;dc=document;nr1=1;}
//alert("01: "+nr1+"|"+nr2+"|"+nr3+"/"+nr4);
//--------------------------------------------------------------
function pg_test() {return true;}
//--------------------------------------------------------------
function www_test(tx) {window.status =tx;}
//--------------------------------------------------------------
function fn_test(tx) {alert("Fn. TEST");}
//--------------------------------------------------------------
//page51...
function mt_ov(nr){frames[1].mt_ov(nr);}
function mt_cl(nr){frames[1].mt_cl(nr);}
function mt_copy(){frames[1].mt_copy();}
//page2...
function fo_send(){frames[1].fo_send();}
//--------------------------------------------------------------
//--------------------------------------------------------------
function pgx_show_0(c) {
if(dhtml==2){pg=dc.spgx.style;}
if(dhtml==1){pg=dc.getElementById("spgx").style;}
pg.visibility="visible";
if(c==1){
if(dhtml==2){dc.spg2.innerHTML="";}
if(dhtml==1){dc.getElementById("spg2").innerHTML="";}
}
}
//--------------------------------------------------------------
function pgx_show_x(w,h) {
t=135; 
if(dhtml==2){pw=dc.spg2.style.width;}
if(dhtml==1){pw=dc.getElementById("spg2").style.width;}
pw=pw.substr(0,3);//vrati hodnotu ako 657px
l=(pw-w)/2+130;//lavy stlpec=130
//alert("width: "+pw+" / w: "+w+" / h: "+h+"/ left: "+l);
if(dhtml==2){pg=dc.spgx.style;}
if(dhtml==1){pg=dc.getElementById("spgx").style;}
pg.visibility="visible";pg.top=t;pg.left=l;pg.width=w;pg.height=h;
if(dhtml==2){dc.spg2.innerHTML="";}
if(dhtml==1){dc.getElementById("spg2").innerHTML="";}
}
//--------------------------------------------------------------
function pgx_show_2() {
if(dhtml==2){pg=dc.spgx.style;}
if(dhtml==1){pg=dc.getElementById("spgx").style;}
pg.visibility="visible";pg.top=135;pg.left=210;pg.width=480;pg.height=460;
if(dhtml==2){dc.spg2.innerHTML="";}
if(dhtml==1){dc.getElementById("spg2").innerHTML="";}
}
//--------------------------------------------------------------
function pgx_show_3() {
if(dhtml==2){pg=dc.spgx.style;}
if(dhtml==1){pg=dc.getElementById("spgx").style;}
pg.visibility="hidden";pg.top=0;pg.left=0;pg.width=1;pg.height=1;
if(dhtml==2){dc.spg2.innerHTML="";}
if(dhtml==1){dc.getElementById("spg2").innerHTML="";}
}
//--------------------------------------------------------------
function pg_wide(nr) {
if(nr==1){
if(dhtml==2){dc.spg2.style.width=657;document.all.spg4.style.display="none";}
if(dhtml==1){dc.getElementById("spg2").style.width=657;document.getElementById("spg4").style.display="none";}
}
else{
if(dhtml==2){dc.spg4.style.display="";document.all.spg2.style.width=517;}
if(dhtml==1){dc.getElementById("spg4").style.display="";document.getElementById("spg2").style.width=517;}
}}
//--------------------------------------------------------------
function pg_copy(m,n) {
window.scrollTo(0,0);
if(dhtml==2){dc.spgx.style.visibility="hidden";}
if(dhtml==1){dc.getElementById("spgx").style.visibility="hidden";}
if(m>0 && m<100){pg_wide(0);}
if(m>100 && m<200){m=m-100;pg_wide(1);}
if(m==1 || m==11){if(dhtml==2){dc.spg2.innerHTML=parent.frames[0].document.all.ppg1.innerHTML;if(n==1){parent.frames[0].document.all.ppg1.innerHTML="";}
         			  dc.spg3.innerHTML=parent.frames[0].document.all.ppg2.innerHTML;}
		 		  if(dhtml==1){dc.getElementById("spg2").innerHTML=parent.frames[0].document.getElementById("ppg1").innerHTML;if(n==1){parent.frames[0].document.getElementById("ppg1").innerHTML="";}
         			  dc.getElementById("spg3").innerHTML=parent.frames[0].document.getElementById("ppg2").innerHTML;}
}
if(m==2 || m==12){if(dhtml==2){dc.spg2.innerHTML=parent.frames[0].document.all.ppg1.innerHTML;if(n==1){parent.frames[0].document.all.ppg1.innerHTML="";}}
				  if(dhtml==1){dc.getElementById("spg2").innerHTML=parent.frames[0].document.getElementById("ppg1").innerHTML;if(n==1){parent.frames[0].document.getElementById("ppg1").innerHTML="";}}
}
if(m==11 || m==12){if(dhtml==2){dc.spg4.innerHTML=parent.frames[0].document.all.ppg3.innerHTML;}
		 		   if(dhtml==1){dc.getElementById("spg4").innerHTML=parent.frames[0].document.getElementById("ppg3").innerHTML;}
}
act_menu=actp_menu;	//actp_menu sa nastavi po kliknuti, act_menu sa nastavi az po skutocnom nacitani
}
//--------------------------------------------------------------
function pg_clear(c) {
if(c==1 || c==3){
if(dhtml==2){parent.frames[0].document.all.ppg1.innerHTML="...";}
if(dhtml==1){parent.frames[0].document.getElementById("ppg1").innerHTML="...";}
}
if(c==2){
if(dhtml==2){parent.frames[0].document.all.ppg2.innerHTML="...";}
if(dhtml==1){parent.frames[0].document.getElementById("ppg2").innerHTML="...";}
}
}
//--------------------------------------------------------------
function pg_load() {
window.scrollTo(0,0);
if(dhtml==2){dc.spg2.innerHTML=loading;}
if(dhtml==1){dc.getElementById("spg2").innerHTML=loading;}
}
//--------------------------------------------------------------
function pgx_close_w(){
if(dhtml==2){pg=dc.spgx.style;}
if(dhtml==1){pg=dc.getElementById("spgx").style;}
t="0px;";l="0px;";w="1px;";h="1px;";
pg.visibility="visible";pg.width=w;pg.height=h;pg.top=t;pg.left=l;
pg_wide(0);
info=www_info;
}
//--------------------------------------------------------------
function m_chCl(index) {
if(sel_id[index]!=""){if(dhtml==2){cl=dc[sel_id[index]].className;}
					  if(dhtml==1){cl=dc.getElementById(sel_id[index]).className;}
  if(cl.substr(cl.length-1,1)=="a"){if(dhtml==2){dc[sel_id[index]].className=cl.substr(0,cl.length-1);}
  									if(dhtml==1){dc.getElementById(sel_id[index]).className=cl.substr(0,cl.length-1);}
  }
}}
//--------------------------------------------------------------
function m_cl() {
  while(act_id.length>2){m_hide(act_id);act_id=act_id.substr(0,act_id.length-1);}
  act_id="";for(i=0;i<3;i++){m_chCl(i);}
  if(dhtml==2){dc.x03.innerHTML=info;}
  if(dhtml==1){dc.getElementById("x03").innerHTML=info;}
}
//--------------------------------------------------------------
function m_ext(obj_id) {var sub_id = obj_id + "s";
if(dhtml==2){dc[sub_id].style.display = "";}
if(dhtml==1){dc.getElementById(sub_id).style.display = "";}
}
//--------------------------------------------------------------
function m_hide(obj_id) {var sub_id;
if (obj_id!=""){sub_id = obj_id + "s";
if(dhtml==2){dc[sub_id].style.display = "none";}
if(dhtml==1){dc.getElementById(sub_id).style.display = "none";}
}}
//--------------------------------------------------------------
  function MouseOver(e) {
  window.status=www_info;
  if(!run_ok)return;
    var inf, cl, obj_src, obj_id, pr, id, ext;
	if(!e){obj_src=window.event.srcElement;} else{obj_src=e.target;}
	//------------------------------
	//alert("e: "+e+" / obj_src: "+obj_src+" / obj_id: "+obj_src.id);
	
	obj_id=obj_src.id;if(obj_id==undefined){obj_src=obj_src.parentNode;}
	obj_id=obj_src.id;if(obj_id==undefined){return;}// Netscape (7.0); Konqeuror pri nabehnuti nad text ma id undefined, text bere samostatne
	
	pr=obj_id.substr(0,2); id=obj_id.substr(0,obj_id.length-1); ext=obj_id.substr(obj_id.length-1,1);
    if (pr == "t0" && ext != "s"){
    cl=obj_id.length-4;m_chCl(cl);cl++;m_chCl(cl);
    inf="t"+id.substr(1);
	  if(dhtml==2){dc.x03.innerHTML=eval(inf);cl=document.all[obj_id].className;}
	  if(dhtml==1){dc.getElementById("x03").innerHTML=eval(inf);cl=document.getElementById(obj_id).className;}
    if(cl.substr(cl.length-1,1)!="a"){if(dhtml==2){dc[obj_id].className=cl+"a";}
									  if(dhtml==1){dc.getElementById(obj_id).className=cl+"a";}
									  }
        do {
        if (act_id!=id.substr(0,act_id.length)) {
        m_hide(act_id);
        act_id=act_id.substr(0,act_id.length-1);
        if (act_id.length<3) act_id="";}
        else break;}
        while(act_id!="")
      sel_id[obj_id.length-4]=obj_id;
      if (ext == "r" || ext == "q") {m_ext(id);act_id=id;}
    }
if (pr != "t0"){m_cl();}
}
//--------------------------------------------------------------
function pgopen1(tx){
window.scrollTo(0,0);info=www_info;
if(dhtml==2){
dc.spgx.style.visibility="hidden";;
dc.spg2.innerHTML=loading;
}
if(dhtml==1){
dc.getElementById("spgx").style.visibility="hidden";;
dc.getElementById("spg2").innerHTML=loading;
}
time_restart=0;
tx="../WWW/page.php?id=11"+tx;
parent.frames[0].location.replace(tx);
}
//--------------------------------------------------------------
function pgopen2(tx){
win=window.open("","4weld_form01","width=700,menubar=0,toolbar=0,location=0,directories=0,status=1,copyhistory=0,scrollbars=yes,resizable=1");
win.document.open();
win.document.write("<HTML><HEAD></HEAD><BODY><BR><CENTER><IMG src='../DATA/IMG/00c.gif' ></CENTER></BODY></HTML>");
win.document.close();
win.focus();
time_restart=0;
tx="../FORM/page.php?id=12"+tx;
win.location=tx;
}
//--------------------------------------------------------------
//...page...menu...tz...mid...acm...pp...id...
function open_pg1(tz){tx=url_code("1|00|"+tz+"|1ODK1|0|"+poc_pr+"|"+id_prst);pgopen1(tx);}
function open_pg7(tz){tx=url_code("7|00|"+tz+"|1ODK7|0|"+poc_pr+"|"+id_prst);pgopen1(tx);}
function open_pg61(tz){tx=url_code("61|00|"+tz+"|1DWN1|0|"+poc_pr+"|"+id_prst);pgopen1(tx);}
function open_pgx(pg,tz,mid){tx=url_code(pg+"|00|"+tz+"|"+mid+"|0|"+poc_pr+"|"+id_prst);pgopen1(tx);}
//--------------------------------------------------------------
function open_win1(page,tz,name,mid,w_width,w_height){
if(name=="")name="4WELD"; if(mid=="")mid="0WIN1"; if(tz=="")tz="A"; if(w_width=="" || w_width<100)w_width=500;
tx1=url_code(page+"|00|"+tz+"|"+mid+"|0|"+poc_pr+"|"+id_prst);tx1="../WWW/page.php?id=13"+tx1;
tx2="width="+w_width+",menubar=0,toolbar=0,location=0,directories=0,status=1,copyhistory=0,scrollbars=yes,resizable=1";
if(w_height>100){tx2=tx2+",height="+w_height;}
win=window.open("",name,tx2);
win.document.open();
win.document.write("<HTML><HEAD></HEAD><BODY><BR><CENTER><IMG src='../DATA/IMG/00c.gif' ></CENTER></BODY></HTML>");
win.document.close();
win.focus();
//win.location=tx1;
time_restart=0;
win.location.replace(tx1);
}
//--------------------------------------------------------------
function open_win_loc(div_id,fn,name,w_width,w_height){
if(name=="")name="4WELD"; if(w_width=="" || w_width<100)w_width=500;
tx2="width="+w_width+",menubar=0,toolbar=0,location=0,directories=0,status=1,copyhistory=0,scrollbars=yes,resizable=1";
if(w_height>100){tx2=tx2+",height="+w_height;}
win=window.open("",name,tx2);
win.document.open();
win.document.write("<html><head><link rel=stylesheet href=\"../data/inc/text.php\" type=\"text/css\"></head><body><br><center><div id=\"winpgl\"><img src='../data/img/00c.gif' ></div></center></body></html>");
win.document.close();
alert("Print >>>");
if(dhtml==2){ev="win.document.winpgl.innerHTML=dc."+div_id+".innerHTML"; eval(ev);}
if(dhtml==1){ev="win.document.getElementById(\"winpgl\").innerHTML=dc.getElementById(\""+div_id+"\").innerHTML"; eval(ev);}
win.focus();
time_restart=0;
if(fn==1){win.print();win.close();}
}


//--------------------------------------------------------------
//page11m, 12m
function mat_oc(tz){open_win1('11m',tz,'4WELD_ocele','1MTOC',700);}
function mat_lt(tz){open_win1('12m',tz,'4WELD_liatiny','1MTLT',700);}
//page2v
function firm_viz(tz){open_win1('2v',tz,'4WELD_vizitka','1FIRV',700,500);}
//--------------------------------------------------------------

function click(e) {
if(!run_ok)return;
var tx, tx1, tx2, nr, obj_src, obj_id, id, ext;
if(!e){obj_src=window.event.srcElement;} else{obj_src=e.target;}
	//------------------------------
	//alert(">>>e: "+e+" / obj_src: "+obj_src+" / obj_id: "+obj_src.id);

obj_id=obj_src.id;if(obj_id==undefined){obj_src=obj_src.parentNode;}
obj_id=obj_src.id;if(obj_id==undefined){return;}// Konqeuror pri nabehnuti nad text ma id undefined, text bere samostatne

id=obj_id.substr(0,obj_id.length-1); ext=obj_id.substr(obj_id.length-1,1);
if(ext=="e" || ext=="r"){
nr="x"+id.substr(1);tx1=eval(nr);
nr="z"+id.substr(1);tx2=eval(nr);
nr="q"+id.substr(1);tx3=eval(nr);

c_menu=id.substr(2,1)*1;	//rata sa max 9 urovni hlavneho menu 1..9; desiata uroven A uz je problem
c_menu=ld_pg4[c_menu];
if(c_menu==act_menu){c_menu=0;}
else{actp_menu=c_menu;}

if(tx1<100){
tx=url_code(tx1+"|"+id+"|"+tx2+"|"+tx3+"|"+c_menu+"|"+poc_pr+"|"+id_prst);
pgopen1(tx);
}
else{
tx=url_code(tx1+"|"+id+"|"+tx2+"|"+tx3+"|"+c_menu+"|"+poc_pr+"|"+id_prst);
pgopen2(tx);
}
m_cl();}
}
//--------------------------------------------------------------
function pgopen_id(id){
nr="";
for(mid in ww){if(mid==id){nr=ww[mid];break;}}
//alert(nr);
if(nr=="")return false;
tx="x0"+nr;tx1=eval(tx);
tx="z0"+nr;tx2=eval(tx);
tx="q0"+nr;tx3=eval(tx);
tx0="t0"+nr;

c_menu=tx0.substr(2,1)*1;	//rata sa max 9 urovni hlavneho menu 1..9; desiata uroven A uz je problem
c_menu=ld_pg4[c_menu];
if(c_menu==act_menu){c_menu=0;}
else{actp_menu=c_menu;}

if(tx1<100){
tx=url_code(tx1+"|"+tx0+"|"+tx2+"|"+tx3+"|"+c_menu+"|"+poc_pr+"|"+id_prst);
pgopen1(tx);
}
else{
tx=url_code(tx1+"|"+tx0+"|"+tx2+"|"+tx3+"|"+c_menu+"|"+poc_pr+"|"+id_prst);
pgopen2(tx);
}
m_cl();
//return true;
}
//--------------------------------------------------------------
function odkaz(pg){
tx=url_code("99|00|"+pg+"|1ODK2|0|"+poc_pr+"|"+id_prst);
//tx="../WWW/odkaz.php?page="+pg;
window.scrollTo(0,0);
pgopen1(tx);
}
//--------------------------------------------------------------
function autorestart(){
time_restart+=10;//po 10s
if(time_restart>=1500){//1500s=25min
tx=url_code("9|00|UVOD|0ARST|1|"+poc_pr+"|"+id_prst);
time_restart=0;actp_menu=1;pgopen1(tx);}
}
//--------------------------------------------------------------
function open_win_pop1(){
def_pop1="width=220,height=350,menubar=no,toolbar=no,location=no,directories=no,status=no,copyhistory=no,scrollbars=yes,resizable=no";
loc_pop1="./WWW/pg0/kurzy/form.html";
win_pop1=window.open(loc_pop1,"4weld_pop1",def_pop1);
}
//--------------------------------------------------------------
function start(){
//alert("start");
window.defaulStatus=www_info;
run_ok=1;
window.scrollTo(0,0);
info=www_info;
if(dhtml==2){
dc.x03.innerHTML=info;
dc.t00.style.display = "";
dc.spgx.style.visibility="hidden";
}
if(dhtml==1){
dc.getElementById("x03").innerHTML=info;
dc.getElementById("t00").style.display = "";
dc.getElementById("spgx").style.visibility="hidden";
}
frames[0].document.open();frames[0].document.write("<HTML><BODY bgcolor=#CC0000></BODY></HTML>");frames[0].document.close();
if(startmenu!=""){pgopen_id(startmenu);}
else{
tx=url_code("9|00|UVOD|0UVOD|1|"+poc_pr+"|"+id_prst);
actp_menu=1;pgopen1(tx);}
setInterval("autorestart();",10000);
setInterval("window.status=www_info;",100);

//otvorenie vyskakovacieho okna po nacitani:
//open_win_pop1();
}
//--------------------------------------------------------------
function restart(){
tx=url_code("9|00|UVOD|0REST|1|"+poc_pr+"|"+id_prst);
actp_menu=1;time_restart=0;
pgopen1(tx);
}
//--------------------------------------------------------------
function stop(){run_ok=0;}
//--------------------------------------------------------------
function zobrazSkry(idecko){
el=document.getElementById(idecko).style; 
el.display=(el.display == 'block')?'none':'block';
}
//--------------------------------------------------------------


