$().ready(function() {
navbar();

    var bgImages = [ 'motiv.jpg', 'motiv2.jpg', 'motiv3.jpg', 'motiv4.jpg' ];
    var currImage = 'motiv.jpg';
    setInterval( function(){
        do{
            var randImage = bgImages[Math.ceil(Math.random()*(bgImages.length-1))];
        }while( randImage == currImage )
        currImage = randImage;
        $('#motiv-bg').BgImageTransition( '/template/classic/images/'+currImage );
    }, 5000);

});

function navbar() {

$('#menu li').hover(function() {
        $(this).find('ul').show();
    },
    function() {
      $(this).find('ul').hide();
});

$('#paliva li').hover(function() {
		  $(this).addClass('active');
        $(this).find('ul').show();
    },
    function() {
		$(this).removeClass('active');
      $(this).find('ul').hide();
});
$('#kominove-systemy div').hover(function() {
        $(this).find('span.over').hide();
    },
    function() {
      $(this).find('span.over').show();
});
};


function highlightUniversal(region){
 var mapa;
 mapa = document.getElementById('mapa');

 switch(region){

   case('pata'):  mapa.style.backgroundPosition = '-304px 0'; break;
	case('jimka'):  mapa.style.backgroundPosition = '-608px 0'; break;
	case('kominova-tvarovka'):  mapa.style.backgroundPosition = '-912px 0'; break;
	case('mrizka'):  mapa.style.backgroundPosition = '-1216px 0'; break;
	case('sklenicka'):  mapa.style.backgroundPosition = '-1520px 0'; break;
	case('dvirka'):  mapa.style.backgroundPosition = '-1824px 0'; break;
	case('tvarovka'):  mapa.style.backgroundPosition = '-2128px 0'; break;
	case('izolace'):  mapa.style.backgroundPosition = '-2432px 0'; break;
	case('vlozka'):  mapa.style.backgroundPosition = '-2736px 0'; break;
	case('pripojeni'):  mapa.style.backgroundPosition = '-3040px 0'; break;
	case('redukce'):  mapa.style.backgroundPosition = '-3344px 0'; break;
	case('prstence-komfort'):  mapa.style.backgroundPosition = '-3648px 0'; break;
	case('kryci-deska'):  mapa.style.backgroundPosition = '-3952px 0'; break;
	case('kominovy-klobouk'):  mapa.style.backgroundPosition = '-4256px 0'; break;
   case('none'):  mapa.style.backgroundPosition = '0 0'; break;
 }

};

function highlightGas(region){
 var mapa;
 mapa = document.getElementById('mapa');

 switch(region){

   case('revizni-kus'):  mapa.style.backgroundPosition = '-304px 0'; break;
	case('revizni-uzaver'):  mapa.style.backgroundPosition = '-608px 0'; break;
	case('kominova-dvirka'):  mapa.style.backgroundPosition = '-912px 0'; break;
	case('upevnovaci-objimka'):  mapa.style.backgroundPosition = '-1216px 0'; break;
	case('kominova-tvarovka'):  mapa.style.backgroundPosition = '-1520px 0'; break;
	case('kominova-vlozka'):  mapa.style.backgroundPosition = '-1824px 0'; break;
	case('t-kus'):  mapa.style.backgroundPosition = '-2128px 0'; break;
	case('adapter'):  mapa.style.backgroundPosition = '-2432px 0'; break;
	case('distancni-objimka'):  mapa.style.backgroundPosition = '-2736px 0'; break;
	case('prstence-komfort'):  mapa.style.backgroundPosition = '-3040px 0'; break;
	case('upevnovaci-objimka'):  mapa.style.backgroundPosition = '-3344px 0'; break;
	case('kryci-deska'):  mapa.style.backgroundPosition = '-3648px 0'; break;
	case('hlavice-odkoureni'):  mapa.style.backgroundPosition = '-3952px 0'; break;
   case('none'):  mapa.style.backgroundPosition = '0 0'; break;
 }

};

function highlightNerez(region){
 var mapa;
 mapa = document.getElementById('mapa');

 switch(region){

   case('kontrolni'):  mapa.style.backgroundPosition = '-304px 0'; break;
	case('deska'):  mapa.style.backgroundPosition = '-608px 0'; break;
	case('soklovy-prvek'):  mapa.style.backgroundPosition = '-912px 0'; break;
	case('t-kus'):  mapa.style.backgroundPosition = '-1216px 0'; break;
	case('prostup'):  mapa.style.backgroundPosition = '-1520px 0'; break;
	case('prodlouzeni'):  mapa.style.backgroundPosition = '-1824px 0'; break;
	case('drzak'):  mapa.style.backgroundPosition = '-2128px 0'; break;
	case('pruchodka'):  mapa.style.backgroundPosition = '-2432px 0'; break;
	case('limec'):  mapa.style.backgroundPosition = '-2736px 0'; break;
	case('spona'):  mapa.style.backgroundPosition = '-3040px 0'; break;
	case('uzaver'):  mapa.style.backgroundPosition = '-3344px 0'; break;
   case('none'):  mapa.style.backgroundPosition = '0 0'; break;
 }

};

function highlightSanace(region){
 var mapa;
 mapa = document.getElementById('mapa');

 switch(region){

   case('zakladaci-dil'):  mapa.style.backgroundPosition = '-304px 0'; break;
	case('puvodni-komin'):  mapa.style.backgroundPosition = '-608px 0'; break;
	case('tvarovka'):  mapa.style.backgroundPosition = '-912px 0'; break;
	case('izolace'):  mapa.style.backgroundPosition = '-1216px 0'; break;
	case('vlozka'):  mapa.style.backgroundPosition = '-1520px 0'; break;
	case('prstence'):  mapa.style.backgroundPosition = '-1824px 0'; break;
	case('deska'):  mapa.style.backgroundPosition = '-2128px 0'; break;
	case('klobouk'):  mapa.style.backgroundPosition = '-2432px 0'; break;
   case('none'):  mapa.style.backgroundPosition = '0 0'; break;
 }

};

function highlightTec(region){
 var mapa;
 mapa = document.getElementById('mapa');

 switch(region){

   case('t-kus'):  mapa.style.backgroundPosition = '-304px 0'; break;
	case('jimka'):  mapa.style.backgroundPosition = '-608px 0'; break;
	case('uzaver'):  mapa.style.backgroundPosition = '-912px 0'; break;
	case('dvirka'):  mapa.style.backgroundPosition = '-1216px 0'; break;
	case('tvarovka'):  mapa.style.backgroundPosition = '-1520px 0'; break;
	case('vlozka'):  mapa.style.backgroundPosition = '-1824px 0'; break;
	case('t-kus2'):  mapa.style.backgroundPosition = '-2128px 0'; break;
	case('redukce'):  mapa.style.backgroundPosition = '-2432px 0'; break;
	case('izolace'):  mapa.style.backgroundPosition = '-2736px 0'; break;
	case('prstenec'):  mapa.style.backgroundPosition = '-3040px 0'; break;
	case('deska'):  mapa.style.backgroundPosition = '-3344px 0'; break;
	case('limec'):  mapa.style.backgroundPosition = '-3648px 0'; break;
	case('striska'):  mapa.style.backgroundPosition = '-3952px 0'; break;
   case('none'):  mapa.style.backgroundPosition = '0 0'; break;
 }

};
