/*
function activeDiv(nr) - obsluha odkazu v tagu DIV //mousemove
function activMe(nr)   - obsluha odkazu v tagu TD  //mousemove
function goDiv()       - aktivace odkazu v tagu DIV
function goMe()        - aktivace odkazu v tagu TD
function myPhone(myurl)- modalDialog on myurl;
function myPhone2(myid)- modalDialog on myurl - parametr předán v myid
function visitka(myurl)- modal + návratová hodnota
function helpme(hlpid) - vyžaduje deklaraci prom path

funkce pro řízení průhlednosti
function startAlpha(el)
function mineAlpha()
function endAlpha(el)

myConfirm('typ')        - vrací hodnotu z potvrzení (ANO/NE)
function openChild(childPath) otevře okno   
function SHMAP() ukazuje / schovává mapu webu     
*/

//       set
var activeColor="#c7e8fc"; //pro pohyb myši "#dc143c"
var wi;
var wie;
//------------------------------------------------------------------
function activeDiv(nr,el)
{
//el=event.srcElement
if (el.tagName!="DIV")
	{
	if (el.tagName=="A")
		{
		el=el.parentElement
		}
	else
		{
		if (el.tagName=="IMG")
			{
			el=el.parentElement.parentElement
			}
		else
			{
			return false;
			}
		}
	}
	if (!nr)
		{
		el.style.backgroundColor=activeColor
        el.style.cursor="pointer"
		//el.title=el.children[0].title
		}
	else
		{
		el.style.backgroundColor=""
         el.style.cursor="default"
		}
}
//------------------------------------------------------------
function activMe(nr,el)
{
//el=event.srcElement
if (el.tagName!="TD" && el.tagName!="P")
    {
	if (el.tagName=="A")
		{
		el=el.parentElement
		}
	else
		{
		if (el.tagName=="IMG")
			{
			el=el.parentElement.parentElement
			}
		else
			{
			return false;
			}
		}
	}
	if (nr)
		{
		el.style.backgroundColor=activeColor
        el.style.cursor="pointer"
		//el.title=el.children[0].title
		}
	else
		{
		el.style.backgroundColor=""
         el.style.cursor="default"
		}
	
}
function activP(nr,el)
{
//el=event.srcElement
if (el.tagName!="TD" && el.tagName!="P")
    {
	if (el.tagName=="A")
		{
		el=el.parentElement
		}
	else
		{
		if (el.tagName=="IMG")
			{
			el=el.parentElement.parentElement
			}
		else
			{
			return false;
			}
		}
	}
	if (nr)
		{
		el.className="PAbutton"
        el.style.cursor="pointer"
		//el.title=el.children[0].title
		}
	else
		{
        
		el.className="pbutton"
         el.style.cursor="default"
		}
	
}
function goDiv(el)
{
//el=event.srcElement
if (el.tagName=="DIV" && el.tagName!="A" )
    {
    myref=el.getElementsByTagName("A")[0].href
    window.location.href=myref;
    }
}
function goMe(el)
{
if ((el.tagName=="TD"||el.tagName=="P") && el.tagName!="A")
    {
    myref=el.getElementsByTagName("A")[0].href
    window.location.href=myref;
    }
}
function myPhone(myurl)
{
if(navigator.appName !="Microsoft Internet Explorer")
{
window.open(myurl,"w2","height=400,width=450,dependent=1,screenX=200,screenY=200,resizable=1");
return false;
}
window.showModalDialog(myurl,"","dialogWidth=400px")
/*ok=window.open(myurl,"wkalendar","location=0,directories=0,toolbar=0,menubar=0,status=0,scrollbars=0,dependent=yes,width=400,height=150");*/
return false
}
function myPhone2(myid)
{
myurl="kontakts/compview.php?ID="+myid;
if(navigator.appName !="Microsoft Internet Explorer")
{
window.open(myurl,"Spolecnost","height=400,width=450,dependent=1,screenX=200,screenY=200,resizable=1");
return false;
}
window.showModalDialog(myurl,"","dialogWidth=400px")
/*ok=window.open(myurl,"wkalendar","location=0,directories=0,toolbar=0,menubar=0,status=0,scrollbars=0,dependent=yes,width=400,height=150");*/
return
}

function visitka(myurl)
{
if(navigator.appName !="Microsoft Internet Explorer")
{
window.open(myurl,"Spolecnost","height=400,width=450,dependent=1,screenX=200,screenY=200,resizable=1");
return false;
}
var miE=window.showModalDialog(myurl,"","dialogWidth=400px")
/*ok=window.open(myurl,"wkalendar","location=0,directories=0,toolbar=0,menubar=0,status=0,scrollbars=0,dependent=yes,width=400,height=150");*/
return miE
}

