
      var d = document;

      function $(id){
	       return d.getElementById(id);
      }

      function hideShow(id) {
	      if($(id))
          $(id).style.display =($(id).style.display=='')?'none':'';
      }


      function hide(id) {
	      if($(id))
          $(id).style.display = 'none';
      }
      
      function show(id) {
	      if($(id))
          $(id).style.display = 'block';
      }
      
      function selectTab (newTabId, oldTabId, selTabNum){
        newTab = $(newTabId);
       // alert(newTabId);
        newTab.className += " sel"; 
        if (oldTabId) {
          oldTab = $(oldTabId);
      //    oldTab.className = oldTab.className.substring(0,oldTab.className.length-3); // Класа за селектване на таб е .sel
          oldTab.className = oldTab.className.substring(0,oldTab.className.length-4); // Класа за селектване на таб е .sel
          hideShow (oldTabId+'child');
          //hideShow (newTabId+'page');
        }
        hideShow (newTabId+'child');
        //hideShow (newTabId+'page');
        
        switch(selTabNum) {
          case 1:
            selTab1 = newTabId;
            break;    
          case 2:
            selTab2 = newTabId;
            break;
          case 3:
            selTab3 = newTabId;
            break;
          case 4:
            selTab4 = newTabId;
            break;
          case 5:
            selTab5 = newTabId;
            break;
          case 6:
            selTab6 = newTabId;
            break;
          case 7:
            selTab7 = newTabId;
            break;
          case 8:
            selTab8 = newTabId;
            break;
          case 9:
            selTab9 = newTabId;
            break;
          case 10:
            selTab10 = newTabId;
            break;
          case 11:
            selTab11 = newTabId;
            break;
          case 12:
            selTab12 = newTabId;
            break;
          case 13:
            selTab13 = newTabId;
            break;
          case 14:
            selTab14 = newTabId;
            break;
          case 15:
            selTab15 = newTabId;
            break;
          default:
          case 16:
            selTab16 = newTabId;
          	break;
        }
      }
      

      function getObj(id){
        var obj=false;
        if(document.getElementById(id)) obj=document.getElementById(id);
        return obj
      }
      
      function getIntFromId (selObj){                                       
              num = parseInt(selObj.substring(1,selObj.length));            
              return num;                                                   
      }                                                               
                                                                            
     /* function getTabId(type, newsCount){  // type is 'prev' or 'next'
              numId = getIntFromId(selTab4);                                
              if (type == 'next') {                                         
                if (numId < newsCount) numId += 1;                          
                else  numId = 1;                                            
              } else if (type == 'prev') {                                  
                if (numId > 1) numId -= 1;                                  
                else numId = newsCount;                                     
              } else numId = 1;                                             
              objId = 'n' + numId;                            // id in "n1".."n3"
              return objId;                                                 
      } */         
      
 //slideshow function                                                                    
      function getTabId(type, newsCount){  // type is 'prev' or 'next'; newsCount is the number of tabs
              numId = getIntFromId(selTab15);                                
              if (type == 'next') {                                         
                if (numId < newsCount) numId += 1;                          
                else  numId = 1;                                            
              } else if (type == 'prev') {                                  
                if (numId > 1) numId -= 1;                                  
                else numId = newsCount;                                     
              } else numId = 1;                                             
              objId = 'a' + numId;                            // id in "n1".."n3"
              return objId;                                                 
      }           
      //slideshow function           
      function getPageId(seltab, type, pagesCount){  // type is 'prev' or 'next'; selTab is current selected tab(page)
              //numId = getIntFromId(selTab);
              numId = parseInt(seltab.substring(3,seltab.length));
           //   alert('numbID = '+numId+' and seltab is: '+seltab);
              if (type == 'next') {                                         
                if (numId < pagesCount) numId += 1;                          
                else  numId = 1;                                            
              } else if (type == 'prev') {                                  
                if (numId > 1) numId -= 1;                                  
                else numId = pagesCount;                                     
              } else numId = 1;                                             
              objId = seltab.substring(0,3) + numId;
              return objId;                                                 
      }
      
      
      


