window.addEvent('domready', function(e)
{ if($('ms-navi-main'))
  if($('ms-navi-main').getElements('li[id^=ms-corenav]').length>0)
  {
    $each($('ms-navi-main').getElements('li[id^=ms-corenav]'), function(el)
    {
      el.addEvent('mouseover',function(e)
      {
         e.stop();
        $each($('ms-navi-main').getElements('li[id^=ms-corenav]'), function(el){el.removeClass('ms-fly-hover');});
        this.addClass('ms-fly-hover');
      }
      );
      
      el.addEvent('mouseout',function(e)
      {
        e.stop();
        //$each($('ms-navi-main').getElements('li[.ms-fly-hover]'), function(el){el.removeClass('ms-fly-hover');});
        //$('ms-navi-main').getElement('li[.ms-fly-hover]').removeClass('ms-fly-hover');
        this.removeClass('ms-fly-hover');
      }
      );
      
    }
    );
  }
  if($('ms-navi-main'))
  if($('ms-navi-main').getElements('.ms-navi-main-fly-v2-navi-a').length>0)
  {
      $each($('ms-navi-main').getElements('.ms-navi-main-fly-v2-navi-a'), function(elul)
      {
        var elul;
        if(elul.getElements('.ms-has-fly').length>0){
        $each(elul.getElements('.ms-has-fly'), function(el)
        {
         // el.getElement('.flow').setStyle('display','none');
          el.addEvent('mouseover',function(e)
          {
            // e.stop();
            //this.getElement('.flow').setStyle('display','block');
            $each(elul.getElements('.ms-has-fly'), function(el){el.removeClass('flow-hover');});
            this.addClass('flow-hover');
          }
          );
          el.addEvent('mouseout',function(e){
            this.removeClass('flow-hover');
            e.stop();
          }
          );
          /*
          $('ms-navi-main').addEvent('mouseout',function()
          {
           $each(elul.getElements('.ms-has-fly'), function(el){el.removeClass('flow-hover');});
            //this.removeClass('flow-hover');
          }
          );
          */ 
        });
        }
      }
      );
  }
  
  
  /*TOP LEVEL END*/
  
  
  
  /*SECOND LEVEL*/
  if($$('li[id^=left_part_]').length>0){
    //window.console.log($$('li[id^=left_part_]').length);
      $each($$('li[id^=left_part_]'), function(el,index){
        el.addEvent('click',function()
        { 
          $each($$('div[id^=right_part_]'), function(els,index){
            els.style.display='none';
          });
          
          //window.console.log(this.id);
          r=this.id.match('([0-9]+)$');
          
          if(r[0]){
           // window.console.log('right_part_'+r[0]);
            $('right_part_'+r[0]).setStyle('display','block');
          }
          return false;
        }
        );
      }
      );
  }
  //window.console.log($$('ul[id=ms-navi-main-fly-v1-1-right]').length);
  if($$('ul[id^=ms-navi-main-fly-v1-1-right]').length>0){
    $each($$('ul[id^=ms-navi-main-fly-v1-1-right]'), function(el,idx){
        if(el.getChildren().length>0)
          {
            $each(el.getChildren(), function(el)
            {
              if(el.getFirst().nodeName=='A')
              {
                el.addEvent('mouseover',function()
                {
                  $each(this.getParent().getElements('div[.ms-navi-main-fly-v1-2]'), function(els,index){
                    els.setStyle('display','none');
                    els.setStyle('visibility','hidden');
                    //els.addClass('off');
                    //els.removeClass('on');
                  });
                  //this.getElement('div[.ms-navi-main-fly-v1-2]').removeClass('off');
                  //this.getElement('div[.ms-navi-main-fly-v1-2]').addClass('on');
                  this.getElement('div[.ms-navi-main-fly-v1-2]').setStyle('display','block');
                  this.getElement('div[.ms-navi-main-fly-v1-2]').setStyle('visibility','visible');
                }
                );
              }
            }
            );
          }
    }
    );
  }
 

  
  //window.console.warn('count'+$('ms-navi-main-fly-v1-1-right').getElements('ul[class=ms-navi-last-level]').length);
  /*SECOND LEVEL END*/
  /*LAST LEVEL BEGIN*/
  if($$('ul[class=ms-navi-last-level]').length>0){
    $each($$('ul[class=ms-navi-last-level]'), function(el)
    {
      if(el.getChildren().length>0){
        $each(el.getChildren(), function(el,index){
          el.indx = index;
          el.addEvent('mouseover',function()
          {
            
            //this.removeClass('ms-hover');
            tmparr = this.getParent().getParent().getParent().getParent().getNext().getElements('div[class=ms-navi-main-fly-v1-2-right]');
            tmparrb = this.getParent().getParent().getParent().getParent().getNext().getElements('div[class=ms-navi-main-fly-v1-2-bottom]');
            
            if(tmparr.length>0){
            
              $each(tmparr, function(el,index)
              {
                  el.getNext().setStyle('display','none');
                  el.getNext().setStyle('visibility','hidden');
                  el.setStyle('display','none');    
                  el.setStyle('visibility','hidden');
              });
              
             
              tmparr[this.indx].setStyle('display','block');
              tmparrb[this.indx].setStyle('display','block');
              tmparr[this.indx].setStyle('visibility','');
              tmparrb[this.indx].setStyle('visibility','');
            }
            
            //window.console.warn('over'+tmparr.length);//debg
          }
          );       
        }
        );
      }
    }
    );
  }
  /*LAST LEVEL END*/
  
  
  /*CLASS LEFT MENU*/
    if($$('p[.ms93-sn-button,.ms-pcn-button]').length>0){
      $each($$('p[.ms93-sn-button,.ms-pcn-button]'), function(el,index){//for each menu buttom
        makeVerticalMenuByButton(el);
      }
      );
    }
  /*CLASS LEFT MENU END*/
  /*NAVIGATION END*/ 
  
  
  /*FLASH TITLES*/
  //alert($$('a[class=flash-titles]').length);
  if($$('a[class=flash-titles]').length>0){
    $each($$('a[class=flash-titles]'), function(el,index){
      el.embs=el.getElement('img');
      
      el.addEvent('mouseover',function()
      {
        this.embs.setProperty('src',this.embs.getProperty('src').replace('234F7B','00ADEF'));
      }
      );
      
      el.addEvent('mouseout',function()
      {
        this.embs.setProperty('src',this.embs.getProperty('src').replace('00ADEF','234F7B'));
      }
      );
    }
    );
  }
  /*FLASH TITLES END*/
      
  //tech data
  if($('tech_table')){
  var path = 'http://'+window.location.hostname+'/';
  //var path = 'http://'+window.location.hostname+'/';
  var select0 = $('lower0');
  var select1 = $('lower1');
  var select2 = $('lower2');
  var tbody = $('tech_table');
  var currentmod = 1;

  //window.console.log(tbody);
   select0.addEvent('change',function(e)//if selecting only some sections
    {
      //window.console.log(0);
       tbody.fade('toggle');      
       var reqstr='sec='+select0.options[select0.selectedIndex].value+'&mod1='+select1.options[select1.selectedIndex].value+'&mod2='+select2.options[select2.selectedIndex].value+'&sel='+currentmod;     
       var req = new Request.HTML({
            url:path+'tech_data/index.php',
            onSuccess: function(html) {
               tbody.empty();
               tbody.adopt(html);
               tbody.fade('toggle');
            },
            onFailure: function() {
              tbody.fade('toggle');
             }
            }).send(reqstr);
      
      
      //window.console.log('yes');
    }
   );
   
   select1.addEvent('change',function(e)//if selecting only some sections
    {
       //tbody.fade('toggle');
       //window.console.log(1);
       currentmod = 1;
       var reqstr='sec='+select0.options[select0.selectedIndex].value+'&mod1='+select1.options[select1.selectedIndex].value+'&mod2='+select2.options[select2.selectedIndex].value+'&sel='+currentmod;
       if(select1.options[select1.selectedIndex].value!=0 ){ 
         trs=tbody.getElements('tr');
         trs.each(function(tr){
            if(tr.getChildren().length ==3 )
            if(tr.getChildren()[1].textContent!='')
              tr.getChildren()[1].fade('out');
          }
         );       
         var req = new Request.HTML({
              url:path+'tech_data/index.php',
              onSuccess: function(html) {
                 tbody.set('text','');
                 tbody.adopt(html);
                 
                   trs=tbody.getElements('tr');
                   trs.each(function(tr){
                    if(tr.getChildren().length ==3 )
                     if(tr.getChildren()[1].textContent!=''){
                      //tr.getChildren()[1].setStyle('opacity','0');
                      tr.getChildren()[1].fade('in');
                     }
                    }
                   );   
              },
              onFailure: function() {
                //tbody.fade('toggle');
               }
              }).send(reqstr);
      }
      
      //window.console.log('yes');
    }
   );
   
   select2.addEvent('change',function(e)//if selecting only some sections
    {
      //window.console.log(2);
       //tbody.fade('toggle');
       currentmod = 2;
       var reqstr='sec='+select0.options[select0.selectedIndex].value+'&mod1='+select1.options[select1.selectedIndex].value+'&mod2='+select2.options[select2.selectedIndex].value+'&sel='+currentmod;
       if( select2.options[select2.selectedIndex].value!=0){
        trs=tbody.getElements('tr');
       trs.each(function(tr){
        if(tr.getChildren().length ==3 )
          if(tr.getChildren()[2].textContent!='')
            tr.getChildren()[2].fade('out');
        }
       );        
       var req = new Request.HTML({
            url:path+'tech_data/index.php',
            onSuccess: function(html) {
               tbody.empty();
               tbody.adopt(html);
               
                 trs=tbody.getElements('tr');
                 trs.each(function(tr){
                  if(tr.getChildren().length ==3 )
                  if(tr.getChildren()[2].textContent!=''){
                      //tr.getChildren()[2].setStyle('opacity','0');
                      tr.getChildren()[2].fade('in');
                     }
                  }
                 );   
            },
            onFailure: function() {
              //tbody.fade('toggle');
             }
            }).send(reqstr);
      
      }
      //window.console.log('yes');
    }
   );
  }
  //end tech data
  
  //rollers
  var rols = $$('div[class^=roller_head]');
  if(rols.length>0){
    rols.each(function(rh){
        if(rh.getElement('a') && rh.getNext().hasClass('roller_body')){
          rh.a =rh.getElement('a');
          rh.a.content = rh.getNext();
          if(rh.hasClass('closed')){
              rh.a.closed = true;
          }
          else{ 
              rh.a.closed = false;
          }
          rh.a.addEvent('click',function(e){
              e.stop();
              if(this.closed){
                this.content.removeClass('closed');
                this.getParent().removeClass('closed');
                this.closed = false;
              }else{
                this.content.addClass('closed');
                this.getParent().addClass('closed');
                this.closed = true;
              }
            }
          );
        }
      }
    );
  }
//end rollers


var right_colls = $$('div[class=ms-component-copyimgsys-f-right]');
  if(right_colls.length>0){
  	gals= new Array;
  	galsz= new Array;
  	right_colls.each(function(r){
  		if(r.getElements('ul[class=ms-agc]').length>0)
  			gals.include(r);
  		else
  			if(r.getElements('p[class=ms-link-enlarge]').length>0)
  				galsz.include(r);
		});
		//one image window
		if(galsz.length>0){	
			galsz.each(function(gr,ind){
				gr.act=0;
				//zoom
				left_offset = (window.getCoordinates().width-504)/2;
				var windowdiv= new Element("div", {"id":"mod_win","class": "ms-modallayer", html: '<div class="ms-modallayer-t"><div class="ms-modallayer-t-c"><p class="ms-btn6"> <a href="#">Close</a></p></div></div><div class="ms-modallayer-m"><div  class="ms-modallayer-m-c"><p ></p> <img src="#"/></div></div><div class="ms-modallayer-b"><div class="ms-modallayer-b-c"><div class="ms-modallayer-b-c-2"><p  class="ms-text ms-tx3" style="width: 250px;"> Bedien- und Anzeigesystem COMAND APS mit Navigationsmodul (Sonderausstattung)</p></div><div class="ms-clearer"></div></div></div>'});
				windowdiv.setStyles({'opacity':"1","display":"block","z-ndex":"1001","left":left_offset+"px","top":"440px","width":"504px"}).makeDraggable();
				
				zoom = gr.getElement('.ms-link-enlarge');
				if(zoom){
				zoom.gr = gr;
				zoom.addEvent('click',function(e){
					e.stop();
					toggleModal("#fff",{zIndex:'1000'});
					windowdiv.inject(document.body);
					top_offset = (window.getCoordinates().height-$('mod_win').getHeight())/2 -100 +window.getScroll().y;
					$('mod_win').setStyles({"top":top_offset+"px"});
					//close butoon
					$('mod_win').getElement('.ms-modallayer-t-c .ms-btn6').addEvent('click',function(e){
						e.stop();
						toggleModal();
						if($('mod_win'))
							$('mod_win').dispose();
					});
					//close butoon end
					
					var _gr = this.gr;
					
					var img_src = _gr.getElements('.ms-image')[this.gr.act].getElement('img').src.replace('/230/','/500/');
					var img_title = _gr.getElements('.ms-image')[this.gr.act].getElement('img').alt;
					
					var main_img = $('mod_win').getElement('.ms-modallayer-m-c').getElement('img');
					var title = $('mod_win').getElement('.ms-modallayer-b-c-2').getElement('p');
					main_img.src = img_src;
					main_img.title = img_title;
					title.set('text',img_title);
					
					
					var liss = $('mod_win').getElements('li');		
					var ppss = $('mod_win').getElements('p[class^=ms-image]');					
					
				});
				}
			});
		}
		
		
		if(gals.length>0){	
			gals.each(function(gr,ind){
				gr.act=0;
				var lis = gr.getElements('li');
				var uls = gr.getElement('.ms-agc');			
				var pps = gr.getElements('p[class^=ms-image]');
				
				gr.getElement('.ms-first-li').addEvent('click',function(e){
					e.stop();					
					pps.each(function(p){
						p.setStyle('display','none');
					});
					lis.each(function(li){
						li.removeClass('ms-active');
					});
					
					if(this.getParent().getParent().act<1){
						this.getParent().getParent().act = pps.length-1;					
					}else{
						this.getParent().getParent().act = this.getParent().getParent().act-1;
					}
					lis[this.getParent().getParent().act+1].addClass('ms-active');
					pps[this.getParent().getParent().act].setStyle('display','block');
				});
				
				gr.getElement('.ms-last-li').addEvent('click',function(e){
					e.stop();
					pps.each(function(p){
						p.setStyle('display','none');
					});
					lis.each(function(li){
						li.removeClass('ms-active');
					});
					
					if(this.getParent().getParent().act==pps.length-1){
						this.getParent().getParent().act = 0;
					}else{
						this.getParent().getParent().act = this.getParent().getParent().act+1;
					}
					
					lis[this.getParent().getParent().act+1].addClass('ms-active');
					pps[this.getParent().getParent().act].setStyle('display','block');
				});
				lis.each(function(li,ind){
						if(ind>0 && ind<lis.length-1){
						li.ind = ind-1;
							li.addEvent('click',function(e){
								e.stop();
								this.getParent().getParent().act = this.ind;
								
								pps.each(function(p){
									p.setStyle('display','none');
								});
								lis.each(function(li){
									li.removeClass('ms-active');
								});
								lis[this.ind+1].addClass('ms-active');
								pps[this.ind].setStyle('display','block');

							});
						}
				});
				//zoom
				left_offset = (window.getCoordinates().width-504)/2;
				var windowdiv= new Element("div", {"id":"mod_win","class": "ms-modallayer", html: '<div class="ms-modallayer-t"><div class="ms-modallayer-t-c"><p class="ms-btn6"> <a href="#">Close</a></p></div></div><div class="ms-modallayer-m"><div  class="ms-modallayer-m-c"><p ></p> <img src="#"/></div></div><div class="ms-modallayer-b"><div class="ms-modallayer-b-c"><div class="ms-modallayer-b-c-2"><p  class="ms-text ms-tx3" style="width: 250px;"> Bedien- und Anzeigesystem COMAND APS mit Navigationsmodul (Sonderausstattung)</p><ul class="ms-agc"><li class="ms-first-li"> <a href="#"></a></li><li class="ms-active"> <a href="#"></a></li><li> <a href="#"></a></li><li class="ms-last-li"> <a href="#"></a></li></ul></div><div class="ms-clearer"></div></div></div>'});
				windowdiv.setStyles({'opacity':"1","display":"block","z-ndex":"1001","left":left_offset+"px","top":"440px","width":"504px"}).makeDraggable();
				
				zoom = gr.getElement('.ms-link-enlarge');
				if(zoom){
				zoom.gr = gr;
				zoom.addEvent('click',function(e){
					e.stop();
					toggleModal("#fff",{zIndex:'1000'});
					windowdiv.inject(document.body);
					top_offset = (window.getCoordinates().height-$('mod_win').getHeight())/2 -100 +window.getScroll().y;
					$('mod_win').setStyles({"top":top_offset+"px"});
					//close butoon
					$('mod_win').getElement('.ms-modallayer-t-c .ms-btn6').addEvent('click',function(e){
						e.stop();
						toggleModal();
						if($('mod_win'))
							$('mod_win').dispose();
					});
					//close butoon end
					this.gr.getElement('.ms-agc').clone().replaces($('mod_win').getElement('.ms-agc'));
					var _gr = this.gr;
					
					var img_src = _gr.getElements('.ms-image')[this.gr.act].getElement('img').src.replace('/230/','/500/');
					var img_title = _gr.getElements('.ms-image')[this.gr.act].getElement('img').alt;
					
					var main_img = $('mod_win').getElement('.ms-modallayer-m-c').getElement('img');
					var title = $('mod_win').getElement('.ms-modallayer-b-c-2').getElement('p');
					main_img.src = img_src;
					main_img.title = img_title;
					title.set('text',img_title);
					
					
					var liss = $('mod_win').getElements('li');		
					var ppss = $('mod_win').getElements('p[class^=ms-image]');
					
					first = $('mod_win').getElement('.ms-agc').getElement('.ms-first-li');
					first.gr = _gr;
					first.par = this.gr.getElement('.ms-first-li');
					first.addEvent('click',function(e){
						e.stop();					
						this.par.fireEvent('click',e);
						
						liss.each(function(li){
							li.removeClass('ms-active');
						});
						liss[this.gr.act+1].addClass('ms-active');
						img_src = _gr.getElements('.ms-image')[this.gr.act].getElement('img').src.replace('/230/','/500/');
						main_img.src = img_src;
						img_title = _gr.getElements('.ms-image')[this.gr.act].getElement('img').alt;
						main_img.title = img_title;
						title.set('text',img_title);
					});
					
					last = $('mod_win').getElement('.ms-agc').getElement('.ms-last-li');
					last.gr = _gr;
					last.par = this.gr.getElement('.ms-last-li');
					last.addEvent('click',function(e){
						e.stop();					
						this.par.fireEvent('click',e);
						
						liss.each(function(li){
							li.removeClass('ms-active');
						});
						liss[this.gr.act+1].addClass('ms-active');
						img_src = _gr.getElements('.ms-image')[this.gr.act].getElement('img').src.replace('/230/','/500/');
						main_img.src = img_src;					
						img_title = _gr.getElements('.ms-image')[this.gr.act].getElement('img').alt;
						main_img.title = img_title;
						title.set('text',img_title);
						
					});
					lis_s = $('mod_win').getElement('.ms-agc').getElements('li');
					
					
					//var _img_cont = $('mod_win').
					lis_s.each(function(li,ind){
						if(ind>0 && ind<lis.length-1){
						li.ind = ind-1;
						
						li.par = _gr.getElements('li')[ind];
							li.addEvent('click',function(e){
								e.stop();
								this.par.fireEvent('click',e);
								_gr.act = this.ind;
								liss.each(function(li){
									li.removeClass('ms-active');
								});
								liss[this.ind+1].addClass('ms-active');
								
								img_src = _gr.getElements('.ms-image')[this.ind].getElement('img').src.replace('/230/','/originals/');
								main_img.src = img_src;
								
								img_title = _gr.getElements('.ms-image')[this.ind].getElement('img').alt;
								main_img.title = img_title;
								title.set('text',img_title);
								
							});
						}
					});
				
					
				});
				}
			});
		}
  }
var video_links = $$('.ms-link-enlarge.video');
if(video_links.length){
var dims_def = [500,329];
var dims = dims_def;
left_offset = (window.getCoordinates().width-dims[0]+4)/2;
var windowdivideo= new Element("div", {"id":"mod_win_vid","class": "ms-modallayer", html: '<div class="ms-modallayer-t"><div class="ms-modallayer-t-c"><p class="ms-btn6"> <a href="#">Close</a></p></div></div><div class="ms-modallayer-m"><div class="ms-modallayer-m-c"><p id="video_input"></p></div></div><div class="ms-modallayer-b"><div class="ms-modallayer-b-c"><div class="ms-modallayer-b-c-2"><p  class="ms-text ms-tx3" id="video_title"></p></div><div class="ms-clearer"></div></div></div>'});
	windowdivideo.setStyles({'opacity':"1","display":"block","z-ndex":"1001","left":left_offset+"px","top":"440px"}).makeDraggable();
	var params =
			 {
			 quality: 'high',
			 wmode: 'transparent',
			 scale: 'noscale',
			 menu: 'false',
			 bgcolor: '#FFFFFF'
			 };
	video_links.each(function(link){
	
		link.addEvent('click',function(e){
		    dims = dims_def;
		    var rel = this.get('rel').split(':');
		    var src = rel[0];
		    
		    if(rel[1]){
		      dims = rel[1].split('x');
        }
        left_offset = (window.getCoordinates().width-dims[0]+4)/2;
		      windowdivideo.setStyles({"width":(dims[0].toInt()+4)+"px","left":left_offset+"px"});
				e.stop();
				toggleModal("#fff",{zIndex:'1000'});
				windowdivideo.inject(document.body);
				
				top_offset = (window.getCoordinates().height-$('mod_win_vid').getHeight())/2 -100 +window.getScroll().y;
				
				
				path = 'content_media/originals/'+src;
				swfobject.embedSWF(path, "video_input", dims[0], dims[1], "7.0",false,false,params);
				$('mod_win_vid').setStyles({"top":top_offset+"px"});
				
				$('mod_win_vid').getElement('#video_title').set('html',this.get('title'));
				//close butoon
				$('mod_win_vid').getElement('.ms-modallayer-t-c .ms-btn6').addEvent('click',function(e){
					e.stop();
					toggleModal();
					if($('mod_win_vid'))
					$('mod_win_vid').dispose();
				});
				//close butoon end
		});
	});
}

/*
;
				
				

				
*/

 
});
function log(el){

	if($type(console)){
		console.log(el);
	}
	
};