function helpme(hlpid)
{
if(document.location.hostname=="www.tzu.cz")
{
cesta=document.location.protocol+"//"+document.location.hostname+"/help/hlp.php?hlpid="+hlpid
}
else
{
cesta=document.location.protocol+"//"+document.location.hostname+"/tzu/help/hlp.php?hlpid="+hlpid
}
//cesta=path+hlpid
//alert(cesta)
//return;
var hlp=window.open(cesta,"help","location=0,directories=0,toolbar=0,menubar=0,status=1,scrollbars=1,height=600,width=800,resizable=1");
if(hlp)hlp.focus();
return false;
}

function startAlpha(el)
{
if (wi) window.clearInterval(wi)
wi=0
el.filters['alpha'].opacity=100
}

function mineAlpha()
{
if(wie.filters['alpha'].opacity<=30)
    {
    window.clearInterval(wi)
    wi=0;
    return true
    }
  wie.filters['alpha'].opacity=(wie.filters['alpha'].opacity-5) 
}

function endAlpha(el)
{
wie=el
wi=window.setInterval("mineAlpha()",1)
}

function myConfirm(typ)
{

var myStr="Vybral jste příkaz "+typ+"!";
    myStr+="\n Mám pokračovat?"
    myVal= window.confirm(myStr)
    return myVal;
}
function openChild(childPath)
{
var hlp=window.open(childPath,"help","location=0,directories=0,toolbar=0,menubar=0,status=1,scrollbars=1,height=500,width=400,resizable=1");
return false;
}
function myAlpha(el,nr)
{
if(navigator.appName !="Microsoft Internet Explorer")return
el.filters['alpha'].opacity=nr
}
function myPhone3(el)
{
if(el.tagName=="A")
    {
    myurl=el.getAttribute("href");
    }
else
    {
    return false
    }
if(navigator.appName !="Microsoft Internet Explorer")
{
window.open(myurl,"w2","height=300,width=500,dependent=1,screenX=200,screenY=200,resizable=1");
return false;
}
window.showModalDialog(myurl,"","dialogWidth=400px")
/*ok=window.open(myurl,"wkalendar","location=0,directories=0,toolbar=0,menubar=0,status=0,scrollbars=0,dependent=yes,width=400,height=150");*/
return false
}
function SHMAP()
{
if(document.getElementById('mapawebu').style.display=='none')
{
document.getElementById('mapawebu').style.display='';
document.getElementById('promapu').className='stisknuto';
}
else
{
document.getElementById('mapawebu').style.display='none';
document.getElementById('promapu').className='abutton';;
}
}
var oldMapClass='';
function toMap(el,nr)
{
ClassArray=new Array()
if(nr==1)
    {
    oldMapClass=el.style.color
    el.style.color='#0000ff'
    }
    else
    {
     el.style.color=oldMapClass
    }
}
function delme(myurl)
{
if(myConfirm("smazat dokument"))
    {
        location.href=myurl
    }
}
function getImage(nr)
{
 myurl="http://www.tzu.cz/svet-textilu/image_view.php?ID="+nr
 mw=window.open(myurl,"Obrázek","location=0,directories=0,toolbar=0,menubar=0,status=0,scrollbars=0,height=50,width=50,dependent=1,screenX=5,screenY=5,resizable=1");
 
 return !mw;
 
}

var reactNR
function reaktiv(nr)
{
var switchPath="http://"+location.hostname+"/"
var toPath=new Array('','index.php','redakce/index.php','redakce/gallery.php','admin/index.php');
if(nr==reactNR)
{
  location.href=switchPath+toPath[nr]
 return false; 
}
reactNR=nr
myBody=document.getElementById('menubody');
myCollect=myBody.getElementsByTagName("TR");
for (i=0;i<myCollect.length;i++)
    {
    myCollect[i].className='trhidden';
    }
document.getElementById('menutr'+nr).className='trvisibled';
myBody=document.getElementById('forcel');
myCollect=myBody.getElementsByTagName("TD");
for (i=1;i<(myCollect.length-1);i++)
    {
    myCollect[i].className='neaktivni';
     }
myCollect[nr].className='superaktivni';
}
function getDocu(nr)
{
  myW=screen.availWidth-100;
  myH=screen.availHeight-100;
  feat='location=0,directories=0,toolbar=0,menubar=0,status=1,scrollbars=1,height=' + myH + ',width=' + myW + ',dependent=0,screenX=50,screenY=50,resizable=1';
 var switchPath="http://"+location.hostname+"/svet-textilu/get_dokument.php?ID="+nr
 mw=window.open(switchPath,"Doc",feat);
 
 mw =! mw
 
 return mw
}