/***********************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

//Contents for menu 1
var menu1=new Array()
menu1[0]='<a href="index.phtml?tid=20&oid=9640&teid=9660" class="lavst">АВСТРИЯ</a>'
menu1[1]='<a href="index.phtml?tid=20&oid=9640&teid=9700" class="lger">ГЕРМАНИЯ</a>'
menu1[2]='<a href="index.phtml?tid=20&oid=9640&teid=9720" class="lger">ГЪРЦИЯ</a>'
menu1[3]='<a href="index.phtml?tid=20&oid=9640&teid=9740" class="lger">ИСПАНИЯ</a>'
menu1[4]='<a href="index.phtml?tid=20&oid=9640&teid=9760" class="lger">ИТАЛИЯ</a>'
menu1[5]='<a href="index.phtml?tid=20&oid=9640&teid=9780" class="lger">ПОЛША</a>'
menu1[6]='<a href="index.phtml?tid=20&oid=9640&teid=9800" class="lger">ПОРТУГАЛИЯ</a>'
menu1[7]='<a href="index.phtml?tid=20&oid=9640&teid=9820" class="lger">РУМЪНИЯ</a>'
menu1[8]='<a href="index.phtml?tid=20&oid=9640&teid=9840" class="lger">РУСИЯ</a>'
menu1[9]='<a href="index.phtml?tid=20&oid=9640&teid=9860" class="lger">ТУРЦИЯ</a>'
menu1[10]='<a href="index.phtml?tid=20&oid=9640&teid=9880" class="lger">ФРАНЦИЯ</a>'
menu1[11]='<a href="index.phtml?tid=20&oid=9640&teid=9900" class="lger">ХОЛАНДИЯ</a>'
menu1[12]='<a href="index.phtml?tid=20&oid=9640&teid=9920" class="lger">ХЪРВАТИЯ</a>'
menu1[13]='<a href="index.phtml?tid=20&oid=9640&teid=9940" class="lger">ЧЕХИЯ</a>'
menu1[14]='<a href="index.phtml?tid=20&oid=9640&teid=9960" class="lger">ШВЕЙЦАРИЯ</a>'
menu1[15]='<a href="index.phtml?tid=20&oid=9640&teid=9980" class="lger">ШВЕЦИЯ</a>'

//Contents for menu 2, and so on
var menu2=new Array()
menu2[0]='<a href="?tid=20&oid=9600&hid=2000660" class="lavst">ПОРТУГАЛИЯ - 2004</a>'
menu2[1]='<a href="?tid=20&oid=9600&hid=2000680" class="lger">БЕЛГИЯ и ХОЛАНДИЯ - 2000</a>'
menu2[2]='<a href="?tid=20&oid=9600&hid=2000700" class="lger">АНГЛИЯ - 1996</a>'
menu2[3]='<a href="?tid=20&oid=9600&hid=2000720" class="lger">ШВЕЦИЯ - 1992</a>'
menu2[4]='<a href="?tid=20&oid=9600&hid=2000740" class="lger">ФРГ - 1988</a>'
menu2[5]='<a href="?tid=20&oid=9600&hid=2000760" class="lger">ФРАНЦИЯ - 1984</a>'
menu2[6]='<a href="?tid=20&oid=9600&hid=2000780" class="lger">ИТАЛИЯ - 1980</a>'
menu2[7]='<a href="?tid=20&oid=9600&hid=2000800" class="lger">ЮГОСЛАВИЯ - 1976</a>'
menu2[8]='<a href="?tid=20&oid=9600&hid=2000820" class="lger">БЕЛГИЯ - 1972</a>'
menu2[9]='<a href="?tid=20&oid=9600&hid=2000840" class="lger">ИТАЛИЯ - 1968</a>'
menu2[10]='<a href="?tid=20&oid=9600&hid=2000860" class="lger">ИСПАНИЯ - 1964</a>'
menu2[11]='<a href="?tid=20&oid=9600&hid=2000880" class="lger">ФРАНЦИЯ - 1960</a>'

//Contents for menu 3, and so on
var menu3=new Array()
menu3[0]='<a class="davst">АВСТРИЯ</a>'
menu3[1]='<a href="index.phtml?tid=20&oid=10120&did=2002840" class="flger">ВИЕНА</a>'
menu3[2]='<a href="index.phtml?tid=20&oid=10120&did=2003000" class="lger">КЛАГЕНФУРТ</a>'
menu3[3]='<a href="index.phtml?tid=20&oid=10120&did=2002900" class="lger">ЗАЛЦБУРГ</a>'
menu3[4]='<a href="index.phtml?tid=20&oid=10120&did=2003020" class="lger">ИНСБРУК</a>'
menu3[5]='<a class="shdavst">ШВЕЙЦАРИЯ</a>'
menu3[6]='<a href="index.phtml?tid=20&oid=10120&did=2003060" class="flger">БАЗЕЛ</a>'
menu3[7]='<a href="index.phtml?tid=20&oid=10120&did=2003080" class="lger">ЦЮРИХ</a>'
menu3[8]='<a href="index.phtml?tid=20&oid=10120&did=2002920" class="lger">БЕРН</a>'
menu3[9]='<a href="index.phtml?tid=20&oid=10120&did=2003040" class="lger">ЖЕНЕВА</a>'



var menuwidth='165px' //default menu width
var menubgcolor='#f9f9f9'  //menu bgcolor
var disappeardelay=0  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="no" //hide menu when user clicks within menu?

var t1;
var tclass;
var tclass2;
var pic1;
var cl;

//   Change class
function changeClass(eID,eClass){
  if(eID) t1 = eID;
  if(eClass) tclass = eClass;
  document.getElementById(t1).className = tclass;
}

function changeBack(eID,beClass){
  if(eID) menubgcolor = eID;
  if(beClass) tbclass = beClass;
  document.getElementById(menubgcolor).className = tbclass;
}


function changebg(eID,pic) {
   if(eID) t1 = eID;
   if(pic) pic1 = pic;
  document.getElementById(t1).style.background = "url('"+pic1+"')";
}

function changecolor(eID,fcolor) {
   if(eID) t1 = eID;
   if(fcolor) cl = fcolor;
  document.getElementById(t1).style.background = cl;
}



/////No further editting needed

function hidetab(eID,which_class){
  if(eID) t1 = eID;
   if(which_class) tclass2 = which_class;
  document.getElementById(t1).className = tclass2;
}


var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu();changeClass(t1,tclass);" onMouseout="dynamichide(event);hidetab(t1,tclass2)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-480px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}

function dropdownmenu2(obj, e, menucontents, menuwidth, menucolor, posx){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
if (menucolor) { document.getElementById("dropmenudiv").style.background = menucolor; }
if (posx) { document.getElementById("dropmenudiv").style.marginLeft = posx+"px"; }
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu

function searchQuery(){
	var base_url = 'http://euro2008.sportni.bg/index.phtml?tid=20&oid=9620';
	
	//if($('qeuro').value != '') base_url += '&q='+$('qeuro').value;
	if($('searchtext').value != '') base_url += '&q='+encodeURI($('searchtext').value);
	if($('fromdate').value != '') base_url += '&f='+$('fromdate').value;
	if($('todate').value != '') base_url += '&d='+$('todate').value;
	if($('category').value != 0) base_url += '&c='+$('category').value;
	
	if($('fulltext').checked) base_url += '&a=on';
		
	window.location.href = base_url;
}
function reloadBanner(){
	
	$('banner_300x250').src = 'http://euro2008.sportni.bg/banner_300x250.phtml';
}