function makeVerticalMenuByButton(el){
    if(el.getNext() && !el.getNext().hasClass('ms93-sn-fly-v1-l1-active')){
    
      el.addEvent('mouseover',function(){
        this.getNext().setStyle('display','block');
      }
      );
      
      el.addEvent('mouseout',function(e){
        this.getNext().setStyle('display','none');
        e.stop();
      }
      );
      
      el.getNext().addEvent('mouseover',function(){
        this.setStyle('display','block');
      }
      );
      
      el.getNext().addEvent('mouseout',function(e){
        this.setStyle('display','none');
        e.stop();
      }
      );
      
      //recusion
        if(el.getNext().getElement('ul[class=ms-navi]')){
          $each(el.getNext().getElement('ul[class=ms-navi]').getChildren(), function(el,index){            
            if(el.hasClass('ms-has-fly') && el.getFirst().tagName=='A'){
               makeVerticalMenuByButton(el.getFirst());
              }
          }
          );
        };
      //recusion end
    }
};
var toggleModal = function(backgroundColour, options) {
    // modal view for the whole screen
    // ver 2.02 17/10/2008 03:42:06
    if ($("modal")) {
        $("modal").dispose();
        return false;
    }

    var options = $merge({
        zIndex: 10000000,
        opacity: .8,
        events: $empty()
    }, options);

    if (!$type(backgroundColour) && !$("modal"))
        return false;

    return new Element("div", {
        id: "modal",
        styles: {
            position: "absolute",
            top: 0,
            left: 0,
            width: window.getScrollWidth(),
            height: window.getScrollHeight(),
            background: backgroundColour,
            "z-index": options.zIndex
        },
        opacity: options.opacity,
        events: options.events
    }).inject(document.body);
} // end toggleModal
function openW(urlW, width_w, height_w, scroll_bar) {
 center_x = Math.round((window.screen.availWidth - width_w) / 2);
 center_y = Math.round((window.screen.availHeight - height_w) / 2);

 window.open(urlW,'_blank','top=' + center_y + ',left=' + center_x + ',width=' + width_w + ',height=' + height_w + ',status=no,titlebar=no,toolbar=no,menubar=no,location=no,resizable=no,directories=no,scrollbars=' + scroll_bar);
}

function fadeTable(t,tbody){
  if(t==1){
    tbody.fade('toggle');
  }else
    if(t==2){
      tbody.fade('toggle');
    }else{
      tbody.fade('toggle');
    }
}

function goToUrl(url){
	loc = String(window.location);
	url = String(url);
	if(!loc.test('.+/$'))
		loc = loc + '/';
	if(url.test('^/.+')){//from root
		window.location=url;
		return;
	}else{
		window.location=loc+url;
		return;
	}
}
function share(id){
 var url = location.href;
 var title = document.title;
 var width = 800;
 var height = 380;
 
 switch (id) {
 case 'fb':
 link = 'http://www.facebook.com/sharer.php?u='+encodeURIComponent(url)+'&t='+encodeURIComponent(title);
 width = 626;
 height = 436;
 break;
 case 'twit':
 link = 'http://www.twitter.com/home?status='+url;
 break;
 case 'sme':
 link = 'http://vybrali.sme.sk/sub.php?url='+encodeURIComponent(url);
 width = 626;
 height = 436;
 break;
 }
 if (link) window.open(link, 'share_'+id, 'toolbar=0,status=0,width='+ width +',height='+height);
 return false;
} 